Pristine copy http://www.seg.rmit.edu.au/zettair/download/zettair-0.9.3.tar.bz2
authorNick Downing <nick@ndcode.org>
Mon, 5 Nov 2018 22:30:29 +0000 (09:30 +1100)
committerNick Downing <nick@ndcode.org>
Mon, 5 Nov 2018 22:30:29 +0000 (09:30 +1100)
220 files changed:
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
Makefile.in [new file with mode: 0644]
README [new file with mode: 0644]
aclocal.m4 [new file with mode: 0644]
compile [new file with mode: 0755]
config.guess [new file with mode: 0755]
config.sub [new file with mode: 0755]
config/psettings.xml [new file with mode: 0644]
config/stoplist_sorted [new file with mode: 0644]
configure [new file with mode: 0755]
configure.ac [new file with mode: 0644]
depcomp [new file with mode: 0755]
doc/Build.html [new file with mode: 0644]
doc/Content.html [new file with mode: 0644]
doc/Credits.html [new file with mode: 0644]
doc/Disclaimer.html [new file with mode: 0644]
doc/README.TXT [new file with mode: 0644]
doc/Readme.html [new file with mode: 0644]
doc/Search.html [new file with mode: 0644]
doc/Tutorial.html [new file with mode: 0644]
doc/copying.html [new file with mode: 0644]
doc/hacking.html [new file with mode: 0644]
doc/index.html [new file with mode: 0644]
doc/logo.gif [new file with mode: 0644]
doc/style.css [new file with mode: 0644]
include/index.h [new file with mode: 0644]
install-sh [new file with mode: 0755]
ltmain.sh [new file with mode: 0644]
missing [new file with mode: 0755]
scripts/metric.py [new file with mode: 0644]
scripts/mime.py [new file with mode: 0644]
setup.py.in [new file with mode: 0644]
src/alloc.c [new file with mode: 0644]
src/binsearch.c [new file with mode: 0644]
src/bit.c [new file with mode: 0644]
src/btbucket.c [new file with mode: 0644]
src/btbulk.c [new file with mode: 0644]
src/bucket.c [new file with mode: 0644]
src/chash.c [new file with mode: 0644]
src/commandline.c [new file with mode: 0644]
src/compat/win32_stubs.c [new file with mode: 0755]
src/compat/zglob.c [new file with mode: 0644]
src/cosine.c [new file with mode: 0644]
src/cosine.metric [new file with mode: 0644]
src/dirichlet.c [new file with mode: 0644]
src/dirichlet.metric [new file with mode: 0644]
src/docmap.c [new file with mode: 0755]
src/error.c [new file with mode: 0644]
src/fdset.c [new file with mode: 0644]
src/freemap.c [new file with mode: 0644]
src/getlongopt.c [new file with mode: 0644]
src/getmaxfsize.c [new file with mode: 0644]
src/hawkapi.c [new file with mode: 0644]
src/hawkapi.metric [new file with mode: 0644]
src/heap.c [new file with mode: 0644]
src/impact.c [new file with mode: 0644]
src/impact_build.c [new file with mode: 0644]
src/include/_btbucket.h [new file with mode: 0644]
src/include/_chash.h [new file with mode: 0644]
src/include/_docmap.h [new file with mode: 0644]
src/include/_index.h [new file with mode: 0644]
src/include/_mem.h [new file with mode: 0644]
src/include/_postings.h [new file with mode: 0644]
src/include/_reposset.h [new file with mode: 0644]
src/include/_uri.h [new file with mode: 0644]
src/include/alloc.h [new file with mode: 0644]
src/include/ascii.h [new file with mode: 0644]
src/include/binsearch.h [new file with mode: 0644]
src/include/bit.h [new file with mode: 0644]
src/include/btbucket.h [new file with mode: 0644]
src/include/btbulk.h [new file with mode: 0644]
src/include/bucket.h [new file with mode: 0644]
src/include/chash.h [new file with mode: 0644]
src/include/compat/zglob.h [new file with mode: 0644]
src/include/compat/zstdint.h [new file with mode: 0644]
src/include/compat/zvalgrind.h [new file with mode: 0644]
src/include/config_h.in [new file with mode: 0644]
src/include/crc.h [new file with mode: 0644]
src/include/cygwin/firstinclude.h [new file with mode: 0644]
src/include/darwin/firstinclude.h [new file with mode: 0644]
src/include/def.h [new file with mode: 0644]
src/include/docmap.h [new file with mode: 0755]
src/include/error.h [new file with mode: 0644]
src/include/fdset.h [new file with mode: 0644]
src/include/freebsd/firstinclude.h [new file with mode: 0644]
src/include/freemap.h [new file with mode: 0644]
src/include/getlongopt.h [new file with mode: 0644]
src/include/getmaxfsize.h [new file with mode: 0644]
src/include/heap.h [new file with mode: 0644]
src/include/impact.h [new file with mode: 0644]
src/include/impact_build.h [new file with mode: 0644]
src/include/index_querybuild.h [new file with mode: 0644]
src/include/iobtree.h [new file with mode: 0644]
src/include/lcrand.h [new file with mode: 0644]
src/include/linux/firstinclude.h [new file with mode: 0644]
src/include/makeindex.h [new file with mode: 0644]
src/include/mem.h [new file with mode: 0644]
src/include/merge.h [new file with mode: 0644]
src/include/metric.h [new file with mode: 0644]
src/include/mime.h [new file with mode: 0644]
src/include/mlparse.h [new file with mode: 0644]
src/include/mlparse_wrap.h [new file with mode: 0644]
src/include/objalloc.h [new file with mode: 0644]
src/include/poolalloc.h [new file with mode: 0644]
src/include/postings.h [new file with mode: 0644]
src/include/psettings.h [new file with mode: 0644]
src/include/pyramid.h [new file with mode: 0644]
src/include/queryparse.h [new file with mode: 0644]
src/include/rbtree.h [new file with mode: 0644]
src/include/reposset.h [new file with mode: 0644]
src/include/search.h [new file with mode: 0644]
src/include/signals.h [new file with mode: 0644]
src/include/stack.h [new file with mode: 0644]
src/include/staticalloc.h [new file with mode: 0644]
src/include/stem.h [new file with mode: 0644]
src/include/stop.h [new file with mode: 0644]
src/include/storagep.h [new file with mode: 0644]
src/include/str.h [new file with mode: 0644]
src/include/stream.h [new file with mode: 0644]
src/include/summarise.h [new file with mode: 0644]
src/include/sunos/firstinclude.h [new file with mode: 0644]
src/include/svnversion.h [new file with mode: 0644]
src/include/test.h [new file with mode: 0644]
src/include/testutils.h [new file with mode: 0644]
src/include/timings.h [new file with mode: 0644]
src/include/trec_eval.h [new file with mode: 0644]
src/include/uri.h [new file with mode: 0644]
src/include/vec.h [new file with mode: 0644]
src/include/vocab.h [new file with mode: 0644]
src/include/win32/config.h [new file with mode: 0644]
src/include/win32/firstinclude.h [new file with mode: 0644]
src/index.c [new file with mode: 0644]
src/index_querybuild.c [new file with mode: 0644]
src/iobtree.c [new file with mode: 0644]
src/lcrand.c [new file with mode: 0644]
src/libtextcodec/crc.c [new file with mode: 0644]
src/libtextcodec/detectfilter.c [new file with mode: 0644]
src/libtextcodec/gunzipfilter.c [new file with mode: 0644]
src/libtextcodec/stream.c [new file with mode: 0644]
src/makeindex.c [new file with mode: 0644]
src/mem.c [new file with mode: 0644]
src/merge.c [new file with mode: 0644]
src/metric.c [new file with mode: 0644]
src/mime.c [new file with mode: 0644]
src/mlparse.c [new file with mode: 0644]
src/mlparse_wrap.c [new file with mode: 0644]
src/objalloc.c [new file with mode: 0644]
src/okapi_k3.c [new file with mode: 0644]
src/okapi_k3.metric [new file with mode: 0644]
src/pcosine.c [new file with mode: 0644]
src/pcosine.metric [new file with mode: 0644]
src/poolalloc.c [new file with mode: 0644]
src/postings.c [new file with mode: 0644]
src/psettings.c [new file with mode: 0644]
src/psettings_default.c [new file with mode: 0644]
src/pyramid.c [new file with mode: 0644]
src/pyzet/pzet.py [new file with mode: 0644]
src/pyzet/zetmodule.c [new file with mode: 0644]
src/queryparse.c [new file with mode: 0644]
src/rbtree.c [new file with mode: 0644]
src/remerge.c [new file with mode: 0644]
src/reposset.c [new file with mode: 0644]
src/search.c [new file with mode: 0644]
src/signals.c [new file with mode: 0644]
src/stack.c [new file with mode: 0644]
src/staticalloc.c [new file with mode: 0644]
src/stem.c [new file with mode: 0644]
src/stop.c [new file with mode: 0644]
src/stop_default.c [new file with mode: 0644]
src/storagep.c [new file with mode: 0644]
src/str.c [new file with mode: 0644]
src/summarise.c [new file with mode: 0644]
src/test.c [new file with mode: 0644]
src/test/binsearch_1.c [new file with mode: 0644]
src/test/binsearch_1.cases [new file with mode: 0644]
src/test/bit_1.c [new file with mode: 0644]
src/test/bucket_1.c [new file with mode: 0644]
src/test/bucket_1.cases [new file with mode: 0644]
src/test/bufstuffer_1.cases [new file with mode: 0644]
src/test/docmap_1.c [new file with mode: 0644]
src/test/docmap_1.cases [new file with mode: 0644]
src/test/freemap_1.c [new file with mode: 0644]
src/test/freemap_1.cases [new file with mode: 0644]
src/test/getlongopt_1.c [new file with mode: 0644]
src/test/getlongopt_1.cases [new file with mode: 0644]
src/test/heap_1.c [new file with mode: 0644]
src/test/heap_1.cases [new file with mode: 0644]
src/test/iobtree_1.c [new file with mode: 0644]
src/test/iobtree_1.cases [new file with mode: 0644]
src/test/mem_1.c [new file with mode: 0644]
src/test/mlparse_1.c [new file with mode: 0644]
src/test/poolalloc_1.c [new file with mode: 0644]
src/test/rbtree_1.c [new file with mode: 0644]
src/test/rbtree_1.cases [new file with mode: 0644]
src/test/stack_1.c [new file with mode: 0644]
src/test/stack_1.cases [new file with mode: 0644]
src/test/stop_1.c [new file with mode: 0644]
src/test/stop_1.cases [new file with mode: 0644]
src/test/str_1.c [new file with mode: 0644]
src/testutils.c [new file with mode: 0644]
src/trec_eval.c [new file with mode: 0644]
src/trecrun.c [new file with mode: 0644]
src/vec.c [new file with mode: 0644]
src/vocab.c [new file with mode: 0644]
tools/btree.c [new file with mode: 0644]
tools/cat.c [new file with mode: 0644]
tools/dict.c [new file with mode: 0644]
tools/diff.c [new file with mode: 0644]
tools/file.c [new file with mode: 0644]
tools/hashtime.c [new file with mode: 0644]
tools/impactify.c [new file with mode: 0644]
txt/README [new file with mode: 0644]
txt/moby.txt [new file with mode: 0644]
win32/visualc6/libzet.dsp [new file with mode: 0644]
win32/visualc6/zet.dsp [new file with mode: 0644]
win32/visualc6/zet_cat.dsp [new file with mode: 0644]
win32/visualc6/zet_diff.dsp [new file with mode: 0644]
win32/visualc6/zet_trec.dsp [new file with mode: 0644]
win32/visualc6/zettair.dsw [new file with mode: 0644]

diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..a62c0af
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,278 @@
+Zettair can be compiled using two different build systems.  The first
+(most commonly used) is using GNU configure and make.  The second is
+via Visual C++.  Instructions on configuration, compilation and
+installation using GNU configure and make are below.  See the section
+on Visual C++ below for instructions on compiling Zettair on windows.
+
+Note that in both cases, compilation of Zettair requires the presence
+of the zlib compression library.
+
+1. Configuration
+================
+
+From inside the top-level directory created when you unpacked the
+Zettair distribution, run the 'configure' script:
+
+  $ ./configure
+
+configure accepts a range of options.  To get a list of available
+options, run with the '--help' flag:
+
+  $ ./configure --help
+
+The most useful option is the --prefix option, which specifies which
+directory Zettair is going to be installed under.  So, for instance,
+to install Zettair in its own directory under '/usr/include', run
+configure like so:
+
+  $ ./configure --prefix=/usr/local/zettair
+
+The default Zettair installation directory is /usr/local.  Make sure
+to specify a directory into which you have, or can acquire, write
+permission: for anything under /usr, this probably means you need to
+be able to become the root user.
+
+
+2. Compilation
+==============
+
+Once configure has finished running, the Zettair distribution is ready
+to be compiled.  Also from inside the top-level Zettair distribution
+directory, run the 'make' program:
+
+  $ make
+
+
+3. Installation
+===============
+
+After Zettair has been compiled, you can install it in the directory
+you specified with the --prefix option to configure.  To do this, run
+make with the 'install' target:
+
+  $ make install
+
+Assuming that you selected '/usr/local/zettair' as your installation
+prefix, this will create the directories '/usr/local/zettair/bin' and
+'/usr/local/zettair/share'.  The main Zettair executable, zet, and a
+number of utilities will be installed in the former; configuration
+files will be installed in the latter.
+
+   While it is possible to run Zettair directly from the directory
+   you compiled it in without performing an explicit installation,
+   this is not recommended, as you have to explicitly specify the
+   location of the configuration files each time you build an index.
+   If you want to run from the compilation directory, we suggest you
+   run configure with the argument '--prefix=.', then run 'make
+   install'.
+
+To save yourself having to type the full path to the zet executable
+every time you want to run it (such as '/usr/local/zettair/bin/zet'),
+you might want to add Zettair's bin directory to your PATH.  How you
+do this depends on which shell you use.  For instance, with the bash
+shell, edit the file ~/.bash_profile, and add a line something like:
+
+   PATH=/usr/local/zettair/bin:$PATH
+
+This will probably not be necessary if you used the default prefix of
+'/usr/local'.
+
+4. Visual C++ configuration, compilation and installation
+=========================================================
+
+First, obtain the latest Zettair distribution and decompress it.
+Obtain the latest zlib source distribution (do NOT download the precompiled DLL)
+from http://www.zlib.net/ and decompress it into a seperate directory.
+Follow the zlib directions to create a statically-linked zlib.lib using 
+Visual C++.
+Locate zlib.lib within your zlib directory tree, and copy it to the
+root zettair-X.X/ directory.  
+In addition, copy zlib.h and zconf.h into zettair-X.X/src/include.
+
+Load zettair-X.X/win32/visualc6/zettair.dsw into Visual C++.
+Using the Build/Set Active Configuration menu option, select the
+executable that you wish to build.
+Build the executable by selecting Build/Rebuild All.  (Repeat for any
+further executables that you wish to build).  You may then copy the
+created executables whereever you like, and use them.
+
+4. Running
+==========
+
+Now you're ready to read the Zettair user manual, in the 'doc'
+subdirectory of the Zettair distribution.  
+
+First, though, you might like to check that everything installed and
+works ok (or perhaps you're just impatient to take your new purchase
+for a spin).  To help with this, we've included the text for Herman
+Melville's "Moby Dick" as a sample collection for you to play around
+with.  This can be found in the subdirectory sampletext/mobydick.
+
+Let's begin by indexing Moby Dick.  To do this, change your current
+directory to sampletext/mobydick.  (You can index it from anywhere,
+but this is simplest.)  We'll assume that the 'zet' executable is in
+your PATH; otherwise, substitute the full pathname to the executable
+wherever you see 'zet' below.  So, let's build this index:
+
+  $ zet -i -t TREC mobydick.trec
+
+The '-i' argument tells zet that we're building a new index.  '-t
+TREC' tells zet that the input documents are in TREC format.  If you
+don't know what the TREC format is, don't worry: it's just a
+convenient way for us to store multiple documents in the one file.
+The default input format is to treat each input file as a separate
+HTML document; since we want to treat each paragraph of Moby Dick as a
+separate document, this would mean a lot of small files.
+
+Now, the text of Moby Dick is less than 1.3 MBs in length, so this
+won't take long to run--Zettair is more used to working with document
+collections of 10 GB or more, but it won't complain.  When it's
+finished running, you should see two new files in the current
+directory, one called 'index.v.0', the 'index.map'.  These are
+Zettair's index files.  
+
+   If you're interested, the former is the index proper, containing
+   the list of terms and where each term occurs; the latter is the
+   document map, providing information about each document indexed.
+   Don't open these files, or you'll violate the EULA!  No, just
+   kidding, but they're in binary format, and so won't make a lot of
+   sense in your text editor.
+
+So now we're ready to run some queries.  To do this, we run zet again,
+this time without any options:
+
+  $ zet
+
+Zettair will load up the index (very quickly, in this case), and then
+prompt you for input.  Let's test the rumour that Moby Dick has
+something to say about whales:
+
+  > whale
+
+  1. Chapter32,Paragraph21 (score 2.506133, docid 688)
+  2. Chapter32,Paragraph19 (score 2.411723, docid 686)
+  3. Chapter32,Paragraph23 (score 2.375970, docid 690)
+  4. Chapter32,Paragraph46 (score 2.344365, docid 713)
+  5. Chapter91,Paragraph17 (score 2.256999, docid 1807)
+  6. Chapter91,Paragraph18 (score 2.247493, docid 1808)
+  7. Chapter75,Paragraph10 (score 2.245327, docid 1552)
+  8. Chapter0,Paragraph74 (score 2.150178, docid 74)
+  9. Chapter0,Paragraph69 (score 2.145605, docid 69)
+  10. Chapter0,Paragraph40 (score 2.122386, docid 40)
+  11. Chapter32,Paragraph24 (score 2.119576, docid 691)
+  12. Chapter0,Paragraph92 (score 2.118144, docid 92)
+  13. Chapter36,Paragraph25 (score 2.080975, docid 773)
+  14. Chapter32,Paragraph8 (score 2.059031, docid 675)
+  15. Chapter0,Paragraph51 (score 2.054273, docid 51)
+  16. Chapter0,Paragraph63 (score 2.050327, docid 63)
+  17. Chapter79,Paragraph6 (score 2.048261, docid 1590)
+  18. Chapter64,Paragraph60 (score 2.046396, docid 1387)
+  19. Chapter49,Paragraph7 (score 2.042479, docid 1059)
+  20. Chapter55,Paragraph10 (score 2.039895, docid 1226)
+
+  20 results of 576 shown (took 0.001639 seconds)
+
+This tells us that the word "whale" occurs in 576 documents in the
+collection (which is to say, paragraphs in Moby Dick).  Zettair thinks
+the most pertinent paragraph is paragraph 21 of chapter 32.  We can
+ask Zettair to print out this document using the 'cache' directive and
+specifying the document's docid:
+
+  > [cache:688]
+
+  <DOC>
+  <DOCNO>Chapter 32, Paragraph 21</DOCNO>
+  FOLIOS.  Among these I here include the following chapters:--I. The
+  SPERM WHALE; II. the RIGHT WHALE; III. the FIN-BACK WHALE; IV. the
+  HUMP-BACKED WHALE; V. the RAZOR-BACK WHALE; VI. the SULPHUR-BOTTOM
+  WHALE.
+  </DOC>
+
+Don't worry about the <DOC> and <DOCNO> tags: that's just part of the
+TREC format we've used to mark up Moby Dick for indexing.  You'll
+notice that the word 'whale' occurs seven times in little more than
+three lines, which is why Zettair thinks this is probably the
+paragraph you're looking for.
+
+You can, of course, query for more than one word at a time.  Say we
+were looking for a particular kind of whale:
+
+  > white whale
+
+  1. Chapter36,Paragraph25 (score 6.672417, docid 773)
+  [...]
+  20. Chapter100,Paragraph31 (score 5.192795, docid 1963)
+
+  20 results of 652 shown (took 0.000801 seconds)
+
+Hmm, 652 paragraphs--but "whale" only occurs in 576!  Well, what
+Zettair is reporting here is all the documents with either "white"
+_or_ "whale" in them.  We can tell specify that we only want documents
+that _both_ occur in:
+
+  > white AND whale
+
+  1. Chapter128,Paragraph4 (score 4.778444, docid 2413)
+  [...]
+  20. Chapter100,Paragraph11 (score 3.977057, docid 1943)
+
+  20 results of 110 shown (took 0.001045 seconds)
+
+or, probably more to the point, only documents that the exact phrase
+"white whale" occurs in:
+
+  > "white whale"
+
+  1. Chapter36,Paragraph25 (score 5.618426, docid 773)
+  [...]
+  20. Chapter59,Paragraph4 (score 4.402413, docid 1269)
+
+  20 results of 80 shown (took 0.000999 seconds)
+
+
+This is great so far (or at least, we hope you think so), but it gets
+tiresome having to individually request each document to see if it
+what we're looking for, especially if the documents are longer than a
+single paragraph.  What we really want is for the list of results to
+include a summary of each document.  And we can ask Zettair to provide
+just this to us.
+
+To do so, we'll have to restart Zettair.  Hit "CONTROL-D" or whatever
+key combination indicates end of input on your system to end your
+current session.  This time, we'll run the zet executable with the
+'-q' option to indicate that we'd like to see document summaries, and
+what form we want these summaries to be in.  We'll also restrict
+output to just the top 2 results:
+
+  $ zet -q capitalise -n 2
+
+Zettair can highlight your search terms within the document summaries
+in a number of different ways, 'capitalise' being one of them.  So,
+let's try out some summaries:
+
+  > ship sea storm
+
+  1. Chapter48,Paragraph51 (score 9.602944, docid 1051)
+  Wet, drenched through, and shivering cold, despairing of SHIP or
+  boat, we lifted up our eyes as the dawn came on. The mist still
+  spread over the SEA, the empty lantern lay crushed in the bottom of
+  the boat. ...We all heard a faint creaking, as of ropes and yards
+  hitherto muffled by the STORM. ...Affrighted, we all sprang into the
+  SEA as the SHIP at last loomed into view, bearing right down upon us
+  within a distance of not much more than its length.
+  2. Chapter0,Paragraph92 (score 9.216548, docid 92)
+  "Oh, the rare old Whale, mid STORM and gale In his ocean home will
+  be A giant in might, where might is right, And King of the boundless
+  SEA." --WHALE SONG.
+
+  2 results of 526 shown (took 0.012296 seconds)
+
+  > "dark blue ocean"
+
+  1. Chapter35,Paragraph11 (score 10.445776, docid 745)
+  "Roll on, thou deep and DARK BLUE OCEAN, roll! Ten thousand
+  blubber-hunters sweep over thee in vain."
+
+  1 results of 1 shown (took 0.002945 seconds)
+
+And that concludes our tour.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..1e5b2a4
--- /dev/null
@@ -0,0 +1,357 @@
+## run automake over this file to create Makefile.in (which then needs
+## to be processed by an autoconf configure script to create Makefile,
+## but don't get me started on this whole process :o( )
+
+## FIXME: automate removal of update stuff
+
+# necessary compiler flags (not that cflags is not supposed to be set
+# for optimisation, as the user is supposed to do that)
+AM_CPPFLAGS = -I $(srcdir)/src/include/ -I $(srcdir)/include/ \
+              -I $(srcdir)/src/include/compat/ \
+              -I $(srcdir)/src/include/@OSINCLUDE@/ \
+              -D@OS@ -DLOGERRORS
+AM_CFLAGS = 
+AM_LDFLAGS = @LIBS@
+
+# declaration of what to build (hint: nodist only seems to apply to SOURCES)
+bin_PROGRAMS = zet zet_trec zet_cat zet_impactify
+data_DATA = config/psettings.xml
+lib_LTLIBRARIES = libzet.la
+noinst_PROGRAMS = zet_diff zet_file zet_dict \
+                  src/test/str_1 \
+                  src/test/bucket_1 src/test/mem_1 \
+                  src/test/iobtree_1 src/test/heap_1 \
+                  src/test/getlongopt_1 src/test/binsearch_1 \
+                  src/test/bit_1 src/test/stack_1 src/test/rbtree_1 \
+                  src/test/mlparse_1 src/test/freemap_1 \
+                  src/test/docmap_1 \
+                  src/test/stop_1 src/test/poolalloc_1 \
+                  \
+                  mlparse.test mlparse_wrap.test mime.test poolalloc.test \
+                  psettings_gen psettings_gen.test stop_gen staticalloc.test \
+                  objalloc.test lcrand.test stem.test btree chash.test \
+                                 hashtime
+
+noinst_HEADERS = src/include/heap.h       include/index.h \
+                 src/include/index_querybuild.h \
+                 src/include/makeindex.h  src/include/uri.h \
+                 src/include/_index.h     src/include/merge.h \
+                 src/include/_postings.h  src/include/mlparse.h \
+                 src/include/_uri.h       src/include/postings.h \
+                 src/include/binsearch.h  src/include/stop.h \
+                 src/include/bit.h        src/include/str.h \
+                 src/include/chash.h      src/include/_chash.h \
+                 src/include/config_h.in  \
+                 src/include/def.h        src/include/timings.h \
+                 src/include/freemap.h    src/include/getlongopt.h \
+                 src/include/vec.h        src/include/poolalloc.h \
+                 src/include/bucket.h     src/include/test.h \
+                 src/include/fdset.h      src/include/queryparse.h \
+                 src/include/pyramid.h    src/include/iobtree.h \
+                 src/include/getmaxfsize.h \
+                 src/include/storagep.h   \
+                 src/include/btbucket.h   src/include/_btbucket.h \
+                 src/include/mem.h        src/include/_mem.h \
+                 src/include/vocab.h      src/include/ascii.h \
+                 src/include/mlparse_wrap.h src/include/btbulk.h \
+                 src/include/error.h      src/include/mime.h \
+                 src/include/summarise.h  src/include/stem.h \
+                 src/include/stack.h      src/include/rbtree.h \
+                 src/include/signals.h    src/include/alloc.h \
+                                src/include/staticalloc.h \
+                                src/include/metric.h     src/include/search.h \
+                 src/include/psettings.h  src/include/lcrand.h \
+                 src/include/objalloc.h   src/include/stream.h \
+                 src/include/crc.h        src/include/trec_eval.h \
+                 src/include/docmap.h     src/include/_docmap.h \
+                 src/include/reposset.h   src/include/_reposset.h \
+                                src/include/impact.h     src/include/impact_build.h \
+                 src/include/testutils.h \
+                 src/include/compat/zstdint.h \
+                 src/include/compat/zvalgrind.h \
+                 src/include/linux/firstinclude.h \
+                 src/include/freebsd/firstinclude.h \
+                 src/include/sunos/firstinclude.h \
+                 src/include/cygwin/firstinclude.h \
+                 src/include/darwin/firstinclude.h \
+                 src/include/win32/firstinclude.h \
+                 src/include/win32/config.h src/include/compat/zglob.h \
+                 src/include/svnversion.h
+
+EXTRA_DIST = config/psettings.xml config/stoplist_sorted \
+             txt/moby.txt txt/README \
+             src/compat/win32_stubs.c \
+             src/compat/zglob.c doc/Build.html doc/Content.html \
+             src/pyzet/zetmodule.c src/pyzet/pzet.py \
+             doc/copying.html doc/Credits.html doc/Disclaimer.html \
+             doc/hacking.html doc/index.html doc/logo.gif \
+             doc/Readme.html doc/README.TXT doc/Search.html \
+             doc/style.css doc/Tutorial.html \
+             scripts/metric.py scripts/mime.py src/metric.c \
+             src/dirichlet.metric src/pcosine.metric \
+             src/cosine.metric src/hawkapi.metric src/okapi_k3.metric \
+             \
+             win32/visualc6/zettair.dsw \
+             win32/visualc6/zet.dsp \
+             win32/visualc6/libzet.dsp \
+             win32/visualc6/zet_cat.dsp \
+             win32/visualc6/zet_trec.dsp \
+             win32/visualc6/zet_diff.dsp \
+             \
+             src/test/binsearch_1.cases \
+             src/test/bucket_1.cases \
+             src/test/bufstuffer_1.cases \
+             src/test/docmap_1.cases \
+             src/test/freemap_1.cases \
+             src/test/getlongopt_1.cases \
+             src/test/heap_1.cases \
+             src/test/iobtree_1.cases \
+             src/test/rbtree_1.cases \
+             src/test/stack_1.cases \
+             src/test/stop_1.cases
+
+# dependencies for the main programs/libraries
+
+zet_SOURCES = src/commandline.c src/include/svnversion.h
+zet_LDADD = -lzet -L.
+zet_DEPENDENCIES = libzet.la
+
+zet_trec_SOURCES = src/trecrun.c src/trec_eval.c
+zet_trec_LDADD = -lzet -L.
+zet_trec_DEPENDENCIES = libzet.la
+
+library_sources = src/str.c src/index.c src/mlparse.c \
+                  src/stop.c src/stop_default.c \
+                  src/postings.c \
+                  src/merge.c src/vec.c src/makeindex.c \
+                  src/freemap.c src/bit.c src/binsearch.c \
+                  src/search.c src/chash.c src/stem.c \
+                  src/heap.c src/queryparse.c src/index_querybuild.c \
+                  src/bucket.c src/mem.c src/fdset.c \
+                  src/pyramid.c src/iobtree.c src/getmaxfsize.c \
+                  src/storagep.c src/btbucket.c src/btbulk.c \
+                  src/vocab.c src/getlongopt.c src/error.c \
+                  src/mlparse_wrap.c src/summarise.c src/mime.c \
+                  src/remerge.c src/signals.c \
+                  src/stack.c src/rbtree.c \
+                  src/psettings.c src/psettings_default.c src/lcrand.c \
+                  src/objalloc.c \
+                  src/docmap.c src/reposset.c \
+                  src/poolalloc.c src/alloc.c src/staticalloc.c \
+                                 src/dirichlet.c src/pcosine.c \
+                                 src/cosine.c src/hawkapi.c src/okapi_k3.c \
+                                 src/impact.c src/impact_build.c \
+                  \
+                  src/libtextcodec/crc.c src/libtextcodec/stream.c \
+                  src/libtextcodec/detectfilter.c \
+                  src/libtextcodec/gunzipfilter.c
+
+libzet_la_SOURCES = $(library_sources)
+
+# depedencies for utility programs
+
+zet_cat_SOURCES = tools/cat.c 
+zet_cat_LDADD = -lzet -L. 
+zet_cat_DEPENDENCIES = libzet.la
+
+zet_dict_SOURCES = tools/dict.c
+zet_dict_LDADD = -lzet -L. 
+zet_dict_DEPENDENCIES = libzet.la
+
+zet_file_SOURCES = tools/file.c src/mime.c src/str.c
+zet_file_CFLAGS = -DHACK
+
+zet_diff_SOURCES = tools/diff.c
+zet_diff_LDADD = -lzet -L. 
+zet_diff_DEPENDENCIES = libzet.la
+
+zet_impactify_SOURCES = tools/impactify.c
+zet_impactify_LDADD = -lzet -L. 
+zet_impactify_DEPENDENCIES = libzet.la
+
+btree_SOURCES = tools/btree.c
+btree_LDADD = -lzet -L. 
+btree_DEPENDENCIES = libzet.la
+
+hashtime_SOURCES = tools/hashtime.c src/chash.c src/str.c src/alloc.c \
+                   src/objalloc.c src/mem.c src/bit.c
+hashtime_CFLAGS = -DHACK
+
+# misc stuff
+
+stop_gen_SOURCES = src/stop.c src/str.c src/poolalloc.c src/chash.c \
+                      src/alloc.c src/bit.c src/objalloc.c src/mem.c
+stop_gen_CFLAGS = -DSTOP_MAIN
+
+psettings_gen_SOURCES = src/psettings.c src/chash.c src/str.c \
+                        src/mlparse_wrap.c src/mlparse.c src/bit.c \
+                        src/mime.c src/objalloc.c src/mem.c \
+                                               src/alloc.c src/error.c
+psettings_gen_CFLAGS = -DPSETTINGS_MAIN
+
+psettings_gen_test_SOURCES = src/psettings.c src/chash.c src/str.c \
+                        src/mlparse_wrap.c src/mlparse.c src/bit.c \
+                        src/mime.c src/psettings_default.c src/objalloc.c \
+                                               src/mem.c src/alloc.c src/error.c
+psettings_gen_test_CFLAGS = -DPSETTINGS_DEFAULT_TEST
+
+poolalloc_test_SOURCES = src/poolalloc.c src/chash.c src/mem.c src/bit.c \
+                         src/objalloc.c src/alloc.c src/str.c
+poolalloc_test_CFLAGS = -DPOOLALLOC_TEST
+
+staticalloc_test_SOURCES = src/staticalloc.c src/mem.c src/bit.c
+staticalloc_test_CFLAGS = -DSTATICALLOC_TEST
+
+mlparse_test_SOURCES = src/mlparse.c src/str.c src/libtextcodec/stream.c \
+                       src/libtextcodec/gunzipfilter.c \
+                       src/libtextcodec/detectfilter.c \
+                       src/libtextcodec/crc.c
+mlparse_test_CFLAGS = -DMLPARSE_TEST
+
+mime_test_SOURCES = src/mime.c src/str.c
+mime_test_CFLAGS = -DMIME_TEST
+
+mlparse_wrap_test_SOURCES = src/mlparse_wrap.c src/mlparse.c src/str.c
+mlparse_wrap_test_CFLAGS = -DMLPARSE_WRAP_TEST
+
+objalloc_test_SOURCES = src/objalloc.c src/bit.c src/mem.c src/str.c \
+                        src/alloc.c
+objalloc_test_CFLAGS = -DOBJALLOC_TEST 
+
+lcrand_test_SOURCES = src/lcrand.c 
+lcrand_test_CFLAGS = -DLCRAND_TEST 
+
+chash_test_SOURCES = src/chash.c src/objalloc.c src/mem.c \
+                     src/bit.c src/str.c src/alloc.c
+chash_test_CFLAGS = -DCHASH_TEST 
+
+stem_test_SOURCES = src/stem.c src/chash.c src/objalloc.c src/mem.c \
+                    src/bit.c src/str.c src/alloc.c
+stem_test_CFLAGS = -DSTEM_TEST 
+
+# more formal testing stuff
+
+# list of tests to run
+TESTS = src/test/binsearch_1 src/test/iobtree_1 src/test/stack_1 \
+        src/test/bit_1 src/test/mem_1 src/test/stop_1 \
+        src/test/bucket_1 src/test/mlparse_1 src/test/str_1 \
+        \
+        src/test/freemap_1 src/test/docmap_1 \
+        src/test/getlongopt_1 src/test/poolalloc_1 src/test/heap_1 \
+               src/test/rbtree_1
+
+# dependencies for tests
+
+# -DHACK added to CFLAGS so that libtool won't complain about having to
+# compile them seperately :o(
+
+#src_test_test_1_SOURCES = src/test/test_1.c
+#src_test_test_1_LDADD = -lzet -L. 
+#src_test_test_1_DEPENDENCIES = libzet.la
+
+src_test_str_1_SOURCES = src/test/str_1.c src/test.c src/str.c \
+                         src/getlongopt.c
+src_test_str_1_CFLAGS = -DHACK
+
+src_test_heap_1_SOURCES = src/test/heap_1.c src/test.c src/str.c \
+                          src/heap.c src/bit.c src/getlongopt.c src/lcrand.c
+src_test_heap_1_CFLAGS = -DHACK
+
+src_test_bucket_1_SOURCES = src/test/bucket_1.c src/test.c \
+                            src/bucket.c src/str.c \
+                            src/vec.c src/chash.c src/objalloc.c \
+                            src/bit.c src/getlongopt.c src/mem.c \
+                                                       src/alloc.c
+src_test_bucket_1_CFLAGS = -DHACK
+
+src_test_mem_1_SOURCES = src/test/mem_1.c src/test.c \
+                         src/mem.c src/getlongopt.c src/str.c src/bit.c
+src_test_mem_1_CFLAGS = -DHACK
+
+src_test_iobtree_1_SOURCES = src/test/iobtree_1.c src/test.c \
+                             src/bucket.c src/str.c src/vec.c \
+                             src/bit.c src/iobtree.c src/binsearch.c \
+                             src/fdset.c src/chash.c src/btbucket.c \
+                             src/freemap.c src/getlongopt.c src/rbtree.c \
+                             src/getmaxfsize.c src/mem.c src/stack.c \
+                             src/lcrand.c src/objalloc.c src/alloc.c
+src_test_iobtree_1_CFLAGS = -DHACK
+
+src_test_binsearch_1_SOURCES = src/test/binsearch_1.c src/test.c \
+                               src/binsearch.c src/getlongopt.c src/str.c \
+                               src/lcrand.c
+src_test_binsearch_1_CFLAGS = -DHACK
+
+src_test_bit_1_SOURCES = src/test/bit_1.c src/test.c \
+                         src/bit.c src/getlongopt.c src/str.c
+src_test_bit_1_CFLAGS = -DHACK
+
+src_test_getlongopt_1_SOURCES = src/test.c src/test/getlongopt_1.c \
+                                src/str.c src/getlongopt.c
+src_test_getlongopt_1_CFLAGS = -DHACK
+
+src_test_stack_1_SOURCES = src/test.c src/test/stack_1.c \
+                           src/str.c src/getlongopt.c src/stack.c
+src_test_stack_1_CFLAGS = -DHACK
+
+src_test_rbtree_1_SOURCES = src/test.c src/test/rbtree_1.c \
+                           src/str.c src/getlongopt.c src/stack.c \
+                           src/rbtree.c src/bit.c src/lcrand.c src/objalloc.c \
+                           src/mem.c src/alloc.c
+src_test_rbtree_1_CFLAGS = -DHACK
+
+src_test_mlparse_1_SOURCES = src/test.c src/test/mlparse_1.c \
+                           src/str.c src/getlongopt.c src/mlparse.c
+src_test_mlparse_1_CFLAGS = -DHACK
+
+src_test_freemap_1_SOURCES = src/test.c src/test/freemap_1.c \
+                             src/str.c src/getlongopt.c src/freemap.c \
+                             src/binsearch.c src/rbtree.c src/stack.c \
+                             src/bit.c src/lcrand.c src/objalloc.c \
+                             src/mem.c src/alloc.c
+src_test_freemap_1_CFLAGS = -DHACK
+
+src_test_docmap_1_SOURCES = src/test.c src/test/docmap_1.c \
+                            src/docmap.c src/reposset.c \
+                            src/str.c src/getlongopt.c \
+                            src/lcrand.c src/vec.c src/error.c \
+                            src/freemap.c src/fdset.c src/bit.c \
+                            src/chash.c src/rbtree.c src/objalloc.c \
+                            src/stack.c src/mem.c src/testutils.c \
+                            src/alloc.c src/binsearch.c src/mime.c
+src_test_docmap_1_CFLAGS = -DHACK
+src_test_docmap_1_LDADD = 
+
+src_test_stop_1_SOURCES = src/test.c src/test/stop_1.c \
+                           src/stop.c src/getlongopt.c src/error.c \
+                           src/str.c src/poolalloc.c src/chash.c \
+                           src/bit.c src/objalloc.c src/mem.c \
+                                                  src/alloc.c
+src_test_stop_1_CFLAGS = -DHACK
+
+src_test_poolalloc_1_SOURCES = src/test.c src/test/poolalloc_1.c \
+                           src/getlongopt.c src/error.c \
+                           src/str.c src/poolalloc.c src/chash.c \
+                           src/bit.c src/objalloc.c src/mem.c \
+                                                  src/alloc.c
+src_test_poolalloc_1_CFLAGS = -DHACK
+
+BUILT_SOURCES = src/mime.c src/include/mime.h src/include/svnversion.h
+
+#
+# PyZET
+#
+# Not very portable, but should work
+#
+# FIXME automatic regeneration of setup.py from setup.py.in not working
+if HAVE_PYTHON
+pyzet:
+       $(PYTHON) setup.py build
+
+pyzet-install:
+       $(PYTHON) setup.py install --prefix=${prefix}
+       @echo "Set the env variable PYTHONPATH to ${prefix}/lib/python${PYTHON_VERSION}/site-packages for python to find the zet module"
+       @echo "The directory holding libzet.so will also have to be in your LD_LIBRARY_PATH or similarly configured"
+endif
+
+#### THINGS AFTER THIS LINE WILL BE REMOVED PRIOR TO DISTRIBUTION ####
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..a771f97
--- /dev/null
@@ -0,0 +1,5845 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+
+SOURCES = $(libzet_la_SOURCES) $(btree_SOURCES) $(chash_test_SOURCES) $(hashtime_SOURCES) $(lcrand_test_SOURCES) $(mime_test_SOURCES) $(mlparse_test_SOURCES) $(mlparse_wrap_test_SOURCES) $(objalloc_test_SOURCES) $(poolalloc_test_SOURCES) $(psettings_gen_SOURCES) $(psettings_gen_test_SOURCES) $(src_test_binsearch_1_SOURCES) $(src_test_bit_1_SOURCES) $(src_test_bucket_1_SOURCES) $(src_test_docmap_1_SOURCES) $(src_test_freemap_1_SOURCES) $(src_test_getlongopt_1_SOURCES) $(src_test_heap_1_SOURCES) $(src_test_iobtree_1_SOURCES) $(src_test_mem_1_SOURCES) $(src_test_mlparse_1_SOURCES) $(src_test_poolalloc_1_SOURCES) $(src_test_rbtree_1_SOURCES) $(src_test_stack_1_SOURCES) $(src_test_stop_1_SOURCES) $(src_test_str_1_SOURCES) $(staticalloc_test_SOURCES) $(stem_test_SOURCES) $(stop_gen_SOURCES) $(zet_SOURCES) $(zet_cat_SOURCES) $(zet_dict_SOURCES) $(zet_diff_SOURCES) $(zet_file_SOURCES) $(zet_impactify_SOURCES) $(zet_trec_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = zet$(EXEEXT) zet_trec$(EXEEXT) zet_cat$(EXEEXT) \
+       zet_impactify$(EXEEXT)
+noinst_PROGRAMS = zet_diff$(EXEEXT) zet_file$(EXEEXT) \
+       zet_dict$(EXEEXT) src/test/str_1$(EXEEXT) \
+       src/test/bucket_1$(EXEEXT) src/test/mem_1$(EXEEXT) \
+       src/test/iobtree_1$(EXEEXT) src/test/heap_1$(EXEEXT) \
+       src/test/getlongopt_1$(EXEEXT) src/test/binsearch_1$(EXEEXT) \
+       src/test/bit_1$(EXEEXT) src/test/stack_1$(EXEEXT) \
+       src/test/rbtree_1$(EXEEXT) src/test/mlparse_1$(EXEEXT) \
+       src/test/freemap_1$(EXEEXT) src/test/docmap_1$(EXEEXT) \
+       src/test/stop_1$(EXEEXT) src/test/poolalloc_1$(EXEEXT) \
+       mlparse.test$(EXEEXT) mlparse_wrap.test$(EXEEXT) \
+       mime.test$(EXEEXT) poolalloc.test$(EXEEXT) \
+       psettings_gen$(EXEEXT) psettings_gen.test$(EXEEXT) \
+       stop_gen$(EXEEXT) staticalloc.test$(EXEEXT) \
+       objalloc.test$(EXEEXT) lcrand.test$(EXEEXT) stem.test$(EXEEXT) \
+       btree$(EXEEXT) chash.test$(EXEEXT) hashtime$(EXEEXT)
+DIST_COMMON = README $(am__configure_deps) $(noinst_HEADERS) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(srcdir)/setup.py.in $(top_srcdir)/configure \
+       $(top_srcdir)/src/include/config_h.in INSTALL compile \
+       config.guess config.sub depcomp install-sh ltmain.sh missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/include/config.h
+CONFIG_CLEAN_FILES = setup.py
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+       "$(DESTDIR)$(datadir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libzet_la_LIBADD =
+am__dirstamp = $(am__leading_dot)dirstamp
+am__objects_1 = src/str.lo src/index.lo src/mlparse.lo src/stop.lo \
+       src/stop_default.lo src/postings.lo src/merge.lo src/vec.lo \
+       src/makeindex.lo src/freemap.lo src/bit.lo src/binsearch.lo \
+       src/search.lo src/chash.lo src/stem.lo src/heap.lo \
+       src/queryparse.lo src/index_querybuild.lo src/bucket.lo \
+       src/mem.lo src/fdset.lo src/pyramid.lo src/iobtree.lo \
+       src/getmaxfsize.lo src/storagep.lo src/btbucket.lo \
+       src/btbulk.lo src/vocab.lo src/getlongopt.lo src/error.lo \
+       src/mlparse_wrap.lo src/summarise.lo src/mime.lo \
+       src/remerge.lo src/signals.lo src/stack.lo src/rbtree.lo \
+       src/psettings.lo src/psettings_default.lo src/lcrand.lo \
+       src/objalloc.lo src/docmap.lo src/reposset.lo src/poolalloc.lo \
+       src/alloc.lo src/staticalloc.lo src/dirichlet.lo \
+       src/pcosine.lo src/cosine.lo src/hawkapi.lo src/okapi_k3.lo \
+       src/impact.lo src/impact_build.lo src/libtextcodec/crc.lo \
+       src/libtextcodec/stream.lo src/libtextcodec/detectfilter.lo \
+       src/libtextcodec/gunzipfilter.lo
+am_libzet_la_OBJECTS = $(am__objects_1)
+libzet_la_OBJECTS = $(am_libzet_la_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_btree_OBJECTS = tools/btree.$(OBJEXT)
+btree_OBJECTS = $(am_btree_OBJECTS)
+am_chash_test_OBJECTS = src/chash_test-chash.$(OBJEXT) \
+       src/chash_test-objalloc.$(OBJEXT) src/chash_test-mem.$(OBJEXT) \
+       src/chash_test-bit.$(OBJEXT) src/chash_test-str.$(OBJEXT) \
+       src/chash_test-alloc.$(OBJEXT)
+chash_test_OBJECTS = $(am_chash_test_OBJECTS)
+chash_test_LDADD = $(LDADD)
+am_hashtime_OBJECTS = tools/hashtime-hashtime.$(OBJEXT) \
+       src/hashtime-chash.$(OBJEXT) src/hashtime-str.$(OBJEXT) \
+       src/hashtime-alloc.$(OBJEXT) src/hashtime-objalloc.$(OBJEXT) \
+       src/hashtime-mem.$(OBJEXT) src/hashtime-bit.$(OBJEXT)
+hashtime_OBJECTS = $(am_hashtime_OBJECTS)
+hashtime_LDADD = $(LDADD)
+am_lcrand_test_OBJECTS = src/lcrand_test-lcrand.$(OBJEXT)
+lcrand_test_OBJECTS = $(am_lcrand_test_OBJECTS)
+lcrand_test_LDADD = $(LDADD)
+am_mime_test_OBJECTS = src/mime_test-mime.$(OBJEXT) \
+       src/mime_test-str.$(OBJEXT)
+mime_test_OBJECTS = $(am_mime_test_OBJECTS)
+mime_test_LDADD = $(LDADD)
+am_mlparse_test_OBJECTS = src/mlparse_test-mlparse.$(OBJEXT) \
+       src/mlparse_test-str.$(OBJEXT) \
+       src/libtextcodec/mlparse_test-stream.$(OBJEXT) \
+       src/libtextcodec/mlparse_test-gunzipfilter.$(OBJEXT) \
+       src/libtextcodec/mlparse_test-detectfilter.$(OBJEXT) \
+       src/libtextcodec/mlparse_test-crc.$(OBJEXT)
+mlparse_test_OBJECTS = $(am_mlparse_test_OBJECTS)
+mlparse_test_LDADD = $(LDADD)
+am_mlparse_wrap_test_OBJECTS =  \
+       src/mlparse_wrap_test-mlparse_wrap.$(OBJEXT) \
+       src/mlparse_wrap_test-mlparse.$(OBJEXT) \
+       src/mlparse_wrap_test-str.$(OBJEXT)
+mlparse_wrap_test_OBJECTS = $(am_mlparse_wrap_test_OBJECTS)
+mlparse_wrap_test_LDADD = $(LDADD)
+am_objalloc_test_OBJECTS = src/objalloc_test-objalloc.$(OBJEXT) \
+       src/objalloc_test-bit.$(OBJEXT) \
+       src/objalloc_test-mem.$(OBJEXT) \
+       src/objalloc_test-str.$(OBJEXT) \
+       src/objalloc_test-alloc.$(OBJEXT)
+objalloc_test_OBJECTS = $(am_objalloc_test_OBJECTS)
+objalloc_test_LDADD = $(LDADD)
+am_poolalloc_test_OBJECTS = src/poolalloc_test-poolalloc.$(OBJEXT) \
+       src/poolalloc_test-chash.$(OBJEXT) \
+       src/poolalloc_test-mem.$(OBJEXT) \
+       src/poolalloc_test-bit.$(OBJEXT) \
+       src/poolalloc_test-objalloc.$(OBJEXT) \
+       src/poolalloc_test-alloc.$(OBJEXT) \
+       src/poolalloc_test-str.$(OBJEXT)
+poolalloc_test_OBJECTS = $(am_poolalloc_test_OBJECTS)
+poolalloc_test_LDADD = $(LDADD)
+am_psettings_gen_OBJECTS = src/psettings_gen-psettings.$(OBJEXT) \
+       src/psettings_gen-chash.$(OBJEXT) \
+       src/psettings_gen-str.$(OBJEXT) \
+       src/psettings_gen-mlparse_wrap.$(OBJEXT) \
+       src/psettings_gen-mlparse.$(OBJEXT) \
+       src/psettings_gen-bit.$(OBJEXT) \
+       src/psettings_gen-mime.$(OBJEXT) \
+       src/psettings_gen-objalloc.$(OBJEXT) \
+       src/psettings_gen-mem.$(OBJEXT) \
+       src/psettings_gen-alloc.$(OBJEXT) \
+       src/psettings_gen-error.$(OBJEXT)
+psettings_gen_OBJECTS = $(am_psettings_gen_OBJECTS)
+psettings_gen_LDADD = $(LDADD)
+am_psettings_gen_test_OBJECTS =  \
+       src/psettings_gen_test-psettings.$(OBJEXT) \
+       src/psettings_gen_test-chash.$(OBJEXT) \
+       src/psettings_gen_test-str.$(OBJEXT) \
+       src/psettings_gen_test-mlparse_wrap.$(OBJEXT) \
+       src/psettings_gen_test-mlparse.$(OBJEXT) \
+       src/psettings_gen_test-bit.$(OBJEXT) \
+       src/psettings_gen_test-mime.$(OBJEXT) \
+       src/psettings_gen_test-psettings_default.$(OBJEXT) \
+       src/psettings_gen_test-objalloc.$(OBJEXT) \
+       src/psettings_gen_test-mem.$(OBJEXT) \
+       src/psettings_gen_test-alloc.$(OBJEXT) \
+       src/psettings_gen_test-error.$(OBJEXT)
+psettings_gen_test_OBJECTS = $(am_psettings_gen_test_OBJECTS)
+psettings_gen_test_LDADD = $(LDADD)
+am_src_test_binsearch_1_OBJECTS =  \
+       src/test/src_test_binsearch_1-binsearch_1.$(OBJEXT) \
+       src/src_test_binsearch_1-test.$(OBJEXT) \
+       src/src_test_binsearch_1-binsearch.$(OBJEXT) \
+       src/src_test_binsearch_1-getlongopt.$(OBJEXT) \
+       src/src_test_binsearch_1-str.$(OBJEXT) \
+       src/src_test_binsearch_1-lcrand.$(OBJEXT)
+src_test_binsearch_1_OBJECTS = $(am_src_test_binsearch_1_OBJECTS)
+src_test_binsearch_1_LDADD = $(LDADD)
+am_src_test_bit_1_OBJECTS = src/test/src_test_bit_1-bit_1.$(OBJEXT) \
+       src/src_test_bit_1-test.$(OBJEXT) \
+       src/src_test_bit_1-bit.$(OBJEXT) \
+       src/src_test_bit_1-getlongopt.$(OBJEXT) \
+       src/src_test_bit_1-str.$(OBJEXT)
+src_test_bit_1_OBJECTS = $(am_src_test_bit_1_OBJECTS)
+src_test_bit_1_LDADD = $(LDADD)
+am_src_test_bucket_1_OBJECTS =  \
+       src/test/src_test_bucket_1-bucket_1.$(OBJEXT) \
+       src/src_test_bucket_1-test.$(OBJEXT) \
+       src/src_test_bucket_1-bucket.$(OBJEXT) \
+       src/src_test_bucket_1-str.$(OBJEXT) \
+       src/src_test_bucket_1-vec.$(OBJEXT) \
+       src/src_test_bucket_1-chash.$(OBJEXT) \
+       src/src_test_bucket_1-objalloc.$(OBJEXT) \
+       src/src_test_bucket_1-bit.$(OBJEXT) \
+       src/src_test_bucket_1-getlongopt.$(OBJEXT) \
+       src/src_test_bucket_1-mem.$(OBJEXT) \
+       src/src_test_bucket_1-alloc.$(OBJEXT)
+src_test_bucket_1_OBJECTS = $(am_src_test_bucket_1_OBJECTS)
+src_test_bucket_1_LDADD = $(LDADD)
+am_src_test_docmap_1_OBJECTS = src/src_test_docmap_1-test.$(OBJEXT) \
+       src/test/src_test_docmap_1-docmap_1.$(OBJEXT) \
+       src/src_test_docmap_1-docmap.$(OBJEXT) \
+       src/src_test_docmap_1-reposset.$(OBJEXT) \
+       src/src_test_docmap_1-str.$(OBJEXT) \
+       src/src_test_docmap_1-getlongopt.$(OBJEXT) \
+       src/src_test_docmap_1-lcrand.$(OBJEXT) \
+       src/src_test_docmap_1-vec.$(OBJEXT) \
+       src/src_test_docmap_1-error.$(OBJEXT) \
+       src/src_test_docmap_1-freemap.$(OBJEXT) \
+       src/src_test_docmap_1-fdset.$(OBJEXT) \
+       src/src_test_docmap_1-bit.$(OBJEXT) \
+       src/src_test_docmap_1-chash.$(OBJEXT) \
+       src/src_test_docmap_1-rbtree.$(OBJEXT) \
+       src/src_test_docmap_1-objalloc.$(OBJEXT) \
+       src/src_test_docmap_1-stack.$(OBJEXT) \
+       src/src_test_docmap_1-mem.$(OBJEXT) \
+       src/src_test_docmap_1-testutils.$(OBJEXT) \
+       src/src_test_docmap_1-alloc.$(OBJEXT) \
+       src/src_test_docmap_1-binsearch.$(OBJEXT) \
+       src/src_test_docmap_1-mime.$(OBJEXT)
+src_test_docmap_1_OBJECTS = $(am_src_test_docmap_1_OBJECTS)
+src_test_docmap_1_DEPENDENCIES =
+am_src_test_freemap_1_OBJECTS = src/src_test_freemap_1-test.$(OBJEXT) \
+       src/test/src_test_freemap_1-freemap_1.$(OBJEXT) \
+       src/src_test_freemap_1-str.$(OBJEXT) \
+       src/src_test_freemap_1-getlongopt.$(OBJEXT) \
+       src/src_test_freemap_1-freemap.$(OBJEXT) \
+       src/src_test_freemap_1-binsearch.$(OBJEXT) \
+       src/src_test_freemap_1-rbtree.$(OBJEXT) \
+       src/src_test_freemap_1-stack.$(OBJEXT) \
+       src/src_test_freemap_1-bit.$(OBJEXT) \
+       src/src_test_freemap_1-lcrand.$(OBJEXT) \
+       src/src_test_freemap_1-objalloc.$(OBJEXT) \
+       src/src_test_freemap_1-mem.$(OBJEXT) \
+       src/src_test_freemap_1-alloc.$(OBJEXT)
+src_test_freemap_1_OBJECTS = $(am_src_test_freemap_1_OBJECTS)
+src_test_freemap_1_LDADD = $(LDADD)
+am_src_test_getlongopt_1_OBJECTS =  \
+       src/src_test_getlongopt_1-test.$(OBJEXT) \
+       src/test/src_test_getlongopt_1-getlongopt_1.$(OBJEXT) \
+       src/src_test_getlongopt_1-str.$(OBJEXT) \
+       src/src_test_getlongopt_1-getlongopt.$(OBJEXT)
+src_test_getlongopt_1_OBJECTS = $(am_src_test_getlongopt_1_OBJECTS)
+src_test_getlongopt_1_LDADD = $(LDADD)
+am_src_test_heap_1_OBJECTS =  \
+       src/test/src_test_heap_1-heap_1.$(OBJEXT) \
+       src/src_test_heap_1-test.$(OBJEXT) \
+       src/src_test_heap_1-str.$(OBJEXT) \
+       src/src_test_heap_1-heap.$(OBJEXT) \
+       src/src_test_heap_1-bit.$(OBJEXT) \
+       src/src_test_heap_1-getlongopt.$(OBJEXT) \
+       src/src_test_heap_1-lcrand.$(OBJEXT)
+src_test_heap_1_OBJECTS = $(am_src_test_heap_1_OBJECTS)
+src_test_heap_1_LDADD = $(LDADD)
+am_src_test_iobtree_1_OBJECTS =  \
+       src/test/src_test_iobtree_1-iobtree_1.$(OBJEXT) \
+       src/src_test_iobtree_1-test.$(OBJEXT) \
+       src/src_test_iobtree_1-bucket.$(OBJEXT) \
+       src/src_test_iobtree_1-str.$(OBJEXT) \
+       src/src_test_iobtree_1-vec.$(OBJEXT) \
+       src/src_test_iobtree_1-bit.$(OBJEXT) \
+       src/src_test_iobtree_1-iobtree.$(OBJEXT) \
+       src/src_test_iobtree_1-binsearch.$(OBJEXT) \
+       src/src_test_iobtree_1-fdset.$(OBJEXT) \
+       src/src_test_iobtree_1-chash.$(OBJEXT) \
+       src/src_test_iobtree_1-btbucket.$(OBJEXT) \
+       src/src_test_iobtree_1-freemap.$(OBJEXT) \
+       src/src_test_iobtree_1-getlongopt.$(OBJEXT) \
+       src/src_test_iobtree_1-rbtree.$(OBJEXT) \
+       src/src_test_iobtree_1-getmaxfsize.$(OBJEXT) \
+       src/src_test_iobtree_1-mem.$(OBJEXT) \
+       src/src_test_iobtree_1-stack.$(OBJEXT) \
+       src/src_test_iobtree_1-lcrand.$(OBJEXT) \
+       src/src_test_iobtree_1-objalloc.$(OBJEXT) \
+       src/src_test_iobtree_1-alloc.$(OBJEXT)
+src_test_iobtree_1_OBJECTS = $(am_src_test_iobtree_1_OBJECTS)
+src_test_iobtree_1_LDADD = $(LDADD)
+am_src_test_mem_1_OBJECTS = src/test/src_test_mem_1-mem_1.$(OBJEXT) \
+       src/src_test_mem_1-test.$(OBJEXT) \
+       src/src_test_mem_1-mem.$(OBJEXT) \
+       src/src_test_mem_1-getlongopt.$(OBJEXT) \
+       src/src_test_mem_1-str.$(OBJEXT) \
+       src/src_test_mem_1-bit.$(OBJEXT)
+src_test_mem_1_OBJECTS = $(am_src_test_mem_1_OBJECTS)
+src_test_mem_1_LDADD = $(LDADD)
+am_src_test_mlparse_1_OBJECTS = src/src_test_mlparse_1-test.$(OBJEXT) \
+       src/test/src_test_mlparse_1-mlparse_1.$(OBJEXT) \
+       src/src_test_mlparse_1-str.$(OBJEXT) \
+       src/src_test_mlparse_1-getlongopt.$(OBJEXT) \
+       src/src_test_mlparse_1-mlparse.$(OBJEXT)
+src_test_mlparse_1_OBJECTS = $(am_src_test_mlparse_1_OBJECTS)
+src_test_mlparse_1_LDADD = $(LDADD)
+am_src_test_poolalloc_1_OBJECTS =  \
+       src/src_test_poolalloc_1-test.$(OBJEXT) \
+       src/test/src_test_poolalloc_1-poolalloc_1.$(OBJEXT) \
+       src/src_test_poolalloc_1-getlongopt.$(OBJEXT) \
+       src/src_test_poolalloc_1-error.$(OBJEXT) \
+       src/src_test_poolalloc_1-str.$(OBJEXT) \
+       src/src_test_poolalloc_1-poolalloc.$(OBJEXT) \
+       src/src_test_poolalloc_1-chash.$(OBJEXT) \
+       src/src_test_poolalloc_1-bit.$(OBJEXT) \
+       src/src_test_poolalloc_1-objalloc.$(OBJEXT) \
+       src/src_test_poolalloc_1-mem.$(OBJEXT) \
+       src/src_test_poolalloc_1-alloc.$(OBJEXT)
+src_test_poolalloc_1_OBJECTS = $(am_src_test_poolalloc_1_OBJECTS)
+src_test_poolalloc_1_LDADD = $(LDADD)
+am_src_test_rbtree_1_OBJECTS = src/src_test_rbtree_1-test.$(OBJEXT) \
+       src/test/src_test_rbtree_1-rbtree_1.$(OBJEXT) \
+       src/src_test_rbtree_1-str.$(OBJEXT) \
+       src/src_test_rbtree_1-getlongopt.$(OBJEXT) \
+       src/src_test_rbtree_1-stack.$(OBJEXT) \
+       src/src_test_rbtree_1-rbtree.$(OBJEXT) \
+       src/src_test_rbtree_1-bit.$(OBJEXT) \
+       src/src_test_rbtree_1-lcrand.$(OBJEXT) \
+       src/src_test_rbtree_1-objalloc.$(OBJEXT) \
+       src/src_test_rbtree_1-mem.$(OBJEXT) \
+       src/src_test_rbtree_1-alloc.$(OBJEXT)
+src_test_rbtree_1_OBJECTS = $(am_src_test_rbtree_1_OBJECTS)
+src_test_rbtree_1_LDADD = $(LDADD)
+am_src_test_stack_1_OBJECTS = src/src_test_stack_1-test.$(OBJEXT) \
+       src/test/src_test_stack_1-stack_1.$(OBJEXT) \
+       src/src_test_stack_1-str.$(OBJEXT) \
+       src/src_test_stack_1-getlongopt.$(OBJEXT) \
+       src/src_test_stack_1-stack.$(OBJEXT)
+src_test_stack_1_OBJECTS = $(am_src_test_stack_1_OBJECTS)
+src_test_stack_1_LDADD = $(LDADD)
+am_src_test_stop_1_OBJECTS = src/src_test_stop_1-test.$(OBJEXT) \
+       src/test/src_test_stop_1-stop_1.$(OBJEXT) \
+       src/src_test_stop_1-stop.$(OBJEXT) \
+       src/src_test_stop_1-getlongopt.$(OBJEXT) \
+       src/src_test_stop_1-error.$(OBJEXT) \
+       src/src_test_stop_1-str.$(OBJEXT) \
+       src/src_test_stop_1-poolalloc.$(OBJEXT) \
+       src/src_test_stop_1-chash.$(OBJEXT) \
+       src/src_test_stop_1-bit.$(OBJEXT) \
+       src/src_test_stop_1-objalloc.$(OBJEXT) \
+       src/src_test_stop_1-mem.$(OBJEXT) \
+       src/src_test_stop_1-alloc.$(OBJEXT)
+src_test_stop_1_OBJECTS = $(am_src_test_stop_1_OBJECTS)
+src_test_stop_1_LDADD = $(LDADD)
+am_src_test_str_1_OBJECTS = src/test/src_test_str_1-str_1.$(OBJEXT) \
+       src/src_test_str_1-test.$(OBJEXT) \
+       src/src_test_str_1-str.$(OBJEXT) \
+       src/src_test_str_1-getlongopt.$(OBJEXT)
+src_test_str_1_OBJECTS = $(am_src_test_str_1_OBJECTS)
+src_test_str_1_LDADD = $(LDADD)
+am_staticalloc_test_OBJECTS =  \
+       src/staticalloc_test-staticalloc.$(OBJEXT) \
+       src/staticalloc_test-mem.$(OBJEXT) \
+       src/staticalloc_test-bit.$(OBJEXT)
+staticalloc_test_OBJECTS = $(am_staticalloc_test_OBJECTS)
+staticalloc_test_LDADD = $(LDADD)
+am_stem_test_OBJECTS = src/stem_test-stem.$(OBJEXT) \
+       src/stem_test-chash.$(OBJEXT) src/stem_test-objalloc.$(OBJEXT) \
+       src/stem_test-mem.$(OBJEXT) src/stem_test-bit.$(OBJEXT) \
+       src/stem_test-str.$(OBJEXT) src/stem_test-alloc.$(OBJEXT)
+stem_test_OBJECTS = $(am_stem_test_OBJECTS)
+stem_test_LDADD = $(LDADD)
+am_stop_gen_OBJECTS = src/stop_gen-stop.$(OBJEXT) \
+       src/stop_gen-str.$(OBJEXT) src/stop_gen-poolalloc.$(OBJEXT) \
+       src/stop_gen-chash.$(OBJEXT) src/stop_gen-alloc.$(OBJEXT) \
+       src/stop_gen-bit.$(OBJEXT) src/stop_gen-objalloc.$(OBJEXT) \
+       src/stop_gen-mem.$(OBJEXT)
+stop_gen_OBJECTS = $(am_stop_gen_OBJECTS)
+stop_gen_LDADD = $(LDADD)
+am_zet_OBJECTS = src/commandline.$(OBJEXT)
+zet_OBJECTS = $(am_zet_OBJECTS)
+am_zet_cat_OBJECTS = tools/cat.$(OBJEXT)
+zet_cat_OBJECTS = $(am_zet_cat_OBJECTS)
+am_zet_dict_OBJECTS = tools/dict.$(OBJEXT)
+zet_dict_OBJECTS = $(am_zet_dict_OBJECTS)
+am_zet_diff_OBJECTS = tools/diff.$(OBJEXT)
+zet_diff_OBJECTS = $(am_zet_diff_OBJECTS)
+am_zet_file_OBJECTS = tools/zet_file-file.$(OBJEXT) \
+       src/zet_file-mime.$(OBJEXT) src/zet_file-str.$(OBJEXT)
+zet_file_OBJECTS = $(am_zet_file_OBJECTS)
+zet_file_LDADD = $(LDADD)
+am_zet_impactify_OBJECTS = tools/impactify.$(OBJEXT)
+zet_impactify_OBJECTS = $(am_zet_impactify_OBJECTS)
+am_zet_trec_OBJECTS = src/trecrun.$(OBJEXT) src/trec_eval.$(OBJEXT)
+zet_trec_OBJECTS = $(am_zet_trec_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libzet_la_SOURCES) $(btree_SOURCES) $(chash_test_SOURCES) \
+       $(hashtime_SOURCES) $(lcrand_test_SOURCES) \
+       $(mime_test_SOURCES) $(mlparse_test_SOURCES) \
+       $(mlparse_wrap_test_SOURCES) $(objalloc_test_SOURCES) \
+       $(poolalloc_test_SOURCES) $(psettings_gen_SOURCES) \
+       $(psettings_gen_test_SOURCES) $(src_test_binsearch_1_SOURCES) \
+       $(src_test_bit_1_SOURCES) $(src_test_bucket_1_SOURCES) \
+       $(src_test_docmap_1_SOURCES) $(src_test_freemap_1_SOURCES) \
+       $(src_test_getlongopt_1_SOURCES) $(src_test_heap_1_SOURCES) \
+       $(src_test_iobtree_1_SOURCES) $(src_test_mem_1_SOURCES) \
+       $(src_test_mlparse_1_SOURCES) $(src_test_poolalloc_1_SOURCES) \
+       $(src_test_rbtree_1_SOURCES) $(src_test_stack_1_SOURCES) \
+       $(src_test_stop_1_SOURCES) $(src_test_str_1_SOURCES) \
+       $(staticalloc_test_SOURCES) $(stem_test_SOURCES) \
+       $(stop_gen_SOURCES) $(zet_SOURCES) $(zet_cat_SOURCES) \
+       $(zet_dict_SOURCES) $(zet_diff_SOURCES) $(zet_file_SOURCES) \
+       $(zet_impactify_SOURCES) $(zet_trec_SOURCES)
+DIST_SOURCES = $(libzet_la_SOURCES) $(btree_SOURCES) \
+       $(chash_test_SOURCES) $(hashtime_SOURCES) \
+       $(lcrand_test_SOURCES) $(mime_test_SOURCES) \
+       $(mlparse_test_SOURCES) $(mlparse_wrap_test_SOURCES) \
+       $(objalloc_test_SOURCES) $(poolalloc_test_SOURCES) \
+       $(psettings_gen_SOURCES) $(psettings_gen_test_SOURCES) \
+       $(src_test_binsearch_1_SOURCES) $(src_test_bit_1_SOURCES) \
+       $(src_test_bucket_1_SOURCES) $(src_test_docmap_1_SOURCES) \
+       $(src_test_freemap_1_SOURCES) $(src_test_getlongopt_1_SOURCES) \
+       $(src_test_heap_1_SOURCES) $(src_test_iobtree_1_SOURCES) \
+       $(src_test_mem_1_SOURCES) $(src_test_mlparse_1_SOURCES) \
+       $(src_test_poolalloc_1_SOURCES) $(src_test_rbtree_1_SOURCES) \
+       $(src_test_stack_1_SOURCES) $(src_test_stop_1_SOURCES) \
+       $(src_test_str_1_SOURCES) $(staticalloc_test_SOURCES) \
+       $(stem_test_SOURCES) $(stop_gen_SOURCES) $(zet_SOURCES) \
+       $(zet_cat_SOURCES) $(zet_dict_SOURCES) $(zet_diff_SOURCES) \
+       $(zet_file_SOURCES) $(zet_impactify_SOURCES) \
+       $(zet_trec_SOURCES)
+dataDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(data_DATA)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).zip
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+HAVE_PYTHON_FALSE = @HAVE_PYTHON_FALSE@
+HAVE_PYTHON_TRUE = @HAVE_PYTHON_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OS = @OS@
+OSINCLUDE = @OSINCLUDE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+
+# necessary compiler flags (not that cflags is not supposed to be set
+# for optimisation, as the user is supposed to do that)
+AM_CPPFLAGS = -I $(srcdir)/src/include/ -I $(srcdir)/include/ \
+              -I $(srcdir)/src/include/compat/ \
+              -I $(srcdir)/src/include/@OSINCLUDE@/ \
+              -D@OS@ -DLOGERRORS
+
+AM_CFLAGS = 
+AM_LDFLAGS = @LIBS@
+data_DATA = config/psettings.xml
+lib_LTLIBRARIES = libzet.la
+noinst_HEADERS = src/include/heap.h       include/index.h \
+                 src/include/index_querybuild.h \
+                 src/include/makeindex.h  src/include/uri.h \
+                 src/include/_index.h     src/include/merge.h \
+                 src/include/_postings.h  src/include/mlparse.h \
+                 src/include/_uri.h       src/include/postings.h \
+                 src/include/binsearch.h  src/include/stop.h \
+                 src/include/bit.h        src/include/str.h \
+                 src/include/chash.h      src/include/_chash.h \
+                 src/include/config_h.in  \
+                 src/include/def.h        src/include/timings.h \
+                 src/include/freemap.h    src/include/getlongopt.h \
+                 src/include/vec.h        src/include/poolalloc.h \
+                 src/include/bucket.h     src/include/test.h \
+                 src/include/fdset.h      src/include/queryparse.h \
+                 src/include/pyramid.h    src/include/iobtree.h \
+                 src/include/getmaxfsize.h \
+                 src/include/storagep.h   \
+                 src/include/btbucket.h   src/include/_btbucket.h \
+                 src/include/mem.h        src/include/_mem.h \
+                 src/include/vocab.h      src/include/ascii.h \
+                 src/include/mlparse_wrap.h src/include/btbulk.h \
+                 src/include/error.h      src/include/mime.h \
+                 src/include/summarise.h  src/include/stem.h \
+                 src/include/stack.h      src/include/rbtree.h \
+                 src/include/signals.h    src/include/alloc.h \
+                                src/include/staticalloc.h \
+                                src/include/metric.h     src/include/search.h \
+                 src/include/psettings.h  src/include/lcrand.h \
+                 src/include/objalloc.h   src/include/stream.h \
+                 src/include/crc.h        src/include/trec_eval.h \
+                 src/include/docmap.h     src/include/_docmap.h \
+                 src/include/reposset.h   src/include/_reposset.h \
+                                src/include/impact.h     src/include/impact_build.h \
+                 src/include/testutils.h \
+                 src/include/compat/zstdint.h \
+                 src/include/compat/zvalgrind.h \
+                 src/include/linux/firstinclude.h \
+                 src/include/freebsd/firstinclude.h \
+                 src/include/sunos/firstinclude.h \
+                 src/include/cygwin/firstinclude.h \
+                 src/include/darwin/firstinclude.h \
+                 src/include/win32/firstinclude.h \
+                 src/include/win32/config.h src/include/compat/zglob.h \
+                 src/include/svnversion.h
+
+EXTRA_DIST = config/psettings.xml config/stoplist_sorted \
+             txt/moby.txt txt/README \
+             src/compat/win32_stubs.c \
+             src/compat/zglob.c doc/Build.html doc/Content.html \
+             src/pyzet/zetmodule.c src/pyzet/pzet.py \
+             doc/copying.html doc/Credits.html doc/Disclaimer.html \
+             doc/hacking.html doc/index.html doc/logo.gif \
+             doc/Readme.html doc/README.TXT doc/Search.html \
+             doc/style.css doc/Tutorial.html \
+             scripts/metric.py scripts/mime.py src/metric.c \
+             src/dirichlet.metric src/pcosine.metric \
+             src/cosine.metric src/hawkapi.metric src/okapi_k3.metric \
+             \
+             win32/visualc6/zettair.dsw \
+             win32/visualc6/zet.dsp \
+             win32/visualc6/libzet.dsp \
+             win32/visualc6/zet_cat.dsp \
+             win32/visualc6/zet_trec.dsp \
+             win32/visualc6/zet_diff.dsp \
+             \
+             src/test/binsearch_1.cases \
+             src/test/bucket_1.cases \
+             src/test/bufstuffer_1.cases \
+             src/test/docmap_1.cases \
+             src/test/freemap_1.cases \
+             src/test/getlongopt_1.cases \
+             src/test/heap_1.cases \
+             src/test/iobtree_1.cases \
+             src/test/rbtree_1.cases \
+             src/test/stack_1.cases \
+             src/test/stop_1.cases
+
+
+# dependencies for the main programs/libraries
+zet_SOURCES = src/commandline.c src/include/svnversion.h
+zet_LDADD = -lzet -L.
+zet_DEPENDENCIES = libzet.la
+zet_trec_SOURCES = src/trecrun.c src/trec_eval.c
+zet_trec_LDADD = -lzet -L.
+zet_trec_DEPENDENCIES = libzet.la
+library_sources = src/str.c src/index.c src/mlparse.c \
+                  src/stop.c src/stop_default.c \
+                  src/postings.c \
+                  src/merge.c src/vec.c src/makeindex.c \
+                  src/freemap.c src/bit.c src/binsearch.c \
+                  src/search.c src/chash.c src/stem.c \
+                  src/heap.c src/queryparse.c src/index_querybuild.c \
+                  src/bucket.c src/mem.c src/fdset.c \
+                  src/pyramid.c src/iobtree.c src/getmaxfsize.c \
+                  src/storagep.c src/btbucket.c src/btbulk.c \
+                  src/vocab.c src/getlongopt.c src/error.c \
+                  src/mlparse_wrap.c src/summarise.c src/mime.c \
+                  src/remerge.c src/signals.c \
+                  src/stack.c src/rbtree.c \
+                  src/psettings.c src/psettings_default.c src/lcrand.c \
+                  src/objalloc.c \
+                  src/docmap.c src/reposset.c \
+                  src/poolalloc.c src/alloc.c src/staticalloc.c \
+                                 src/dirichlet.c src/pcosine.c \
+                                 src/cosine.c src/hawkapi.c src/okapi_k3.c \
+                                 src/impact.c src/impact_build.c \
+                  \
+                  src/libtextcodec/crc.c src/libtextcodec/stream.c \
+                  src/libtextcodec/detectfilter.c \
+                  src/libtextcodec/gunzipfilter.c
+
+libzet_la_SOURCES = $(library_sources)
+
+# depedencies for utility programs
+zet_cat_SOURCES = tools/cat.c 
+zet_cat_LDADD = -lzet -L. 
+zet_cat_DEPENDENCIES = libzet.la
+zet_dict_SOURCES = tools/dict.c
+zet_dict_LDADD = -lzet -L. 
+zet_dict_DEPENDENCIES = libzet.la
+zet_file_SOURCES = tools/file.c src/mime.c src/str.c
+zet_file_CFLAGS = -DHACK
+zet_diff_SOURCES = tools/diff.c
+zet_diff_LDADD = -lzet -L. 
+zet_diff_DEPENDENCIES = libzet.la
+zet_impactify_SOURCES = tools/impactify.c
+zet_impactify_LDADD = -lzet -L. 
+zet_impactify_DEPENDENCIES = libzet.la
+btree_SOURCES = tools/btree.c
+btree_LDADD = -lzet -L. 
+btree_DEPENDENCIES = libzet.la
+hashtime_SOURCES = tools/hashtime.c src/chash.c src/str.c src/alloc.c \
+                   src/objalloc.c src/mem.c src/bit.c
+
+hashtime_CFLAGS = -DHACK
+
+# misc stuff
+stop_gen_SOURCES = src/stop.c src/str.c src/poolalloc.c src/chash.c \
+                      src/alloc.c src/bit.c src/objalloc.c src/mem.c
+
+stop_gen_CFLAGS = -DSTOP_MAIN
+psettings_gen_SOURCES = src/psettings.c src/chash.c src/str.c \
+                        src/mlparse_wrap.c src/mlparse.c src/bit.c \
+                        src/mime.c src/objalloc.c src/mem.c \
+                                               src/alloc.c src/error.c
+
+psettings_gen_CFLAGS = -DPSETTINGS_MAIN
+psettings_gen_test_SOURCES = src/psettings.c src/chash.c src/str.c \
+                        src/mlparse_wrap.c src/mlparse.c src/bit.c \
+                        src/mime.c src/psettings_default.c src/objalloc.c \
+                                               src/mem.c src/alloc.c src/error.c
+
+psettings_gen_test_CFLAGS = -DPSETTINGS_DEFAULT_TEST
+poolalloc_test_SOURCES = src/poolalloc.c src/chash.c src/mem.c src/bit.c \
+                         src/objalloc.c src/alloc.c src/str.c
+
+poolalloc_test_CFLAGS = -DPOOLALLOC_TEST
+staticalloc_test_SOURCES = src/staticalloc.c src/mem.c src/bit.c
+staticalloc_test_CFLAGS = -DSTATICALLOC_TEST
+mlparse_test_SOURCES = src/mlparse.c src/str.c src/libtextcodec/stream.c \
+                       src/libtextcodec/gunzipfilter.c \
+                       src/libtextcodec/detectfilter.c \
+                       src/libtextcodec/crc.c
+
+mlparse_test_CFLAGS = -DMLPARSE_TEST
+mime_test_SOURCES = src/mime.c src/str.c
+mime_test_CFLAGS = -DMIME_TEST
+mlparse_wrap_test_SOURCES = src/mlparse_wrap.c src/mlparse.c src/str.c
+mlparse_wrap_test_CFLAGS = -DMLPARSE_WRAP_TEST
+objalloc_test_SOURCES = src/objalloc.c src/bit.c src/mem.c src/str.c \
+                        src/alloc.c
+
+objalloc_test_CFLAGS = -DOBJALLOC_TEST 
+lcrand_test_SOURCES = src/lcrand.c 
+lcrand_test_CFLAGS = -DLCRAND_TEST 
+chash_test_SOURCES = src/chash.c src/objalloc.c src/mem.c \
+                     src/bit.c src/str.c src/alloc.c
+
+chash_test_CFLAGS = -DCHASH_TEST 
+stem_test_SOURCES = src/stem.c src/chash.c src/objalloc.c src/mem.c \
+                    src/bit.c src/str.c src/alloc.c
+
+stem_test_CFLAGS = -DSTEM_TEST 
+
+# more formal testing stuff
+
+# list of tests to run
+TESTS = src/test/binsearch_1 src/test/iobtree_1 src/test/stack_1 \
+        src/test/bit_1 src/test/mem_1 src/test/stop_1 \
+        src/test/bucket_1 src/test/mlparse_1 src/test/str_1 \
+        \
+        src/test/freemap_1 src/test/docmap_1 \
+        src/test/getlongopt_1 src/test/poolalloc_1 src/test/heap_1 \
+               src/test/rbtree_1
+
+
+# dependencies for tests
+
+# -DHACK added to CFLAGS so that libtool won't complain about having to
+# compile them seperately :o(
+
+#src_test_test_1_SOURCES = src/test/test_1.c
+#src_test_test_1_LDADD = -lzet -L. 
+#src_test_test_1_DEPENDENCIES = libzet.la
+src_test_str_1_SOURCES = src/test/str_1.c src/test.c src/str.c \
+                         src/getlongopt.c
+
+src_test_str_1_CFLAGS = -DHACK
+src_test_heap_1_SOURCES = src/test/heap_1.c src/test.c src/str.c \
+                          src/heap.c src/bit.c src/getlongopt.c src/lcrand.c
+
+src_test_heap_1_CFLAGS = -DHACK
+src_test_bucket_1_SOURCES = src/test/bucket_1.c src/test.c \
+                            src/bucket.c src/str.c \
+                            src/vec.c src/chash.c src/objalloc.c \
+                            src/bit.c src/getlongopt.c src/mem.c \
+                                                       src/alloc.c
+
+src_test_bucket_1_CFLAGS = -DHACK
+src_test_mem_1_SOURCES = src/test/mem_1.c src/test.c \
+                         src/mem.c src/getlongopt.c src/str.c src/bit.c
+
+src_test_mem_1_CFLAGS = -DHACK
+src_test_iobtree_1_SOURCES = src/test/iobtree_1.c src/test.c \
+                             src/bucket.c src/str.c src/vec.c \
+                             src/bit.c src/iobtree.c src/binsearch.c \
+                             src/fdset.c src/chash.c src/btbucket.c \
+                             src/freemap.c src/getlongopt.c src/rbtree.c \
+                             src/getmaxfsize.c src/mem.c src/stack.c \
+                             src/lcrand.c src/objalloc.c src/alloc.c
+
+src_test_iobtree_1_CFLAGS = -DHACK
+src_test_binsearch_1_SOURCES = src/test/binsearch_1.c src/test.c \
+                               src/binsearch.c src/getlongopt.c src/str.c \
+                               src/lcrand.c
+
+src_test_binsearch_1_CFLAGS = -DHACK
+src_test_bit_1_SOURCES = src/test/bit_1.c src/test.c \
+                         src/bit.c src/getlongopt.c src/str.c
+
+src_test_bit_1_CFLAGS = -DHACK
+src_test_getlongopt_1_SOURCES = src/test.c src/test/getlongopt_1.c \
+                                src/str.c src/getlongopt.c
+
+src_test_getlongopt_1_CFLAGS = -DHACK
+src_test_stack_1_SOURCES = src/test.c src/test/stack_1.c \
+                           src/str.c src/getlongopt.c src/stack.c
+
+src_test_stack_1_CFLAGS = -DHACK
+src_test_rbtree_1_SOURCES = src/test.c src/test/rbtree_1.c \
+                           src/str.c src/getlongopt.c src/stack.c \
+                           src/rbtree.c src/bit.c src/lcrand.c src/objalloc.c \
+                           src/mem.c src/alloc.c
+
+src_test_rbtree_1_CFLAGS = -DHACK
+src_test_mlparse_1_SOURCES = src/test.c src/test/mlparse_1.c \
+                           src/str.c src/getlongopt.c src/mlparse.c
+
+src_test_mlparse_1_CFLAGS = -DHACK
+src_test_freemap_1_SOURCES = src/test.c src/test/freemap_1.c \
+                             src/str.c src/getlongopt.c src/freemap.c \
+                             src/binsearch.c src/rbtree.c src/stack.c \
+                             src/bit.c src/lcrand.c src/objalloc.c \
+                             src/mem.c src/alloc.c
+
+src_test_freemap_1_CFLAGS = -DHACK
+src_test_docmap_1_SOURCES = src/test.c src/test/docmap_1.c \
+                            src/docmap.c src/reposset.c \
+                            src/str.c src/getlongopt.c \
+                            src/lcrand.c src/vec.c src/error.c \
+                            src/freemap.c src/fdset.c src/bit.c \
+                            src/chash.c src/rbtree.c src/objalloc.c \
+                            src/stack.c src/mem.c src/testutils.c \
+                            src/alloc.c src/binsearch.c src/mime.c
+
+src_test_docmap_1_CFLAGS = -DHACK
+src_test_docmap_1_LDADD = 
+src_test_stop_1_SOURCES = src/test.c src/test/stop_1.c \
+                           src/stop.c src/getlongopt.c src/error.c \
+                           src/str.c src/poolalloc.c src/chash.c \
+                           src/bit.c src/objalloc.c src/mem.c \
+                                                  src/alloc.c
+
+src_test_stop_1_CFLAGS = -DHACK
+src_test_poolalloc_1_SOURCES = src/test.c src/test/poolalloc_1.c \
+                           src/getlongopt.c src/error.c \
+                           src/str.c src/poolalloc.c src/chash.c \
+                           src/bit.c src/objalloc.c src/mem.c \
+                                                  src/alloc.c
+
+src_test_poolalloc_1_CFLAGS = -DHACK
+BUILT_SOURCES = src/mime.c src/include/mime.h src/include/svnversion.h
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+am--refresh:
+       @:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+             cd $(srcdir) && $(AUTOMAKE) --foreign  \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --foreign  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           echo ' $(SHELL) ./config.status'; \
+           $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+src/include/config.h: src/include/stamp-h1
+       @if test ! -f $@; then \
+         rm -f src/include/stamp-h1; \
+         $(MAKE) src/include/stamp-h1; \
+       else :; fi
+
+src/include/stamp-h1: $(top_srcdir)/src/include/config_h.in $(top_builddir)/config.status
+       @rm -f src/include/stamp-h1
+       cd $(top_builddir) && $(SHELL) ./config.status src/include/config.h
+$(top_srcdir)/src/include/config_h.in:  $(am__configure_deps) 
+       cd $(top_srcdir) && $(AUTOHEADER)
+       rm -f src/include/stamp-h1
+       touch $@
+
+distclean-hdr:
+       -rm -f src/include/config.h src/include/stamp-h1
+setup.py: $(top_builddir)/config.status $(srcdir)/setup.py.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+           $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+src/$(am__dirstamp):
+       @$(mkdir_p) src
+       @: > src/$(am__dirstamp)
+src/$(DEPDIR)/$(am__dirstamp):
+       @$(mkdir_p) src/$(DEPDIR)
+       @: > src/$(DEPDIR)/$(am__dirstamp)
+src/str.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/index.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/mlparse.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/stop.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/stop_default.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/postings.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/merge.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/vec.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/makeindex.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/freemap.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/bit.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/binsearch.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/search.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/chash.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/stem.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/heap.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/queryparse.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/index_querybuild.lo: src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/bucket.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/mem.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/fdset.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/pyramid.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/iobtree.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/getmaxfsize.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/storagep.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/btbucket.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/btbulk.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/vocab.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/getlongopt.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/error.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/mlparse_wrap.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/summarise.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/mime.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/remerge.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/signals.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/stack.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/rbtree.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/psettings.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_default.lo: src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/lcrand.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/objalloc.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/docmap.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/reposset.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/poolalloc.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/alloc.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/staticalloc.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/dirichlet.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/pcosine.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/cosine.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/hawkapi.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/okapi_k3.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/impact.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/impact_build.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/$(am__dirstamp):
+       @$(mkdir_p) src/libtextcodec
+       @: > src/libtextcodec/$(am__dirstamp)
+src/libtextcodec/$(DEPDIR)/$(am__dirstamp):
+       @$(mkdir_p) src/libtextcodec/$(DEPDIR)
+       @: > src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/crc.lo: src/libtextcodec/$(am__dirstamp) \
+       src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/stream.lo: src/libtextcodec/$(am__dirstamp) \
+       src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/detectfilter.lo: src/libtextcodec/$(am__dirstamp) \
+       src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/gunzipfilter.lo: src/libtextcodec/$(am__dirstamp) \
+       src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+libzet.la: $(libzet_la_OBJECTS) $(libzet_la_DEPENDENCIES) 
+       $(LINK) -rpath $(libdir) $(libzet_la_LDFLAGS) $(libzet_la_OBJECTS) $(libzet_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+            || test -f $$p1 \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(bindir)/$$f"; \
+       done
+
+clean-binPROGRAMS:
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+
+clean-noinstPROGRAMS:
+       @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+tools/$(am__dirstamp):
+       @$(mkdir_p) tools
+       @: > tools/$(am__dirstamp)
+tools/$(DEPDIR)/$(am__dirstamp):
+       @$(mkdir_p) tools/$(DEPDIR)
+       @: > tools/$(DEPDIR)/$(am__dirstamp)
+tools/btree.$(OBJEXT): tools/$(am__dirstamp) \
+       tools/$(DEPDIR)/$(am__dirstamp)
+btree$(EXEEXT): $(btree_OBJECTS) $(btree_DEPENDENCIES) 
+       @rm -f btree$(EXEEXT)
+       $(LINK) $(btree_LDFLAGS) $(btree_OBJECTS) $(btree_LDADD) $(LIBS)
+src/chash_test-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/chash_test-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/chash_test-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/chash_test-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/chash_test-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/chash_test-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+chash.test$(EXEEXT): $(chash_test_OBJECTS) $(chash_test_DEPENDENCIES) 
+       @rm -f chash.test$(EXEEXT)
+       $(LINK) $(chash_test_LDFLAGS) $(chash_test_OBJECTS) $(chash_test_LDADD) $(LIBS)
+tools/hashtime-hashtime.$(OBJEXT): tools/$(am__dirstamp) \
+       tools/$(DEPDIR)/$(am__dirstamp)
+src/hashtime-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/hashtime-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/hashtime-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/hashtime-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/hashtime-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/hashtime-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+hashtime$(EXEEXT): $(hashtime_OBJECTS) $(hashtime_DEPENDENCIES) 
+       @rm -f hashtime$(EXEEXT)
+       $(LINK) $(hashtime_LDFLAGS) $(hashtime_OBJECTS) $(hashtime_LDADD) $(LIBS)
+src/lcrand_test-lcrand.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+lcrand.test$(EXEEXT): $(lcrand_test_OBJECTS) $(lcrand_test_DEPENDENCIES) 
+       @rm -f lcrand.test$(EXEEXT)
+       $(LINK) $(lcrand_test_LDFLAGS) $(lcrand_test_OBJECTS) $(lcrand_test_LDADD) $(LIBS)
+src/mime_test-mime.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/mime_test-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+mime.test$(EXEEXT): $(mime_test_OBJECTS) $(mime_test_DEPENDENCIES) 
+       @rm -f mime.test$(EXEEXT)
+       $(LINK) $(mime_test_LDFLAGS) $(mime_test_OBJECTS) $(mime_test_LDADD) $(LIBS)
+src/mlparse_test-mlparse.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/mlparse_test-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/mlparse_test-stream.$(OBJEXT):  \
+       src/libtextcodec/$(am__dirstamp) \
+       src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/mlparse_test-gunzipfilter.$(OBJEXT):  \
+       src/libtextcodec/$(am__dirstamp) \
+       src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/mlparse_test-detectfilter.$(OBJEXT):  \
+       src/libtextcodec/$(am__dirstamp) \
+       src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+src/libtextcodec/mlparse_test-crc.$(OBJEXT):  \
+       src/libtextcodec/$(am__dirstamp) \
+       src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+mlparse.test$(EXEEXT): $(mlparse_test_OBJECTS) $(mlparse_test_DEPENDENCIES) 
+       @rm -f mlparse.test$(EXEEXT)
+       $(LINK) $(mlparse_test_LDFLAGS) $(mlparse_test_OBJECTS) $(mlparse_test_LDADD) $(LIBS)
+src/mlparse_wrap_test-mlparse_wrap.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/mlparse_wrap_test-mlparse.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/mlparse_wrap_test-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+mlparse_wrap.test$(EXEEXT): $(mlparse_wrap_test_OBJECTS) $(mlparse_wrap_test_DEPENDENCIES) 
+       @rm -f mlparse_wrap.test$(EXEEXT)
+       $(LINK) $(mlparse_wrap_test_LDFLAGS) $(mlparse_wrap_test_OBJECTS) $(mlparse_wrap_test_LDADD) $(LIBS)
+src/objalloc_test-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/objalloc_test-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/objalloc_test-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/objalloc_test-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/objalloc_test-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+objalloc.test$(EXEEXT): $(objalloc_test_OBJECTS) $(objalloc_test_DEPENDENCIES) 
+       @rm -f objalloc.test$(EXEEXT)
+       $(LINK) $(objalloc_test_LDFLAGS) $(objalloc_test_OBJECTS) $(objalloc_test_LDADD) $(LIBS)
+src/poolalloc_test-poolalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/poolalloc_test-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/poolalloc_test-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/poolalloc_test-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/poolalloc_test-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/poolalloc_test-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/poolalloc_test-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+poolalloc.test$(EXEEXT): $(poolalloc_test_OBJECTS) $(poolalloc_test_DEPENDENCIES) 
+       @rm -f poolalloc.test$(EXEEXT)
+       $(LINK) $(poolalloc_test_LDFLAGS) $(poolalloc_test_OBJECTS) $(poolalloc_test_LDADD) $(LIBS)
+src/psettings_gen-psettings.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-mlparse_wrap.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-mlparse.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-mime.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen-error.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+psettings_gen$(EXEEXT): $(psettings_gen_OBJECTS) $(psettings_gen_DEPENDENCIES) 
+       @rm -f psettings_gen$(EXEEXT)
+       $(LINK) $(psettings_gen_LDFLAGS) $(psettings_gen_OBJECTS) $(psettings_gen_LDADD) $(LIBS)
+src/psettings_gen_test-psettings.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-mlparse_wrap.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-mlparse.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-mime.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-psettings_default.$(OBJEXT):  \
+       src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/psettings_gen_test-error.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+psettings_gen.test$(EXEEXT): $(psettings_gen_test_OBJECTS) $(psettings_gen_test_DEPENDENCIES) 
+       @rm -f psettings_gen.test$(EXEEXT)
+       $(LINK) $(psettings_gen_test_LDFLAGS) $(psettings_gen_test_OBJECTS) $(psettings_gen_test_LDADD) $(LIBS)
+src/test/$(am__dirstamp):
+       @$(mkdir_p) src/test
+       @: > src/test/$(am__dirstamp)
+src/test/$(DEPDIR)/$(am__dirstamp):
+       @$(mkdir_p) src/test/$(DEPDIR)
+       @: > src/test/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_binsearch_1-binsearch_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_binsearch_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_binsearch_1-binsearch.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_binsearch_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_binsearch_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_binsearch_1-lcrand.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/binsearch_1$(EXEEXT): $(src_test_binsearch_1_OBJECTS) $(src_test_binsearch_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/binsearch_1$(EXEEXT)
+       $(LINK) $(src_test_binsearch_1_LDFLAGS) $(src_test_binsearch_1_OBJECTS) $(src_test_binsearch_1_LDADD) $(LIBS)
+src/test/src_test_bit_1-bit_1.$(OBJEXT): src/test/$(am__dirstamp) \
+       src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bit_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bit_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bit_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bit_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/bit_1$(EXEEXT): $(src_test_bit_1_OBJECTS) $(src_test_bit_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/bit_1$(EXEEXT)
+       $(LINK) $(src_test_bit_1_LDFLAGS) $(src_test_bit_1_OBJECTS) $(src_test_bit_1_LDADD) $(LIBS)
+src/test/src_test_bucket_1-bucket_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-bucket.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-vec.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_bucket_1-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/bucket_1$(EXEEXT): $(src_test_bucket_1_OBJECTS) $(src_test_bucket_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/bucket_1$(EXEEXT)
+       $(LINK) $(src_test_bucket_1_LDFLAGS) $(src_test_bucket_1_OBJECTS) $(src_test_bucket_1_LDADD) $(LIBS)
+src/src_test_docmap_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_docmap_1-docmap_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-docmap.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-reposset.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-lcrand.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-vec.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-error.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-freemap.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-fdset.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-rbtree.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-stack.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-testutils.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-binsearch.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_docmap_1-mime.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/docmap_1$(EXEEXT): $(src_test_docmap_1_OBJECTS) $(src_test_docmap_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/docmap_1$(EXEEXT)
+       $(LINK) $(src_test_docmap_1_LDFLAGS) $(src_test_docmap_1_OBJECTS) $(src_test_docmap_1_LDADD) $(LIBS)
+src/src_test_freemap_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_freemap_1-freemap_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-freemap.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-binsearch.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-rbtree.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-stack.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-lcrand.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_freemap_1-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/freemap_1$(EXEEXT): $(src_test_freemap_1_OBJECTS) $(src_test_freemap_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/freemap_1$(EXEEXT)
+       $(LINK) $(src_test_freemap_1_LDFLAGS) $(src_test_freemap_1_OBJECTS) $(src_test_freemap_1_LDADD) $(LIBS)
+src/src_test_getlongopt_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_getlongopt_1-getlongopt_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_getlongopt_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_getlongopt_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/getlongopt_1$(EXEEXT): $(src_test_getlongopt_1_OBJECTS) $(src_test_getlongopt_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/getlongopt_1$(EXEEXT)
+       $(LINK) $(src_test_getlongopt_1_LDFLAGS) $(src_test_getlongopt_1_OBJECTS) $(src_test_getlongopt_1_LDADD) $(LIBS)
+src/test/src_test_heap_1-heap_1.$(OBJEXT): src/test/$(am__dirstamp) \
+       src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_heap_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_heap_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_heap_1-heap.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_heap_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_heap_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_heap_1-lcrand.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/heap_1$(EXEEXT): $(src_test_heap_1_OBJECTS) $(src_test_heap_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/heap_1$(EXEEXT)
+       $(LINK) $(src_test_heap_1_LDFLAGS) $(src_test_heap_1_OBJECTS) $(src_test_heap_1_LDADD) $(LIBS)
+src/test/src_test_iobtree_1-iobtree_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-bucket.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-vec.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-iobtree.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-binsearch.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-fdset.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-btbucket.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-freemap.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-rbtree.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-getmaxfsize.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-stack.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-lcrand.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_iobtree_1-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/iobtree_1$(EXEEXT): $(src_test_iobtree_1_OBJECTS) $(src_test_iobtree_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/iobtree_1$(EXEEXT)
+       $(LINK) $(src_test_iobtree_1_LDFLAGS) $(src_test_iobtree_1_OBJECTS) $(src_test_iobtree_1_LDADD) $(LIBS)
+src/test/src_test_mem_1-mem_1.$(OBJEXT): src/test/$(am__dirstamp) \
+       src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_mem_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_mem_1-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_mem_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_mem_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_mem_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/mem_1$(EXEEXT): $(src_test_mem_1_OBJECTS) $(src_test_mem_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/mem_1$(EXEEXT)
+       $(LINK) $(src_test_mem_1_LDFLAGS) $(src_test_mem_1_OBJECTS) $(src_test_mem_1_LDADD) $(LIBS)
+src/src_test_mlparse_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_mlparse_1-mlparse_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_mlparse_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_mlparse_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_mlparse_1-mlparse.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/mlparse_1$(EXEEXT): $(src_test_mlparse_1_OBJECTS) $(src_test_mlparse_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/mlparse_1$(EXEEXT)
+       $(LINK) $(src_test_mlparse_1_LDFLAGS) $(src_test_mlparse_1_OBJECTS) $(src_test_mlparse_1_LDADD) $(LIBS)
+src/src_test_poolalloc_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_poolalloc_1-poolalloc_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-error.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-poolalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_poolalloc_1-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/poolalloc_1$(EXEEXT): $(src_test_poolalloc_1_OBJECTS) $(src_test_poolalloc_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/poolalloc_1$(EXEEXT)
+       $(LINK) $(src_test_poolalloc_1_LDFLAGS) $(src_test_poolalloc_1_OBJECTS) $(src_test_poolalloc_1_LDADD) $(LIBS)
+src/src_test_rbtree_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_rbtree_1-rbtree_1.$(OBJEXT):  \
+       src/test/$(am__dirstamp) src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-stack.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-rbtree.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-lcrand.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_rbtree_1-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/rbtree_1$(EXEEXT): $(src_test_rbtree_1_OBJECTS) $(src_test_rbtree_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/rbtree_1$(EXEEXT)
+       $(LINK) $(src_test_rbtree_1_LDFLAGS) $(src_test_rbtree_1_OBJECTS) $(src_test_rbtree_1_LDADD) $(LIBS)
+src/src_test_stack_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_stack_1-stack_1.$(OBJEXT): src/test/$(am__dirstamp) \
+       src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stack_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stack_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stack_1-stack.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/stack_1$(EXEEXT): $(src_test_stack_1_OBJECTS) $(src_test_stack_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/stack_1$(EXEEXT)
+       $(LINK) $(src_test_stack_1_LDFLAGS) $(src_test_stack_1_OBJECTS) $(src_test_stack_1_LDADD) $(LIBS)
+src/src_test_stop_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/src_test_stop_1-stop_1.$(OBJEXT): src/test/$(am__dirstamp) \
+       src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-stop.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-error.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-poolalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_stop_1-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/stop_1$(EXEEXT): $(src_test_stop_1_OBJECTS) $(src_test_stop_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/stop_1$(EXEEXT)
+       $(LINK) $(src_test_stop_1_LDFLAGS) $(src_test_stop_1_OBJECTS) $(src_test_stop_1_LDADD) $(LIBS)
+src/test/src_test_str_1-str_1.$(OBJEXT): src/test/$(am__dirstamp) \
+       src/test/$(DEPDIR)/$(am__dirstamp)
+src/src_test_str_1-test.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_str_1-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/src_test_str_1-getlongopt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/test/str_1$(EXEEXT): $(src_test_str_1_OBJECTS) $(src_test_str_1_DEPENDENCIES) src/test/$(am__dirstamp)
+       @rm -f src/test/str_1$(EXEEXT)
+       $(LINK) $(src_test_str_1_LDFLAGS) $(src_test_str_1_OBJECTS) $(src_test_str_1_LDADD) $(LIBS)
+src/staticalloc_test-staticalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/staticalloc_test-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/staticalloc_test-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+staticalloc.test$(EXEEXT): $(staticalloc_test_OBJECTS) $(staticalloc_test_DEPENDENCIES) 
+       @rm -f staticalloc.test$(EXEEXT)
+       $(LINK) $(staticalloc_test_LDFLAGS) $(staticalloc_test_OBJECTS) $(staticalloc_test_LDADD) $(LIBS)
+src/stem_test-stem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stem_test-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stem_test-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stem_test-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stem_test-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stem_test-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stem_test-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+stem.test$(EXEEXT): $(stem_test_OBJECTS) $(stem_test_DEPENDENCIES) 
+       @rm -f stem.test$(EXEEXT)
+       $(LINK) $(stem_test_LDFLAGS) $(stem_test_OBJECTS) $(stem_test_LDADD) $(LIBS)
+src/stop_gen-stop.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stop_gen-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stop_gen-poolalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stop_gen-chash.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stop_gen-alloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stop_gen-bit.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stop_gen-objalloc.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/stop_gen-mem.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+stop_gen$(EXEEXT): $(stop_gen_OBJECTS) $(stop_gen_DEPENDENCIES) 
+       @rm -f stop_gen$(EXEEXT)
+       $(LINK) $(stop_gen_LDFLAGS) $(stop_gen_OBJECTS) $(stop_gen_LDADD) $(LIBS)
+src/commandline.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+zet$(EXEEXT): $(zet_OBJECTS) $(zet_DEPENDENCIES) 
+       @rm -f zet$(EXEEXT)
+       $(LINK) $(zet_LDFLAGS) $(zet_OBJECTS) $(zet_LDADD) $(LIBS)
+tools/cat.$(OBJEXT): tools/$(am__dirstamp) \
+       tools/$(DEPDIR)/$(am__dirstamp)
+zet_cat$(EXEEXT): $(zet_cat_OBJECTS) $(zet_cat_DEPENDENCIES) 
+       @rm -f zet_cat$(EXEEXT)
+       $(LINK) $(zet_cat_LDFLAGS) $(zet_cat_OBJECTS) $(zet_cat_LDADD) $(LIBS)
+tools/dict.$(OBJEXT): tools/$(am__dirstamp) \
+       tools/$(DEPDIR)/$(am__dirstamp)
+zet_dict$(EXEEXT): $(zet_dict_OBJECTS) $(zet_dict_DEPENDENCIES) 
+       @rm -f zet_dict$(EXEEXT)
+       $(LINK) $(zet_dict_LDFLAGS) $(zet_dict_OBJECTS) $(zet_dict_LDADD) $(LIBS)
+tools/diff.$(OBJEXT): tools/$(am__dirstamp) \
+       tools/$(DEPDIR)/$(am__dirstamp)
+zet_diff$(EXEEXT): $(zet_diff_OBJECTS) $(zet_diff_DEPENDENCIES) 
+       @rm -f zet_diff$(EXEEXT)
+       $(LINK) $(zet_diff_LDFLAGS) $(zet_diff_OBJECTS) $(zet_diff_LDADD) $(LIBS)
+tools/zet_file-file.$(OBJEXT): tools/$(am__dirstamp) \
+       tools/$(DEPDIR)/$(am__dirstamp)
+src/zet_file-mime.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/zet_file-str.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+zet_file$(EXEEXT): $(zet_file_OBJECTS) $(zet_file_DEPENDENCIES) 
+       @rm -f zet_file$(EXEEXT)
+       $(LINK) $(zet_file_LDFLAGS) $(zet_file_OBJECTS) $(zet_file_LDADD) $(LIBS)
+tools/impactify.$(OBJEXT): tools/$(am__dirstamp) \
+       tools/$(DEPDIR)/$(am__dirstamp)
+zet_impactify$(EXEEXT): $(zet_impactify_OBJECTS) $(zet_impactify_DEPENDENCIES) 
+       @rm -f zet_impactify$(EXEEXT)
+       $(LINK) $(zet_impactify_LDFLAGS) $(zet_impactify_OBJECTS) $(zet_impactify_LDADD) $(LIBS)
+src/trecrun.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/trec_eval.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+zet_trec$(EXEEXT): $(zet_trec_OBJECTS) $(zet_trec_DEPENDENCIES) 
+       @rm -f zet_trec$(EXEEXT)
+       $(LINK) $(zet_trec_LDFLAGS) $(zet_trec_OBJECTS) $(zet_trec_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+       -rm -f src/alloc.$(OBJEXT)
+       -rm -f src/alloc.lo
+       -rm -f src/binsearch.$(OBJEXT)
+       -rm -f src/binsearch.lo
+       -rm -f src/bit.$(OBJEXT)
+       -rm -f src/bit.lo
+       -rm -f src/btbucket.$(OBJEXT)
+       -rm -f src/btbucket.lo
+       -rm -f src/btbulk.$(OBJEXT)
+       -rm -f src/btbulk.lo
+       -rm -f src/bucket.$(OBJEXT)
+       -rm -f src/bucket.lo
+       -rm -f src/chash.$(OBJEXT)
+       -rm -f src/chash.lo
+       -rm -f src/chash_test-alloc.$(OBJEXT)
+       -rm -f src/chash_test-bit.$(OBJEXT)
+       -rm -f src/chash_test-chash.$(OBJEXT)
+       -rm -f src/chash_test-mem.$(OBJEXT)
+       -rm -f src/chash_test-objalloc.$(OBJEXT)
+       -rm -f src/chash_test-str.$(OBJEXT)
+       -rm -f src/commandline.$(OBJEXT)
+       -rm -f src/cosine.$(OBJEXT)
+       -rm -f src/cosine.lo
+       -rm -f src/dirichlet.$(OBJEXT)
+       -rm -f src/dirichlet.lo
+       -rm -f src/docmap.$(OBJEXT)
+       -rm -f src/docmap.lo
+       -rm -f src/error.$(OBJEXT)
+       -rm -f src/error.lo
+       -rm -f src/fdset.$(OBJEXT)
+       -rm -f src/fdset.lo
+       -rm -f src/freemap.$(OBJEXT)
+       -rm -f src/freemap.lo
+       -rm -f src/getlongopt.$(OBJEXT)
+       -rm -f src/getlongopt.lo
+       -rm -f src/getmaxfsize.$(OBJEXT)
+       -rm -f src/getmaxfsize.lo
+       -rm -f src/hashtime-alloc.$(OBJEXT)
+       -rm -f src/hashtime-bit.$(OBJEXT)
+       -rm -f src/hashtime-chash.$(OBJEXT)
+       -rm -f src/hashtime-mem.$(OBJEXT)
+       -rm -f src/hashtime-objalloc.$(OBJEXT)
+       -rm -f src/hashtime-str.$(OBJEXT)
+       -rm -f src/hawkapi.$(OBJEXT)
+       -rm -f src/hawkapi.lo
+       -rm -f src/heap.$(OBJEXT)
+       -rm -f src/heap.lo
+       -rm -f src/impact.$(OBJEXT)
+       -rm -f src/impact.lo
+       -rm -f src/impact_build.$(OBJEXT)
+       -rm -f src/impact_build.lo
+       -rm -f src/index.$(OBJEXT)
+       -rm -f src/index.lo
+       -rm -f src/index_querybuild.$(OBJEXT)
+       -rm -f src/index_querybuild.lo
+       -rm -f src/iobtree.$(OBJEXT)
+       -rm -f src/iobtree.lo
+       -rm -f src/lcrand.$(OBJEXT)
+       -rm -f src/lcrand.lo
+       -rm -f src/lcrand_test-lcrand.$(OBJEXT)
+       -rm -f src/libtextcodec/crc.$(OBJEXT)
+       -rm -f src/libtextcodec/crc.lo
+       -rm -f src/libtextcodec/detectfilter.$(OBJEXT)
+       -rm -f src/libtextcodec/detectfilter.lo
+       -rm -f src/libtextcodec/gunzipfilter.$(OBJEXT)
+       -rm -f src/libtextcodec/gunzipfilter.lo
+       -rm -f src/libtextcodec/mlparse_test-crc.$(OBJEXT)
+       -rm -f src/libtextcodec/mlparse_test-detectfilter.$(OBJEXT)
+       -rm -f src/libtextcodec/mlparse_test-gunzipfilter.$(OBJEXT)
+       -rm -f src/libtextcodec/mlparse_test-stream.$(OBJEXT)
+       -rm -f src/libtextcodec/stream.$(OBJEXT)
+       -rm -f src/libtextcodec/stream.lo
+       -rm -f src/makeindex.$(OBJEXT)
+       -rm -f src/makeindex.lo
+       -rm -f src/mem.$(OBJEXT)
+       -rm -f src/mem.lo
+       -rm -f src/merge.$(OBJEXT)
+       -rm -f src/merge.lo
+       -rm -f src/mime.$(OBJEXT)
+       -rm -f src/mime.lo
+       -rm -f src/mime_test-mime.$(OBJEXT)
+       -rm -f src/mime_test-str.$(OBJEXT)
+       -rm -f src/mlparse.$(OBJEXT)
+       -rm -f src/mlparse.lo
+       -rm -f src/mlparse_test-mlparse.$(OBJEXT)
+       -rm -f src/mlparse_test-str.$(OBJEXT)
+       -rm -f src/mlparse_wrap.$(OBJEXT)
+       -rm -f src/mlparse_wrap.lo
+       -rm -f src/mlparse_wrap_test-mlparse.$(OBJEXT)
+       -rm -f src/mlparse_wrap_test-mlparse_wrap.$(OBJEXT)
+       -rm -f src/mlparse_wrap_test-str.$(OBJEXT)
+       -rm -f src/objalloc.$(OBJEXT)
+       -rm -f src/objalloc.lo
+       -rm -f src/objalloc_test-alloc.$(OBJEXT)
+       -rm -f src/objalloc_test-bit.$(OBJEXT)
+       -rm -f src/objalloc_test-mem.$(OBJEXT)
+       -rm -f src/objalloc_test-objalloc.$(OBJEXT)
+       -rm -f src/objalloc_test-str.$(OBJEXT)
+       -rm -f src/okapi_k3.$(OBJEXT)
+       -rm -f src/okapi_k3.lo
+       -rm -f src/pcosine.$(OBJEXT)
+       -rm -f src/pcosine.lo
+       -rm -f src/poolalloc.$(OBJEXT)
+       -rm -f src/poolalloc.lo
+       -rm -f src/poolalloc_test-alloc.$(OBJEXT)
+       -rm -f src/poolalloc_test-bit.$(OBJEXT)
+       -rm -f src/poolalloc_test-chash.$(OBJEXT)
+       -rm -f src/poolalloc_test-mem.$(OBJEXT)
+       -rm -f src/poolalloc_test-objalloc.$(OBJEXT)
+       -rm -f src/poolalloc_test-poolalloc.$(OBJEXT)
+       -rm -f src/poolalloc_test-str.$(OBJEXT)
+       -rm -f src/postings.$(OBJEXT)
+       -rm -f src/postings.lo
+       -rm -f src/psettings.$(OBJEXT)
+       -rm -f src/psettings.lo
+       -rm -f src/psettings_default.$(OBJEXT)
+       -rm -f src/psettings_default.lo
+       -rm -f src/psettings_gen-alloc.$(OBJEXT)
+       -rm -f src/psettings_gen-bit.$(OBJEXT)
+       -rm -f src/psettings_gen-chash.$(OBJEXT)
+       -rm -f src/psettings_gen-error.$(OBJEXT)
+       -rm -f src/psettings_gen-mem.$(OBJEXT)
+       -rm -f src/psettings_gen-mime.$(OBJEXT)
+       -rm -f src/psettings_gen-mlparse.$(OBJEXT)
+       -rm -f src/psettings_gen-mlparse_wrap.$(OBJEXT)
+       -rm -f src/psettings_gen-objalloc.$(OBJEXT)
+       -rm -f src/psettings_gen-psettings.$(OBJEXT)
+       -rm -f src/psettings_gen-str.$(OBJEXT)
+       -rm -f src/psettings_gen_test-alloc.$(OBJEXT)
+       -rm -f src/psettings_gen_test-bit.$(OBJEXT)
+       -rm -f src/psettings_gen_test-chash.$(OBJEXT)
+       -rm -f src/psettings_gen_test-error.$(OBJEXT)
+       -rm -f src/psettings_gen_test-mem.$(OBJEXT)
+       -rm -f src/psettings_gen_test-mime.$(OBJEXT)
+       -rm -f src/psettings_gen_test-mlparse.$(OBJEXT)
+       -rm -f src/psettings_gen_test-mlparse_wrap.$(OBJEXT)
+       -rm -f src/psettings_gen_test-objalloc.$(OBJEXT)
+       -rm -f src/psettings_gen_test-psettings.$(OBJEXT)
+       -rm -f src/psettings_gen_test-psettings_default.$(OBJEXT)
+       -rm -f src/psettings_gen_test-str.$(OBJEXT)
+       -rm -f src/pyramid.$(OBJEXT)
+       -rm -f src/pyramid.lo
+       -rm -f src/queryparse.$(OBJEXT)
+       -rm -f src/queryparse.lo
+       -rm -f src/rbtree.$(OBJEXT)
+       -rm -f src/rbtree.lo
+       -rm -f src/remerge.$(OBJEXT)
+       -rm -f src/remerge.lo
+       -rm -f src/reposset.$(OBJEXT)
+       -rm -f src/reposset.lo
+       -rm -f src/search.$(OBJEXT)
+       -rm -f src/search.lo
+       -rm -f src/signals.$(OBJEXT)
+       -rm -f src/signals.lo
+       -rm -f src/src_test_binsearch_1-binsearch.$(OBJEXT)
+       -rm -f src/src_test_binsearch_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_binsearch_1-lcrand.$(OBJEXT)
+       -rm -f src/src_test_binsearch_1-str.$(OBJEXT)
+       -rm -f src/src_test_binsearch_1-test.$(OBJEXT)
+       -rm -f src/src_test_bit_1-bit.$(OBJEXT)
+       -rm -f src/src_test_bit_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_bit_1-str.$(OBJEXT)
+       -rm -f src/src_test_bit_1-test.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-alloc.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-bit.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-bucket.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-chash.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-mem.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-objalloc.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-str.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-test.$(OBJEXT)
+       -rm -f src/src_test_bucket_1-vec.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-alloc.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-binsearch.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-bit.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-chash.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-docmap.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-error.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-fdset.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-freemap.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-lcrand.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-mem.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-mime.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-objalloc.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-rbtree.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-reposset.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-stack.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-str.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-test.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-testutils.$(OBJEXT)
+       -rm -f src/src_test_docmap_1-vec.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-alloc.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-binsearch.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-bit.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-freemap.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-lcrand.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-mem.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-objalloc.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-rbtree.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-stack.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-str.$(OBJEXT)
+       -rm -f src/src_test_freemap_1-test.$(OBJEXT)
+       -rm -f src/src_test_getlongopt_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_getlongopt_1-str.$(OBJEXT)
+       -rm -f src/src_test_getlongopt_1-test.$(OBJEXT)
+       -rm -f src/src_test_heap_1-bit.$(OBJEXT)
+       -rm -f src/src_test_heap_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_heap_1-heap.$(OBJEXT)
+       -rm -f src/src_test_heap_1-lcrand.$(OBJEXT)
+       -rm -f src/src_test_heap_1-str.$(OBJEXT)
+       -rm -f src/src_test_heap_1-test.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-alloc.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-binsearch.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-bit.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-btbucket.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-bucket.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-chash.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-fdset.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-freemap.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-getmaxfsize.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-iobtree.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-lcrand.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-mem.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-objalloc.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-rbtree.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-stack.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-str.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-test.$(OBJEXT)
+       -rm -f src/src_test_iobtree_1-vec.$(OBJEXT)
+       -rm -f src/src_test_mem_1-bit.$(OBJEXT)
+       -rm -f src/src_test_mem_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_mem_1-mem.$(OBJEXT)
+       -rm -f src/src_test_mem_1-str.$(OBJEXT)
+       -rm -f src/src_test_mem_1-test.$(OBJEXT)
+       -rm -f src/src_test_mlparse_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_mlparse_1-mlparse.$(OBJEXT)
+       -rm -f src/src_test_mlparse_1-str.$(OBJEXT)
+       -rm -f src/src_test_mlparse_1-test.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-alloc.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-bit.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-chash.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-error.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-mem.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-objalloc.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-poolalloc.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-str.$(OBJEXT)
+       -rm -f src/src_test_poolalloc_1-test.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-alloc.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-bit.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-lcrand.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-mem.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-objalloc.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-rbtree.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-stack.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-str.$(OBJEXT)
+       -rm -f src/src_test_rbtree_1-test.$(OBJEXT)
+       -rm -f src/src_test_stack_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_stack_1-stack.$(OBJEXT)
+       -rm -f src/src_test_stack_1-str.$(OBJEXT)
+       -rm -f src/src_test_stack_1-test.$(OBJEXT)
+       -rm -f src/src_test_stop_1-alloc.$(OBJEXT)
+       -rm -f src/src_test_stop_1-bit.$(OBJEXT)
+       -rm -f src/src_test_stop_1-chash.$(OBJEXT)
+       -rm -f src/src_test_stop_1-error.$(OBJEXT)
+       -rm -f src/src_test_stop_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_stop_1-mem.$(OBJEXT)
+       -rm -f src/src_test_stop_1-objalloc.$(OBJEXT)
+       -rm -f src/src_test_stop_1-poolalloc.$(OBJEXT)
+       -rm -f src/src_test_stop_1-stop.$(OBJEXT)
+       -rm -f src/src_test_stop_1-str.$(OBJEXT)
+       -rm -f src/src_test_stop_1-test.$(OBJEXT)
+       -rm -f src/src_test_str_1-getlongopt.$(OBJEXT)
+       -rm -f src/src_test_str_1-str.$(OBJEXT)
+       -rm -f src/src_test_str_1-test.$(OBJEXT)
+       -rm -f src/stack.$(OBJEXT)
+       -rm -f src/stack.lo
+       -rm -f src/staticalloc.$(OBJEXT)
+       -rm -f src/staticalloc.lo
+       -rm -f src/staticalloc_test-bit.$(OBJEXT)
+       -rm -f src/staticalloc_test-mem.$(OBJEXT)
+       -rm -f src/staticalloc_test-staticalloc.$(OBJEXT)
+       -rm -f src/stem.$(OBJEXT)
+       -rm -f src/stem.lo
+       -rm -f src/stem_test-alloc.$(OBJEXT)
+       -rm -f src/stem_test-bit.$(OBJEXT)
+       -rm -f src/stem_test-chash.$(OBJEXT)
+       -rm -f src/stem_test-mem.$(OBJEXT)
+       -rm -f src/stem_test-objalloc.$(OBJEXT)
+       -rm -f src/stem_test-stem.$(OBJEXT)
+       -rm -f src/stem_test-str.$(OBJEXT)
+       -rm -f src/stop.$(OBJEXT)
+       -rm -f src/stop.lo
+       -rm -f src/stop_default.$(OBJEXT)
+       -rm -f src/stop_default.lo
+       -rm -f src/stop_gen-alloc.$(OBJEXT)
+       -rm -f src/stop_gen-bit.$(OBJEXT)
+       -rm -f src/stop_gen-chash.$(OBJEXT)
+       -rm -f src/stop_gen-mem.$(OBJEXT)
+       -rm -f src/stop_gen-objalloc.$(OBJEXT)
+       -rm -f src/stop_gen-poolalloc.$(OBJEXT)
+       -rm -f src/stop_gen-stop.$(OBJEXT)
+       -rm -f src/stop_gen-str.$(OBJEXT)
+       -rm -f src/storagep.$(OBJEXT)
+       -rm -f src/storagep.lo
+       -rm -f src/str.$(OBJEXT)
+       -rm -f src/str.lo
+       -rm -f src/summarise.$(OBJEXT)
+       -rm -f src/summarise.lo
+       -rm -f src/test/src_test_binsearch_1-binsearch_1.$(OBJEXT)
+       -rm -f src/test/src_test_bit_1-bit_1.$(OBJEXT)
+       -rm -f src/test/src_test_bucket_1-bucket_1.$(OBJEXT)
+       -rm -f src/test/src_test_docmap_1-docmap_1.$(OBJEXT)
+       -rm -f src/test/src_test_freemap_1-freemap_1.$(OBJEXT)
+       -rm -f src/test/src_test_getlongopt_1-getlongopt_1.$(OBJEXT)
+       -rm -f src/test/src_test_heap_1-heap_1.$(OBJEXT)
+       -rm -f src/test/src_test_iobtree_1-iobtree_1.$(OBJEXT)
+       -rm -f src/test/src_test_mem_1-mem_1.$(OBJEXT)
+       -rm -f src/test/src_test_mlparse_1-mlparse_1.$(OBJEXT)
+       -rm -f src/test/src_test_poolalloc_1-poolalloc_1.$(OBJEXT)
+       -rm -f src/test/src_test_rbtree_1-rbtree_1.$(OBJEXT)
+       -rm -f src/test/src_test_stack_1-stack_1.$(OBJEXT)
+       -rm -f src/test/src_test_stop_1-stop_1.$(OBJEXT)
+       -rm -f src/test/src_test_str_1-str_1.$(OBJEXT)
+       -rm -f src/trec_eval.$(OBJEXT)
+       -rm -f src/trecrun.$(OBJEXT)
+       -rm -f src/vec.$(OBJEXT)
+       -rm -f src/vec.lo
+       -rm -f src/vocab.$(OBJEXT)
+       -rm -f src/vocab.lo
+       -rm -f src/zet_file-mime.$(OBJEXT)
+       -rm -f src/zet_file-str.$(OBJEXT)
+       -rm -f tools/btree.$(OBJEXT)
+       -rm -f tools/cat.$(OBJEXT)
+       -rm -f tools/dict.$(OBJEXT)
+       -rm -f tools/diff.$(OBJEXT)
+       -rm -f tools/hashtime-hashtime.$(OBJEXT)
+       -rm -f tools/impactify.$(OBJEXT)
+       -rm -f tools/zet_file-file.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/alloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/binsearch.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/btbucket.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/btbulk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bucket.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/chash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/chash_test-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/chash_test-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/chash_test-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/chash_test-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/chash_test-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/chash_test-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/commandline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cosine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dirichlet.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/docmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/fdset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/freemap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/getlongopt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/getmaxfsize.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hashtime-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hashtime-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hashtime-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hashtime-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hashtime-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hashtime-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hawkapi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/heap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/impact.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/impact_build.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/index.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/index_querybuild.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/iobtree.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/lcrand.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/lcrand_test-lcrand.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/makeindex.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/merge.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mime.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mime_test-mime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mime_test-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mlparse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mlparse_test-mlparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mlparse_test-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mlparse_wrap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mlparse_wrap_test-mlparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mlparse_wrap_test-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/objalloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/objalloc_test-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/objalloc_test-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/objalloc_test-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/objalloc_test-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/objalloc_test-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/okapi_k3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/pcosine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/poolalloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/poolalloc_test-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/poolalloc_test-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/poolalloc_test-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/poolalloc_test-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/poolalloc_test-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/poolalloc_test-poolalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/poolalloc_test-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/postings.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_default.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-error.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-mime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-mlparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-mlparse_wrap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-psettings.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-error.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-mime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-mlparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-psettings.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-psettings_default.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/psettings_gen_test-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/pyramid.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/queryparse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/rbtree.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/remerge.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/reposset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/search.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/signals.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_binsearch_1-binsearch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_binsearch_1-lcrand.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_binsearch_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_binsearch_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bit_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bit_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bit_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bit_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-bucket.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_bucket_1-vec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-binsearch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-docmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-error.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-fdset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-freemap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-lcrand.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-mime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-rbtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-reposset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-stack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-testutils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_docmap_1-vec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-binsearch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-freemap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-lcrand.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-rbtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-stack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_freemap_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_getlongopt_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_getlongopt_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_heap_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_heap_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_heap_1-heap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_heap_1-lcrand.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_heap_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_heap_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-binsearch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-btbucket.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-bucket.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-fdset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-freemap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-iobtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-lcrand.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-rbtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-stack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_iobtree_1-vec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mem_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mem_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mem_1-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mem_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mem_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mlparse_1-mlparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mlparse_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_mlparse_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-error.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_poolalloc_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-lcrand.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-rbtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-stack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_rbtree_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stack_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stack_1-stack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stack_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stack_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-error.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-poolalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-stop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_stop_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_str_1-getlongopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_str_1-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_test_str_1-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/staticalloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/staticalloc_test-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/staticalloc_test-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/staticalloc_test-staticalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stem_test-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stem_test-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stem_test-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stem_test-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stem_test-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stem_test-stem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stem_test-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_default.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_gen-alloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_gen-bit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_gen-chash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_gen-mem.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_gen-objalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_gen-poolalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_gen-stop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/stop_gen-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/storagep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/str.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/summarise.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/trec_eval.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/trecrun.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/vec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/vocab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/zet_file-mime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/zet_file-str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/libtextcodec/$(DEPDIR)/crc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/libtextcodec/$(DEPDIR)/detectfilter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/libtextcodec/$(DEPDIR)/gunzipfilter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/libtextcodec/$(DEPDIR)/stream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_bit_1-bit_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_heap_1-heap_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_mem_1-mem_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_stack_1-stack_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_stop_1-stop_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/test/$(DEPDIR)/src_test_str_1-str_1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/btree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/cat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/dict.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/diff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/hashtime-hashtime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/impactify.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/zet_file-file.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`; \
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$$depbase.Tpo" "$$depbase.Po"; else rm -f "$$depbase.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`; \
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$$depbase.Tpo" "$$depbase.Po"; else rm -f "$$depbase.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \
+@am__fastdepCC_TRUE@   if $(LTCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+src/chash_test-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-chash.o -MD -MP -MF "src/$(DEPDIR)/chash_test-chash.Tpo" -c -o src/chash_test-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-chash.Tpo" "src/$(DEPDIR)/chash_test-chash.Po"; else rm -f "src/$(DEPDIR)/chash_test-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/chash_test-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/chash_test-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-chash.obj -MD -MP -MF "src/$(DEPDIR)/chash_test-chash.Tpo" -c -o src/chash_test-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-chash.Tpo" "src/$(DEPDIR)/chash_test-chash.Po"; else rm -f "src/$(DEPDIR)/chash_test-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/chash_test-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/chash_test-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-objalloc.o -MD -MP -MF "src/$(DEPDIR)/chash_test-objalloc.Tpo" -c -o src/chash_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-objalloc.Tpo" "src/$(DEPDIR)/chash_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/chash_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/chash_test-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/chash_test-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/chash_test-objalloc.Tpo" -c -o src/chash_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-objalloc.Tpo" "src/$(DEPDIR)/chash_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/chash_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/chash_test-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/chash_test-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-mem.o -MD -MP -MF "src/$(DEPDIR)/chash_test-mem.Tpo" -c -o src/chash_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-mem.Tpo" "src/$(DEPDIR)/chash_test-mem.Po"; else rm -f "src/$(DEPDIR)/chash_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/chash_test-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/chash_test-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-mem.obj -MD -MP -MF "src/$(DEPDIR)/chash_test-mem.Tpo" -c -o src/chash_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-mem.Tpo" "src/$(DEPDIR)/chash_test-mem.Po"; else rm -f "src/$(DEPDIR)/chash_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/chash_test-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/chash_test-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-bit.o -MD -MP -MF "src/$(DEPDIR)/chash_test-bit.Tpo" -c -o src/chash_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-bit.Tpo" "src/$(DEPDIR)/chash_test-bit.Po"; else rm -f "src/$(DEPDIR)/chash_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/chash_test-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/chash_test-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-bit.obj -MD -MP -MF "src/$(DEPDIR)/chash_test-bit.Tpo" -c -o src/chash_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-bit.Tpo" "src/$(DEPDIR)/chash_test-bit.Po"; else rm -f "src/$(DEPDIR)/chash_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/chash_test-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/chash_test-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-str.o -MD -MP -MF "src/$(DEPDIR)/chash_test-str.Tpo" -c -o src/chash_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-str.Tpo" "src/$(DEPDIR)/chash_test-str.Po"; else rm -f "src/$(DEPDIR)/chash_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/chash_test-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/chash_test-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-str.obj -MD -MP -MF "src/$(DEPDIR)/chash_test-str.Tpo" -c -o src/chash_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-str.Tpo" "src/$(DEPDIR)/chash_test-str.Po"; else rm -f "src/$(DEPDIR)/chash_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/chash_test-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/chash_test-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-alloc.o -MD -MP -MF "src/$(DEPDIR)/chash_test-alloc.Tpo" -c -o src/chash_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-alloc.Tpo" "src/$(DEPDIR)/chash_test-alloc.Po"; else rm -f "src/$(DEPDIR)/chash_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/chash_test-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/chash_test-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -MT src/chash_test-alloc.obj -MD -MP -MF "src/$(DEPDIR)/chash_test-alloc.Tpo" -c -o src/chash_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/chash_test-alloc.Tpo" "src/$(DEPDIR)/chash_test-alloc.Po"; else rm -f "src/$(DEPDIR)/chash_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/chash_test-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chash_test_CFLAGS) $(CFLAGS) -c -o src/chash_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+tools/hashtime-hashtime.o: tools/hashtime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT tools/hashtime-hashtime.o -MD -MP -MF "tools/$(DEPDIR)/hashtime-hashtime.Tpo" -c -o tools/hashtime-hashtime.o `test -f 'tools/hashtime.c' || echo '$(srcdir)/'`tools/hashtime.c; \
+@am__fastdepCC_TRUE@   then mv -f "tools/$(DEPDIR)/hashtime-hashtime.Tpo" "tools/$(DEPDIR)/hashtime-hashtime.Po"; else rm -f "tools/$(DEPDIR)/hashtime-hashtime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='tools/hashtime.c' object='tools/hashtime-hashtime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o tools/hashtime-hashtime.o `test -f 'tools/hashtime.c' || echo '$(srcdir)/'`tools/hashtime.c
+
+tools/hashtime-hashtime.obj: tools/hashtime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT tools/hashtime-hashtime.obj -MD -MP -MF "tools/$(DEPDIR)/hashtime-hashtime.Tpo" -c -o tools/hashtime-hashtime.obj `if test -f 'tools/hashtime.c'; then $(CYGPATH_W) 'tools/hashtime.c'; else $(CYGPATH_W) '$(srcdir)/tools/hashtime.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "tools/$(DEPDIR)/hashtime-hashtime.Tpo" "tools/$(DEPDIR)/hashtime-hashtime.Po"; else rm -f "tools/$(DEPDIR)/hashtime-hashtime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='tools/hashtime.c' object='tools/hashtime-hashtime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o tools/hashtime-hashtime.obj `if test -f 'tools/hashtime.c'; then $(CYGPATH_W) 'tools/hashtime.c'; else $(CYGPATH_W) '$(srcdir)/tools/hashtime.c'; fi`
+
+src/hashtime-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-chash.o -MD -MP -MF "src/$(DEPDIR)/hashtime-chash.Tpo" -c -o src/hashtime-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-chash.Tpo" "src/$(DEPDIR)/hashtime-chash.Po"; else rm -f "src/$(DEPDIR)/hashtime-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/hashtime-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/hashtime-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-chash.obj -MD -MP -MF "src/$(DEPDIR)/hashtime-chash.Tpo" -c -o src/hashtime-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-chash.Tpo" "src/$(DEPDIR)/hashtime-chash.Po"; else rm -f "src/$(DEPDIR)/hashtime-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/hashtime-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/hashtime-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-str.o -MD -MP -MF "src/$(DEPDIR)/hashtime-str.Tpo" -c -o src/hashtime-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-str.Tpo" "src/$(DEPDIR)/hashtime-str.Po"; else rm -f "src/$(DEPDIR)/hashtime-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/hashtime-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/hashtime-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-str.obj -MD -MP -MF "src/$(DEPDIR)/hashtime-str.Tpo" -c -o src/hashtime-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-str.Tpo" "src/$(DEPDIR)/hashtime-str.Po"; else rm -f "src/$(DEPDIR)/hashtime-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/hashtime-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/hashtime-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-alloc.o -MD -MP -MF "src/$(DEPDIR)/hashtime-alloc.Tpo" -c -o src/hashtime-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-alloc.Tpo" "src/$(DEPDIR)/hashtime-alloc.Po"; else rm -f "src/$(DEPDIR)/hashtime-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/hashtime-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/hashtime-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-alloc.obj -MD -MP -MF "src/$(DEPDIR)/hashtime-alloc.Tpo" -c -o src/hashtime-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-alloc.Tpo" "src/$(DEPDIR)/hashtime-alloc.Po"; else rm -f "src/$(DEPDIR)/hashtime-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/hashtime-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/hashtime-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-objalloc.o -MD -MP -MF "src/$(DEPDIR)/hashtime-objalloc.Tpo" -c -o src/hashtime-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-objalloc.Tpo" "src/$(DEPDIR)/hashtime-objalloc.Po"; else rm -f "src/$(DEPDIR)/hashtime-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/hashtime-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/hashtime-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/hashtime-objalloc.Tpo" -c -o src/hashtime-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-objalloc.Tpo" "src/$(DEPDIR)/hashtime-objalloc.Po"; else rm -f "src/$(DEPDIR)/hashtime-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/hashtime-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/hashtime-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-mem.o -MD -MP -MF "src/$(DEPDIR)/hashtime-mem.Tpo" -c -o src/hashtime-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-mem.Tpo" "src/$(DEPDIR)/hashtime-mem.Po"; else rm -f "src/$(DEPDIR)/hashtime-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/hashtime-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/hashtime-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-mem.obj -MD -MP -MF "src/$(DEPDIR)/hashtime-mem.Tpo" -c -o src/hashtime-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-mem.Tpo" "src/$(DEPDIR)/hashtime-mem.Po"; else rm -f "src/$(DEPDIR)/hashtime-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/hashtime-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/hashtime-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-bit.o -MD -MP -MF "src/$(DEPDIR)/hashtime-bit.Tpo" -c -o src/hashtime-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-bit.Tpo" "src/$(DEPDIR)/hashtime-bit.Po"; else rm -f "src/$(DEPDIR)/hashtime-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/hashtime-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/hashtime-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -MT src/hashtime-bit.obj -MD -MP -MF "src/$(DEPDIR)/hashtime-bit.Tpo" -c -o src/hashtime-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/hashtime-bit.Tpo" "src/$(DEPDIR)/hashtime-bit.Po"; else rm -f "src/$(DEPDIR)/hashtime-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/hashtime-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hashtime_CFLAGS) $(CFLAGS) -c -o src/hashtime-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/lcrand_test-lcrand.o: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lcrand_test_CFLAGS) $(CFLAGS) -MT src/lcrand_test-lcrand.o -MD -MP -MF "src/$(DEPDIR)/lcrand_test-lcrand.Tpo" -c -o src/lcrand_test-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/lcrand_test-lcrand.Tpo" "src/$(DEPDIR)/lcrand_test-lcrand.Po"; else rm -f "src/$(DEPDIR)/lcrand_test-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/lcrand_test-lcrand.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lcrand_test_CFLAGS) $(CFLAGS) -c -o src/lcrand_test-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c
+
+src/lcrand_test-lcrand.obj: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lcrand_test_CFLAGS) $(CFLAGS) -MT src/lcrand_test-lcrand.obj -MD -MP -MF "src/$(DEPDIR)/lcrand_test-lcrand.Tpo" -c -o src/lcrand_test-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/lcrand_test-lcrand.Tpo" "src/$(DEPDIR)/lcrand_test-lcrand.Po"; else rm -f "src/$(DEPDIR)/lcrand_test-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/lcrand_test-lcrand.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lcrand_test_CFLAGS) $(CFLAGS) -c -o src/lcrand_test-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`
+
+src/mime_test-mime.o: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mime_test_CFLAGS) $(CFLAGS) -MT src/mime_test-mime.o -MD -MP -MF "src/$(DEPDIR)/mime_test-mime.Tpo" -c -o src/mime_test-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mime_test-mime.Tpo" "src/$(DEPDIR)/mime_test-mime.Po"; else rm -f "src/$(DEPDIR)/mime_test-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/mime_test-mime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mime_test_CFLAGS) $(CFLAGS) -c -o src/mime_test-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c
+
+src/mime_test-mime.obj: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mime_test_CFLAGS) $(CFLAGS) -MT src/mime_test-mime.obj -MD -MP -MF "src/$(DEPDIR)/mime_test-mime.Tpo" -c -o src/mime_test-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mime_test-mime.Tpo" "src/$(DEPDIR)/mime_test-mime.Po"; else rm -f "src/$(DEPDIR)/mime_test-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/mime_test-mime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mime_test_CFLAGS) $(CFLAGS) -c -o src/mime_test-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`
+
+src/mime_test-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mime_test_CFLAGS) $(CFLAGS) -MT src/mime_test-str.o -MD -MP -MF "src/$(DEPDIR)/mime_test-str.Tpo" -c -o src/mime_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mime_test-str.Tpo" "src/$(DEPDIR)/mime_test-str.Po"; else rm -f "src/$(DEPDIR)/mime_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/mime_test-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mime_test_CFLAGS) $(CFLAGS) -c -o src/mime_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/mime_test-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mime_test_CFLAGS) $(CFLAGS) -MT src/mime_test-str.obj -MD -MP -MF "src/$(DEPDIR)/mime_test-str.Tpo" -c -o src/mime_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mime_test-str.Tpo" "src/$(DEPDIR)/mime_test-str.Po"; else rm -f "src/$(DEPDIR)/mime_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/mime_test-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mime_test_CFLAGS) $(CFLAGS) -c -o src/mime_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/mlparse_test-mlparse.o: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/mlparse_test-mlparse.o -MD -MP -MF "src/$(DEPDIR)/mlparse_test-mlparse.Tpo" -c -o src/mlparse_test-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_test-mlparse.Tpo" "src/$(DEPDIR)/mlparse_test-mlparse.Po"; else rm -f "src/$(DEPDIR)/mlparse_test-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/mlparse_test-mlparse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_test-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c
+
+src/mlparse_test-mlparse.obj: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/mlparse_test-mlparse.obj -MD -MP -MF "src/$(DEPDIR)/mlparse_test-mlparse.Tpo" -c -o src/mlparse_test-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_test-mlparse.Tpo" "src/$(DEPDIR)/mlparse_test-mlparse.Po"; else rm -f "src/$(DEPDIR)/mlparse_test-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/mlparse_test-mlparse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_test-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`
+
+src/mlparse_test-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/mlparse_test-str.o -MD -MP -MF "src/$(DEPDIR)/mlparse_test-str.Tpo" -c -o src/mlparse_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_test-str.Tpo" "src/$(DEPDIR)/mlparse_test-str.Po"; else rm -f "src/$(DEPDIR)/mlparse_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/mlparse_test-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/mlparse_test-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/mlparse_test-str.obj -MD -MP -MF "src/$(DEPDIR)/mlparse_test-str.Tpo" -c -o src/mlparse_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_test-str.Tpo" "src/$(DEPDIR)/mlparse_test-str.Po"; else rm -f "src/$(DEPDIR)/mlparse_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/mlparse_test-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/libtextcodec/mlparse_test-stream.o: src/libtextcodec/stream.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/libtextcodec/mlparse_test-stream.o -MD -MP -MF "src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Tpo" -c -o src/libtextcodec/mlparse_test-stream.o `test -f 'src/libtextcodec/stream.c' || echo '$(srcdir)/'`src/libtextcodec/stream.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Tpo" "src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Po"; else rm -f "src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/libtextcodec/stream.c' object='src/libtextcodec/mlparse_test-stream.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/libtextcodec/mlparse_test-stream.o `test -f 'src/libtextcodec/stream.c' || echo '$(srcdir)/'`src/libtextcodec/stream.c
+
+src/libtextcodec/mlparse_test-stream.obj: src/libtextcodec/stream.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/libtextcodec/mlparse_test-stream.obj -MD -MP -MF "src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Tpo" -c -o src/libtextcodec/mlparse_test-stream.obj `if test -f 'src/libtextcodec/stream.c'; then $(CYGPATH_W) 'src/libtextcodec/stream.c'; else $(CYGPATH_W) '$(srcdir)/src/libtextcodec/stream.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Tpo" "src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Po"; else rm -f "src/libtextcodec/$(DEPDIR)/mlparse_test-stream.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/libtextcodec/stream.c' object='src/libtextcodec/mlparse_test-stream.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/libtextcodec/mlparse_test-stream.obj `if test -f 'src/libtextcodec/stream.c'; then $(CYGPATH_W) 'src/libtextcodec/stream.c'; else $(CYGPATH_W) '$(srcdir)/src/libtextcodec/stream.c'; fi`
+
+src/libtextcodec/mlparse_test-gunzipfilter.o: src/libtextcodec/gunzipfilter.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/libtextcodec/mlparse_test-gunzipfilter.o -MD -MP -MF "src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Tpo" -c -o src/libtextcodec/mlparse_test-gunzipfilter.o `test -f 'src/libtextcodec/gunzipfilter.c' || echo '$(srcdir)/'`src/libtextcodec/gunzipfilter.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Tpo" "src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Po"; else rm -f "src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/libtextcodec/gunzipfilter.c' object='src/libtextcodec/mlparse_test-gunzipfilter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/libtextcodec/mlparse_test-gunzipfilter.o `test -f 'src/libtextcodec/gunzipfilter.c' || echo '$(srcdir)/'`src/libtextcodec/gunzipfilter.c
+
+src/libtextcodec/mlparse_test-gunzipfilter.obj: src/libtextcodec/gunzipfilter.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/libtextcodec/mlparse_test-gunzipfilter.obj -MD -MP -MF "src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Tpo" -c -o src/libtextcodec/mlparse_test-gunzipfilter.obj `if test -f 'src/libtextcodec/gunzipfilter.c'; then $(CYGPATH_W) 'src/libtextcodec/gunzipfilter.c'; else $(CYGPATH_W) '$(srcdir)/src/libtextcodec/gunzipfilter.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Tpo" "src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Po"; else rm -f "src/libtextcodec/$(DEPDIR)/mlparse_test-gunzipfilter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/libtextcodec/gunzipfilter.c' object='src/libtextcodec/mlparse_test-gunzipfilter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/libtextcodec/mlparse_test-gunzipfilter.obj `if test -f 'src/libtextcodec/gunzipfilter.c'; then $(CYGPATH_W) 'src/libtextcodec/gunzipfilter.c'; else $(CYGPATH_W) '$(srcdir)/src/libtextcodec/gunzipfilter.c'; fi`
+
+src/libtextcodec/mlparse_test-detectfilter.o: src/libtextcodec/detectfilter.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/libtextcodec/mlparse_test-detectfilter.o -MD -MP -MF "src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Tpo" -c -o src/libtextcodec/mlparse_test-detectfilter.o `test -f 'src/libtextcodec/detectfilter.c' || echo '$(srcdir)/'`src/libtextcodec/detectfilter.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Tpo" "src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Po"; else rm -f "src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/libtextcodec/detectfilter.c' object='src/libtextcodec/mlparse_test-detectfilter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/libtextcodec/mlparse_test-detectfilter.o `test -f 'src/libtextcodec/detectfilter.c' || echo '$(srcdir)/'`src/libtextcodec/detectfilter.c
+
+src/libtextcodec/mlparse_test-detectfilter.obj: src/libtextcodec/detectfilter.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/libtextcodec/mlparse_test-detectfilter.obj -MD -MP -MF "src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Tpo" -c -o src/libtextcodec/mlparse_test-detectfilter.obj `if test -f 'src/libtextcodec/detectfilter.c'; then $(CYGPATH_W) 'src/libtextcodec/detectfilter.c'; else $(CYGPATH_W) '$(srcdir)/src/libtextcodec/detectfilter.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Tpo" "src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Po"; else rm -f "src/libtextcodec/$(DEPDIR)/mlparse_test-detectfilter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/libtextcodec/detectfilter.c' object='src/libtextcodec/mlparse_test-detectfilter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/libtextcodec/mlparse_test-detectfilter.obj `if test -f 'src/libtextcodec/detectfilter.c'; then $(CYGPATH_W) 'src/libtextcodec/detectfilter.c'; else $(CYGPATH_W) '$(srcdir)/src/libtextcodec/detectfilter.c'; fi`
+
+src/libtextcodec/mlparse_test-crc.o: src/libtextcodec/crc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/libtextcodec/mlparse_test-crc.o -MD -MP -MF "src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Tpo" -c -o src/libtextcodec/mlparse_test-crc.o `test -f 'src/libtextcodec/crc.c' || echo '$(srcdir)/'`src/libtextcodec/crc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Tpo" "src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Po"; else rm -f "src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/libtextcodec/crc.c' object='src/libtextcodec/mlparse_test-crc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/libtextcodec/mlparse_test-crc.o `test -f 'src/libtextcodec/crc.c' || echo '$(srcdir)/'`src/libtextcodec/crc.c
+
+src/libtextcodec/mlparse_test-crc.obj: src/libtextcodec/crc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -MT src/libtextcodec/mlparse_test-crc.obj -MD -MP -MF "src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Tpo" -c -o src/libtextcodec/mlparse_test-crc.obj `if test -f 'src/libtextcodec/crc.c'; then $(CYGPATH_W) 'src/libtextcodec/crc.c'; else $(CYGPATH_W) '$(srcdir)/src/libtextcodec/crc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Tpo" "src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Po"; else rm -f "src/libtextcodec/$(DEPDIR)/mlparse_test-crc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/libtextcodec/crc.c' object='src/libtextcodec/mlparse_test-crc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_test_CFLAGS) $(CFLAGS) -c -o src/libtextcodec/mlparse_test-crc.obj `if test -f 'src/libtextcodec/crc.c'; then $(CYGPATH_W) 'src/libtextcodec/crc.c'; else $(CYGPATH_W) '$(srcdir)/src/libtextcodec/crc.c'; fi`
+
+src/mlparse_wrap_test-mlparse_wrap.o: src/mlparse_wrap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -MT src/mlparse_wrap_test-mlparse_wrap.o -MD -MP -MF "src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Tpo" -c -o src/mlparse_wrap_test-mlparse_wrap.o `test -f 'src/mlparse_wrap.c' || echo '$(srcdir)/'`src/mlparse_wrap.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Tpo" "src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Po"; else rm -f "src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse_wrap.c' object='src/mlparse_wrap_test-mlparse_wrap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_wrap_test-mlparse_wrap.o `test -f 'src/mlparse_wrap.c' || echo '$(srcdir)/'`src/mlparse_wrap.c
+
+src/mlparse_wrap_test-mlparse_wrap.obj: src/mlparse_wrap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -MT src/mlparse_wrap_test-mlparse_wrap.obj -MD -MP -MF "src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Tpo" -c -o src/mlparse_wrap_test-mlparse_wrap.obj `if test -f 'src/mlparse_wrap.c'; then $(CYGPATH_W) 'src/mlparse_wrap.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse_wrap.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Tpo" "src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Po"; else rm -f "src/$(DEPDIR)/mlparse_wrap_test-mlparse_wrap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse_wrap.c' object='src/mlparse_wrap_test-mlparse_wrap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_wrap_test-mlparse_wrap.obj `if test -f 'src/mlparse_wrap.c'; then $(CYGPATH_W) 'src/mlparse_wrap.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse_wrap.c'; fi`
+
+src/mlparse_wrap_test-mlparse.o: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -MT src/mlparse_wrap_test-mlparse.o -MD -MP -MF "src/$(DEPDIR)/mlparse_wrap_test-mlparse.Tpo" -c -o src/mlparse_wrap_test-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_wrap_test-mlparse.Tpo" "src/$(DEPDIR)/mlparse_wrap_test-mlparse.Po"; else rm -f "src/$(DEPDIR)/mlparse_wrap_test-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/mlparse_wrap_test-mlparse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_wrap_test-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c
+
+src/mlparse_wrap_test-mlparse.obj: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -MT src/mlparse_wrap_test-mlparse.obj -MD -MP -MF "src/$(DEPDIR)/mlparse_wrap_test-mlparse.Tpo" -c -o src/mlparse_wrap_test-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_wrap_test-mlparse.Tpo" "src/$(DEPDIR)/mlparse_wrap_test-mlparse.Po"; else rm -f "src/$(DEPDIR)/mlparse_wrap_test-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/mlparse_wrap_test-mlparse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_wrap_test-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`
+
+src/mlparse_wrap_test-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -MT src/mlparse_wrap_test-str.o -MD -MP -MF "src/$(DEPDIR)/mlparse_wrap_test-str.Tpo" -c -o src/mlparse_wrap_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_wrap_test-str.Tpo" "src/$(DEPDIR)/mlparse_wrap_test-str.Po"; else rm -f "src/$(DEPDIR)/mlparse_wrap_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/mlparse_wrap_test-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_wrap_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/mlparse_wrap_test-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -MT src/mlparse_wrap_test-str.obj -MD -MP -MF "src/$(DEPDIR)/mlparse_wrap_test-str.Tpo" -c -o src/mlparse_wrap_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/mlparse_wrap_test-str.Tpo" "src/$(DEPDIR)/mlparse_wrap_test-str.Po"; else rm -f "src/$(DEPDIR)/mlparse_wrap_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/mlparse_wrap_test-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mlparse_wrap_test_CFLAGS) $(CFLAGS) -c -o src/mlparse_wrap_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/objalloc_test-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-objalloc.o -MD -MP -MF "src/$(DEPDIR)/objalloc_test-objalloc.Tpo" -c -o src/objalloc_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-objalloc.Tpo" "src/$(DEPDIR)/objalloc_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/objalloc_test-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/objalloc_test-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/objalloc_test-objalloc.Tpo" -c -o src/objalloc_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-objalloc.Tpo" "src/$(DEPDIR)/objalloc_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/objalloc_test-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/objalloc_test-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-bit.o -MD -MP -MF "src/$(DEPDIR)/objalloc_test-bit.Tpo" -c -o src/objalloc_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-bit.Tpo" "src/$(DEPDIR)/objalloc_test-bit.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/objalloc_test-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/objalloc_test-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-bit.obj -MD -MP -MF "src/$(DEPDIR)/objalloc_test-bit.Tpo" -c -o src/objalloc_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-bit.Tpo" "src/$(DEPDIR)/objalloc_test-bit.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/objalloc_test-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/objalloc_test-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-mem.o -MD -MP -MF "src/$(DEPDIR)/objalloc_test-mem.Tpo" -c -o src/objalloc_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-mem.Tpo" "src/$(DEPDIR)/objalloc_test-mem.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/objalloc_test-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/objalloc_test-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-mem.obj -MD -MP -MF "src/$(DEPDIR)/objalloc_test-mem.Tpo" -c -o src/objalloc_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-mem.Tpo" "src/$(DEPDIR)/objalloc_test-mem.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/objalloc_test-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/objalloc_test-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-str.o -MD -MP -MF "src/$(DEPDIR)/objalloc_test-str.Tpo" -c -o src/objalloc_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-str.Tpo" "src/$(DEPDIR)/objalloc_test-str.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/objalloc_test-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/objalloc_test-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-str.obj -MD -MP -MF "src/$(DEPDIR)/objalloc_test-str.Tpo" -c -o src/objalloc_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-str.Tpo" "src/$(DEPDIR)/objalloc_test-str.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/objalloc_test-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/objalloc_test-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-alloc.o -MD -MP -MF "src/$(DEPDIR)/objalloc_test-alloc.Tpo" -c -o src/objalloc_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-alloc.Tpo" "src/$(DEPDIR)/objalloc_test-alloc.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/objalloc_test-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/objalloc_test-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -MT src/objalloc_test-alloc.obj -MD -MP -MF "src/$(DEPDIR)/objalloc_test-alloc.Tpo" -c -o src/objalloc_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/objalloc_test-alloc.Tpo" "src/$(DEPDIR)/objalloc_test-alloc.Po"; else rm -f "src/$(DEPDIR)/objalloc_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/objalloc_test-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(objalloc_test_CFLAGS) $(CFLAGS) -c -o src/objalloc_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/poolalloc_test-poolalloc.o: src/poolalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-poolalloc.o -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-poolalloc.Tpo" -c -o src/poolalloc_test-poolalloc.o `test -f 'src/poolalloc.c' || echo '$(srcdir)/'`src/poolalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-poolalloc.Tpo" "src/$(DEPDIR)/poolalloc_test-poolalloc.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-poolalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/poolalloc.c' object='src/poolalloc_test-poolalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-poolalloc.o `test -f 'src/poolalloc.c' || echo '$(srcdir)/'`src/poolalloc.c
+
+src/poolalloc_test-poolalloc.obj: src/poolalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-poolalloc.obj -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-poolalloc.Tpo" -c -o src/poolalloc_test-poolalloc.obj `if test -f 'src/poolalloc.c'; then $(CYGPATH_W) 'src/poolalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/poolalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-poolalloc.Tpo" "src/$(DEPDIR)/poolalloc_test-poolalloc.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-poolalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/poolalloc.c' object='src/poolalloc_test-poolalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-poolalloc.obj `if test -f 'src/poolalloc.c'; then $(CYGPATH_W) 'src/poolalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/poolalloc.c'; fi`
+
+src/poolalloc_test-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-chash.o -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-chash.Tpo" -c -o src/poolalloc_test-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-chash.Tpo" "src/$(DEPDIR)/poolalloc_test-chash.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/poolalloc_test-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/poolalloc_test-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-chash.obj -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-chash.Tpo" -c -o src/poolalloc_test-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-chash.Tpo" "src/$(DEPDIR)/poolalloc_test-chash.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/poolalloc_test-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/poolalloc_test-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-mem.o -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-mem.Tpo" -c -o src/poolalloc_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-mem.Tpo" "src/$(DEPDIR)/poolalloc_test-mem.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/poolalloc_test-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/poolalloc_test-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-mem.obj -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-mem.Tpo" -c -o src/poolalloc_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-mem.Tpo" "src/$(DEPDIR)/poolalloc_test-mem.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/poolalloc_test-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/poolalloc_test-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-bit.o -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-bit.Tpo" -c -o src/poolalloc_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-bit.Tpo" "src/$(DEPDIR)/poolalloc_test-bit.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/poolalloc_test-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/poolalloc_test-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-bit.obj -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-bit.Tpo" -c -o src/poolalloc_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-bit.Tpo" "src/$(DEPDIR)/poolalloc_test-bit.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/poolalloc_test-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/poolalloc_test-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-objalloc.o -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-objalloc.Tpo" -c -o src/poolalloc_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-objalloc.Tpo" "src/$(DEPDIR)/poolalloc_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/poolalloc_test-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/poolalloc_test-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-objalloc.Tpo" -c -o src/poolalloc_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-objalloc.Tpo" "src/$(DEPDIR)/poolalloc_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/poolalloc_test-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/poolalloc_test-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-alloc.o -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-alloc.Tpo" -c -o src/poolalloc_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-alloc.Tpo" "src/$(DEPDIR)/poolalloc_test-alloc.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/poolalloc_test-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/poolalloc_test-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-alloc.obj -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-alloc.Tpo" -c -o src/poolalloc_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-alloc.Tpo" "src/$(DEPDIR)/poolalloc_test-alloc.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/poolalloc_test-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/poolalloc_test-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-str.o -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-str.Tpo" -c -o src/poolalloc_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-str.Tpo" "src/$(DEPDIR)/poolalloc_test-str.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/poolalloc_test-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/poolalloc_test-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -MT src/poolalloc_test-str.obj -MD -MP -MF "src/$(DEPDIR)/poolalloc_test-str.Tpo" -c -o src/poolalloc_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/poolalloc_test-str.Tpo" "src/$(DEPDIR)/poolalloc_test-str.Po"; else rm -f "src/$(DEPDIR)/poolalloc_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/poolalloc_test-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(poolalloc_test_CFLAGS) $(CFLAGS) -c -o src/poolalloc_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/psettings_gen-psettings.o: src/psettings.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-psettings.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-psettings.Tpo" -c -o src/psettings_gen-psettings.o `test -f 'src/psettings.c' || echo '$(srcdir)/'`src/psettings.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-psettings.Tpo" "src/$(DEPDIR)/psettings_gen-psettings.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-psettings.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/psettings.c' object='src/psettings_gen-psettings.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-psettings.o `test -f 'src/psettings.c' || echo '$(srcdir)/'`src/psettings.c
+
+src/psettings_gen-psettings.obj: src/psettings.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-psettings.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-psettings.Tpo" -c -o src/psettings_gen-psettings.obj `if test -f 'src/psettings.c'; then $(CYGPATH_W) 'src/psettings.c'; else $(CYGPATH_W) '$(srcdir)/src/psettings.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-psettings.Tpo" "src/$(DEPDIR)/psettings_gen-psettings.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-psettings.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/psettings.c' object='src/psettings_gen-psettings.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-psettings.obj `if test -f 'src/psettings.c'; then $(CYGPATH_W) 'src/psettings.c'; else $(CYGPATH_W) '$(srcdir)/src/psettings.c'; fi`
+
+src/psettings_gen-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-chash.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-chash.Tpo" -c -o src/psettings_gen-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-chash.Tpo" "src/$(DEPDIR)/psettings_gen-chash.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/psettings_gen-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/psettings_gen-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-chash.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-chash.Tpo" -c -o src/psettings_gen-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-chash.Tpo" "src/$(DEPDIR)/psettings_gen-chash.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/psettings_gen-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/psettings_gen-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-str.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-str.Tpo" -c -o src/psettings_gen-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-str.Tpo" "src/$(DEPDIR)/psettings_gen-str.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/psettings_gen-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/psettings_gen-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-str.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-str.Tpo" -c -o src/psettings_gen-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-str.Tpo" "src/$(DEPDIR)/psettings_gen-str.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/psettings_gen-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/psettings_gen-mlparse_wrap.o: src/mlparse_wrap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-mlparse_wrap.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-mlparse_wrap.Tpo" -c -o src/psettings_gen-mlparse_wrap.o `test -f 'src/mlparse_wrap.c' || echo '$(srcdir)/'`src/mlparse_wrap.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-mlparse_wrap.Tpo" "src/$(DEPDIR)/psettings_gen-mlparse_wrap.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-mlparse_wrap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse_wrap.c' object='src/psettings_gen-mlparse_wrap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-mlparse_wrap.o `test -f 'src/mlparse_wrap.c' || echo '$(srcdir)/'`src/mlparse_wrap.c
+
+src/psettings_gen-mlparse_wrap.obj: src/mlparse_wrap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-mlparse_wrap.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-mlparse_wrap.Tpo" -c -o src/psettings_gen-mlparse_wrap.obj `if test -f 'src/mlparse_wrap.c'; then $(CYGPATH_W) 'src/mlparse_wrap.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse_wrap.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-mlparse_wrap.Tpo" "src/$(DEPDIR)/psettings_gen-mlparse_wrap.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-mlparse_wrap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse_wrap.c' object='src/psettings_gen-mlparse_wrap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-mlparse_wrap.obj `if test -f 'src/mlparse_wrap.c'; then $(CYGPATH_W) 'src/mlparse_wrap.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse_wrap.c'; fi`
+
+src/psettings_gen-mlparse.o: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-mlparse.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-mlparse.Tpo" -c -o src/psettings_gen-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-mlparse.Tpo" "src/$(DEPDIR)/psettings_gen-mlparse.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/psettings_gen-mlparse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c
+
+src/psettings_gen-mlparse.obj: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-mlparse.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-mlparse.Tpo" -c -o src/psettings_gen-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-mlparse.Tpo" "src/$(DEPDIR)/psettings_gen-mlparse.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/psettings_gen-mlparse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`
+
+src/psettings_gen-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-bit.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-bit.Tpo" -c -o src/psettings_gen-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-bit.Tpo" "src/$(DEPDIR)/psettings_gen-bit.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/psettings_gen-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/psettings_gen-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-bit.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-bit.Tpo" -c -o src/psettings_gen-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-bit.Tpo" "src/$(DEPDIR)/psettings_gen-bit.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/psettings_gen-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/psettings_gen-mime.o: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-mime.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-mime.Tpo" -c -o src/psettings_gen-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-mime.Tpo" "src/$(DEPDIR)/psettings_gen-mime.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/psettings_gen-mime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c
+
+src/psettings_gen-mime.obj: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-mime.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-mime.Tpo" -c -o src/psettings_gen-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-mime.Tpo" "src/$(DEPDIR)/psettings_gen-mime.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/psettings_gen-mime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`
+
+src/psettings_gen-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-objalloc.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-objalloc.Tpo" -c -o src/psettings_gen-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-objalloc.Tpo" "src/$(DEPDIR)/psettings_gen-objalloc.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/psettings_gen-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/psettings_gen-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-objalloc.Tpo" -c -o src/psettings_gen-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-objalloc.Tpo" "src/$(DEPDIR)/psettings_gen-objalloc.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/psettings_gen-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/psettings_gen-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-mem.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-mem.Tpo" -c -o src/psettings_gen-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-mem.Tpo" "src/$(DEPDIR)/psettings_gen-mem.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/psettings_gen-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/psettings_gen-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-mem.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-mem.Tpo" -c -o src/psettings_gen-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-mem.Tpo" "src/$(DEPDIR)/psettings_gen-mem.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/psettings_gen-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/psettings_gen-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-alloc.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-alloc.Tpo" -c -o src/psettings_gen-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-alloc.Tpo" "src/$(DEPDIR)/psettings_gen-alloc.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/psettings_gen-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/psettings_gen-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-alloc.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-alloc.Tpo" -c -o src/psettings_gen-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-alloc.Tpo" "src/$(DEPDIR)/psettings_gen-alloc.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/psettings_gen-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/psettings_gen-error.o: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-error.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen-error.Tpo" -c -o src/psettings_gen-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-error.Tpo" "src/$(DEPDIR)/psettings_gen-error.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/psettings_gen-error.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c
+
+src/psettings_gen-error.obj: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -MT src/psettings_gen-error.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen-error.Tpo" -c -o src/psettings_gen-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen-error.Tpo" "src/$(DEPDIR)/psettings_gen-error.Po"; else rm -f "src/$(DEPDIR)/psettings_gen-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/psettings_gen-error.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_CFLAGS) $(CFLAGS) -c -o src/psettings_gen-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`
+
+src/psettings_gen_test-psettings.o: src/psettings.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-psettings.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-psettings.Tpo" -c -o src/psettings_gen_test-psettings.o `test -f 'src/psettings.c' || echo '$(srcdir)/'`src/psettings.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-psettings.Tpo" "src/$(DEPDIR)/psettings_gen_test-psettings.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-psettings.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/psettings.c' object='src/psettings_gen_test-psettings.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-psettings.o `test -f 'src/psettings.c' || echo '$(srcdir)/'`src/psettings.c
+
+src/psettings_gen_test-psettings.obj: src/psettings.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-psettings.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-psettings.Tpo" -c -o src/psettings_gen_test-psettings.obj `if test -f 'src/psettings.c'; then $(CYGPATH_W) 'src/psettings.c'; else $(CYGPATH_W) '$(srcdir)/src/psettings.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-psettings.Tpo" "src/$(DEPDIR)/psettings_gen_test-psettings.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-psettings.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/psettings.c' object='src/psettings_gen_test-psettings.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-psettings.obj `if test -f 'src/psettings.c'; then $(CYGPATH_W) 'src/psettings.c'; else $(CYGPATH_W) '$(srcdir)/src/psettings.c'; fi`
+
+src/psettings_gen_test-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-chash.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-chash.Tpo" -c -o src/psettings_gen_test-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-chash.Tpo" "src/$(DEPDIR)/psettings_gen_test-chash.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/psettings_gen_test-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/psettings_gen_test-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-chash.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-chash.Tpo" -c -o src/psettings_gen_test-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-chash.Tpo" "src/$(DEPDIR)/psettings_gen_test-chash.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/psettings_gen_test-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/psettings_gen_test-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-str.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-str.Tpo" -c -o src/psettings_gen_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-str.Tpo" "src/$(DEPDIR)/psettings_gen_test-str.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/psettings_gen_test-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/psettings_gen_test-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-str.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-str.Tpo" -c -o src/psettings_gen_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-str.Tpo" "src/$(DEPDIR)/psettings_gen_test-str.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/psettings_gen_test-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/psettings_gen_test-mlparse_wrap.o: src/mlparse_wrap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-mlparse_wrap.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Tpo" -c -o src/psettings_gen_test-mlparse_wrap.o `test -f 'src/mlparse_wrap.c' || echo '$(srcdir)/'`src/mlparse_wrap.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Tpo" "src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse_wrap.c' object='src/psettings_gen_test-mlparse_wrap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-mlparse_wrap.o `test -f 'src/mlparse_wrap.c' || echo '$(srcdir)/'`src/mlparse_wrap.c
+
+src/psettings_gen_test-mlparse_wrap.obj: src/mlparse_wrap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-mlparse_wrap.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Tpo" -c -o src/psettings_gen_test-mlparse_wrap.obj `if test -f 'src/mlparse_wrap.c'; then $(CYGPATH_W) 'src/mlparse_wrap.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse_wrap.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Tpo" "src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-mlparse_wrap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse_wrap.c' object='src/psettings_gen_test-mlparse_wrap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-mlparse_wrap.obj `if test -f 'src/mlparse_wrap.c'; then $(CYGPATH_W) 'src/mlparse_wrap.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse_wrap.c'; fi`
+
+src/psettings_gen_test-mlparse.o: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-mlparse.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-mlparse.Tpo" -c -o src/psettings_gen_test-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-mlparse.Tpo" "src/$(DEPDIR)/psettings_gen_test-mlparse.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/psettings_gen_test-mlparse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c
+
+src/psettings_gen_test-mlparse.obj: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-mlparse.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-mlparse.Tpo" -c -o src/psettings_gen_test-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-mlparse.Tpo" "src/$(DEPDIR)/psettings_gen_test-mlparse.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/psettings_gen_test-mlparse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`
+
+src/psettings_gen_test-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-bit.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-bit.Tpo" -c -o src/psettings_gen_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-bit.Tpo" "src/$(DEPDIR)/psettings_gen_test-bit.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/psettings_gen_test-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/psettings_gen_test-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-bit.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-bit.Tpo" -c -o src/psettings_gen_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-bit.Tpo" "src/$(DEPDIR)/psettings_gen_test-bit.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/psettings_gen_test-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/psettings_gen_test-mime.o: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-mime.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-mime.Tpo" -c -o src/psettings_gen_test-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-mime.Tpo" "src/$(DEPDIR)/psettings_gen_test-mime.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/psettings_gen_test-mime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c
+
+src/psettings_gen_test-mime.obj: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-mime.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-mime.Tpo" -c -o src/psettings_gen_test-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-mime.Tpo" "src/$(DEPDIR)/psettings_gen_test-mime.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/psettings_gen_test-mime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`
+
+src/psettings_gen_test-psettings_default.o: src/psettings_default.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-psettings_default.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-psettings_default.Tpo" -c -o src/psettings_gen_test-psettings_default.o `test -f 'src/psettings_default.c' || echo '$(srcdir)/'`src/psettings_default.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-psettings_default.Tpo" "src/$(DEPDIR)/psettings_gen_test-psettings_default.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-psettings_default.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/psettings_default.c' object='src/psettings_gen_test-psettings_default.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-psettings_default.o `test -f 'src/psettings_default.c' || echo '$(srcdir)/'`src/psettings_default.c
+
+src/psettings_gen_test-psettings_default.obj: src/psettings_default.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-psettings_default.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-psettings_default.Tpo" -c -o src/psettings_gen_test-psettings_default.obj `if test -f 'src/psettings_default.c'; then $(CYGPATH_W) 'src/psettings_default.c'; else $(CYGPATH_W) '$(srcdir)/src/psettings_default.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-psettings_default.Tpo" "src/$(DEPDIR)/psettings_gen_test-psettings_default.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-psettings_default.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/psettings_default.c' object='src/psettings_gen_test-psettings_default.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-psettings_default.obj `if test -f 'src/psettings_default.c'; then $(CYGPATH_W) 'src/psettings_default.c'; else $(CYGPATH_W) '$(srcdir)/src/psettings_default.c'; fi`
+
+src/psettings_gen_test-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-objalloc.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-objalloc.Tpo" -c -o src/psettings_gen_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-objalloc.Tpo" "src/$(DEPDIR)/psettings_gen_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/psettings_gen_test-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/psettings_gen_test-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-objalloc.Tpo" -c -o src/psettings_gen_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-objalloc.Tpo" "src/$(DEPDIR)/psettings_gen_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/psettings_gen_test-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/psettings_gen_test-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-mem.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-mem.Tpo" -c -o src/psettings_gen_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-mem.Tpo" "src/$(DEPDIR)/psettings_gen_test-mem.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/psettings_gen_test-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/psettings_gen_test-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-mem.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-mem.Tpo" -c -o src/psettings_gen_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-mem.Tpo" "src/$(DEPDIR)/psettings_gen_test-mem.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/psettings_gen_test-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/psettings_gen_test-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-alloc.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-alloc.Tpo" -c -o src/psettings_gen_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-alloc.Tpo" "src/$(DEPDIR)/psettings_gen_test-alloc.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/psettings_gen_test-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/psettings_gen_test-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-alloc.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-alloc.Tpo" -c -o src/psettings_gen_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-alloc.Tpo" "src/$(DEPDIR)/psettings_gen_test-alloc.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/psettings_gen_test-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/psettings_gen_test-error.o: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-error.o -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-error.Tpo" -c -o src/psettings_gen_test-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-error.Tpo" "src/$(DEPDIR)/psettings_gen_test-error.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/psettings_gen_test-error.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c
+
+src/psettings_gen_test-error.obj: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -MT src/psettings_gen_test-error.obj -MD -MP -MF "src/$(DEPDIR)/psettings_gen_test-error.Tpo" -c -o src/psettings_gen_test-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/psettings_gen_test-error.Tpo" "src/$(DEPDIR)/psettings_gen_test-error.Po"; else rm -f "src/$(DEPDIR)/psettings_gen_test-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/psettings_gen_test-error.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(psettings_gen_test_CFLAGS) $(CFLAGS) -c -o src/psettings_gen_test-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`
+
+src/test/src_test_binsearch_1-binsearch_1.o: src/test/binsearch_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_binsearch_1-binsearch_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Tpo" -c -o src/test/src_test_binsearch_1-binsearch_1.o `test -f 'src/test/binsearch_1.c' || echo '$(srcdir)/'`src/test/binsearch_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Tpo" "src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/binsearch_1.c' object='src/test/src_test_binsearch_1-binsearch_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_binsearch_1-binsearch_1.o `test -f 'src/test/binsearch_1.c' || echo '$(srcdir)/'`src/test/binsearch_1.c
+
+src/test/src_test_binsearch_1-binsearch_1.obj: src/test/binsearch_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_binsearch_1-binsearch_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Tpo" -c -o src/test/src_test_binsearch_1-binsearch_1.obj `if test -f 'src/test/binsearch_1.c'; then $(CYGPATH_W) 'src/test/binsearch_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/binsearch_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Tpo" "src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_binsearch_1-binsearch_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/binsearch_1.c' object='src/test/src_test_binsearch_1-binsearch_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_binsearch_1-binsearch_1.obj `if test -f 'src/test/binsearch_1.c'; then $(CYGPATH_W) 'src/test/binsearch_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/binsearch_1.c'; fi`
+
+src/src_test_binsearch_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-test.Tpo" -c -o src/src_test_binsearch_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-test.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_binsearch_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_binsearch_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-test.Tpo" -c -o src/src_test_binsearch_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-test.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_binsearch_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/src_test_binsearch_1-binsearch.o: src/binsearch.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-binsearch.o -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-binsearch.Tpo" -c -o src/src_test_binsearch_1-binsearch.o `test -f 'src/binsearch.c' || echo '$(srcdir)/'`src/binsearch.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-binsearch.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-binsearch.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-binsearch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/binsearch.c' object='src/src_test_binsearch_1-binsearch.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-binsearch.o `test -f 'src/binsearch.c' || echo '$(srcdir)/'`src/binsearch.c
+
+src/src_test_binsearch_1-binsearch.obj: src/binsearch.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-binsearch.obj -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-binsearch.Tpo" -c -o src/src_test_binsearch_1-binsearch.obj `if test -f 'src/binsearch.c'; then $(CYGPATH_W) 'src/binsearch.c'; else $(CYGPATH_W) '$(srcdir)/src/binsearch.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-binsearch.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-binsearch.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-binsearch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/binsearch.c' object='src/src_test_binsearch_1-binsearch.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-binsearch.obj `if test -f 'src/binsearch.c'; then $(CYGPATH_W) 'src/binsearch.c'; else $(CYGPATH_W) '$(srcdir)/src/binsearch.c'; fi`
+
+src/src_test_binsearch_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Tpo" -c -o src/src_test_binsearch_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_binsearch_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_binsearch_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Tpo" -c -o src/src_test_binsearch_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_binsearch_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_binsearch_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-str.Tpo" -c -o src/src_test_binsearch_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-str.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_binsearch_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_binsearch_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-str.Tpo" -c -o src/src_test_binsearch_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-str.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_binsearch_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_binsearch_1-lcrand.o: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-lcrand.o -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-lcrand.Tpo" -c -o src/src_test_binsearch_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_binsearch_1-lcrand.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c
+
+src/src_test_binsearch_1-lcrand.obj: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -MT src/src_test_binsearch_1-lcrand.obj -MD -MP -MF "src/$(DEPDIR)/src_test_binsearch_1-lcrand.Tpo" -c -o src/src_test_binsearch_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_binsearch_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_binsearch_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_binsearch_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_binsearch_1-lcrand.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_binsearch_1_CFLAGS) $(CFLAGS) -c -o src/src_test_binsearch_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`
+
+src/test/src_test_bit_1-bit_1.o: src/test/bit_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_bit_1-bit_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_bit_1-bit_1.Tpo" -c -o src/test/src_test_bit_1-bit_1.o `test -f 'src/test/bit_1.c' || echo '$(srcdir)/'`src/test/bit_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_bit_1-bit_1.Tpo" "src/test/$(DEPDIR)/src_test_bit_1-bit_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_bit_1-bit_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/bit_1.c' object='src/test/src_test_bit_1-bit_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_bit_1-bit_1.o `test -f 'src/test/bit_1.c' || echo '$(srcdir)/'`src/test/bit_1.c
+
+src/test/src_test_bit_1-bit_1.obj: src/test/bit_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_bit_1-bit_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_bit_1-bit_1.Tpo" -c -o src/test/src_test_bit_1-bit_1.obj `if test -f 'src/test/bit_1.c'; then $(CYGPATH_W) 'src/test/bit_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/bit_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_bit_1-bit_1.Tpo" "src/test/$(DEPDIR)/src_test_bit_1-bit_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_bit_1-bit_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/bit_1.c' object='src/test/src_test_bit_1-bit_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_bit_1-bit_1.obj `if test -f 'src/test/bit_1.c'; then $(CYGPATH_W) 'src/test/bit_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/bit_1.c'; fi`
+
+src/src_test_bit_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/src_test_bit_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_bit_1-test.Tpo" -c -o src/src_test_bit_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bit_1-test.Tpo" "src/$(DEPDIR)/src_test_bit_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_bit_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_bit_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bit_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_bit_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/src_test_bit_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bit_1-test.Tpo" -c -o src/src_test_bit_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bit_1-test.Tpo" "src/$(DEPDIR)/src_test_bit_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_bit_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_bit_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bit_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/src_test_bit_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/src_test_bit_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_bit_1-bit.Tpo" -c -o src/src_test_bit_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bit_1-bit.Tpo" "src/$(DEPDIR)/src_test_bit_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_bit_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_bit_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bit_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_bit_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/src_test_bit_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bit_1-bit.Tpo" -c -o src/src_test_bit_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bit_1-bit.Tpo" "src/$(DEPDIR)/src_test_bit_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_bit_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_bit_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bit_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_bit_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/src_test_bit_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_bit_1-getlongopt.Tpo" -c -o src/src_test_bit_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bit_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_bit_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_bit_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_bit_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bit_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_bit_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/src_test_bit_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bit_1-getlongopt.Tpo" -c -o src/src_test_bit_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bit_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_bit_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_bit_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_bit_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bit_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_bit_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/src_test_bit_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_bit_1-str.Tpo" -c -o src/src_test_bit_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bit_1-str.Tpo" "src/$(DEPDIR)/src_test_bit_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_bit_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_bit_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bit_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_bit_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -MT src/src_test_bit_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bit_1-str.Tpo" -c -o src/src_test_bit_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bit_1-str.Tpo" "src/$(DEPDIR)/src_test_bit_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_bit_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_bit_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bit_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bit_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/test/src_test_bucket_1-bucket_1.o: src/test/bucket_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_bucket_1-bucket_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Tpo" -c -o src/test/src_test_bucket_1-bucket_1.o `test -f 'src/test/bucket_1.c' || echo '$(srcdir)/'`src/test/bucket_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Tpo" "src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/bucket_1.c' object='src/test/src_test_bucket_1-bucket_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_bucket_1-bucket_1.o `test -f 'src/test/bucket_1.c' || echo '$(srcdir)/'`src/test/bucket_1.c
+
+src/test/src_test_bucket_1-bucket_1.obj: src/test/bucket_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_bucket_1-bucket_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Tpo" -c -o src/test/src_test_bucket_1-bucket_1.obj `if test -f 'src/test/bucket_1.c'; then $(CYGPATH_W) 'src/test/bucket_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/bucket_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Tpo" "src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_bucket_1-bucket_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/bucket_1.c' object='src/test/src_test_bucket_1-bucket_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_bucket_1-bucket_1.obj `if test -f 'src/test/bucket_1.c'; then $(CYGPATH_W) 'src/test/bucket_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/bucket_1.c'; fi`
+
+src/src_test_bucket_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-test.Tpo" -c -o src/src_test_bucket_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-test.Tpo" "src/$(DEPDIR)/src_test_bucket_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_bucket_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_bucket_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-test.Tpo" -c -o src/src_test_bucket_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-test.Tpo" "src/$(DEPDIR)/src_test_bucket_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_bucket_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/src_test_bucket_1-bucket.o: src/bucket.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-bucket.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-bucket.Tpo" -c -o src/src_test_bucket_1-bucket.o `test -f 'src/bucket.c' || echo '$(srcdir)/'`src/bucket.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-bucket.Tpo" "src/$(DEPDIR)/src_test_bucket_1-bucket.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-bucket.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bucket.c' object='src/src_test_bucket_1-bucket.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-bucket.o `test -f 'src/bucket.c' || echo '$(srcdir)/'`src/bucket.c
+
+src/src_test_bucket_1-bucket.obj: src/bucket.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-bucket.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-bucket.Tpo" -c -o src/src_test_bucket_1-bucket.obj `if test -f 'src/bucket.c'; then $(CYGPATH_W) 'src/bucket.c'; else $(CYGPATH_W) '$(srcdir)/src/bucket.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-bucket.Tpo" "src/$(DEPDIR)/src_test_bucket_1-bucket.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-bucket.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bucket.c' object='src/src_test_bucket_1-bucket.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-bucket.obj `if test -f 'src/bucket.c'; then $(CYGPATH_W) 'src/bucket.c'; else $(CYGPATH_W) '$(srcdir)/src/bucket.c'; fi`
+
+src/src_test_bucket_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-str.Tpo" -c -o src/src_test_bucket_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-str.Tpo" "src/$(DEPDIR)/src_test_bucket_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_bucket_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_bucket_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-str.Tpo" -c -o src/src_test_bucket_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-str.Tpo" "src/$(DEPDIR)/src_test_bucket_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_bucket_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_bucket_1-vec.o: src/vec.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-vec.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-vec.Tpo" -c -o src/src_test_bucket_1-vec.o `test -f 'src/vec.c' || echo '$(srcdir)/'`src/vec.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-vec.Tpo" "src/$(DEPDIR)/src_test_bucket_1-vec.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-vec.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/vec.c' object='src/src_test_bucket_1-vec.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-vec.o `test -f 'src/vec.c' || echo '$(srcdir)/'`src/vec.c
+
+src/src_test_bucket_1-vec.obj: src/vec.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-vec.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-vec.Tpo" -c -o src/src_test_bucket_1-vec.obj `if test -f 'src/vec.c'; then $(CYGPATH_W) 'src/vec.c'; else $(CYGPATH_W) '$(srcdir)/src/vec.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-vec.Tpo" "src/$(DEPDIR)/src_test_bucket_1-vec.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-vec.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/vec.c' object='src/src_test_bucket_1-vec.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-vec.obj `if test -f 'src/vec.c'; then $(CYGPATH_W) 'src/vec.c'; else $(CYGPATH_W) '$(srcdir)/src/vec.c'; fi`
+
+src/src_test_bucket_1-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-chash.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-chash.Tpo" -c -o src/src_test_bucket_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-chash.Tpo" "src/$(DEPDIR)/src_test_bucket_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_bucket_1-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/src_test_bucket_1-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-chash.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-chash.Tpo" -c -o src/src_test_bucket_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-chash.Tpo" "src/$(DEPDIR)/src_test_bucket_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_bucket_1-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/src_test_bucket_1-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-objalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-objalloc.Tpo" -c -o src/src_test_bucket_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_bucket_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_bucket_1-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/src_test_bucket_1-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-objalloc.Tpo" -c -o src/src_test_bucket_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_bucket_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_bucket_1-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/src_test_bucket_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-bit.Tpo" -c -o src/src_test_bucket_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-bit.Tpo" "src/$(DEPDIR)/src_test_bucket_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_bucket_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_bucket_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-bit.Tpo" -c -o src/src_test_bucket_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-bit.Tpo" "src/$(DEPDIR)/src_test_bucket_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_bucket_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_bucket_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-getlongopt.Tpo" -c -o src/src_test_bucket_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_bucket_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_bucket_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_bucket_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-getlongopt.Tpo" -c -o src/src_test_bucket_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_bucket_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_bucket_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_bucket_1-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-mem.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-mem.Tpo" -c -o src/src_test_bucket_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-mem.Tpo" "src/$(DEPDIR)/src_test_bucket_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_bucket_1-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/src_test_bucket_1-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-mem.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-mem.Tpo" -c -o src/src_test_bucket_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-mem.Tpo" "src/$(DEPDIR)/src_test_bucket_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_bucket_1-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/src_test_bucket_1-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-alloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-alloc.Tpo" -c -o src/src_test_bucket_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-alloc.Tpo" "src/$(DEPDIR)/src_test_bucket_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_bucket_1-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/src_test_bucket_1-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -MT src/src_test_bucket_1-alloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_bucket_1-alloc.Tpo" -c -o src/src_test_bucket_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_bucket_1-alloc.Tpo" "src/$(DEPDIR)/src_test_bucket_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_bucket_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_bucket_1-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_bucket_1_CFLAGS) $(CFLAGS) -c -o src/src_test_bucket_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/src_test_docmap_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-test.Tpo" -c -o src/src_test_docmap_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-test.Tpo" "src/$(DEPDIR)/src_test_docmap_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_docmap_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_docmap_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-test.Tpo" -c -o src/src_test_docmap_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-test.Tpo" "src/$(DEPDIR)/src_test_docmap_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_docmap_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/test/src_test_docmap_1-docmap_1.o: src/test/docmap_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_docmap_1-docmap_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Tpo" -c -o src/test/src_test_docmap_1-docmap_1.o `test -f 'src/test/docmap_1.c' || echo '$(srcdir)/'`src/test/docmap_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Tpo" "src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/docmap_1.c' object='src/test/src_test_docmap_1-docmap_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_docmap_1-docmap_1.o `test -f 'src/test/docmap_1.c' || echo '$(srcdir)/'`src/test/docmap_1.c
+
+src/test/src_test_docmap_1-docmap_1.obj: src/test/docmap_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_docmap_1-docmap_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Tpo" -c -o src/test/src_test_docmap_1-docmap_1.obj `if test -f 'src/test/docmap_1.c'; then $(CYGPATH_W) 'src/test/docmap_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/docmap_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Tpo" "src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_docmap_1-docmap_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/docmap_1.c' object='src/test/src_test_docmap_1-docmap_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_docmap_1-docmap_1.obj `if test -f 'src/test/docmap_1.c'; then $(CYGPATH_W) 'src/test/docmap_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/docmap_1.c'; fi`
+
+src/src_test_docmap_1-docmap.o: src/docmap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-docmap.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-docmap.Tpo" -c -o src/src_test_docmap_1-docmap.o `test -f 'src/docmap.c' || echo '$(srcdir)/'`src/docmap.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-docmap.Tpo" "src/$(DEPDIR)/src_test_docmap_1-docmap.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-docmap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/docmap.c' object='src/src_test_docmap_1-docmap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-docmap.o `test -f 'src/docmap.c' || echo '$(srcdir)/'`src/docmap.c
+
+src/src_test_docmap_1-docmap.obj: src/docmap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-docmap.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-docmap.Tpo" -c -o src/src_test_docmap_1-docmap.obj `if test -f 'src/docmap.c'; then $(CYGPATH_W) 'src/docmap.c'; else $(CYGPATH_W) '$(srcdir)/src/docmap.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-docmap.Tpo" "src/$(DEPDIR)/src_test_docmap_1-docmap.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-docmap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/docmap.c' object='src/src_test_docmap_1-docmap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-docmap.obj `if test -f 'src/docmap.c'; then $(CYGPATH_W) 'src/docmap.c'; else $(CYGPATH_W) '$(srcdir)/src/docmap.c'; fi`
+
+src/src_test_docmap_1-reposset.o: src/reposset.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-reposset.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-reposset.Tpo" -c -o src/src_test_docmap_1-reposset.o `test -f 'src/reposset.c' || echo '$(srcdir)/'`src/reposset.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-reposset.Tpo" "src/$(DEPDIR)/src_test_docmap_1-reposset.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-reposset.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/reposset.c' object='src/src_test_docmap_1-reposset.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-reposset.o `test -f 'src/reposset.c' || echo '$(srcdir)/'`src/reposset.c
+
+src/src_test_docmap_1-reposset.obj: src/reposset.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-reposset.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-reposset.Tpo" -c -o src/src_test_docmap_1-reposset.obj `if test -f 'src/reposset.c'; then $(CYGPATH_W) 'src/reposset.c'; else $(CYGPATH_W) '$(srcdir)/src/reposset.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-reposset.Tpo" "src/$(DEPDIR)/src_test_docmap_1-reposset.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-reposset.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/reposset.c' object='src/src_test_docmap_1-reposset.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-reposset.obj `if test -f 'src/reposset.c'; then $(CYGPATH_W) 'src/reposset.c'; else $(CYGPATH_W) '$(srcdir)/src/reposset.c'; fi`
+
+src/src_test_docmap_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-str.Tpo" -c -o src/src_test_docmap_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-str.Tpo" "src/$(DEPDIR)/src_test_docmap_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_docmap_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_docmap_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-str.Tpo" -c -o src/src_test_docmap_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-str.Tpo" "src/$(DEPDIR)/src_test_docmap_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_docmap_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_docmap_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-getlongopt.Tpo" -c -o src/src_test_docmap_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_docmap_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_docmap_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_docmap_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-getlongopt.Tpo" -c -o src/src_test_docmap_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_docmap_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_docmap_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_docmap_1-lcrand.o: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-lcrand.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-lcrand.Tpo" -c -o src/src_test_docmap_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_docmap_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_docmap_1-lcrand.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c
+
+src/src_test_docmap_1-lcrand.obj: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-lcrand.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-lcrand.Tpo" -c -o src/src_test_docmap_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_docmap_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_docmap_1-lcrand.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`
+
+src/src_test_docmap_1-vec.o: src/vec.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-vec.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-vec.Tpo" -c -o src/src_test_docmap_1-vec.o `test -f 'src/vec.c' || echo '$(srcdir)/'`src/vec.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-vec.Tpo" "src/$(DEPDIR)/src_test_docmap_1-vec.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-vec.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/vec.c' object='src/src_test_docmap_1-vec.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-vec.o `test -f 'src/vec.c' || echo '$(srcdir)/'`src/vec.c
+
+src/src_test_docmap_1-vec.obj: src/vec.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-vec.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-vec.Tpo" -c -o src/src_test_docmap_1-vec.obj `if test -f 'src/vec.c'; then $(CYGPATH_W) 'src/vec.c'; else $(CYGPATH_W) '$(srcdir)/src/vec.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-vec.Tpo" "src/$(DEPDIR)/src_test_docmap_1-vec.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-vec.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/vec.c' object='src/src_test_docmap_1-vec.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-vec.obj `if test -f 'src/vec.c'; then $(CYGPATH_W) 'src/vec.c'; else $(CYGPATH_W) '$(srcdir)/src/vec.c'; fi`
+
+src/src_test_docmap_1-error.o: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-error.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-error.Tpo" -c -o src/src_test_docmap_1-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-error.Tpo" "src/$(DEPDIR)/src_test_docmap_1-error.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/src_test_docmap_1-error.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c
+
+src/src_test_docmap_1-error.obj: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-error.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-error.Tpo" -c -o src/src_test_docmap_1-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-error.Tpo" "src/$(DEPDIR)/src_test_docmap_1-error.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/src_test_docmap_1-error.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`
+
+src/src_test_docmap_1-freemap.o: src/freemap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-freemap.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-freemap.Tpo" -c -o src/src_test_docmap_1-freemap.o `test -f 'src/freemap.c' || echo '$(srcdir)/'`src/freemap.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-freemap.Tpo" "src/$(DEPDIR)/src_test_docmap_1-freemap.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-freemap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/freemap.c' object='src/src_test_docmap_1-freemap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-freemap.o `test -f 'src/freemap.c' || echo '$(srcdir)/'`src/freemap.c
+
+src/src_test_docmap_1-freemap.obj: src/freemap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-freemap.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-freemap.Tpo" -c -o src/src_test_docmap_1-freemap.obj `if test -f 'src/freemap.c'; then $(CYGPATH_W) 'src/freemap.c'; else $(CYGPATH_W) '$(srcdir)/src/freemap.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-freemap.Tpo" "src/$(DEPDIR)/src_test_docmap_1-freemap.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-freemap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/freemap.c' object='src/src_test_docmap_1-freemap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-freemap.obj `if test -f 'src/freemap.c'; then $(CYGPATH_W) 'src/freemap.c'; else $(CYGPATH_W) '$(srcdir)/src/freemap.c'; fi`
+
+src/src_test_docmap_1-fdset.o: src/fdset.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-fdset.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-fdset.Tpo" -c -o src/src_test_docmap_1-fdset.o `test -f 'src/fdset.c' || echo '$(srcdir)/'`src/fdset.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-fdset.Tpo" "src/$(DEPDIR)/src_test_docmap_1-fdset.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-fdset.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/fdset.c' object='src/src_test_docmap_1-fdset.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-fdset.o `test -f 'src/fdset.c' || echo '$(srcdir)/'`src/fdset.c
+
+src/src_test_docmap_1-fdset.obj: src/fdset.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-fdset.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-fdset.Tpo" -c -o src/src_test_docmap_1-fdset.obj `if test -f 'src/fdset.c'; then $(CYGPATH_W) 'src/fdset.c'; else $(CYGPATH_W) '$(srcdir)/src/fdset.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-fdset.Tpo" "src/$(DEPDIR)/src_test_docmap_1-fdset.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-fdset.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/fdset.c' object='src/src_test_docmap_1-fdset.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-fdset.obj `if test -f 'src/fdset.c'; then $(CYGPATH_W) 'src/fdset.c'; else $(CYGPATH_W) '$(srcdir)/src/fdset.c'; fi`
+
+src/src_test_docmap_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-bit.Tpo" -c -o src/src_test_docmap_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-bit.Tpo" "src/$(DEPDIR)/src_test_docmap_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_docmap_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_docmap_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-bit.Tpo" -c -o src/src_test_docmap_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-bit.Tpo" "src/$(DEPDIR)/src_test_docmap_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_docmap_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_docmap_1-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-chash.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-chash.Tpo" -c -o src/src_test_docmap_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-chash.Tpo" "src/$(DEPDIR)/src_test_docmap_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_docmap_1-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/src_test_docmap_1-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-chash.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-chash.Tpo" -c -o src/src_test_docmap_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-chash.Tpo" "src/$(DEPDIR)/src_test_docmap_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_docmap_1-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/src_test_docmap_1-rbtree.o: src/rbtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-rbtree.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-rbtree.Tpo" -c -o src/src_test_docmap_1-rbtree.o `test -f 'src/rbtree.c' || echo '$(srcdir)/'`src/rbtree.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-rbtree.Tpo" "src/$(DEPDIR)/src_test_docmap_1-rbtree.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-rbtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/rbtree.c' object='src/src_test_docmap_1-rbtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-rbtree.o `test -f 'src/rbtree.c' || echo '$(srcdir)/'`src/rbtree.c
+
+src/src_test_docmap_1-rbtree.obj: src/rbtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-rbtree.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-rbtree.Tpo" -c -o src/src_test_docmap_1-rbtree.obj `if test -f 'src/rbtree.c'; then $(CYGPATH_W) 'src/rbtree.c'; else $(CYGPATH_W) '$(srcdir)/src/rbtree.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-rbtree.Tpo" "src/$(DEPDIR)/src_test_docmap_1-rbtree.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-rbtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/rbtree.c' object='src/src_test_docmap_1-rbtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-rbtree.obj `if test -f 'src/rbtree.c'; then $(CYGPATH_W) 'src/rbtree.c'; else $(CYGPATH_W) '$(srcdir)/src/rbtree.c'; fi`
+
+src/src_test_docmap_1-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-objalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-objalloc.Tpo" -c -o src/src_test_docmap_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_docmap_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_docmap_1-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/src_test_docmap_1-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-objalloc.Tpo" -c -o src/src_test_docmap_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_docmap_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_docmap_1-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/src_test_docmap_1-stack.o: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-stack.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-stack.Tpo" -c -o src/src_test_docmap_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-stack.Tpo" "src/$(DEPDIR)/src_test_docmap_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_docmap_1-stack.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c
+
+src/src_test_docmap_1-stack.obj: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-stack.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-stack.Tpo" -c -o src/src_test_docmap_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-stack.Tpo" "src/$(DEPDIR)/src_test_docmap_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_docmap_1-stack.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`
+
+src/src_test_docmap_1-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-mem.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-mem.Tpo" -c -o src/src_test_docmap_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-mem.Tpo" "src/$(DEPDIR)/src_test_docmap_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_docmap_1-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/src_test_docmap_1-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-mem.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-mem.Tpo" -c -o src/src_test_docmap_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-mem.Tpo" "src/$(DEPDIR)/src_test_docmap_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_docmap_1-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/src_test_docmap_1-testutils.o: src/testutils.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-testutils.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-testutils.Tpo" -c -o src/src_test_docmap_1-testutils.o `test -f 'src/testutils.c' || echo '$(srcdir)/'`src/testutils.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-testutils.Tpo" "src/$(DEPDIR)/src_test_docmap_1-testutils.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-testutils.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/testutils.c' object='src/src_test_docmap_1-testutils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-testutils.o `test -f 'src/testutils.c' || echo '$(srcdir)/'`src/testutils.c
+
+src/src_test_docmap_1-testutils.obj: src/testutils.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-testutils.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-testutils.Tpo" -c -o src/src_test_docmap_1-testutils.obj `if test -f 'src/testutils.c'; then $(CYGPATH_W) 'src/testutils.c'; else $(CYGPATH_W) '$(srcdir)/src/testutils.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-testutils.Tpo" "src/$(DEPDIR)/src_test_docmap_1-testutils.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-testutils.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/testutils.c' object='src/src_test_docmap_1-testutils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-testutils.obj `if test -f 'src/testutils.c'; then $(CYGPATH_W) 'src/testutils.c'; else $(CYGPATH_W) '$(srcdir)/src/testutils.c'; fi`
+
+src/src_test_docmap_1-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-alloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-alloc.Tpo" -c -o src/src_test_docmap_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-alloc.Tpo" "src/$(DEPDIR)/src_test_docmap_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_docmap_1-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/src_test_docmap_1-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-alloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-alloc.Tpo" -c -o src/src_test_docmap_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-alloc.Tpo" "src/$(DEPDIR)/src_test_docmap_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_docmap_1-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/src_test_docmap_1-binsearch.o: src/binsearch.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-binsearch.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-binsearch.Tpo" -c -o src/src_test_docmap_1-binsearch.o `test -f 'src/binsearch.c' || echo '$(srcdir)/'`src/binsearch.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-binsearch.Tpo" "src/$(DEPDIR)/src_test_docmap_1-binsearch.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-binsearch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/binsearch.c' object='src/src_test_docmap_1-binsearch.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-binsearch.o `test -f 'src/binsearch.c' || echo '$(srcdir)/'`src/binsearch.c
+
+src/src_test_docmap_1-binsearch.obj: src/binsearch.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-binsearch.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-binsearch.Tpo" -c -o src/src_test_docmap_1-binsearch.obj `if test -f 'src/binsearch.c'; then $(CYGPATH_W) 'src/binsearch.c'; else $(CYGPATH_W) '$(srcdir)/src/binsearch.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-binsearch.Tpo" "src/$(DEPDIR)/src_test_docmap_1-binsearch.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-binsearch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/binsearch.c' object='src/src_test_docmap_1-binsearch.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-binsearch.obj `if test -f 'src/binsearch.c'; then $(CYGPATH_W) 'src/binsearch.c'; else $(CYGPATH_W) '$(srcdir)/src/binsearch.c'; fi`
+
+src/src_test_docmap_1-mime.o: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-mime.o -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-mime.Tpo" -c -o src/src_test_docmap_1-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-mime.Tpo" "src/$(DEPDIR)/src_test_docmap_1-mime.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/src_test_docmap_1-mime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c
+
+src/src_test_docmap_1-mime.obj: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -MT src/src_test_docmap_1-mime.obj -MD -MP -MF "src/$(DEPDIR)/src_test_docmap_1-mime.Tpo" -c -o src/src_test_docmap_1-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_docmap_1-mime.Tpo" "src/$(DEPDIR)/src_test_docmap_1-mime.Po"; else rm -f "src/$(DEPDIR)/src_test_docmap_1-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/src_test_docmap_1-mime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_docmap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_docmap_1-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`
+
+src/src_test_freemap_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-test.Tpo" -c -o src/src_test_freemap_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-test.Tpo" "src/$(DEPDIR)/src_test_freemap_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_freemap_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_freemap_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-test.Tpo" -c -o src/src_test_freemap_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-test.Tpo" "src/$(DEPDIR)/src_test_freemap_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_freemap_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/test/src_test_freemap_1-freemap_1.o: src/test/freemap_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_freemap_1-freemap_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Tpo" -c -o src/test/src_test_freemap_1-freemap_1.o `test -f 'src/test/freemap_1.c' || echo '$(srcdir)/'`src/test/freemap_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Tpo" "src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/freemap_1.c' object='src/test/src_test_freemap_1-freemap_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_freemap_1-freemap_1.o `test -f 'src/test/freemap_1.c' || echo '$(srcdir)/'`src/test/freemap_1.c
+
+src/test/src_test_freemap_1-freemap_1.obj: src/test/freemap_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_freemap_1-freemap_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Tpo" -c -o src/test/src_test_freemap_1-freemap_1.obj `if test -f 'src/test/freemap_1.c'; then $(CYGPATH_W) 'src/test/freemap_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/freemap_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Tpo" "src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_freemap_1-freemap_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/freemap_1.c' object='src/test/src_test_freemap_1-freemap_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_freemap_1-freemap_1.obj `if test -f 'src/test/freemap_1.c'; then $(CYGPATH_W) 'src/test/freemap_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/freemap_1.c'; fi`
+
+src/src_test_freemap_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-str.Tpo" -c -o src/src_test_freemap_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-str.Tpo" "src/$(DEPDIR)/src_test_freemap_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_freemap_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_freemap_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-str.Tpo" -c -o src/src_test_freemap_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-str.Tpo" "src/$(DEPDIR)/src_test_freemap_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_freemap_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_freemap_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-getlongopt.Tpo" -c -o src/src_test_freemap_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_freemap_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_freemap_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_freemap_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-getlongopt.Tpo" -c -o src/src_test_freemap_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_freemap_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_freemap_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_freemap_1-freemap.o: src/freemap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-freemap.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-freemap.Tpo" -c -o src/src_test_freemap_1-freemap.o `test -f 'src/freemap.c' || echo '$(srcdir)/'`src/freemap.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-freemap.Tpo" "src/$(DEPDIR)/src_test_freemap_1-freemap.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-freemap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/freemap.c' object='src/src_test_freemap_1-freemap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-freemap.o `test -f 'src/freemap.c' || echo '$(srcdir)/'`src/freemap.c
+
+src/src_test_freemap_1-freemap.obj: src/freemap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-freemap.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-freemap.Tpo" -c -o src/src_test_freemap_1-freemap.obj `if test -f 'src/freemap.c'; then $(CYGPATH_W) 'src/freemap.c'; else $(CYGPATH_W) '$(srcdir)/src/freemap.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-freemap.Tpo" "src/$(DEPDIR)/src_test_freemap_1-freemap.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-freemap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/freemap.c' object='src/src_test_freemap_1-freemap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-freemap.obj `if test -f 'src/freemap.c'; then $(CYGPATH_W) 'src/freemap.c'; else $(CYGPATH_W) '$(srcdir)/src/freemap.c'; fi`
+
+src/src_test_freemap_1-binsearch.o: src/binsearch.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-binsearch.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-binsearch.Tpo" -c -o src/src_test_freemap_1-binsearch.o `test -f 'src/binsearch.c' || echo '$(srcdir)/'`src/binsearch.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-binsearch.Tpo" "src/$(DEPDIR)/src_test_freemap_1-binsearch.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-binsearch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/binsearch.c' object='src/src_test_freemap_1-binsearch.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-binsearch.o `test -f 'src/binsearch.c' || echo '$(srcdir)/'`src/binsearch.c
+
+src/src_test_freemap_1-binsearch.obj: src/binsearch.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-binsearch.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-binsearch.Tpo" -c -o src/src_test_freemap_1-binsearch.obj `if test -f 'src/binsearch.c'; then $(CYGPATH_W) 'src/binsearch.c'; else $(CYGPATH_W) '$(srcdir)/src/binsearch.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-binsearch.Tpo" "src/$(DEPDIR)/src_test_freemap_1-binsearch.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-binsearch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/binsearch.c' object='src/src_test_freemap_1-binsearch.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-binsearch.obj `if test -f 'src/binsearch.c'; then $(CYGPATH_W) 'src/binsearch.c'; else $(CYGPATH_W) '$(srcdir)/src/binsearch.c'; fi`
+
+src/src_test_freemap_1-rbtree.o: src/rbtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-rbtree.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-rbtree.Tpo" -c -o src/src_test_freemap_1-rbtree.o `test -f 'src/rbtree.c' || echo '$(srcdir)/'`src/rbtree.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-rbtree.Tpo" "src/$(DEPDIR)/src_test_freemap_1-rbtree.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-rbtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/rbtree.c' object='src/src_test_freemap_1-rbtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-rbtree.o `test -f 'src/rbtree.c' || echo '$(srcdir)/'`src/rbtree.c
+
+src/src_test_freemap_1-rbtree.obj: src/rbtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-rbtree.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-rbtree.Tpo" -c -o src/src_test_freemap_1-rbtree.obj `if test -f 'src/rbtree.c'; then $(CYGPATH_W) 'src/rbtree.c'; else $(CYGPATH_W) '$(srcdir)/src/rbtree.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-rbtree.Tpo" "src/$(DEPDIR)/src_test_freemap_1-rbtree.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-rbtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/rbtree.c' object='src/src_test_freemap_1-rbtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-rbtree.obj `if test -f 'src/rbtree.c'; then $(CYGPATH_W) 'src/rbtree.c'; else $(CYGPATH_W) '$(srcdir)/src/rbtree.c'; fi`
+
+src/src_test_freemap_1-stack.o: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-stack.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-stack.Tpo" -c -o src/src_test_freemap_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-stack.Tpo" "src/$(DEPDIR)/src_test_freemap_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_freemap_1-stack.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c
+
+src/src_test_freemap_1-stack.obj: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-stack.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-stack.Tpo" -c -o src/src_test_freemap_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-stack.Tpo" "src/$(DEPDIR)/src_test_freemap_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_freemap_1-stack.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`
+
+src/src_test_freemap_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-bit.Tpo" -c -o src/src_test_freemap_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-bit.Tpo" "src/$(DEPDIR)/src_test_freemap_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_freemap_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_freemap_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-bit.Tpo" -c -o src/src_test_freemap_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-bit.Tpo" "src/$(DEPDIR)/src_test_freemap_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_freemap_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_freemap_1-lcrand.o: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-lcrand.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-lcrand.Tpo" -c -o src/src_test_freemap_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_freemap_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_freemap_1-lcrand.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c
+
+src/src_test_freemap_1-lcrand.obj: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-lcrand.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-lcrand.Tpo" -c -o src/src_test_freemap_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_freemap_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_freemap_1-lcrand.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`
+
+src/src_test_freemap_1-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-objalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-objalloc.Tpo" -c -o src/src_test_freemap_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_freemap_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_freemap_1-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/src_test_freemap_1-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-objalloc.Tpo" -c -o src/src_test_freemap_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_freemap_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_freemap_1-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/src_test_freemap_1-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-mem.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-mem.Tpo" -c -o src/src_test_freemap_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-mem.Tpo" "src/$(DEPDIR)/src_test_freemap_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_freemap_1-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/src_test_freemap_1-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-mem.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-mem.Tpo" -c -o src/src_test_freemap_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-mem.Tpo" "src/$(DEPDIR)/src_test_freemap_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_freemap_1-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/src_test_freemap_1-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-alloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-alloc.Tpo" -c -o src/src_test_freemap_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-alloc.Tpo" "src/$(DEPDIR)/src_test_freemap_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_freemap_1-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/src_test_freemap_1-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -MT src/src_test_freemap_1-alloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_freemap_1-alloc.Tpo" -c -o src/src_test_freemap_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_freemap_1-alloc.Tpo" "src/$(DEPDIR)/src_test_freemap_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_freemap_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_freemap_1-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_freemap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_freemap_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/src_test_getlongopt_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -MT src/src_test_getlongopt_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_getlongopt_1-test.Tpo" -c -o src/src_test_getlongopt_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_getlongopt_1-test.Tpo" "src/$(DEPDIR)/src_test_getlongopt_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_getlongopt_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_getlongopt_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -c -o src/src_test_getlongopt_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_getlongopt_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -MT src/src_test_getlongopt_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_getlongopt_1-test.Tpo" -c -o src/src_test_getlongopt_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_getlongopt_1-test.Tpo" "src/$(DEPDIR)/src_test_getlongopt_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_getlongopt_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_getlongopt_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -c -o src/src_test_getlongopt_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/test/src_test_getlongopt_1-getlongopt_1.o: src/test/getlongopt_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_getlongopt_1-getlongopt_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Tpo" -c -o src/test/src_test_getlongopt_1-getlongopt_1.o `test -f 'src/test/getlongopt_1.c' || echo '$(srcdir)/'`src/test/getlongopt_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Tpo" "src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/getlongopt_1.c' object='src/test/src_test_getlongopt_1-getlongopt_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_getlongopt_1-getlongopt_1.o `test -f 'src/test/getlongopt_1.c' || echo '$(srcdir)/'`src/test/getlongopt_1.c
+
+src/test/src_test_getlongopt_1-getlongopt_1.obj: src/test/getlongopt_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_getlongopt_1-getlongopt_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Tpo" -c -o src/test/src_test_getlongopt_1-getlongopt_1.obj `if test -f 'src/test/getlongopt_1.c'; then $(CYGPATH_W) 'src/test/getlongopt_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/getlongopt_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Tpo" "src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_getlongopt_1-getlongopt_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/getlongopt_1.c' object='src/test/src_test_getlongopt_1-getlongopt_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_getlongopt_1-getlongopt_1.obj `if test -f 'src/test/getlongopt_1.c'; then $(CYGPATH_W) 'src/test/getlongopt_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/getlongopt_1.c'; fi`
+
+src/src_test_getlongopt_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -MT src/src_test_getlongopt_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_getlongopt_1-str.Tpo" -c -o src/src_test_getlongopt_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_getlongopt_1-str.Tpo" "src/$(DEPDIR)/src_test_getlongopt_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_getlongopt_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_getlongopt_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -c -o src/src_test_getlongopt_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_getlongopt_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -MT src/src_test_getlongopt_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_getlongopt_1-str.Tpo" -c -o src/src_test_getlongopt_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_getlongopt_1-str.Tpo" "src/$(DEPDIR)/src_test_getlongopt_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_getlongopt_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_getlongopt_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -c -o src/src_test_getlongopt_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_getlongopt_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -MT src/src_test_getlongopt_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Tpo" -c -o src/src_test_getlongopt_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_getlongopt_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -c -o src/src_test_getlongopt_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_getlongopt_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -MT src/src_test_getlongopt_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Tpo" -c -o src/src_test_getlongopt_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_getlongopt_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_getlongopt_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_getlongopt_1_CFLAGS) $(CFLAGS) -c -o src/src_test_getlongopt_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/test/src_test_heap_1-heap_1.o: src/test/heap_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_heap_1-heap_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_heap_1-heap_1.Tpo" -c -o src/test/src_test_heap_1-heap_1.o `test -f 'src/test/heap_1.c' || echo '$(srcdir)/'`src/test/heap_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_heap_1-heap_1.Tpo" "src/test/$(DEPDIR)/src_test_heap_1-heap_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_heap_1-heap_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/heap_1.c' object='src/test/src_test_heap_1-heap_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_heap_1-heap_1.o `test -f 'src/test/heap_1.c' || echo '$(srcdir)/'`src/test/heap_1.c
+
+src/test/src_test_heap_1-heap_1.obj: src/test/heap_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_heap_1-heap_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_heap_1-heap_1.Tpo" -c -o src/test/src_test_heap_1-heap_1.obj `if test -f 'src/test/heap_1.c'; then $(CYGPATH_W) 'src/test/heap_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/heap_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_heap_1-heap_1.Tpo" "src/test/$(DEPDIR)/src_test_heap_1-heap_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_heap_1-heap_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/heap_1.c' object='src/test/src_test_heap_1-heap_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_heap_1-heap_1.obj `if test -f 'src/test/heap_1.c'; then $(CYGPATH_W) 'src/test/heap_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/heap_1.c'; fi`
+
+src/src_test_heap_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-test.Tpo" -c -o src/src_test_heap_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-test.Tpo" "src/$(DEPDIR)/src_test_heap_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_heap_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_heap_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-test.Tpo" -c -o src/src_test_heap_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-test.Tpo" "src/$(DEPDIR)/src_test_heap_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_heap_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/src_test_heap_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-str.Tpo" -c -o src/src_test_heap_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-str.Tpo" "src/$(DEPDIR)/src_test_heap_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_heap_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_heap_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-str.Tpo" -c -o src/src_test_heap_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-str.Tpo" "src/$(DEPDIR)/src_test_heap_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_heap_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_heap_1-heap.o: src/heap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-heap.o -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-heap.Tpo" -c -o src/src_test_heap_1-heap.o `test -f 'src/heap.c' || echo '$(srcdir)/'`src/heap.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-heap.Tpo" "src/$(DEPDIR)/src_test_heap_1-heap.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-heap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/heap.c' object='src/src_test_heap_1-heap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-heap.o `test -f 'src/heap.c' || echo '$(srcdir)/'`src/heap.c
+
+src/src_test_heap_1-heap.obj: src/heap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-heap.obj -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-heap.Tpo" -c -o src/src_test_heap_1-heap.obj `if test -f 'src/heap.c'; then $(CYGPATH_W) 'src/heap.c'; else $(CYGPATH_W) '$(srcdir)/src/heap.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-heap.Tpo" "src/$(DEPDIR)/src_test_heap_1-heap.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-heap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/heap.c' object='src/src_test_heap_1-heap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-heap.obj `if test -f 'src/heap.c'; then $(CYGPATH_W) 'src/heap.c'; else $(CYGPATH_W) '$(srcdir)/src/heap.c'; fi`
+
+src/src_test_heap_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-bit.Tpo" -c -o src/src_test_heap_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-bit.Tpo" "src/$(DEPDIR)/src_test_heap_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_heap_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_heap_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-bit.Tpo" -c -o src/src_test_heap_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-bit.Tpo" "src/$(DEPDIR)/src_test_heap_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_heap_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_heap_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-getlongopt.Tpo" -c -o src/src_test_heap_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_heap_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_heap_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_heap_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-getlongopt.Tpo" -c -o src/src_test_heap_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_heap_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_heap_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_heap_1-lcrand.o: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-lcrand.o -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-lcrand.Tpo" -c -o src/src_test_heap_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_heap_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_heap_1-lcrand.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c
+
+src/src_test_heap_1-lcrand.obj: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -MT src/src_test_heap_1-lcrand.obj -MD -MP -MF "src/$(DEPDIR)/src_test_heap_1-lcrand.Tpo" -c -o src/src_test_heap_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_heap_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_heap_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_heap_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_heap_1-lcrand.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_heap_1_CFLAGS) $(CFLAGS) -c -o src/src_test_heap_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`
+
+src/test/src_test_iobtree_1-iobtree_1.o: src/test/iobtree_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_iobtree_1-iobtree_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Tpo" -c -o src/test/src_test_iobtree_1-iobtree_1.o `test -f 'src/test/iobtree_1.c' || echo '$(srcdir)/'`src/test/iobtree_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Tpo" "src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/iobtree_1.c' object='src/test/src_test_iobtree_1-iobtree_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_iobtree_1-iobtree_1.o `test -f 'src/test/iobtree_1.c' || echo '$(srcdir)/'`src/test/iobtree_1.c
+
+src/test/src_test_iobtree_1-iobtree_1.obj: src/test/iobtree_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_iobtree_1-iobtree_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Tpo" -c -o src/test/src_test_iobtree_1-iobtree_1.obj `if test -f 'src/test/iobtree_1.c'; then $(CYGPATH_W) 'src/test/iobtree_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/iobtree_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Tpo" "src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_iobtree_1-iobtree_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/iobtree_1.c' object='src/test/src_test_iobtree_1-iobtree_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_iobtree_1-iobtree_1.obj `if test -f 'src/test/iobtree_1.c'; then $(CYGPATH_W) 'src/test/iobtree_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/iobtree_1.c'; fi`
+
+src/src_test_iobtree_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-test.Tpo" -c -o src/src_test_iobtree_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-test.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_iobtree_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_iobtree_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-test.Tpo" -c -o src/src_test_iobtree_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-test.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_iobtree_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/src_test_iobtree_1-bucket.o: src/bucket.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-bucket.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-bucket.Tpo" -c -o src/src_test_iobtree_1-bucket.o `test -f 'src/bucket.c' || echo '$(srcdir)/'`src/bucket.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-bucket.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-bucket.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-bucket.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bucket.c' object='src/src_test_iobtree_1-bucket.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-bucket.o `test -f 'src/bucket.c' || echo '$(srcdir)/'`src/bucket.c
+
+src/src_test_iobtree_1-bucket.obj: src/bucket.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-bucket.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-bucket.Tpo" -c -o src/src_test_iobtree_1-bucket.obj `if test -f 'src/bucket.c'; then $(CYGPATH_W) 'src/bucket.c'; else $(CYGPATH_W) '$(srcdir)/src/bucket.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-bucket.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-bucket.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-bucket.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bucket.c' object='src/src_test_iobtree_1-bucket.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-bucket.obj `if test -f 'src/bucket.c'; then $(CYGPATH_W) 'src/bucket.c'; else $(CYGPATH_W) '$(srcdir)/src/bucket.c'; fi`
+
+src/src_test_iobtree_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-str.Tpo" -c -o src/src_test_iobtree_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-str.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_iobtree_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_iobtree_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-str.Tpo" -c -o src/src_test_iobtree_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-str.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_iobtree_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_iobtree_1-vec.o: src/vec.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-vec.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-vec.Tpo" -c -o src/src_test_iobtree_1-vec.o `test -f 'src/vec.c' || echo '$(srcdir)/'`src/vec.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-vec.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-vec.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-vec.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/vec.c' object='src/src_test_iobtree_1-vec.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-vec.o `test -f 'src/vec.c' || echo '$(srcdir)/'`src/vec.c
+
+src/src_test_iobtree_1-vec.obj: src/vec.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-vec.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-vec.Tpo" -c -o src/src_test_iobtree_1-vec.obj `if test -f 'src/vec.c'; then $(CYGPATH_W) 'src/vec.c'; else $(CYGPATH_W) '$(srcdir)/src/vec.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-vec.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-vec.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-vec.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/vec.c' object='src/src_test_iobtree_1-vec.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-vec.obj `if test -f 'src/vec.c'; then $(CYGPATH_W) 'src/vec.c'; else $(CYGPATH_W) '$(srcdir)/src/vec.c'; fi`
+
+src/src_test_iobtree_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-bit.Tpo" -c -o src/src_test_iobtree_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-bit.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_iobtree_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_iobtree_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-bit.Tpo" -c -o src/src_test_iobtree_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-bit.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_iobtree_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_iobtree_1-iobtree.o: src/iobtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-iobtree.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-iobtree.Tpo" -c -o src/src_test_iobtree_1-iobtree.o `test -f 'src/iobtree.c' || echo '$(srcdir)/'`src/iobtree.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-iobtree.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-iobtree.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-iobtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/iobtree.c' object='src/src_test_iobtree_1-iobtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-iobtree.o `test -f 'src/iobtree.c' || echo '$(srcdir)/'`src/iobtree.c
+
+src/src_test_iobtree_1-iobtree.obj: src/iobtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-iobtree.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-iobtree.Tpo" -c -o src/src_test_iobtree_1-iobtree.obj `if test -f 'src/iobtree.c'; then $(CYGPATH_W) 'src/iobtree.c'; else $(CYGPATH_W) '$(srcdir)/src/iobtree.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-iobtree.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-iobtree.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-iobtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/iobtree.c' object='src/src_test_iobtree_1-iobtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-iobtree.obj `if test -f 'src/iobtree.c'; then $(CYGPATH_W) 'src/iobtree.c'; else $(CYGPATH_W) '$(srcdir)/src/iobtree.c'; fi`
+
+src/src_test_iobtree_1-binsearch.o: src/binsearch.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-binsearch.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-binsearch.Tpo" -c -o src/src_test_iobtree_1-binsearch.o `test -f 'src/binsearch.c' || echo '$(srcdir)/'`src/binsearch.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-binsearch.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-binsearch.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-binsearch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/binsearch.c' object='src/src_test_iobtree_1-binsearch.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-binsearch.o `test -f 'src/binsearch.c' || echo '$(srcdir)/'`src/binsearch.c
+
+src/src_test_iobtree_1-binsearch.obj: src/binsearch.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-binsearch.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-binsearch.Tpo" -c -o src/src_test_iobtree_1-binsearch.obj `if test -f 'src/binsearch.c'; then $(CYGPATH_W) 'src/binsearch.c'; else $(CYGPATH_W) '$(srcdir)/src/binsearch.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-binsearch.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-binsearch.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-binsearch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/binsearch.c' object='src/src_test_iobtree_1-binsearch.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-binsearch.obj `if test -f 'src/binsearch.c'; then $(CYGPATH_W) 'src/binsearch.c'; else $(CYGPATH_W) '$(srcdir)/src/binsearch.c'; fi`
+
+src/src_test_iobtree_1-fdset.o: src/fdset.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-fdset.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-fdset.Tpo" -c -o src/src_test_iobtree_1-fdset.o `test -f 'src/fdset.c' || echo '$(srcdir)/'`src/fdset.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-fdset.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-fdset.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-fdset.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/fdset.c' object='src/src_test_iobtree_1-fdset.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-fdset.o `test -f 'src/fdset.c' || echo '$(srcdir)/'`src/fdset.c
+
+src/src_test_iobtree_1-fdset.obj: src/fdset.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-fdset.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-fdset.Tpo" -c -o src/src_test_iobtree_1-fdset.obj `if test -f 'src/fdset.c'; then $(CYGPATH_W) 'src/fdset.c'; else $(CYGPATH_W) '$(srcdir)/src/fdset.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-fdset.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-fdset.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-fdset.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/fdset.c' object='src/src_test_iobtree_1-fdset.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-fdset.obj `if test -f 'src/fdset.c'; then $(CYGPATH_W) 'src/fdset.c'; else $(CYGPATH_W) '$(srcdir)/src/fdset.c'; fi`
+
+src/src_test_iobtree_1-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-chash.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-chash.Tpo" -c -o src/src_test_iobtree_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-chash.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_iobtree_1-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/src_test_iobtree_1-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-chash.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-chash.Tpo" -c -o src/src_test_iobtree_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-chash.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_iobtree_1-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/src_test_iobtree_1-btbucket.o: src/btbucket.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-btbucket.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-btbucket.Tpo" -c -o src/src_test_iobtree_1-btbucket.o `test -f 'src/btbucket.c' || echo '$(srcdir)/'`src/btbucket.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-btbucket.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-btbucket.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-btbucket.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/btbucket.c' object='src/src_test_iobtree_1-btbucket.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-btbucket.o `test -f 'src/btbucket.c' || echo '$(srcdir)/'`src/btbucket.c
+
+src/src_test_iobtree_1-btbucket.obj: src/btbucket.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-btbucket.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-btbucket.Tpo" -c -o src/src_test_iobtree_1-btbucket.obj `if test -f 'src/btbucket.c'; then $(CYGPATH_W) 'src/btbucket.c'; else $(CYGPATH_W) '$(srcdir)/src/btbucket.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-btbucket.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-btbucket.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-btbucket.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/btbucket.c' object='src/src_test_iobtree_1-btbucket.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-btbucket.obj `if test -f 'src/btbucket.c'; then $(CYGPATH_W) 'src/btbucket.c'; else $(CYGPATH_W) '$(srcdir)/src/btbucket.c'; fi`
+
+src/src_test_iobtree_1-freemap.o: src/freemap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-freemap.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-freemap.Tpo" -c -o src/src_test_iobtree_1-freemap.o `test -f 'src/freemap.c' || echo '$(srcdir)/'`src/freemap.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-freemap.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-freemap.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-freemap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/freemap.c' object='src/src_test_iobtree_1-freemap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-freemap.o `test -f 'src/freemap.c' || echo '$(srcdir)/'`src/freemap.c
+
+src/src_test_iobtree_1-freemap.obj: src/freemap.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-freemap.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-freemap.Tpo" -c -o src/src_test_iobtree_1-freemap.obj `if test -f 'src/freemap.c'; then $(CYGPATH_W) 'src/freemap.c'; else $(CYGPATH_W) '$(srcdir)/src/freemap.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-freemap.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-freemap.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-freemap.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/freemap.c' object='src/src_test_iobtree_1-freemap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-freemap.obj `if test -f 'src/freemap.c'; then $(CYGPATH_W) 'src/freemap.c'; else $(CYGPATH_W) '$(srcdir)/src/freemap.c'; fi`
+
+src/src_test_iobtree_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Tpo" -c -o src/src_test_iobtree_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_iobtree_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_iobtree_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Tpo" -c -o src/src_test_iobtree_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_iobtree_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_iobtree_1-rbtree.o: src/rbtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-rbtree.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-rbtree.Tpo" -c -o src/src_test_iobtree_1-rbtree.o `test -f 'src/rbtree.c' || echo '$(srcdir)/'`src/rbtree.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-rbtree.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-rbtree.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-rbtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/rbtree.c' object='src/src_test_iobtree_1-rbtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-rbtree.o `test -f 'src/rbtree.c' || echo '$(srcdir)/'`src/rbtree.c
+
+src/src_test_iobtree_1-rbtree.obj: src/rbtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-rbtree.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-rbtree.Tpo" -c -o src/src_test_iobtree_1-rbtree.obj `if test -f 'src/rbtree.c'; then $(CYGPATH_W) 'src/rbtree.c'; else $(CYGPATH_W) '$(srcdir)/src/rbtree.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-rbtree.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-rbtree.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-rbtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/rbtree.c' object='src/src_test_iobtree_1-rbtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-rbtree.obj `if test -f 'src/rbtree.c'; then $(CYGPATH_W) 'src/rbtree.c'; else $(CYGPATH_W) '$(srcdir)/src/rbtree.c'; fi`
+
+src/src_test_iobtree_1-getmaxfsize.o: src/getmaxfsize.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-getmaxfsize.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Tpo" -c -o src/src_test_iobtree_1-getmaxfsize.o `test -f 'src/getmaxfsize.c' || echo '$(srcdir)/'`src/getmaxfsize.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getmaxfsize.c' object='src/src_test_iobtree_1-getmaxfsize.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-getmaxfsize.o `test -f 'src/getmaxfsize.c' || echo '$(srcdir)/'`src/getmaxfsize.c
+
+src/src_test_iobtree_1-getmaxfsize.obj: src/getmaxfsize.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-getmaxfsize.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Tpo" -c -o src/src_test_iobtree_1-getmaxfsize.obj `if test -f 'src/getmaxfsize.c'; then $(CYGPATH_W) 'src/getmaxfsize.c'; else $(CYGPATH_W) '$(srcdir)/src/getmaxfsize.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-getmaxfsize.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getmaxfsize.c' object='src/src_test_iobtree_1-getmaxfsize.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-getmaxfsize.obj `if test -f 'src/getmaxfsize.c'; then $(CYGPATH_W) 'src/getmaxfsize.c'; else $(CYGPATH_W) '$(srcdir)/src/getmaxfsize.c'; fi`
+
+src/src_test_iobtree_1-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-mem.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-mem.Tpo" -c -o src/src_test_iobtree_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-mem.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_iobtree_1-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/src_test_iobtree_1-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-mem.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-mem.Tpo" -c -o src/src_test_iobtree_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-mem.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_iobtree_1-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/src_test_iobtree_1-stack.o: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-stack.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-stack.Tpo" -c -o src/src_test_iobtree_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-stack.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_iobtree_1-stack.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c
+
+src/src_test_iobtree_1-stack.obj: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-stack.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-stack.Tpo" -c -o src/src_test_iobtree_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-stack.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_iobtree_1-stack.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`
+
+src/src_test_iobtree_1-lcrand.o: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-lcrand.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-lcrand.Tpo" -c -o src/src_test_iobtree_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_iobtree_1-lcrand.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c
+
+src/src_test_iobtree_1-lcrand.obj: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-lcrand.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-lcrand.Tpo" -c -o src/src_test_iobtree_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_iobtree_1-lcrand.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`
+
+src/src_test_iobtree_1-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-objalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-objalloc.Tpo" -c -o src/src_test_iobtree_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_iobtree_1-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/src_test_iobtree_1-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-objalloc.Tpo" -c -o src/src_test_iobtree_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_iobtree_1-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/src_test_iobtree_1-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-alloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-alloc.Tpo" -c -o src/src_test_iobtree_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-alloc.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_iobtree_1-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/src_test_iobtree_1-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_iobtree_1-alloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_iobtree_1-alloc.Tpo" -c -o src/src_test_iobtree_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_iobtree_1-alloc.Tpo" "src/$(DEPDIR)/src_test_iobtree_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_iobtree_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_iobtree_1-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_iobtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_iobtree_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/test/src_test_mem_1-mem_1.o: src/test/mem_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_mem_1-mem_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_mem_1-mem_1.Tpo" -c -o src/test/src_test_mem_1-mem_1.o `test -f 'src/test/mem_1.c' || echo '$(srcdir)/'`src/test/mem_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_mem_1-mem_1.Tpo" "src/test/$(DEPDIR)/src_test_mem_1-mem_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_mem_1-mem_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/mem_1.c' object='src/test/src_test_mem_1-mem_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_mem_1-mem_1.o `test -f 'src/test/mem_1.c' || echo '$(srcdir)/'`src/test/mem_1.c
+
+src/test/src_test_mem_1-mem_1.obj: src/test/mem_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_mem_1-mem_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_mem_1-mem_1.Tpo" -c -o src/test/src_test_mem_1-mem_1.obj `if test -f 'src/test/mem_1.c'; then $(CYGPATH_W) 'src/test/mem_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/mem_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_mem_1-mem_1.Tpo" "src/test/$(DEPDIR)/src_test_mem_1-mem_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_mem_1-mem_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/mem_1.c' object='src/test/src_test_mem_1-mem_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_mem_1-mem_1.obj `if test -f 'src/test/mem_1.c'; then $(CYGPATH_W) 'src/test/mem_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/mem_1.c'; fi`
+
+src/src_test_mem_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-test.Tpo" -c -o src/src_test_mem_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-test.Tpo" "src/$(DEPDIR)/src_test_mem_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_mem_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_mem_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-test.Tpo" -c -o src/src_test_mem_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-test.Tpo" "src/$(DEPDIR)/src_test_mem_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_mem_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/src_test_mem_1-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-mem.o -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-mem.Tpo" -c -o src/src_test_mem_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-mem.Tpo" "src/$(DEPDIR)/src_test_mem_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_mem_1-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/src_test_mem_1-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-mem.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-mem.Tpo" -c -o src/src_test_mem_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-mem.Tpo" "src/$(DEPDIR)/src_test_mem_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_mem_1-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/src_test_mem_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-getlongopt.Tpo" -c -o src/src_test_mem_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_mem_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_mem_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_mem_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-getlongopt.Tpo" -c -o src/src_test_mem_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_mem_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_mem_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_mem_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-str.Tpo" -c -o src/src_test_mem_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-str.Tpo" "src/$(DEPDIR)/src_test_mem_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_mem_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_mem_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-str.Tpo" -c -o src/src_test_mem_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-str.Tpo" "src/$(DEPDIR)/src_test_mem_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_mem_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_mem_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-bit.Tpo" -c -o src/src_test_mem_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-bit.Tpo" "src/$(DEPDIR)/src_test_mem_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_mem_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_mem_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -MT src/src_test_mem_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mem_1-bit.Tpo" -c -o src/src_test_mem_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mem_1-bit.Tpo" "src/$(DEPDIR)/src_test_mem_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_mem_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_mem_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mem_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mem_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_mlparse_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/src_test_mlparse_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_mlparse_1-test.Tpo" -c -o src/src_test_mlparse_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mlparse_1-test.Tpo" "src/$(DEPDIR)/src_test_mlparse_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_mlparse_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_mlparse_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mlparse_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_mlparse_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/src_test_mlparse_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mlparse_1-test.Tpo" -c -o src/src_test_mlparse_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mlparse_1-test.Tpo" "src/$(DEPDIR)/src_test_mlparse_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_mlparse_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_mlparse_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mlparse_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/test/src_test_mlparse_1-mlparse_1.o: src/test/mlparse_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_mlparse_1-mlparse_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Tpo" -c -o src/test/src_test_mlparse_1-mlparse_1.o `test -f 'src/test/mlparse_1.c' || echo '$(srcdir)/'`src/test/mlparse_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Tpo" "src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/mlparse_1.c' object='src/test/src_test_mlparse_1-mlparse_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_mlparse_1-mlparse_1.o `test -f 'src/test/mlparse_1.c' || echo '$(srcdir)/'`src/test/mlparse_1.c
+
+src/test/src_test_mlparse_1-mlparse_1.obj: src/test/mlparse_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_mlparse_1-mlparse_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Tpo" -c -o src/test/src_test_mlparse_1-mlparse_1.obj `if test -f 'src/test/mlparse_1.c'; then $(CYGPATH_W) 'src/test/mlparse_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/mlparse_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Tpo" "src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_mlparse_1-mlparse_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/mlparse_1.c' object='src/test/src_test_mlparse_1-mlparse_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_mlparse_1-mlparse_1.obj `if test -f 'src/test/mlparse_1.c'; then $(CYGPATH_W) 'src/test/mlparse_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/mlparse_1.c'; fi`
+
+src/src_test_mlparse_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/src_test_mlparse_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_mlparse_1-str.Tpo" -c -o src/src_test_mlparse_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mlparse_1-str.Tpo" "src/$(DEPDIR)/src_test_mlparse_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_mlparse_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_mlparse_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mlparse_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_mlparse_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/src_test_mlparse_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mlparse_1-str.Tpo" -c -o src/src_test_mlparse_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mlparse_1-str.Tpo" "src/$(DEPDIR)/src_test_mlparse_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_mlparse_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_mlparse_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mlparse_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_mlparse_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/src_test_mlparse_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Tpo" -c -o src/src_test_mlparse_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_mlparse_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mlparse_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_mlparse_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/src_test_mlparse_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Tpo" -c -o src/src_test_mlparse_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_mlparse_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_mlparse_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mlparse_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_mlparse_1-mlparse.o: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/src_test_mlparse_1-mlparse.o -MD -MP -MF "src/$(DEPDIR)/src_test_mlparse_1-mlparse.Tpo" -c -o src/src_test_mlparse_1-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mlparse_1-mlparse.Tpo" "src/$(DEPDIR)/src_test_mlparse_1-mlparse.Po"; else rm -f "src/$(DEPDIR)/src_test_mlparse_1-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/src_test_mlparse_1-mlparse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mlparse_1-mlparse.o `test -f 'src/mlparse.c' || echo '$(srcdir)/'`src/mlparse.c
+
+src/src_test_mlparse_1-mlparse.obj: src/mlparse.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -MT src/src_test_mlparse_1-mlparse.obj -MD -MP -MF "src/$(DEPDIR)/src_test_mlparse_1-mlparse.Tpo" -c -o src/src_test_mlparse_1-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_mlparse_1-mlparse.Tpo" "src/$(DEPDIR)/src_test_mlparse_1-mlparse.Po"; else rm -f "src/$(DEPDIR)/src_test_mlparse_1-mlparse.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mlparse.c' object='src/src_test_mlparse_1-mlparse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_mlparse_1_CFLAGS) $(CFLAGS) -c -o src/src_test_mlparse_1-mlparse.obj `if test -f 'src/mlparse.c'; then $(CYGPATH_W) 'src/mlparse.c'; else $(CYGPATH_W) '$(srcdir)/src/mlparse.c'; fi`
+
+src/src_test_poolalloc_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-test.Tpo" -c -o src/src_test_poolalloc_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-test.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_poolalloc_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_poolalloc_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-test.Tpo" -c -o src/src_test_poolalloc_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-test.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_poolalloc_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/test/src_test_poolalloc_1-poolalloc_1.o: src/test/poolalloc_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_poolalloc_1-poolalloc_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Tpo" -c -o src/test/src_test_poolalloc_1-poolalloc_1.o `test -f 'src/test/poolalloc_1.c' || echo '$(srcdir)/'`src/test/poolalloc_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Tpo" "src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/poolalloc_1.c' object='src/test/src_test_poolalloc_1-poolalloc_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_poolalloc_1-poolalloc_1.o `test -f 'src/test/poolalloc_1.c' || echo '$(srcdir)/'`src/test/poolalloc_1.c
+
+src/test/src_test_poolalloc_1-poolalloc_1.obj: src/test/poolalloc_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_poolalloc_1-poolalloc_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Tpo" -c -o src/test/src_test_poolalloc_1-poolalloc_1.obj `if test -f 'src/test/poolalloc_1.c'; then $(CYGPATH_W) 'src/test/poolalloc_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/poolalloc_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Tpo" "src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_poolalloc_1-poolalloc_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/poolalloc_1.c' object='src/test/src_test_poolalloc_1-poolalloc_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_poolalloc_1-poolalloc_1.obj `if test -f 'src/test/poolalloc_1.c'; then $(CYGPATH_W) 'src/test/poolalloc_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/poolalloc_1.c'; fi`
+
+src/src_test_poolalloc_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Tpo" -c -o src/src_test_poolalloc_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_poolalloc_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_poolalloc_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Tpo" -c -o src/src_test_poolalloc_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_poolalloc_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_poolalloc_1-error.o: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-error.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-error.Tpo" -c -o src/src_test_poolalloc_1-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-error.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-error.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/src_test_poolalloc_1-error.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c
+
+src/src_test_poolalloc_1-error.obj: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-error.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-error.Tpo" -c -o src/src_test_poolalloc_1-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-error.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-error.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/src_test_poolalloc_1-error.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`
+
+src/src_test_poolalloc_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-str.Tpo" -c -o src/src_test_poolalloc_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-str.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_poolalloc_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_poolalloc_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-str.Tpo" -c -o src/src_test_poolalloc_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-str.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_poolalloc_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_poolalloc_1-poolalloc.o: src/poolalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-poolalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Tpo" -c -o src/src_test_poolalloc_1-poolalloc.o `test -f 'src/poolalloc.c' || echo '$(srcdir)/'`src/poolalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/poolalloc.c' object='src/src_test_poolalloc_1-poolalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-poolalloc.o `test -f 'src/poolalloc.c' || echo '$(srcdir)/'`src/poolalloc.c
+
+src/src_test_poolalloc_1-poolalloc.obj: src/poolalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-poolalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Tpo" -c -o src/src_test_poolalloc_1-poolalloc.obj `if test -f 'src/poolalloc.c'; then $(CYGPATH_W) 'src/poolalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/poolalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-poolalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/poolalloc.c' object='src/src_test_poolalloc_1-poolalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-poolalloc.obj `if test -f 'src/poolalloc.c'; then $(CYGPATH_W) 'src/poolalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/poolalloc.c'; fi`
+
+src/src_test_poolalloc_1-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-chash.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-chash.Tpo" -c -o src/src_test_poolalloc_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-chash.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_poolalloc_1-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/src_test_poolalloc_1-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-chash.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-chash.Tpo" -c -o src/src_test_poolalloc_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-chash.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_poolalloc_1-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/src_test_poolalloc_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-bit.Tpo" -c -o src/src_test_poolalloc_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-bit.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_poolalloc_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_poolalloc_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-bit.Tpo" -c -o src/src_test_poolalloc_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-bit.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_poolalloc_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_poolalloc_1-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-objalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Tpo" -c -o src/src_test_poolalloc_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_poolalloc_1-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/src_test_poolalloc_1-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Tpo" -c -o src/src_test_poolalloc_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_poolalloc_1-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/src_test_poolalloc_1-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-mem.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-mem.Tpo" -c -o src/src_test_poolalloc_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-mem.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_poolalloc_1-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/src_test_poolalloc_1-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-mem.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-mem.Tpo" -c -o src/src_test_poolalloc_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-mem.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_poolalloc_1-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/src_test_poolalloc_1-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-alloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-alloc.Tpo" -c -o src/src_test_poolalloc_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-alloc.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_poolalloc_1-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/src_test_poolalloc_1-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -MT src/src_test_poolalloc_1-alloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_poolalloc_1-alloc.Tpo" -c -o src/src_test_poolalloc_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_poolalloc_1-alloc.Tpo" "src/$(DEPDIR)/src_test_poolalloc_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_poolalloc_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_poolalloc_1-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_poolalloc_1_CFLAGS) $(CFLAGS) -c -o src/src_test_poolalloc_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/src_test_rbtree_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-test.Tpo" -c -o src/src_test_rbtree_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-test.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_rbtree_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_rbtree_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-test.Tpo" -c -o src/src_test_rbtree_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-test.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_rbtree_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/test/src_test_rbtree_1-rbtree_1.o: src/test/rbtree_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_rbtree_1-rbtree_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Tpo" -c -o src/test/src_test_rbtree_1-rbtree_1.o `test -f 'src/test/rbtree_1.c' || echo '$(srcdir)/'`src/test/rbtree_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Tpo" "src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/rbtree_1.c' object='src/test/src_test_rbtree_1-rbtree_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_rbtree_1-rbtree_1.o `test -f 'src/test/rbtree_1.c' || echo '$(srcdir)/'`src/test/rbtree_1.c
+
+src/test/src_test_rbtree_1-rbtree_1.obj: src/test/rbtree_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_rbtree_1-rbtree_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Tpo" -c -o src/test/src_test_rbtree_1-rbtree_1.obj `if test -f 'src/test/rbtree_1.c'; then $(CYGPATH_W) 'src/test/rbtree_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/rbtree_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Tpo" "src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_rbtree_1-rbtree_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/rbtree_1.c' object='src/test/src_test_rbtree_1-rbtree_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_rbtree_1-rbtree_1.obj `if test -f 'src/test/rbtree_1.c'; then $(CYGPATH_W) 'src/test/rbtree_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/rbtree_1.c'; fi`
+
+src/src_test_rbtree_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-str.Tpo" -c -o src/src_test_rbtree_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-str.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_rbtree_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_rbtree_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-str.Tpo" -c -o src/src_test_rbtree_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-str.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_rbtree_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_rbtree_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Tpo" -c -o src/src_test_rbtree_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_rbtree_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_rbtree_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Tpo" -c -o src/src_test_rbtree_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_rbtree_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_rbtree_1-stack.o: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-stack.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-stack.Tpo" -c -o src/src_test_rbtree_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-stack.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_rbtree_1-stack.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c
+
+src/src_test_rbtree_1-stack.obj: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-stack.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-stack.Tpo" -c -o src/src_test_rbtree_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-stack.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_rbtree_1-stack.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`
+
+src/src_test_rbtree_1-rbtree.o: src/rbtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-rbtree.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-rbtree.Tpo" -c -o src/src_test_rbtree_1-rbtree.o `test -f 'src/rbtree.c' || echo '$(srcdir)/'`src/rbtree.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-rbtree.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-rbtree.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-rbtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/rbtree.c' object='src/src_test_rbtree_1-rbtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-rbtree.o `test -f 'src/rbtree.c' || echo '$(srcdir)/'`src/rbtree.c
+
+src/src_test_rbtree_1-rbtree.obj: src/rbtree.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-rbtree.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-rbtree.Tpo" -c -o src/src_test_rbtree_1-rbtree.obj `if test -f 'src/rbtree.c'; then $(CYGPATH_W) 'src/rbtree.c'; else $(CYGPATH_W) '$(srcdir)/src/rbtree.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-rbtree.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-rbtree.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-rbtree.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/rbtree.c' object='src/src_test_rbtree_1-rbtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-rbtree.obj `if test -f 'src/rbtree.c'; then $(CYGPATH_W) 'src/rbtree.c'; else $(CYGPATH_W) '$(srcdir)/src/rbtree.c'; fi`
+
+src/src_test_rbtree_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-bit.Tpo" -c -o src/src_test_rbtree_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-bit.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_rbtree_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_rbtree_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-bit.Tpo" -c -o src/src_test_rbtree_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-bit.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_rbtree_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_rbtree_1-lcrand.o: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-lcrand.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-lcrand.Tpo" -c -o src/src_test_rbtree_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_rbtree_1-lcrand.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-lcrand.o `test -f 'src/lcrand.c' || echo '$(srcdir)/'`src/lcrand.c
+
+src/src_test_rbtree_1-lcrand.obj: src/lcrand.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-lcrand.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-lcrand.Tpo" -c -o src/src_test_rbtree_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-lcrand.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-lcrand.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-lcrand.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/lcrand.c' object='src/src_test_rbtree_1-lcrand.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-lcrand.obj `if test -f 'src/lcrand.c'; then $(CYGPATH_W) 'src/lcrand.c'; else $(CYGPATH_W) '$(srcdir)/src/lcrand.c'; fi`
+
+src/src_test_rbtree_1-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-objalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-objalloc.Tpo" -c -o src/src_test_rbtree_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_rbtree_1-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/src_test_rbtree_1-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-objalloc.Tpo" -c -o src/src_test_rbtree_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_rbtree_1-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/src_test_rbtree_1-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-mem.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-mem.Tpo" -c -o src/src_test_rbtree_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-mem.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_rbtree_1-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/src_test_rbtree_1-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-mem.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-mem.Tpo" -c -o src/src_test_rbtree_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-mem.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_rbtree_1-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/src_test_rbtree_1-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-alloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-alloc.Tpo" -c -o src/src_test_rbtree_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-alloc.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_rbtree_1-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/src_test_rbtree_1-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -MT src/src_test_rbtree_1-alloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_rbtree_1-alloc.Tpo" -c -o src/src_test_rbtree_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_rbtree_1-alloc.Tpo" "src/$(DEPDIR)/src_test_rbtree_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_rbtree_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_rbtree_1-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_rbtree_1_CFLAGS) $(CFLAGS) -c -o src/src_test_rbtree_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/src_test_stack_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/src_test_stack_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_stack_1-test.Tpo" -c -o src/src_test_stack_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stack_1-test.Tpo" "src/$(DEPDIR)/src_test_stack_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_stack_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_stack_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stack_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_stack_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/src_test_stack_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stack_1-test.Tpo" -c -o src/src_test_stack_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stack_1-test.Tpo" "src/$(DEPDIR)/src_test_stack_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_stack_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_stack_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stack_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/test/src_test_stack_1-stack_1.o: src/test/stack_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_stack_1-stack_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_stack_1-stack_1.Tpo" -c -o src/test/src_test_stack_1-stack_1.o `test -f 'src/test/stack_1.c' || echo '$(srcdir)/'`src/test/stack_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_stack_1-stack_1.Tpo" "src/test/$(DEPDIR)/src_test_stack_1-stack_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_stack_1-stack_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/stack_1.c' object='src/test/src_test_stack_1-stack_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_stack_1-stack_1.o `test -f 'src/test/stack_1.c' || echo '$(srcdir)/'`src/test/stack_1.c
+
+src/test/src_test_stack_1-stack_1.obj: src/test/stack_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_stack_1-stack_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_stack_1-stack_1.Tpo" -c -o src/test/src_test_stack_1-stack_1.obj `if test -f 'src/test/stack_1.c'; then $(CYGPATH_W) 'src/test/stack_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/stack_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_stack_1-stack_1.Tpo" "src/test/$(DEPDIR)/src_test_stack_1-stack_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_stack_1-stack_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/stack_1.c' object='src/test/src_test_stack_1-stack_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_stack_1-stack_1.obj `if test -f 'src/test/stack_1.c'; then $(CYGPATH_W) 'src/test/stack_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/stack_1.c'; fi`
+
+src/src_test_stack_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/src_test_stack_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_stack_1-str.Tpo" -c -o src/src_test_stack_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stack_1-str.Tpo" "src/$(DEPDIR)/src_test_stack_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_stack_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_stack_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stack_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_stack_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/src_test_stack_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stack_1-str.Tpo" -c -o src/src_test_stack_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stack_1-str.Tpo" "src/$(DEPDIR)/src_test_stack_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_stack_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_stack_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stack_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_stack_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/src_test_stack_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_stack_1-getlongopt.Tpo" -c -o src/src_test_stack_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stack_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_stack_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_stack_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_stack_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stack_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_stack_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/src_test_stack_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stack_1-getlongopt.Tpo" -c -o src/src_test_stack_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stack_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_stack_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_stack_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_stack_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stack_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_stack_1-stack.o: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/src_test_stack_1-stack.o -MD -MP -MF "src/$(DEPDIR)/src_test_stack_1-stack.Tpo" -c -o src/src_test_stack_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stack_1-stack.Tpo" "src/$(DEPDIR)/src_test_stack_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_stack_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_stack_1-stack.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stack_1-stack.o `test -f 'src/stack.c' || echo '$(srcdir)/'`src/stack.c
+
+src/src_test_stack_1-stack.obj: src/stack.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -MT src/src_test_stack_1-stack.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stack_1-stack.Tpo" -c -o src/src_test_stack_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stack_1-stack.Tpo" "src/$(DEPDIR)/src_test_stack_1-stack.Po"; else rm -f "src/$(DEPDIR)/src_test_stack_1-stack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stack.c' object='src/src_test_stack_1-stack.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stack_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stack_1-stack.obj `if test -f 'src/stack.c'; then $(CYGPATH_W) 'src/stack.c'; else $(CYGPATH_W) '$(srcdir)/src/stack.c'; fi`
+
+src/src_test_stop_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-test.Tpo" -c -o src/src_test_stop_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-test.Tpo" "src/$(DEPDIR)/src_test_stop_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_stop_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_stop_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-test.Tpo" -c -o src/src_test_stop_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-test.Tpo" "src/$(DEPDIR)/src_test_stop_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_stop_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/test/src_test_stop_1-stop_1.o: src/test/stop_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_stop_1-stop_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_stop_1-stop_1.Tpo" -c -o src/test/src_test_stop_1-stop_1.o `test -f 'src/test/stop_1.c' || echo '$(srcdir)/'`src/test/stop_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_stop_1-stop_1.Tpo" "src/test/$(DEPDIR)/src_test_stop_1-stop_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_stop_1-stop_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/stop_1.c' object='src/test/src_test_stop_1-stop_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_stop_1-stop_1.o `test -f 'src/test/stop_1.c' || echo '$(srcdir)/'`src/test/stop_1.c
+
+src/test/src_test_stop_1-stop_1.obj: src/test/stop_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_stop_1-stop_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_stop_1-stop_1.Tpo" -c -o src/test/src_test_stop_1-stop_1.obj `if test -f 'src/test/stop_1.c'; then $(CYGPATH_W) 'src/test/stop_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/stop_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_stop_1-stop_1.Tpo" "src/test/$(DEPDIR)/src_test_stop_1-stop_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_stop_1-stop_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/stop_1.c' object='src/test/src_test_stop_1-stop_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_stop_1-stop_1.obj `if test -f 'src/test/stop_1.c'; then $(CYGPATH_W) 'src/test/stop_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/stop_1.c'; fi`
+
+src/src_test_stop_1-stop.o: src/stop.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-stop.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-stop.Tpo" -c -o src/src_test_stop_1-stop.o `test -f 'src/stop.c' || echo '$(srcdir)/'`src/stop.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-stop.Tpo" "src/$(DEPDIR)/src_test_stop_1-stop.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-stop.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stop.c' object='src/src_test_stop_1-stop.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-stop.o `test -f 'src/stop.c' || echo '$(srcdir)/'`src/stop.c
+
+src/src_test_stop_1-stop.obj: src/stop.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-stop.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-stop.Tpo" -c -o src/src_test_stop_1-stop.obj `if test -f 'src/stop.c'; then $(CYGPATH_W) 'src/stop.c'; else $(CYGPATH_W) '$(srcdir)/src/stop.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-stop.Tpo" "src/$(DEPDIR)/src_test_stop_1-stop.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-stop.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stop.c' object='src/src_test_stop_1-stop.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-stop.obj `if test -f 'src/stop.c'; then $(CYGPATH_W) 'src/stop.c'; else $(CYGPATH_W) '$(srcdir)/src/stop.c'; fi`
+
+src/src_test_stop_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-getlongopt.Tpo" -c -o src/src_test_stop_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_stop_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_stop_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_stop_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-getlongopt.Tpo" -c -o src/src_test_stop_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_stop_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_stop_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/src_test_stop_1-error.o: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-error.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-error.Tpo" -c -o src/src_test_stop_1-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-error.Tpo" "src/$(DEPDIR)/src_test_stop_1-error.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/src_test_stop_1-error.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-error.o `test -f 'src/error.c' || echo '$(srcdir)/'`src/error.c
+
+src/src_test_stop_1-error.obj: src/error.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-error.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-error.Tpo" -c -o src/src_test_stop_1-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-error.Tpo" "src/$(DEPDIR)/src_test_stop_1-error.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/error.c' object='src/src_test_stop_1-error.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-error.obj `if test -f 'src/error.c'; then $(CYGPATH_W) 'src/error.c'; else $(CYGPATH_W) '$(srcdir)/src/error.c'; fi`
+
+src/src_test_stop_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-str.Tpo" -c -o src/src_test_stop_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-str.Tpo" "src/$(DEPDIR)/src_test_stop_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_stop_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_stop_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-str.Tpo" -c -o src/src_test_stop_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-str.Tpo" "src/$(DEPDIR)/src_test_stop_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_stop_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_stop_1-poolalloc.o: src/poolalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-poolalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-poolalloc.Tpo" -c -o src/src_test_stop_1-poolalloc.o `test -f 'src/poolalloc.c' || echo '$(srcdir)/'`src/poolalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-poolalloc.Tpo" "src/$(DEPDIR)/src_test_stop_1-poolalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-poolalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/poolalloc.c' object='src/src_test_stop_1-poolalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-poolalloc.o `test -f 'src/poolalloc.c' || echo '$(srcdir)/'`src/poolalloc.c
+
+src/src_test_stop_1-poolalloc.obj: src/poolalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-poolalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-poolalloc.Tpo" -c -o src/src_test_stop_1-poolalloc.obj `if test -f 'src/poolalloc.c'; then $(CYGPATH_W) 'src/poolalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/poolalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-poolalloc.Tpo" "src/$(DEPDIR)/src_test_stop_1-poolalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-poolalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/poolalloc.c' object='src/src_test_stop_1-poolalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-poolalloc.obj `if test -f 'src/poolalloc.c'; then $(CYGPATH_W) 'src/poolalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/poolalloc.c'; fi`
+
+src/src_test_stop_1-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-chash.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-chash.Tpo" -c -o src/src_test_stop_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-chash.Tpo" "src/$(DEPDIR)/src_test_stop_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_stop_1-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/src_test_stop_1-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-chash.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-chash.Tpo" -c -o src/src_test_stop_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-chash.Tpo" "src/$(DEPDIR)/src_test_stop_1-chash.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/src_test_stop_1-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/src_test_stop_1-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-bit.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-bit.Tpo" -c -o src/src_test_stop_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-bit.Tpo" "src/$(DEPDIR)/src_test_stop_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_stop_1-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/src_test_stop_1-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-bit.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-bit.Tpo" -c -o src/src_test_stop_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-bit.Tpo" "src/$(DEPDIR)/src_test_stop_1-bit.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/src_test_stop_1-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/src_test_stop_1-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-objalloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-objalloc.Tpo" -c -o src/src_test_stop_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_stop_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_stop_1-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/src_test_stop_1-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-objalloc.Tpo" -c -o src/src_test_stop_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-objalloc.Tpo" "src/$(DEPDIR)/src_test_stop_1-objalloc.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/src_test_stop_1-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/src_test_stop_1-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-mem.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-mem.Tpo" -c -o src/src_test_stop_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-mem.Tpo" "src/$(DEPDIR)/src_test_stop_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_stop_1-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/src_test_stop_1-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-mem.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-mem.Tpo" -c -o src/src_test_stop_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-mem.Tpo" "src/$(DEPDIR)/src_test_stop_1-mem.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/src_test_stop_1-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/src_test_stop_1-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-alloc.o -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-alloc.Tpo" -c -o src/src_test_stop_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-alloc.Tpo" "src/$(DEPDIR)/src_test_stop_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_stop_1-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/src_test_stop_1-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -MT src/src_test_stop_1-alloc.obj -MD -MP -MF "src/$(DEPDIR)/src_test_stop_1-alloc.Tpo" -c -o src/src_test_stop_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_stop_1-alloc.Tpo" "src/$(DEPDIR)/src_test_stop_1-alloc.Po"; else rm -f "src/$(DEPDIR)/src_test_stop_1-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/src_test_stop_1-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_stop_1_CFLAGS) $(CFLAGS) -c -o src/src_test_stop_1-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/test/src_test_str_1-str_1.o: src/test/str_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_str_1-str_1.o -MD -MP -MF "src/test/$(DEPDIR)/src_test_str_1-str_1.Tpo" -c -o src/test/src_test_str_1-str_1.o `test -f 'src/test/str_1.c' || echo '$(srcdir)/'`src/test/str_1.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_str_1-str_1.Tpo" "src/test/$(DEPDIR)/src_test_str_1-str_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_str_1-str_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/str_1.c' object='src/test/src_test_str_1-str_1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_str_1-str_1.o `test -f 'src/test/str_1.c' || echo '$(srcdir)/'`src/test/str_1.c
+
+src/test/src_test_str_1-str_1.obj: src/test/str_1.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -MT src/test/src_test_str_1-str_1.obj -MD -MP -MF "src/test/$(DEPDIR)/src_test_str_1-str_1.Tpo" -c -o src/test/src_test_str_1-str_1.obj `if test -f 'src/test/str_1.c'; then $(CYGPATH_W) 'src/test/str_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/str_1.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/test/$(DEPDIR)/src_test_str_1-str_1.Tpo" "src/test/$(DEPDIR)/src_test_str_1-str_1.Po"; else rm -f "src/test/$(DEPDIR)/src_test_str_1-str_1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test/str_1.c' object='src/test/src_test_str_1-str_1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -c -o src/test/src_test_str_1-str_1.obj `if test -f 'src/test/str_1.c'; then $(CYGPATH_W) 'src/test/str_1.c'; else $(CYGPATH_W) '$(srcdir)/src/test/str_1.c'; fi`
+
+src/src_test_str_1-test.o: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -MT src/src_test_str_1-test.o -MD -MP -MF "src/$(DEPDIR)/src_test_str_1-test.Tpo" -c -o src/src_test_str_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_str_1-test.Tpo" "src/$(DEPDIR)/src_test_str_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_str_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_str_1-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -c -o src/src_test_str_1-test.o `test -f 'src/test.c' || echo '$(srcdir)/'`src/test.c
+
+src/src_test_str_1-test.obj: src/test.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -MT src/src_test_str_1-test.obj -MD -MP -MF "src/$(DEPDIR)/src_test_str_1-test.Tpo" -c -o src/src_test_str_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_str_1-test.Tpo" "src/$(DEPDIR)/src_test_str_1-test.Po"; else rm -f "src/$(DEPDIR)/src_test_str_1-test.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/test.c' object='src/src_test_str_1-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -c -o src/src_test_str_1-test.obj `if test -f 'src/test.c'; then $(CYGPATH_W) 'src/test.c'; else $(CYGPATH_W) '$(srcdir)/src/test.c'; fi`
+
+src/src_test_str_1-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -MT src/src_test_str_1-str.o -MD -MP -MF "src/$(DEPDIR)/src_test_str_1-str.Tpo" -c -o src/src_test_str_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_str_1-str.Tpo" "src/$(DEPDIR)/src_test_str_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_str_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_str_1-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -c -o src/src_test_str_1-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/src_test_str_1-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -MT src/src_test_str_1-str.obj -MD -MP -MF "src/$(DEPDIR)/src_test_str_1-str.Tpo" -c -o src/src_test_str_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_str_1-str.Tpo" "src/$(DEPDIR)/src_test_str_1-str.Po"; else rm -f "src/$(DEPDIR)/src_test_str_1-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/src_test_str_1-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -c -o src/src_test_str_1-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/src_test_str_1-getlongopt.o: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -MT src/src_test_str_1-getlongopt.o -MD -MP -MF "src/$(DEPDIR)/src_test_str_1-getlongopt.Tpo" -c -o src/src_test_str_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_str_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_str_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_str_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_str_1-getlongopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -c -o src/src_test_str_1-getlongopt.o `test -f 'src/getlongopt.c' || echo '$(srcdir)/'`src/getlongopt.c
+
+src/src_test_str_1-getlongopt.obj: src/getlongopt.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -MT src/src_test_str_1-getlongopt.obj -MD -MP -MF "src/$(DEPDIR)/src_test_str_1-getlongopt.Tpo" -c -o src/src_test_str_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/src_test_str_1-getlongopt.Tpo" "src/$(DEPDIR)/src_test_str_1-getlongopt.Po"; else rm -f "src/$(DEPDIR)/src_test_str_1-getlongopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/getlongopt.c' object='src/src_test_str_1-getlongopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_test_str_1_CFLAGS) $(CFLAGS) -c -o src/src_test_str_1-getlongopt.obj `if test -f 'src/getlongopt.c'; then $(CYGPATH_W) 'src/getlongopt.c'; else $(CYGPATH_W) '$(srcdir)/src/getlongopt.c'; fi`
+
+src/staticalloc_test-staticalloc.o: src/staticalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -MT src/staticalloc_test-staticalloc.o -MD -MP -MF "src/$(DEPDIR)/staticalloc_test-staticalloc.Tpo" -c -o src/staticalloc_test-staticalloc.o `test -f 'src/staticalloc.c' || echo '$(srcdir)/'`src/staticalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/staticalloc_test-staticalloc.Tpo" "src/$(DEPDIR)/staticalloc_test-staticalloc.Po"; else rm -f "src/$(DEPDIR)/staticalloc_test-staticalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/staticalloc.c' object='src/staticalloc_test-staticalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -c -o src/staticalloc_test-staticalloc.o `test -f 'src/staticalloc.c' || echo '$(srcdir)/'`src/staticalloc.c
+
+src/staticalloc_test-staticalloc.obj: src/staticalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -MT src/staticalloc_test-staticalloc.obj -MD -MP -MF "src/$(DEPDIR)/staticalloc_test-staticalloc.Tpo" -c -o src/staticalloc_test-staticalloc.obj `if test -f 'src/staticalloc.c'; then $(CYGPATH_W) 'src/staticalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/staticalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/staticalloc_test-staticalloc.Tpo" "src/$(DEPDIR)/staticalloc_test-staticalloc.Po"; else rm -f "src/$(DEPDIR)/staticalloc_test-staticalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/staticalloc.c' object='src/staticalloc_test-staticalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -c -o src/staticalloc_test-staticalloc.obj `if test -f 'src/staticalloc.c'; then $(CYGPATH_W) 'src/staticalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/staticalloc.c'; fi`
+
+src/staticalloc_test-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -MT src/staticalloc_test-mem.o -MD -MP -MF "src/$(DEPDIR)/staticalloc_test-mem.Tpo" -c -o src/staticalloc_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/staticalloc_test-mem.Tpo" "src/$(DEPDIR)/staticalloc_test-mem.Po"; else rm -f "src/$(DEPDIR)/staticalloc_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/staticalloc_test-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -c -o src/staticalloc_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/staticalloc_test-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -MT src/staticalloc_test-mem.obj -MD -MP -MF "src/$(DEPDIR)/staticalloc_test-mem.Tpo" -c -o src/staticalloc_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/staticalloc_test-mem.Tpo" "src/$(DEPDIR)/staticalloc_test-mem.Po"; else rm -f "src/$(DEPDIR)/staticalloc_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/staticalloc_test-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -c -o src/staticalloc_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/staticalloc_test-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -MT src/staticalloc_test-bit.o -MD -MP -MF "src/$(DEPDIR)/staticalloc_test-bit.Tpo" -c -o src/staticalloc_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/staticalloc_test-bit.Tpo" "src/$(DEPDIR)/staticalloc_test-bit.Po"; else rm -f "src/$(DEPDIR)/staticalloc_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/staticalloc_test-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -c -o src/staticalloc_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/staticalloc_test-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -MT src/staticalloc_test-bit.obj -MD -MP -MF "src/$(DEPDIR)/staticalloc_test-bit.Tpo" -c -o src/staticalloc_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/staticalloc_test-bit.Tpo" "src/$(DEPDIR)/staticalloc_test-bit.Po"; else rm -f "src/$(DEPDIR)/staticalloc_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/staticalloc_test-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(staticalloc_test_CFLAGS) $(CFLAGS) -c -o src/staticalloc_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/stem_test-stem.o: src/stem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-stem.o -MD -MP -MF "src/$(DEPDIR)/stem_test-stem.Tpo" -c -o src/stem_test-stem.o `test -f 'src/stem.c' || echo '$(srcdir)/'`src/stem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-stem.Tpo" "src/$(DEPDIR)/stem_test-stem.Po"; else rm -f "src/$(DEPDIR)/stem_test-stem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stem.c' object='src/stem_test-stem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-stem.o `test -f 'src/stem.c' || echo '$(srcdir)/'`src/stem.c
+
+src/stem_test-stem.obj: src/stem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-stem.obj -MD -MP -MF "src/$(DEPDIR)/stem_test-stem.Tpo" -c -o src/stem_test-stem.obj `if test -f 'src/stem.c'; then $(CYGPATH_W) 'src/stem.c'; else $(CYGPATH_W) '$(srcdir)/src/stem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-stem.Tpo" "src/$(DEPDIR)/stem_test-stem.Po"; else rm -f "src/$(DEPDIR)/stem_test-stem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stem.c' object='src/stem_test-stem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-stem.obj `if test -f 'src/stem.c'; then $(CYGPATH_W) 'src/stem.c'; else $(CYGPATH_W) '$(srcdir)/src/stem.c'; fi`
+
+src/stem_test-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-chash.o -MD -MP -MF "src/$(DEPDIR)/stem_test-chash.Tpo" -c -o src/stem_test-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-chash.Tpo" "src/$(DEPDIR)/stem_test-chash.Po"; else rm -f "src/$(DEPDIR)/stem_test-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/stem_test-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/stem_test-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-chash.obj -MD -MP -MF "src/$(DEPDIR)/stem_test-chash.Tpo" -c -o src/stem_test-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-chash.Tpo" "src/$(DEPDIR)/stem_test-chash.Po"; else rm -f "src/$(DEPDIR)/stem_test-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/stem_test-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/stem_test-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-objalloc.o -MD -MP -MF "src/$(DEPDIR)/stem_test-objalloc.Tpo" -c -o src/stem_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-objalloc.Tpo" "src/$(DEPDIR)/stem_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/stem_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/stem_test-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/stem_test-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/stem_test-objalloc.Tpo" -c -o src/stem_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-objalloc.Tpo" "src/$(DEPDIR)/stem_test-objalloc.Po"; else rm -f "src/$(DEPDIR)/stem_test-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/stem_test-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/stem_test-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-mem.o -MD -MP -MF "src/$(DEPDIR)/stem_test-mem.Tpo" -c -o src/stem_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-mem.Tpo" "src/$(DEPDIR)/stem_test-mem.Po"; else rm -f "src/$(DEPDIR)/stem_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/stem_test-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/stem_test-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-mem.obj -MD -MP -MF "src/$(DEPDIR)/stem_test-mem.Tpo" -c -o src/stem_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-mem.Tpo" "src/$(DEPDIR)/stem_test-mem.Po"; else rm -f "src/$(DEPDIR)/stem_test-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/stem_test-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+src/stem_test-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-bit.o -MD -MP -MF "src/$(DEPDIR)/stem_test-bit.Tpo" -c -o src/stem_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-bit.Tpo" "src/$(DEPDIR)/stem_test-bit.Po"; else rm -f "src/$(DEPDIR)/stem_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/stem_test-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/stem_test-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-bit.obj -MD -MP -MF "src/$(DEPDIR)/stem_test-bit.Tpo" -c -o src/stem_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-bit.Tpo" "src/$(DEPDIR)/stem_test-bit.Po"; else rm -f "src/$(DEPDIR)/stem_test-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/stem_test-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/stem_test-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-str.o -MD -MP -MF "src/$(DEPDIR)/stem_test-str.Tpo" -c -o src/stem_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-str.Tpo" "src/$(DEPDIR)/stem_test-str.Po"; else rm -f "src/$(DEPDIR)/stem_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/stem_test-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/stem_test-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-str.obj -MD -MP -MF "src/$(DEPDIR)/stem_test-str.Tpo" -c -o src/stem_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-str.Tpo" "src/$(DEPDIR)/stem_test-str.Po"; else rm -f "src/$(DEPDIR)/stem_test-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/stem_test-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/stem_test-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-alloc.o -MD -MP -MF "src/$(DEPDIR)/stem_test-alloc.Tpo" -c -o src/stem_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-alloc.Tpo" "src/$(DEPDIR)/stem_test-alloc.Po"; else rm -f "src/$(DEPDIR)/stem_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/stem_test-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/stem_test-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -MT src/stem_test-alloc.obj -MD -MP -MF "src/$(DEPDIR)/stem_test-alloc.Tpo" -c -o src/stem_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stem_test-alloc.Tpo" "src/$(DEPDIR)/stem_test-alloc.Po"; else rm -f "src/$(DEPDIR)/stem_test-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/stem_test-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stem_test_CFLAGS) $(CFLAGS) -c -o src/stem_test-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/stop_gen-stop.o: src/stop.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-stop.o -MD -MP -MF "src/$(DEPDIR)/stop_gen-stop.Tpo" -c -o src/stop_gen-stop.o `test -f 'src/stop.c' || echo '$(srcdir)/'`src/stop.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-stop.Tpo" "src/$(DEPDIR)/stop_gen-stop.Po"; else rm -f "src/$(DEPDIR)/stop_gen-stop.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stop.c' object='src/stop_gen-stop.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-stop.o `test -f 'src/stop.c' || echo '$(srcdir)/'`src/stop.c
+
+src/stop_gen-stop.obj: src/stop.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-stop.obj -MD -MP -MF "src/$(DEPDIR)/stop_gen-stop.Tpo" -c -o src/stop_gen-stop.obj `if test -f 'src/stop.c'; then $(CYGPATH_W) 'src/stop.c'; else $(CYGPATH_W) '$(srcdir)/src/stop.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-stop.Tpo" "src/$(DEPDIR)/stop_gen-stop.Po"; else rm -f "src/$(DEPDIR)/stop_gen-stop.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/stop.c' object='src/stop_gen-stop.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-stop.obj `if test -f 'src/stop.c'; then $(CYGPATH_W) 'src/stop.c'; else $(CYGPATH_W) '$(srcdir)/src/stop.c'; fi`
+
+src/stop_gen-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-str.o -MD -MP -MF "src/$(DEPDIR)/stop_gen-str.Tpo" -c -o src/stop_gen-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-str.Tpo" "src/$(DEPDIR)/stop_gen-str.Po"; else rm -f "src/$(DEPDIR)/stop_gen-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/stop_gen-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/stop_gen-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-str.obj -MD -MP -MF "src/$(DEPDIR)/stop_gen-str.Tpo" -c -o src/stop_gen-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-str.Tpo" "src/$(DEPDIR)/stop_gen-str.Po"; else rm -f "src/$(DEPDIR)/stop_gen-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/stop_gen-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+src/stop_gen-poolalloc.o: src/poolalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-poolalloc.o -MD -MP -MF "src/$(DEPDIR)/stop_gen-poolalloc.Tpo" -c -o src/stop_gen-poolalloc.o `test -f 'src/poolalloc.c' || echo '$(srcdir)/'`src/poolalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-poolalloc.Tpo" "src/$(DEPDIR)/stop_gen-poolalloc.Po"; else rm -f "src/$(DEPDIR)/stop_gen-poolalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/poolalloc.c' object='src/stop_gen-poolalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-poolalloc.o `test -f 'src/poolalloc.c' || echo '$(srcdir)/'`src/poolalloc.c
+
+src/stop_gen-poolalloc.obj: src/poolalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-poolalloc.obj -MD -MP -MF "src/$(DEPDIR)/stop_gen-poolalloc.Tpo" -c -o src/stop_gen-poolalloc.obj `if test -f 'src/poolalloc.c'; then $(CYGPATH_W) 'src/poolalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/poolalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-poolalloc.Tpo" "src/$(DEPDIR)/stop_gen-poolalloc.Po"; else rm -f "src/$(DEPDIR)/stop_gen-poolalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/poolalloc.c' object='src/stop_gen-poolalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-poolalloc.obj `if test -f 'src/poolalloc.c'; then $(CYGPATH_W) 'src/poolalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/poolalloc.c'; fi`
+
+src/stop_gen-chash.o: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-chash.o -MD -MP -MF "src/$(DEPDIR)/stop_gen-chash.Tpo" -c -o src/stop_gen-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-chash.Tpo" "src/$(DEPDIR)/stop_gen-chash.Po"; else rm -f "src/$(DEPDIR)/stop_gen-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/stop_gen-chash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-chash.o `test -f 'src/chash.c' || echo '$(srcdir)/'`src/chash.c
+
+src/stop_gen-chash.obj: src/chash.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-chash.obj -MD -MP -MF "src/$(DEPDIR)/stop_gen-chash.Tpo" -c -o src/stop_gen-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-chash.Tpo" "src/$(DEPDIR)/stop_gen-chash.Po"; else rm -f "src/$(DEPDIR)/stop_gen-chash.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/chash.c' object='src/stop_gen-chash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-chash.obj `if test -f 'src/chash.c'; then $(CYGPATH_W) 'src/chash.c'; else $(CYGPATH_W) '$(srcdir)/src/chash.c'; fi`
+
+src/stop_gen-alloc.o: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-alloc.o -MD -MP -MF "src/$(DEPDIR)/stop_gen-alloc.Tpo" -c -o src/stop_gen-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-alloc.Tpo" "src/$(DEPDIR)/stop_gen-alloc.Po"; else rm -f "src/$(DEPDIR)/stop_gen-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/stop_gen-alloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-alloc.o `test -f 'src/alloc.c' || echo '$(srcdir)/'`src/alloc.c
+
+src/stop_gen-alloc.obj: src/alloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-alloc.obj -MD -MP -MF "src/$(DEPDIR)/stop_gen-alloc.Tpo" -c -o src/stop_gen-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-alloc.Tpo" "src/$(DEPDIR)/stop_gen-alloc.Po"; else rm -f "src/$(DEPDIR)/stop_gen-alloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/alloc.c' object='src/stop_gen-alloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-alloc.obj `if test -f 'src/alloc.c'; then $(CYGPATH_W) 'src/alloc.c'; else $(CYGPATH_W) '$(srcdir)/src/alloc.c'; fi`
+
+src/stop_gen-bit.o: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-bit.o -MD -MP -MF "src/$(DEPDIR)/stop_gen-bit.Tpo" -c -o src/stop_gen-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-bit.Tpo" "src/$(DEPDIR)/stop_gen-bit.Po"; else rm -f "src/$(DEPDIR)/stop_gen-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/stop_gen-bit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-bit.o `test -f 'src/bit.c' || echo '$(srcdir)/'`src/bit.c
+
+src/stop_gen-bit.obj: src/bit.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-bit.obj -MD -MP -MF "src/$(DEPDIR)/stop_gen-bit.Tpo" -c -o src/stop_gen-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-bit.Tpo" "src/$(DEPDIR)/stop_gen-bit.Po"; else rm -f "src/$(DEPDIR)/stop_gen-bit.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/bit.c' object='src/stop_gen-bit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-bit.obj `if test -f 'src/bit.c'; then $(CYGPATH_W) 'src/bit.c'; else $(CYGPATH_W) '$(srcdir)/src/bit.c'; fi`
+
+src/stop_gen-objalloc.o: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-objalloc.o -MD -MP -MF "src/$(DEPDIR)/stop_gen-objalloc.Tpo" -c -o src/stop_gen-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-objalloc.Tpo" "src/$(DEPDIR)/stop_gen-objalloc.Po"; else rm -f "src/$(DEPDIR)/stop_gen-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/stop_gen-objalloc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-objalloc.o `test -f 'src/objalloc.c' || echo '$(srcdir)/'`src/objalloc.c
+
+src/stop_gen-objalloc.obj: src/objalloc.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-objalloc.obj -MD -MP -MF "src/$(DEPDIR)/stop_gen-objalloc.Tpo" -c -o src/stop_gen-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-objalloc.Tpo" "src/$(DEPDIR)/stop_gen-objalloc.Po"; else rm -f "src/$(DEPDIR)/stop_gen-objalloc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/objalloc.c' object='src/stop_gen-objalloc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-objalloc.obj `if test -f 'src/objalloc.c'; then $(CYGPATH_W) 'src/objalloc.c'; else $(CYGPATH_W) '$(srcdir)/src/objalloc.c'; fi`
+
+src/stop_gen-mem.o: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-mem.o -MD -MP -MF "src/$(DEPDIR)/stop_gen-mem.Tpo" -c -o src/stop_gen-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-mem.Tpo" "src/$(DEPDIR)/stop_gen-mem.Po"; else rm -f "src/$(DEPDIR)/stop_gen-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/stop_gen-mem.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-mem.o `test -f 'src/mem.c' || echo '$(srcdir)/'`src/mem.c
+
+src/stop_gen-mem.obj: src/mem.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -MT src/stop_gen-mem.obj -MD -MP -MF "src/$(DEPDIR)/stop_gen-mem.Tpo" -c -o src/stop_gen-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/stop_gen-mem.Tpo" "src/$(DEPDIR)/stop_gen-mem.Po"; else rm -f "src/$(DEPDIR)/stop_gen-mem.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mem.c' object='src/stop_gen-mem.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stop_gen_CFLAGS) $(CFLAGS) -c -o src/stop_gen-mem.obj `if test -f 'src/mem.c'; then $(CYGPATH_W) 'src/mem.c'; else $(CYGPATH_W) '$(srcdir)/src/mem.c'; fi`
+
+tools/zet_file-file.o: tools/file.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -MT tools/zet_file-file.o -MD -MP -MF "tools/$(DEPDIR)/zet_file-file.Tpo" -c -o tools/zet_file-file.o `test -f 'tools/file.c' || echo '$(srcdir)/'`tools/file.c; \
+@am__fastdepCC_TRUE@   then mv -f "tools/$(DEPDIR)/zet_file-file.Tpo" "tools/$(DEPDIR)/zet_file-file.Po"; else rm -f "tools/$(DEPDIR)/zet_file-file.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='tools/file.c' object='tools/zet_file-file.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -c -o tools/zet_file-file.o `test -f 'tools/file.c' || echo '$(srcdir)/'`tools/file.c
+
+tools/zet_file-file.obj: tools/file.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -MT tools/zet_file-file.obj -MD -MP -MF "tools/$(DEPDIR)/zet_file-file.Tpo" -c -o tools/zet_file-file.obj `if test -f 'tools/file.c'; then $(CYGPATH_W) 'tools/file.c'; else $(CYGPATH_W) '$(srcdir)/tools/file.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "tools/$(DEPDIR)/zet_file-file.Tpo" "tools/$(DEPDIR)/zet_file-file.Po"; else rm -f "tools/$(DEPDIR)/zet_file-file.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='tools/file.c' object='tools/zet_file-file.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -c -o tools/zet_file-file.obj `if test -f 'tools/file.c'; then $(CYGPATH_W) 'tools/file.c'; else $(CYGPATH_W) '$(srcdir)/tools/file.c'; fi`
+
+src/zet_file-mime.o: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -MT src/zet_file-mime.o -MD -MP -MF "src/$(DEPDIR)/zet_file-mime.Tpo" -c -o src/zet_file-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/zet_file-mime.Tpo" "src/$(DEPDIR)/zet_file-mime.Po"; else rm -f "src/$(DEPDIR)/zet_file-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/zet_file-mime.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -c -o src/zet_file-mime.o `test -f 'src/mime.c' || echo '$(srcdir)/'`src/mime.c
+
+src/zet_file-mime.obj: src/mime.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -MT src/zet_file-mime.obj -MD -MP -MF "src/$(DEPDIR)/zet_file-mime.Tpo" -c -o src/zet_file-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/zet_file-mime.Tpo" "src/$(DEPDIR)/zet_file-mime.Po"; else rm -f "src/$(DEPDIR)/zet_file-mime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/mime.c' object='src/zet_file-mime.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -c -o src/zet_file-mime.obj `if test -f 'src/mime.c'; then $(CYGPATH_W) 'src/mime.c'; else $(CYGPATH_W) '$(srcdir)/src/mime.c'; fi`
+
+src/zet_file-str.o: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -MT src/zet_file-str.o -MD -MP -MF "src/$(DEPDIR)/zet_file-str.Tpo" -c -o src/zet_file-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/zet_file-str.Tpo" "src/$(DEPDIR)/zet_file-str.Po"; else rm -f "src/$(DEPDIR)/zet_file-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/zet_file-str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -c -o src/zet_file-str.o `test -f 'src/str.c' || echo '$(srcdir)/'`src/str.c
+
+src/zet_file-str.obj: src/str.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -MT src/zet_file-str.obj -MD -MP -MF "src/$(DEPDIR)/zet_file-str.Tpo" -c -o src/zet_file-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "src/$(DEPDIR)/zet_file-str.Tpo" "src/$(DEPDIR)/zet_file-str.Po"; else rm -f "src/$(DEPDIR)/zet_file-str.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/str.c' object='src/zet_file-str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(zet_file_CFLAGS) $(CFLAGS) -c -o src/zet_file-str.obj `if test -f 'src/str.c'; then $(CYGPATH_W) 'src/str.c'; else $(CYGPATH_W) '$(srcdir)/src/str.c'; fi`
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+       -rm -rf src/.libs src/_libs
+       -rm -rf src/libtextcodec/.libs src/libtextcodec/_libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+install-dataDATA: $(data_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(datadir)" || $(mkdir_p) "$(DESTDIR)$(datadir)"
+       @list='$(data_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(datadir)/$$f'"; \
+         $(dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(datadir)/$$f"; \
+       done
+
+uninstall-dataDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(data_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(datadir)/$$f'"; \
+         rm -f "$(DESTDIR)$(datadir)/$$f"; \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+       srcdir=$(srcdir); export srcdir; \
+       list='$(TESTS)'; \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           elif test -f $$tst; then dir=; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *" $$tst "*) \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               echo "XPASS: $$tst"; \
+             ;; \
+             *) \
+               echo "PASS: $$tst"; \
+             ;; \
+             esac; \
+           elif test $$? -ne 77; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *" $$tst "*) \
+               xfail=`expr $$xfail + 1`; \
+               echo "XFAIL: $$tst"; \
+             ;; \
+             *) \
+               failed=`expr $$failed + 1`; \
+               echo "FAIL: $$tst"; \
+             ;; \
+             esac; \
+           else \
+             skip=`expr $$skip + 1`; \
+             echo "SKIP: $$tst"; \
+           fi; \
+         done; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="All $$all tests passed"; \
+           else \
+             banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all tests failed"; \
+           else \
+             banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+           fi; \
+         fi; \
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           skipped="($$skip tests were not run)"; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         echo "$$dashes"; \
+         echo "$$banner"; \
+         test -z "$$skipped" || echo "$$skipped"; \
+         test -z "$$report" || echo "$$report"; \
+         echo "$$dashes"; \
+         test "$$failed" -eq 0; \
+       else :; fi
+
+distdir: $(DISTFILES)
+       $(am__remove_distdir)
+       mkdir $(distdir)
+       $(mkdir_p) $(distdir)/. $(distdir)/config $(distdir)/doc $(distdir)/include $(distdir)/scripts $(distdir)/src $(distdir)/src/compat $(distdir)/src/include $(distdir)/src/include/compat $(distdir)/src/include/cygwin $(distdir)/src/include/darwin $(distdir)/src/include/freebsd $(distdir)/src/include/linux $(distdir)/src/include/sunos $(distdir)/src/include/win32 $(distdir)/src/pyzet $(distdir)/src/test $(distdir)/txt $(distdir)/win32/visualc6
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+       || chmod -R a+r $(distdir)
+dist-gzip: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+dist-bzip2: distdir
+       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       $(am__remove_distdir)
+
+dist-tarZ: distdir
+       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+       $(am__remove_distdir)
+
+dist-shar: distdir
+       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       $(am__remove_distdir)
+dist-zip: distdir
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__remove_distdir)
+
+dist dist-all: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       case '$(DIST_ARCHIVES)' in \
+       *.tar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+       *.tar.bz2*) \
+         bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.Z*) \
+         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+       *.shar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+       *.zip*) \
+         unzip $(distdir).zip ;;\
+       esac
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
+       mkdir $(distdir)/_build
+       mkdir $(distdir)/_inst
+       chmod a-w $(distdir)
+       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+         && cd $(distdir)/_build \
+         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+               distuninstallcheck \
+         && chmod -R a-w "$$dc_install_base" \
+         && ({ \
+              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && rm -rf $(DIST_ARCHIVES) \
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+       $(am__remove_distdir)
+       @(echo "$(distdir) archives ready for distribution: "; \
+         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+         sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+       @cd $(distuninstallcheck_dir) \
+       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+          || { echo "ERROR: files left after uninstall:" ; \
+               if test -n "$(DESTDIR)"; then \
+                 echo "  (check DESTDIR support)"; \
+               fi ; \
+               $(distuninstallcheck_listfiles) ; \
+               exit 1; } >&2
+distcleancheck: distclean
+       @if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left in build directory after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(datadir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -rm -f src/$(DEPDIR)/$(am__dirstamp)
+       -rm -f src/$(am__dirstamp)
+       -rm -f src/libtextcodec/$(DEPDIR)/$(am__dirstamp)
+       -rm -f src/libtextcodec/$(am__dirstamp)
+       -rm -f src/test/$(DEPDIR)/$(am__dirstamp)
+       -rm -f src/test/$(am__dirstamp)
+       -rm -f tools/$(DEPDIR)/$(am__dirstamp)
+       -rm -f tools/$(am__dirstamp)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+       clean-libtool clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf src/$(DEPDIR) src/libtextcodec/$(DEPDIR) src/test/$(DEPDIR) tools/$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dataDATA
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -rf src/$(DEPDIR) src/libtextcodec/$(DEPDIR) src/test/$(DEPDIR) tools/$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dataDATA \
+       uninstall-info-am uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
+       clean clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+       clean-libtool clean-noinstPROGRAMS ctags dist dist-all \
+       dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip distcheck \
+       distclean distclean-compile distclean-generic distclean-hdr \
+       distclean-libtool distclean-tags distcleancheck distdir \
+       distuninstallcheck dvi dvi-am html html-am info info-am \
+       install install-am install-binPROGRAMS install-data \
+       install-data-am install-dataDATA install-exec install-exec-am \
+       install-info install-info-am install-libLTLIBRARIES \
+       install-man install-strip installcheck installcheck-am \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+       uninstall-am uninstall-binPROGRAMS uninstall-dataDATA \
+       uninstall-info-am uninstall-libLTLIBRARIES
+
+
+#
+# PyZET
+#
+# Not very portable, but should work
+#
+# FIXME automatic regeneration of setup.py from setup.py.in not working
+@HAVE_PYTHON_TRUE@pyzet:
+@HAVE_PYTHON_TRUE@     $(PYTHON) setup.py build
+
+@HAVE_PYTHON_TRUE@pyzet-install:
+@HAVE_PYTHON_TRUE@     $(PYTHON) setup.py install --prefix=${prefix}
+@HAVE_PYTHON_TRUE@     @echo "Set the env variable PYTHONPATH to ${prefix}/lib/python${PYTHON_VERSION}/site-packages for python to find the zet module"
+@HAVE_PYTHON_TRUE@     @echo "The directory holding libzet.so will also have to be in your LD_LIBRARY_PATH or similarly configured"
+
+#### THINGS AFTER THIS LINE WILL BE REMOVED PRIOR TO DISTRIBUTION ####
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..6109dc9
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+zettair is a compact and fast text search engine produced by the Search Engine 
+Group at RMIT.  It was designed for simplicity as well as speed and flexibility.  
+One of its primary features is the ability to handle large amounts of text 
+efficiently.  It was previously named lucy, and was renamed around
+May, 2004.
+
+Installation instructions can be found the file named INSTALL.  zettair was
+written in C and has been tested on Solaris and Linux.  It is available for 
+download from http://www.seg.rmit.edu.au and is licensed under the GPL.
+
+Please send feedback/bug reports to zettair@cs.rmit.edu.au 
+
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..97cf70a
--- /dev/null
@@ -0,0 +1,7215 @@
+# generated automatically by aclocal 1.9.2 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 47 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+                [m4_ifdef([AC_PROVIDE_$1],
+                          [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+       [AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+            [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+            [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+            [define([LT_AC_PROG_GCJ],
+               defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+       [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+       [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+            [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+        [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+[$]*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+        test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+        echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+        test "X$echo_testing_string" = "X$echo_test_string"; then
+       # Cool, printf works
+       :
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+       export CONFIG_SHELL
+       SHELL="$CONFIG_SHELL"
+       export SHELL
+       echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+       # maybe with a smaller string...
+       prev=:
+
+       for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+         if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+         then
+           break
+         fi
+         prev="$cmd"
+       done
+
+       if test "$prev" != 'sed 50q "[$]0"'; then
+         echo_test_string=`eval $prev`
+         export echo_test_string
+         exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+       else
+         # Oops.  We lost completely, so just stick with echo.
+         echo=echo
+       fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+       [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case "`/usr/bin/file conftest.o`" in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#              [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+     else
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+ *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+              = "XX$teststring") >/dev/null 2>&1 &&
+           new_result=`expr "X$teststring" : ".*" 2>&1` &&
+           lt_cv_sys_max_cmd_len=$new_result &&
+           test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_unknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# -------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+         [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+           [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+       [AC_CHECK_FUNC([dlopen],
+             [lt_cv_dlopen="dlopen"],
+         [AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+           [AC_CHECK_LIB([svld], [dlopen],
+                 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+             [AC_CHECK_LIB([dld], [dld_link],
+                   [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+             ])
+           ])
+         ])
+       ])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+         lt_cv_dlopen_self, [dnl
+         _LT_AC_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+           lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+         lt_cv_dlopen_self_static, [dnl
+         _LT_AC_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+           lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+   test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+    if AC_TRY_EVAL(ac_compile); then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_ARG_WITH([tags],
+    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+        [include additional configurations @<:@automatic@:>@])],
+    [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    AC_MSG_WARN([output file `$ofile' does not exist])
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+    else
+      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+    fi
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+    "") ;;
+    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+       ;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+       if test -n "$CXX" && test "X$CXX" != "Xno"; then
+         AC_LIBTOOL_LANG_CXX_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      F77)
+       if test -n "$F77" && test "X$F77" != "Xno"; then
+         AC_LIBTOOL_LANG_F77_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      GCJ)
+       if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+         AC_LIBTOOL_LANG_GCJ_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      RC)
+       AC_LIBTOOL_LANG_RC_CONFIG
+       ;;
+
+      *)
+       AC_MSG_ERROR([Unsupported tag name: $tagname])
+       ;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+  fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+       [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+#- set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+       [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+    [AC_HELP_STRING([--with-gnu-ld],
+       [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | kfreebsd*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case "$host_cpu" in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  case $host_cpu in
+  alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm="$ac_dir/${ac_tool_prefix}nm"
+    if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+      */dev/null* | *'Invalid file or object type'*)
+       lt_cv_path_NM="$tmp_nm -B"
+       break
+        ;;
+      *)
+       case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+       */dev/null*)
+         lt_cv_path_NM="$tmp_nm -p"
+         break
+         ;;
+       *)
+         lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+         continue # so that we can try to find one that supports BSD flags
+         ;;
+       esac
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments.  Note that LIBLTDL
+# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If
+# DIRECTORY is not provided, it is assumed to be `libltdl'.  LIBLTDL will
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that LIBLTDL
+# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If
+# DIRECTORY is not provided and an installed libltdl is not found, it is
+# assumed to be `libltdl'.  LIBLTDL will be prefixed with '${top_builddir}/'
+# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single
+# quotes!).  If your package is not flat and you're not using automake,
+# define top_builddir and top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, lt_dlinit,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+        [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+          [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# --------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_AC_SYS_COMPILER
+
+#
+# Check for any special shared library compilation flags.
+#
+_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)=
+if test "$GCC" = no; then
+  case $host_os in
+  sco3.2v5*)
+    _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf'
+    ;;
+  esac
+fi
+if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then
+  AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries])
+  if echo "$old_CC $old_CFLAGS " | grep "[[    ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[        ]]" >/dev/null; then :
+  else
+    AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure])
+    _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no
+  fi
+fi
+
+
+#
+# Check to make sure the static flag actually works.
+#
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works],
+  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  $_LT_AC_TAGVAR(lt_prog_compiler_static, $1),
+  [],
+  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+# Report which librarie types wil actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+  darwin* | rhapsody*)
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[[012]])
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+      ;;
+    esac
+    output_verbose_link_cmd='echo'
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
+    _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag  -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+  else
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+  fi
+    ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cc
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+  AC_PROG_LD
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+       grep 'no-whole-archive' > /dev/null; then
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+       for ld_flag in $LDFLAGS; do
+         case $ld_flag in
+         *-brtl*)
+           aix_use_runtimelinking=yes
+           break
+           ;;
+         esac
+       done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    _LT_AC_TAGVAR(archive_cmds, $1)=''
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+       collect2name=`${CC} -print-prog-name=collect2`
+       if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+       then
+         # We have reworked collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+       else
+         # We have old collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+       fi
+      esac
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+       shared_flag='-G'
+      else
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag='${wl}-G'
+       else
+         shared_flag='${wl}-bM:SRE'
+       fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      _LT_AC_SYS_LIBPATH_AIX
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+       # Warning - without using the other run time loading flags,
+       # -berok will link without error, but may produce a broken library.
+       _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+       # -bexpall does not export symbols beginning with underscore (_)
+       _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+       # Exported symbols can be pulled into shared objects from archives
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
+       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+       # This is similar to how AIX traditionally builds it's shared libraries.
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+  chorus*)
+    case $cc_basename in
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+    # as there is no search path for DLLs.
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+       cp $export_symbols $output_objdir/$soname.def;
+      else
+       echo EXPORTS > $output_objdir/$soname.def;
+       cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+  ;;
+
+  darwin* | rhapsody*)
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[[012]])
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+      ;;
+    esac
+    lt_int_apple_cc_single_mod=no
+    output_verbose_link_cmd='echo'
+    if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+      lt_int_apple_cc_single_mod=yes
+    fi
+    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    else
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    fi
+    _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+
+    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+  else
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+  fi
+    ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      ghcx)
+       # Green Hills C++ Compiler
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  freebsd[12]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  freebsd-elf*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  freebsd* | kfreebsd*-gnu)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                               # but as the default
+                               # location of the library.
+
+    case $cc_basename in
+    CC)
+      # FIXME: insert proper C++ library support
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    aCC)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      case "$host_cpu" in
+      hppa*64*)
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+        ;;
+      ia64*)
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        ;;
+      *)
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        ;;
+      esac
+    fi
+    case "$host_cpu" in
+    hppa*64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+    ia64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                             # but as the default
+                                             # location of the library.
+      ;;
+    *)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                             # but as the default
+                                             # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      aCC)
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       esac
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test $with_gnu_ld = no; then
+           case "$host_cpu" in
+           ia64*|hppa*64*)
+             _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+             ;;
+           *)
+             _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           esac
+         fi
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC)
+       # SGI C++
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+       # Archives containing C++ object files must be created using
+       # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test "$with_gnu_ld" = no; then
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+         else
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+         fi
+       fi
+       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+       ;;
+    esac
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    ;;
+  linux*)
+    case $cc_basename in
+      KCC)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+       ;;
+      icpc)
+       # Intel C++
+       with_gnu_ld=yes
+       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+       ;;
+      cxx)
+       # Compaq C++
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+       runpath_var=LD_RUN_PATH
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+       ;;
+      RCC)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      cxx)
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Archives containing C++ object files must be created using
+       # the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+       ;;
+      RCC)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      cxx)
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+         echo "-hidden">> $lib.exp~
+         $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~
+         $rm $lib.exp'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  sco*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    case $cc_basename in
+      CC)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC)
+       # Sun C++ 4.x
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      lcc)
+       # Lucid
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC)
+       # Sun C++ 4.2, 5.x and Centerline C++
+       _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+       case $host_os in
+         solaris2.[0-5] | solaris2.[0-5].*) ;;
+         *)
+           # The C++ compiler is used as linker so we must use $wl
+           # flag to pass the commands to the underlying system
+           # linker.
+           # Supported since Solaris 2.6 (maybe 2.5.1?)
+           _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+           ;;
+       esac
+       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+       # Archives containing C++ object files must be created using
+       # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+       ;;
+      gcx)
+       # Green Hills C++ Compiler
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+       # The C++ compiler must be used to create the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+       ;;
+      *)
+       # GNU C++ compiler with Solaris linker
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+         if $CC --version | grep -v '^2\.7' > /dev/null; then
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         else
+           # g++ 2.7 appears to require `-G' NOT `-shared' on this
+           # platform.
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         fi
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+       fi
+       ;;
+    esac
+    ;;
+  sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC)
+       # NonStop-UX NCC 3.20
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`"
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+         || test $p = "-R"; then
+        prev=$p
+        continue
+       else
+        prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        case $p in
+        -L* | -R*)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+            _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+          else
+            _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+          _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+        else
+          _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+        fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+          _LT_AC_TAGVAR(predep_objects, $1)="$p"
+        else
+          _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+        fi
+       else
+        if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+          _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+        else
+          _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="      program t\n      end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  test "$enable_shared" = yes && enable_static=no
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars.  Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    _LT_AC_TAGVAR(compiler, $1) \
+    _LT_AC_TAGVAR(CC, $1) \
+    _LT_AC_TAGVAR(LD, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+    _LT_AC_TAGVAR(predep_objects, $1) \
+    _LT_AC_TAGVAR(postdep_objects, $1) \
+    _LT_AC_TAGVAR(predeps, $1) \
+    _LT_AC_TAGVAR(postdeps, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(archive_cmds, $1) \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+    _LT_AC_TAGVAR(include_expsyms, $1); do
+
+    case $var in
+    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\[$]0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+    ;;
+  esac
+
+ifelse([$1], [],
+  [cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  AC_MSG_NOTICE([creating $ofile])],
+  [cfgfile="$ofile"])
+
+  cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+])
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris* | sysv5*)
+  symcode='[[BDRT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[     ]]\($symcode$symcode*\)[[       ]][[    ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+       if grep ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+         cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+         cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_save_LIBS="$LIBS"
+         lt_save_CFLAGS="$CFLAGS"
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+         if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+         CFLAGS="$lt_save_CFLAGS"
+       else
+         echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+       else
+         _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68)
+         # Green Hills C++ Compiler
+         # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         ghcx)
+           # Green Hills C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | kfreebsd*-gnu)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+           if test "$host_cpu" != ia64; then
+             _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+           fi
+           ;;
+         aCC)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+           case "$host_cpu" in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux*)
+       case $cc_basename in
+         KCC)
+           # KAI C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           ;;
+         icpc)
+           # Intel C++
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         cxx)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd*)
+       ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           ;;
+         RCC)
+           # Rational C++ 2.4.1
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         cxx)
+           # Digital/Compaq C++
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      sco*)
+       case $cc_basename in
+         CC)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+           ;;
+         gcx)
+           # Green Hills C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC)
+           # Sun C++ 4.x
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         lcc)
+           # Lucid
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC)
+           # NonStop-UX NCC 3.20
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      unixware*)
+       ;;
+      vxworks*)
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+       ;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    linux*)
+      case $CC in
+      icc* | ecc*)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      ccc*)
+        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn'
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+],[
+  runpath_var=
+  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_AC_TAGVAR(archive_cmds, $1)=
+  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_AC_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+  linux*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds"
+      supports_anon_versioning=no
+      case `$LD -v 2>/dev/null` in
+        *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+        *\ 2.11.*) ;; # other 2.11 versions
+        *) supports_anon_versioning=yes ;;
+      esac
+      if test $supports_anon_versioning = yes; then
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+$echo "local: *; };" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+      else
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds"
+      fi
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then
+      runpath_var=LD_RUN_PATH
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+      fi
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$link_static_flag"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+       else
+         _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_AC_TAGVAR(archive_cmds, $1)=''
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+         else
+         # We have old collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+       esac
+       shared_flag='-shared'
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+       if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+       fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        _LT_AC_SYS_LIBPATH_AIX
+        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+         # -bexpall does not export symbols beginning with underscore (_)
+         _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+         # Exported symbols can be pulled into shared objects from archives
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+         # This is similar to how AIX traditionally builds it's shared libraries.
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      # see comment about different semantics on the GNU ld section
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi4*)
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+    if test "$GXX" = yes ; then
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      case "$host_os" in
+      rhapsody* | darwin1.[[012]])
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
+       ;;
+      *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[[012]])
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+       ;;
+      esac
+       lt_int_apple_cc_single_mod=no
+       output_verbose_link_cmd='echo'
+       if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+         lt_int_apple_cc_single_mod=yes
+       fi
+       if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+       else
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      fi
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        else
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        fi
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+      ;;
+
+    dgux*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10* | hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       case "$host_cpu" in
+       hppa*64*)
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no
+         _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+         ;;
+       ia64*)
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no
+         _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         ;;
+       *)
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+         _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    openbsd*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      else
+       case $host_os in
+        openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+          _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+          ;;
+        *)
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    sco3.2v5*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+      esac
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no
+        ;;
+       motorola)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4.2uw2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      hardcode_runpath_var=yes
+      runpath_var=LD_RUN_PATH
+      ;;
+
+   sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[[78]]* | unixware7*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text'
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv5*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      # $CC -shared without GNU ld will not create a library from C++
+      # object files and a static libstdc++, better avoid it by now
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+        then
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && break
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+SED=$lt_cv_path_SED
+])
+AC_MSG_RESULT([$SED])
+])
+
+#                                                        -*- Autoconf -*-
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Generated from amversion.in; do not edit by hand.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+        [AM_AUTOMAKE_VERSION([1.9.2])])
+
+# AM_AUX_DIR_EXPAND
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                              -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 6
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# serial 7                                             -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.   -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+#   Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+#serial 2
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 7
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                            -*- Autoconf -*-
+
+# This macro actually does too much some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 11
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+#                                                          -*- Autoconf -*-
+# Copyright (C) 2003  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# serial 2
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+
+# Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+])
+
+#  -*- Autoconf -*-
+
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                    -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+
+# Adds support for distributing Python modules and packages.  To
+# install modules, copy them to $(pythondir), using the python_PYTHON
+# automake variable.  To install a package with the same name as the
+# automake package, install to $(pkgpythondir), or use the
+# pkgpython_PYTHON automake variable.
+
+# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
+# locations to install python extension modules (shared libraries).
+# Another macro is required to find the appropriate flags to compile
+# extension modules.
+
+# If your package is configured with a different prefix to python,
+# users will have to add the install directory to the PYTHONPATH
+# environment variable, or create a .pth file (see the python
+# documentation for details).
+
+# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
+# cause an error if the version of python installed on the system
+# doesn't meet the requirement.  MINIMUM-VERSION should consist of
+# numbers and dots only.
+
+AC_DEFUN([AM_PATH_PYTHON],
+ [
+  dnl Find a Python interpreter.  Python versions prior to 1.5 are not
+  dnl supported because the default installation locations changed from
+  dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
+  dnl in 1.5.
+  m4_define([_AM_PYTHON_INTERPRETER_LIST],
+            [python python2 python2.4 python2.3 python2.2 dnl
+python2.1 python2.0 python1.6 python1.5])
+
+  m4_if([$1],[],[
+    dnl No version check is needed.
+    # Find any Python interpreter.
+    if test -z "$PYTHON"; then
+      PYTHON=:
+      AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST)
+    fi
+    am_display_PYTHON=python
+  ], [
+    dnl A version check is needed.
+    if test -n "$PYTHON"; then
+      # If the user set $PYTHON, use it and don't search something else.
+      AC_MSG_CHECKING([whether $PYTHON version >= $1])
+      AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
+                             [AC_MSG_RESULT(yes)],
+                             [AC_MSG_ERROR(too old)])
+      am_display_PYTHON=$PYTHON
+    else
+      # Otherwise, try each interpreter until we find one that satisfies
+      # VERSION.
+      AC_CACHE_CHECK([for a Python interpreter with version >= $1],
+       [am_cv_pathless_PYTHON],[
+       for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
+         test "$am_cv_pathless_PYTHON" = none && break
+         AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
+       done])
+      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
+      if test "$am_cv_pathless_PYTHON" = none; then
+       PYTHON=:
+      else
+        AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
+      fi
+      am_display_PYTHON=$am_cv_pathless_PYTHON
+    fi
+  ])
+
+  if test "$PYTHON" = :; then
+  dnl Run any user-specified action, or abort.
+    m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
+  else
+
+  dnl Query Python for its version number.  Getting [:3] seems to be
+  dnl the best way to do this; it's what "site.py" does in the standard
+  dnl library.
+
+  AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
+    [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
+  AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
+
+  dnl Use the values of $prefix and $exec_prefix for the corresponding
+  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made
+  dnl distinct variables so they can be overridden if need be.  However,
+  dnl general consensus is that you shouldn't need this ability.
+
+  AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
+  AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
+
+  dnl At times (like when building shared libraries) you may want
+  dnl to know which OS platform Python thinks this is.
+
+  AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
+    [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
+  AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
+
+
+  dnl Set up 4 directories:
+
+  dnl pythondir -- where to install python scripts.  This is the
+  dnl   site-packages directory, not the python standard library
+  dnl   directory like in previous automake betas.  This behavior
+  dnl   is more consistent with lispdir.m4 for example.
+  dnl Query distutils for this directory.  distutils does not exist in
+  dnl Python 1.5, so we fall back to the hardcoded directory if it
+  dnl doesn't work.
+  AC_CACHE_CHECK([for $am_display_PYTHON script directory],
+    [am_cv_python_pythondir],
+    [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
+     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
+  AC_SUBST([pythondir], [$am_cv_python_pythondir])
+
+  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
+  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
+  dnl   more consistent with the rest of automake.
+
+  AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
+
+  dnl pyexecdir -- directory for installing python extension modules
+  dnl   (shared libraries)
+  dnl Query distutils for this directory.  distutils does not exist in
+  dnl Python 1.5, so we fall back to the hardcoded directory if it
+  dnl doesn't work.
+  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
+    [am_cv_python_pyexecdir],
+    [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
+     echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
+  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
+
+  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
+
+  AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
+
+  dnl Run any user-specified action.
+  $2
+  fi
+
+])
+
+
+# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# ---------------------------------------------------------------------------
+# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
+# Run ACTION-IF-FALSE otherwise.
+# This test uses sys.hexversion instead of the string equivalent (first
+# word of sys.version), in order to cope with versions such as 2.2c1.
+# hexversion has been introduced in Python 1.5.2; it's probably not
+# worth to support older versions (1.5.1 was released on October 31, 1998).
+AC_DEFUN([AM_PYTHON_CHECK_VERSION],
+ [prog="import sys, string
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('$2', '.')) + [[0, 0, 0]]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(sys.hexversion < minverhex)"
+  AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.     -*- Autoconf -*-
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# AM_PROG_INSTALL_STRIP
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/compile b/compile
new file mode 100755 (executable)
index 0000000..80b645b
--- /dev/null
+++ b/compile
@@ -0,0 +1,140 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2004-09-10.20
+
+# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit 0
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit 0
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+       # configure might choose to run compile as `compile cc -o foo foo.c'.
+       # So we strip `-o arg' only if arg is an object.
+       eat=1
+       case $2 in
+         *.o | *.obj)
+           ofile=$2
+           ;;
+         *)
+           set x "$@" -o "$2"
+           shift
+           ;;
+       esac
+       ;;
+      *.c)
+       cfile=$1
+       set x "$@" "$1"
+       shift
+       ;;
+      *)
+       set x "$@" "$1"
+       shift
+       ;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/config.guess b/config.guess
new file mode 100755 (executable)
index 0000000..2fc3acc
--- /dev/null
@@ -0,0 +1,1411 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2003-06-17'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+## for Red Hat Linux
+if test -f /etc/redhat-release ; then
+    VENDOR=redhat ;
+else
+    VENDOR= ;
+fi
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit 0 ;;
+    amiga:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    arc:OpenBSD:*:*)
+       echo mipsel-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    hp300:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mac68k:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    macppc:OpenBSD:*:*)
+       echo powerpc-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+       echo m88k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+       echo powerpc-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    pmax:OpenBSD:*:*)
+       echo mipsel-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sgi:OpenBSD:*:*)
+       echo mipseb-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sun3:OpenBSD:*:*)
+       echo m68k-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+       echo mipsel-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    *:OpenBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    alpha:OSF1:*:*)
+       if test $UNAME_RELEASE = "V4.0"; then
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+       fi
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit 0 ;;
+    Alpha*:OpenVMS:*:*)
+       echo alpha-hp-vms
+       exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit 0 ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit 0;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit 0 ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit 0 ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit 0;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit 0;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit 0 ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit 0 ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7 && exit 0 ;;
+       esac ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit 0 ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit 0 ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit 0 ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit 0 ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c \
+         && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+         && exit 0
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit 0 ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit 0 ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit 0 ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit 0 ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit 0 ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit 0 ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+       exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit 0 ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit 0 ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+               echo rs6000-ibm-aix3.2.5
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit 0 ;;
+    *:AIX:*:[45])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit 0 ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit 0 ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+               {
+               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+               case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+                   switch (bits)
+                       {
+                       case 64: puts ("hppa2.0w"); break;
+                       case 32: puts ("hppa2.0n"); break;
+                       default: puts ("hppa2.0"); break;
+                       } break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+                   puts ("hppa2.0"); break;
+              #endif
+               default: puts ("hppa1.0"); break;
+               }
+                  exit (0);
+              }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           # avoid double evaluation of $set_cc_for_build
+           test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit 0 ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit 0 ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+       echo unknown-hitachi-hiuxwe2
+       exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit 0 ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit 0 ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit 0 ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit 0 ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
+    *:UNICOS/mp:*:*)
+       echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
+       exit 0 ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
+       # Determine whether the default compiler uses glibc.
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #if __GLIBC__ >= 2
+       LIBC=gnu
+       #else
+       LIBC=
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+       exit 0 ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit 0 ;;
+    i*:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit 0 ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit 0 ;;
+    x86:Interix*:[34]*)
+       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+       exit 0 ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit 0 ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit 0 ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit 0 ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    *:GNU:*:*)
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit 0 ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit 0 ;;
+    arm*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    cris:Linux:*:*)
+       echo cris-axis-linux-gnu
+       exit 0 ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu
+       exit 0 ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+       ;;
+    mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips64
+       #undef mips64el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mips64el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips64
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+       ;;
+    ppc:Linux:*:*)
+       echo powerpc-${VENDOR:-unknown}-linux-gnu
+       exit 0 ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-${VENDOR:-unknown}-linux-gnu
+       exit 0 ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu
+       exit 0 ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit 0 ;;
+    x86_64:Linux:*:*)
+       echo x86_64-${VENDOR:-unknown}-linux-gnu
+       exit 0 ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+               exit 0 ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+               exit 0 ;;
+         "")
+               # Either a pre-BFD a.out linker (linux-gnuoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+               exit 0 ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #ifdef __INTEL_COMPILER
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR:-pc}-linux-${LIBC}" && exit 0
+       test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+       ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit 0 ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit 0 ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit 0 ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit 0 ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit 0 ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit 0 ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit 0 ;;
+    i*86:*:5:[78]*)
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit 0 ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit 0 ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
+        exit 0 ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit 0 ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit 0 ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit 0 ;;
+    M68*:*:R3V[567]*:*)
+       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit 0 ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit 0 ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit 0 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit 0 ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit 0 ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit 0 ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit 0 ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit 0 ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+        exit 0 ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit 0 ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit 0 ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit 0 ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit 0 ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit 0 ;;
+    *:Darwin:*:*)
+       case `uname -p` in
+           *86) UNAME_PROCESSOR=i686 ;;
+           powerpc) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit 0 ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit 0 ;;
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit 0 ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit 0 ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit 0 ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit 0 ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit 0 ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit 0 ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit 0 ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit 0 ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+       exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit 0 ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit 0 ;;
+    c34*)
+       echo c34-convex-bsd
+       exit 0 ;;
+    c38*)
+       echo c38-convex-bsd
+       exit 0 ;;
+    c4*)
+       echo c4-convex-bsd
+       exit 0 ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
new file mode 100755 (executable)
index 0000000..7cee3d6
--- /dev/null
@@ -0,0 +1,1500 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2003-06-18'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit 0;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis)
+               os=
+               basic_machine=$1
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k \
+       | m32r | m68000 | m68k | m88k | mcore \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | msp430 \
+       | ns16k | ns32k \
+       | openrisc | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | pyramid \
+       | s390 | s390x \
+       | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+       | strongarm \
+       | tahoe | thumb | tic4x | tic80 | tron \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xscale | xstormy16 | xtensa \
+       | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* \
+       | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | clipper-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* \
+       | m32r-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | mcore-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | msp430-* \
+       | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | pyramid-* \
+       | romp-* | rs6000-* \
+       | s390-* | s390x-* \
+       | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+       | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tron-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+       | xtensa-* \
+       | ymp-* \
+       | z8k-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       mmix*)
+               basic_machine=mmix-knuth
+               os=-mmixware
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       nv1)
+               basic_machine=nv1-cray
+               os=-unicosmp
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       or32 | or32-*)
+               basic_machine=or32-unknown
+               os=-coff
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
+       tic55x | c55x*)
+               basic_machine=tic55x-unknown
+               os=-coff
+               ;;
+       tic6x | c6x*)
+               basic_machine=tic6x-unknown
+               os=-coff
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparc | sparcv9 | sparcv9b)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+             | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+       c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/psettings.xml b/config/psettings.xml
new file mode 100644 (file)
index 0000000..50fc06d
--- /dev/null
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<psettings>
+  <!-- each type gets its own configuration -->
+  <type mimetype="text/html" default="true">
+    <!-- list of things that we don't want to index -->
+       <tag name="sgmlcomment" index="false" flow="true"/>  <!-- note that comments are handled as the psuedo-tags 'sgmlcomment' and '/sgmlcomment' -->
+       <tag name="/sgmlcomment" index="pop" flow="true"/>
+    <tag name="dochdr" index="false"/>
+    <tag name="javascript" index="false" flow="true"/>
+    <tag name="/javascript" flow="true"/>
+    <tag name="profile" index="false"/>
+    <tag name="script" index="false" flow="true"/>
+    <tag name="/script" flow="true"/>
+    <tag name="style" index="false" flow="true"/>
+    <tag name="/style" flow="true"/>
+    <tag name="vbscript" index="false" flow="true"/>
+    <tag name="/vbscript" flow="true"/>
+       <tag name="title" index="title"/>
+
+    <!-- below tag pairs just establish flow attribute -->
+       <tag name="link" flow="true"/> <tag name="/link" flow="true"/>
+       <tag name="meta" flow="true"/> <tag name="/meta" flow="true"/>
+       <tag name="bdo" flow="true"/> <tag name="/bdo" flow="true"/>
+       <tag name="a" flow="true"/> <tag name="/a" flow="true"/>
+       <tag name="b" flow="true"/> <tag name="/b" flow="true"/>
+       <tag name="big" flow="true"/> <tag name="/big" flow="true"/>
+       <tag name="font" flow="true"/> <tag name="/font" flow="true"/>
+       <tag name="i" flow="true"/> <tag name="/i" flow="true"/>
+       <tag name="s" flow="true"/> <tag name="/s" flow="true"/>
+       <tag name="small" flow="true"/> <tag name="/small" flow="true"/>
+       <tag name="strike" flow="true"/> <tag name="/strike" flow="true"/>
+       <tag name="sub" flow="true"/> <tag name="/sub" flow="true"/>
+       <tag name="sup" flow="true"/> <tag name="/sup" flow="true"/>
+       <tag name="tt" flow="true"/> <tag name="/tt" flow="true"/>
+       <tag name="u" flow="true"/> <tag name="/u" flow="true"/>
+       <tag name="acronym" flow="true"/> <tag name="/acronym" flow="true"/>
+       <tag name="address" flow="true"/> <tag name="/address" flow="true"/>
+       <tag name="cite" flow="true"/> <tag name="/cite" flow="true"/>
+       <tag name="code" flow="true"/> <tag name="/code" flow="true"/>
+       <tag name="del" flow="true"/> <tag name="/del" flow="true"/>
+       <tag name="dfn" flow="true"/> <tag name="/dfn" flow="true"/>
+       <tag name="em" flow="true"/> <tag name="/em" flow="true"/>
+       <tag name="kbd" flow="true"/> <tag name="/kbd" flow="true"/>
+       <tag name="q" flow="true"/> <tag name="/q" flow="true"/>
+       <tag name="samp" flow="true"/> <tag name="/samp" flow="true"/>
+       <tag name="strong" flow="true"/> <tag name="/strong" flow="true"/>
+       <tag name="var" flow="true"/> <tag name="/var" flow="true"/>
+       <tag name="span" flow="true"/> <tag name="/span" flow="true"/>
+  </type>
+
+  <type mimetype="application/x-trec" endtag="/doc" default="true">
+    <!-- list of things that we don't want to index -->
+       <tag name="docno" index="identifier"/>  <!-- docno identifies the document -->
+       <tag name="dochdr" index="offend"/>     <!-- don't process tags in dochdr -->
+       <tag name="/dochdr" index="binary"/>    <!-- after /dochdr we check for binary document content -->
+    <tag name="au" index="false"/>
+    <tag name="byline" index="false"/>
+       <tag name="sgmlcomment" index="false" flow="true"/>  <!-- note that comments are handled as the psuedo-tags 'sgmlcomment' and '/sgmlcomment' -->
+       <tag name="/sgmlcomment" index="pop" flow="true"/>
+    <tag name="dateline" index="false"/>
+    <tag name="docid" index="false"/>
+    <tag name="docoldno" index="false"/>
+    <tag name="fileid" index="false"/>
+    <tag name="first" index="false"/>
+    <tag name="ht" index="false"/>
+    <tag name="javascript" index="false" flow="true"/>
+    <tag name="/javascript" flow="true"/>
+    <tag name="parent" index="false"/>
+    <tag name="profile" index="false"/>
+    <tag name="script" index="false" flow="true"/>
+    <tag name="/script" flow="true" flow="true"/>
+    <tag name="second" index="false"/>
+    <tag name="style" index="false" flow="true"/>
+    <tag name="/style" flow="true"/>
+    <tag name="vbscript" index="false" flow="true"/>
+    <tag name="/vbscript" index="false" flow="true"/>
+       <tag name="title" index="title"/>
+
+    <!-- below tag pairs just establish flow attribute -->
+       <tag name="link" flow="true"/> <tag name="/link" flow="true"/>
+       <tag name="meta" flow="true"/> <tag name="/meta" flow="true"/>
+       <tag name="bdo" flow="true"/> <tag name="/bdo" flow="true"/>
+       <tag name="a" flow="true"/> <tag name="/a" flow="true"/>
+       <tag name="b" flow="true"/> <tag name="/b" flow="true"/>
+       <tag name="big" flow="true"/> <tag name="/big" flow="true"/>
+       <tag name="font" flow="true"/> <tag name="/font" flow="true"/>
+       <tag name="i" flow="true"/> <tag name="/i" flow="true"/>
+       <tag name="s" flow="true"/> <tag name="/s" flow="true"/>
+       <tag name="small" flow="true"/> <tag name="/small" flow="true"/>
+       <tag name="strike" flow="true"/> <tag name="/strike" flow="true"/>
+       <tag name="sub" flow="true"/> <tag name="/sub" flow="true"/>
+       <tag name="sup" flow="true"/> <tag name="/sup" flow="true"/>
+       <tag name="tt" flow="true"/> <tag name="/tt" flow="true"/>
+       <tag name="u" flow="true"/> <tag name="/u" flow="true"/>
+       <tag name="acronym" flow="true"/> <tag name="/acronym" flow="true"/>
+       <tag name="address" flow="true"/> <tag name="/address" flow="true"/>
+       <tag name="cite" flow="true"/> <tag name="/cite" flow="true"/>
+       <tag name="code" flow="true"/> <tag name="/code" flow="true"/>
+       <tag name="del" flow="true"/> <tag name="/del" flow="true"/>
+       <tag name="dfn" flow="true"/> <tag name="/dfn" flow="true"/>
+       <tag name="em" flow="true"/> <tag name="/em" flow="true"/>
+       <tag name="kbd" flow="true"/> <tag name="/kbd" flow="true"/>
+       <tag name="q" flow="true"/> <tag name="/q" flow="true"/>
+       <tag name="samp" flow="true"/> <tag name="/samp" flow="true"/>
+       <tag name="strong" flow="true"/> <tag name="/strong" flow="true"/>
+       <tag name="var" flow="true"/> <tag name="/var" flow="true"/>
+       <tag name="span" flow="true"/> <tag name="/span" flow="true"/>
+  </type>
+
+  <type mimetype="application/x-inex" endtag="/article" default="true">
+    <!-- list of things that we don't want to index -->
+       <tag name="dirpath" index="identifier"/>
+       <tag name="sgmlcomment" index="false" flow="true"/>  <!-- note that comments are handled as the psuedo-tags 'sgmlcomment' and '/sgmlcomment' -->
+       <tag name="/sgmlcomment" index="pop" flow="true"/>
+    <tag name="dochdr" index="false"/>
+    <tag name="javascript" index="false" flow="true"/>
+    <tag name="/javascript" flow="true"/>
+    <tag name="profile" index="false"/>
+    <tag name="script" index="false" flow="true"/>
+    <tag name="/script" flow="true"/>
+    <tag name="style" index="false" flow="true"/>
+    <tag name="/style" flow="true"/>
+    <tag name="vbscript" index="false" flow="true"/>
+    <tag name="/vbscript" flow="true"/>
+       <tag name="title" index="title"/>
+  </type>
+
+  <!-- HTML tags through which text can flow:
+  link meta bdo a b big font i s small strike sub sup tt u acronym address
+  cite code del dfn em kbd q samp strong style var span sgmlcomment
+  script javascript vbscript -->
+</psettings>
+
diff --git a/config/stoplist_sorted b/config/stoplist_sorted
new file mode 100644 (file)
index 0000000..143e94a
--- /dev/null
@@ -0,0 +1,469 @@
+a
+about
+above
+accordingly
+across
+after
+afterwards
+again
+against
+albeit
+all
+allow
+allowable
+allowed
+allowing
+allows
+almost
+alone
+along
+already
+also
+although
+always
+am
+among
+amongst
+an
+and
+another
+any
+anybody
+anyhow
+anyone
+anything
+anywhere
+apart
+appear
+appears
+appropriate
+are
+around
+as
+at
+away
+b
+be
+became
+because
+become
+becomes
+been
+before
+beforehand
+behind
+below
+beside
+besides
+between
+beyond
+big
+billion
+both
+but
+by
+c
+can
+cannot
+co
+consequently
+consider
+considerable
+considered
+considering
+considers
+contain
+containing
+contains
+corresponding
+could
+currently
+d
+did
+do
+does
+doing
+done
+down
+downwards
+dozen
+during
+e
+each
+eg
+eight
+eighteen
+eighth
+eighty
+either
+eleven
+eleventh
+else
+enough
+entire
+entirely
+et
+etc
+even
+ever
+every
+ex
+example
+except
+exclusive
+exclusively
+f
+far
+few
+fifteen
+fifth
+fifty
+first
+five
+for
+former
+forth
+forty
+found
+four
+fourteen
+fourth
+from
+further
+furthermore
+g
+get
+given
+go
+gone
+got
+h
+had
+half
+hardly
+has
+have
+having
+he
+hence
+her
+here
+hereafter
+hereby
+herein
+hereupon
+hers
+herself
+himself
+his
+hitherto
+how
+howbeit
+however
+hundred
+i
+ie
+if
+immediate
+in
+inasmuch
+inc
+include
+included
+includes
+including
+indeed
+indicate
+indicated
+indicates
+inner
+insofar
+instead
+interest
+interested
+interesting
+interests
+into
+inward
+is
+it
+its
+itself
+j
+just
+k
+l
+last
+latter
+latterly
+least
+left
+less
+lest
+like
+little
+ltd
+m
+many
+may
+me
+mean
+meaning
+means
+meanwhile
+might
+million
+mine
+missed
+misses
+missing
+more
+moreover
+most
+mostly
+much
+must
+my
+myself
+n
+name
+namely
+near
+necessary
+neither
+never
+nevertheless
+new
+next
+nine
+nineteen
+ninety
+ninth
+no
+nobody
+none
+noone
+nor
+normally
+not
+note
+notes
+nothing
+notion
+notional
+notions
+nought
+now
+nowhere
+o
+of
+off
+often
+oh
+old
+on
+once
+one
+only
+onto
+or
+other
+others
+otherwise
+ought
+our
+ours
+ourselves
+out
+outside
+over
+overall
+own
+p
+particular
+particularly
+per
+perhaps
+placed
+please
+plus
+possible
+principle
+probably
+provides
+q
+questionable
+quite
+r
+rather
+really
+relate
+related
+relates
+relatively
+respectively
+right
+role
+roles
+s
+said
+same
+secondly
+see
+seem
+seemed
+seeming
+seems
+self
+sensible
+sent
+serious
+seven
+seventeen
+seventh
+seventy
+several
+shall
+she
+should
+since
+six
+sixteen
+sixth
+sixty
+so
+some
+somebody
+somehow
+someone
+something
+sometime
+sometimes
+somewhat
+somewhere
+specified
+specify
+specifying
+still
+style
+styled
+styler
+styling
+stylish
+stylistic
+sub
+subject
+subjects
+such
+sup
+t
+taken
+ten
+tenth
+than
+that
+the
+their
+theirs
+them
+themselves
+then
+thence
+there
+thereafter
+thereby
+therefore
+therein
+thereupon
+these
+they
+third
+thirteen
+thirty
+this
+thorough
+thoroughly
+those
+though
+thousand
+three
+through
+throughout
+thus
+to
+together
+too
+toward
+towards
+twelth
+twelve
+twenty
+two
+u
+under
+understand
+understood
+unless
+until
+unto
+up
+upon
+us
+use
+used
+useful
+uses
+using
+usually
+v
+value
+various
+very
+via
+viz
+vs
+w
+want
+wanted
+was
+way
+we
+well
+went
+were
+what
+whatever
+when
+whence
+whenever
+where
+whereafter
+whereas
+whereby
+wherein
+whereupon
+wherever
+whether
+which
+while
+whither
+who
+whoever
+whole
+whom
+whose
+why
+will
+with
+within
+without
+would
+x
+y
+yet
+you
+your
+yourself
+yourselves
+z
+zero
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..46d2774
--- /dev/null
+++ b/configure
@@ -0,0 +1,25993 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for zettair 0.9.3.
+#
+# Report bugs to <zettair@cs.rmit.edu.au>.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+        test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+        echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+        test "X$echo_testing_string" = "X$echo_test_string"; then
+       # Cool, printf works
+       :
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+       export CONFIG_SHELL
+       SHELL="$CONFIG_SHELL"
+       export SHELL
+       echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+       # maybe with a smaller string...
+       prev=:
+
+       for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+         if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+         then
+           break
+         fi
+         prev="$cmd"
+       done
+
+       if test "$prev" != 'sed 50q "$0"'; then
+         echo_test_string=`eval $prev`
+         export echo_test_string
+         exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+       else
+         # Oops.  We lost completely, so just stick with echo.
+         echo=echo
+       fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='zettair'
+PACKAGE_TARNAME='zettair'
+PACKAGE_VERSION='0.9.3'
+PACKAGE_STRING='zettair 0.9.3'
+PACKAGE_BUGREPORT='zettair@cs.rmit.edu.au'
+
+ac_unique_file="src/commandline.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar OS OSINCLUDE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB EGREP LN_S ECHO AR ac_ct_AR CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pyexecdir pkgpyexecdir HAVE_PYTHON_TRUE HAVE_PYTHON_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+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'
+
+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
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # 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_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$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 ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) 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 | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$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 | -n)
+    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_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    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 "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+             localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# 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_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  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 "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
+ac_env_CXXCPP_set=${CXXCPP+set}
+ac_env_CXXCPP_value=$CXXCPP
+ac_cv_env_CXXCPP_set=${CXXCPP+set}
+ac_cv_env_CXXCPP_value=$CXXCPP
+ac_env_F77_set=${F77+set}
+ac_env_F77_value=$F77
+ac_cv_env_F77_set=${F77+set}
+ac_cv_env_F77_value=$F77
+ac_env_FFLAGS_set=${FFLAGS+set}
+ac_env_FFLAGS_value=$FFLAGS
+ac_cv_env_FFLAGS_set=${FFLAGS+set}
+ac_cv_env_FFLAGS_value=$FFLAGS
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # 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 <<_ACEOF
+\`configure' configures zettair 0.9.3 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                         [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                         [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --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
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of zettair 0.9.3:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-shared[=PKGS]
+                          build shared libraries [default=yes]
+  --enable-static[=PKGS]
+                          build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-valgrind=DIR   integrate valgrind support for better error detetion
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-tags[=TAGS]
+                          include additional configurations [automatic]
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+  F77         Fortran 77 compiler command
+  FFLAGS      Fortran 77 compiler flags
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <zettair@cs.rmit.edu.au>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+          test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+zettair configure 0.9.3
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by zettair $as_me 0.9.3, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=$`echo $ac_var`
+       echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# 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
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# 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 "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+       ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# calculate variables for target system
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+  ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+# check for valgrind
+
+# Check whether --with-valgrind or --without-valgrind was given.
+if test "${with_valgrind+set}" = set; then
+  withval="$with_valgrind"
+
+fi;
+
+if test "x$with_valgrind" != "x"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_VALGRIND 1
+_ACEOF
+
+    # check in various locations for valgrind headers
+
+    # note that we use CHECK_FILES instead of CHECK_HEADERS, because
+    # CHECK_HEADERS tries to compile the headers, which fails and
+    # causes confusion
+
+    if test "x$with_valgrind" != "xyes"; then
+
+        # also note that trying to get valgrind_include, HAVE_VALGRIND_H
+        # and HAVE_MEMCHECK_H defined properly in this ridiculous
+        # frankenstein of a so-called programming environment is absurdly
+        # complicated, hence the mess below
+        path=$with_valgrind
+        if test "x$valgrind_include" == "x"; then
+            as_ac_File=`echo "ac_cv_file_$path/valgrind.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/valgrind.h" >&5
+echo $ECHO_N "checking for $path/valgrind.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/valgrind.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  valgrind_include=$path
+fi
+
+            if test "x$valgrind_include" != "x"; then
+                as_ac_File=`echo "ac_cv_file_$path/memcheck.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/memcheck.h" >&5
+echo $ECHO_N "checking for $path/memcheck.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/memcheck.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  memcheck=yes
+fi
+
+                if test "x$memcheck" == "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMCHECK_H 1
+_ACEOF
+
+                fi
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VALGRIND_H 1
+_ACEOF
+
+            fi
+        fi
+
+        path=$with_valgrind/include
+        if test "x$valgrind_include" == "x"; then
+            as_ac_File=`echo "ac_cv_file_$path/valgrind.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/valgrind.h" >&5
+echo $ECHO_N "checking for $path/valgrind.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/valgrind.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  valgrind_include=$path
+fi
+
+            if test "x$valgrind_include" != "x"; then
+                as_ac_File=`echo "ac_cv_file_$path/memcheck.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/memcheck.h" >&5
+echo $ECHO_N "checking for $path/memcheck.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/memcheck.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  memcheck=yes
+fi
+
+                if test "x$memcheck" == "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMCHECK_H 1
+_ACEOF
+
+                fi
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VALGRIND_H 1
+_ACEOF
+
+            fi
+        fi
+
+        path=$with_valgrind/include/valgrind
+        if test "x$valgrind_include" == "x"; then
+            as_ac_File=`echo "ac_cv_file_$path/valgrind.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/valgrind.h" >&5
+echo $ECHO_N "checking for $path/valgrind.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/valgrind.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  valgrind_include=$path
+fi
+
+            if test "x$valgrind_include" != "x"; then
+                as_ac_File=`echo "ac_cv_file_$path/memcheck.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/memcheck.h" >&5
+echo $ECHO_N "checking for $path/memcheck.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/memcheck.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  memcheck=yes
+fi
+
+                if test "x$memcheck" == "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMCHECK_H 1
+_ACEOF
+
+                fi
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VALGRIND_H 1
+_ACEOF
+
+            fi
+        fi
+
+        path=$with_valgrind/valgrind
+        if test "x$valgrind_include" == "x"; then
+            as_ac_File=`echo "ac_cv_file_$path/valgrind.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/valgrind.h" >&5
+echo $ECHO_N "checking for $path/valgrind.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/valgrind.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  valgrind_include=$path
+fi
+
+            if test "x$valgrind_include" != "x"; then
+                as_ac_File=`echo "ac_cv_file_$path/memcheck.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/memcheck.h" >&5
+echo $ECHO_N "checking for $path/memcheck.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/memcheck.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  memcheck=yes
+fi
+
+                if test "x$memcheck" == "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMCHECK_H 1
+_ACEOF
+
+                fi
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VALGRIND_H 1
+_ACEOF
+
+            fi
+        fi
+    fi
+
+    path=/usr/include/valgrind
+    if test "x$valgrind_include" == "x"; then
+        as_ac_File=`echo "ac_cv_file_$path/valgrind.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/valgrind.h" >&5
+echo $ECHO_N "checking for $path/valgrind.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/valgrind.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  valgrind_include=$path
+fi
+
+        if test "x$valgrind_include" != "x"; then
+            as_ac_File=`echo "ac_cv_file_$path/memcheck.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/memcheck.h" >&5
+echo $ECHO_N "checking for $path/memcheck.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/memcheck.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  memcheck=yes
+fi
+
+            if test "x$memcheck" == "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMCHECK_H 1
+_ACEOF
+
+            fi
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VALGRIND_H 1
+_ACEOF
+
+        fi
+    fi
+
+    path=/usr/include/
+    if test "x$valgrind_include" == "x"; then
+        as_ac_File=`echo "ac_cv_file_$path/valgrind.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/valgrind.h" >&5
+echo $ECHO_N "checking for $path/valgrind.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/valgrind.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  valgrind_include=$path
+fi
+
+        if test "x$valgrind_include" != "x"; then
+            as_ac_File=`echo "ac_cv_file_$path/memcheck.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/memcheck.h" >&5
+echo $ECHO_N "checking for $path/memcheck.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/memcheck.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  memcheck=yes
+fi
+
+            if test "x$memcheck" == "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMCHECK_H 1
+_ACEOF
+
+            fi
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VALGRIND_H 1
+_ACEOF
+
+        fi
+    fi
+
+    path=/usr/local/include/
+    if test "x$valgrind_include" == "x"; then
+        as_ac_File=`echo "ac_cv_file_$path/valgrind.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/valgrind.h" >&5
+echo $ECHO_N "checking for $path/valgrind.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/valgrind.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  valgrind_include=$path
+fi
+
+        if test "x$valgrind_include" != "x"; then
+            as_ac_File=`echo "ac_cv_file_$path/memcheck.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $path/memcheck.h" >&5
+echo $ECHO_N "checking for $path/memcheck.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$path/memcheck.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  memcheck=yes
+fi
+
+            if test "x$memcheck" == "xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMCHECK_H 1
+_ACEOF
+
+            fi
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VALGRIND_H 1
+_ACEOF
+
+        fi
+    fi
+
+    if test "x$valgrind_include" == "x"; then
+        { { echo "$as_me:$LINENO: error: Can't find valgrind.h include file" >&5
+echo "$as_me: error: Can't find valgrind.h include file" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+fi
+
+if test "x$valgrind_include" != "x"; then
+    CPPFLAGS="$CPPFLAGS -I $valgrind_include"
+fi
+
+# note that we've switch from config.h.in to config_h.in for
+# compatibility with various crappy win32 zip programs :o(
+          ac_config_headers="$ac_config_headers src/include/config.h:src/include/config_h.in"
+
+#AM_INIT_AUTOMAKE(subdir-objects)
+am__api_version="1.9"
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+       @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='zettair'
+ VERSION='0.9.3'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+
+
+# figure out which OS specific include directory should be used (FIXME)
+case $target_os in
+*linux*)
+  OS=LINUX
+
+  osinclude=linux ;;
+*solaris*)
+  OS=SUNOS
+
+  osinclude=sunos ;;
+*freebsd*)
+  OS=FREEBSD
+
+  osinclude=freebsd ;;
+*darwin*)
+  OS=DARWIN
+
+  osinclude=darwin ;;
+*cygwin*)
+  OS=CYGWIN
+
+  osinclude=cygwin ;;
+default)
+  OS=LINUX
+
+  osinclude=linux ;;
+esac
+
+# export variable for use in makefile
+OSINCLUDE=$osinclude
+
+
+# checks for programs
+DEPDIR="${am__leading_dot}deps"
+
+          ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+       ;;
+    conftest.$ac_ext )
+       # This is the source file.
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       # FIXME: I believe we export ac_cv_exeext for Libtool,
+       # but it would be cool to find out if it's true.  Does anybody
+       # maintain Libtool? --akim.
+       export ac_cv_exeext
+       break;;
+    * )
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         export ac_cv_exeext
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+if test "x$CC" != xcc; then
+  echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
+echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
+echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6
+fi
+set dummy $CC; ac_cc=`echo $2 |
+                     sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&5'
+if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+   test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); };
+then
+  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+  if test "x$CC" != xcc; then
+    # Test first that cc exists at all.
+    if { ac_try='cc -c conftest.$ac_ext >&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+      ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&5'
+      if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); };
+      then
+       # cc works too.
+       :
+      else
+       # cc exists but doesn't like -o.
+       eval ac_cv_prog_cc_${ac_cc}_c_o=no
+      fi
+    fi
+  fi
+else
+  eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_MINUS_C_MINUS_O 1
+_ACEOF
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+    # support subdir objects for automake
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  RANLIB=$ac_ct_RANLIB
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi;
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi;
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi;
+
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+if test "${lt_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && break
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+SED=$lt_cv_path_SED
+
+fi
+
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+
+echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
+if test "${lt_cv_path_NM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm="$ac_dir/${ac_tool_prefix}nm"
+    if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+      */dev/null* | *'Invalid file or object type'*)
+       lt_cv_path_NM="$tmp_nm -B"
+       break
+        ;;
+      *)
+       case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+       */dev/null*)
+         lt_cv_path_NM="$tmp_nm -p"
+         break
+         ;;
+       *)
+         lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+         continue # so that we can try to find one that supports BSD flags
+         ;;
+       esac
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6
+NM="$lt_cv_path_NM"
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | kfreebsd*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case "$host_cpu" in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  case $host_cpu in
+  alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 5228 "configure"' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case "`/usr/bin/file conftest.o`" in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  lt_cv_cc_needs_belf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+lt_cv_cc_needs_belf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  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 <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  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 <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#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);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to zettair@cs.rmit.edu.au ##
+## ------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+  CXX=$ac_ct_CXX
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$F77"; then
+  ac_cv_prog_F77="$F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+  echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$F77" && break
+  done
+fi
+if test -z "$F77"; then
+  ac_ct_F77=$F77
+  for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_F77"; then
+  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_F77="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+  echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_F77" && break
+done
+
+  F77=$ac_ct_F77
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:6800:" \
+     "checking for Fortran 77 compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_f77_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_f77_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_f77_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_f77_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_f77_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6
+if test "$ac_test_FFLAGS" = set; then
+  FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-g -O2"
+  else
+    FFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-O2"
+  else
+    FFLAGS=
+  fi
+fi
+
+G77=`test $ac_compiler_gnu = yes && echo yes`
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# find the maximum length of command line arguments
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+ *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+              = "XX$teststring") >/dev/null 2>&1 &&
+           new_result=`expr "X$teststring" : ".*" 2>&1` &&
+           lt_cv_sys_max_cmd_len=$new_result &&
+           test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
+else
+  echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris* | sysv5*)
+  symcode='[BDRT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[      ]\($symcode$symcode*\)[         ][      ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+       if grep ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+         cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+         cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_save_LIBS="$LIBS"
+         lt_save_CFLAGS="$CFLAGS"
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+         if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+         CFLAGS="$lt_save_CFLAGS"
+       else
+         echo "cannot find nm_test_func in $nlist" >&5
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
+else
+  echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+fi
+
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
+if test "${lt_cv_objdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_AR="ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  AR=$ac_ct_AR
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  RANLIB=$ac_ct_RANLIB
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi;
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+#
+# Check for any special shared library compilation flags.
+#
+lt_prog_cc_shlib=
+if test "$GCC" = no; then
+  case $host_os in
+  sco3.2v5*)
+    lt_prog_cc_shlib='-belf'
+    ;;
+  esac
+fi
+if test -n "$lt_prog_cc_shlib"; then
+  { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5
+echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;}
+  if echo "$old_CC $old_CFLAGS " | grep "[     ]$lt_prog_cc_shlib[     ]" >/dev/null; then :
+  else
+    { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5
+echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;}
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+
+#
+# Check to make sure the static flag actually works.
+#
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6
+if test "${lt_prog_compiler_static_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_prog_compiler_static"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+     else
+       lt_prog_compiler_static_works=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
+
+if test x"$lt_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7834: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7838: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      else
+       lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    linux*)
+      case $CC in
+      icc* | ecc*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-KPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_prog_compiler_pic='-Kpic'
+      lt_prog_compiler_static='-dn'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic='-Kconform_pic'
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8067: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:8071: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_prog_compiler_pic_works=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8127: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:8131: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  runpath_var=
+  allow_undefined_flag=
+  enable_shared_with_static_runtimes=no
+  archive_cmds=
+  archive_expsym_cmds=
+  old_archive_From_new_cmds=
+  old_archive_from_expsyms_cmds=
+  export_dynamic_flag_spec=
+  whole_archive_flag_spec=
+  thread_safe_flag_spec=
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_direct=no
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  link_all_deplibs=unknown
+  hardcode_automatic=no
+  module_cmds=
+  module_expsym_cmds=
+  always_export_symbols=no
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       ld_shlibs=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+  linux*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_cmds="$tmp_archive_cmds"
+      supports_anon_versioning=no
+      case `$LD -v 2>/dev/null` in
+        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+        *\ 2.11.*) ;; # other 2.11 versions
+        *) supports_anon_versioning=yes ;;
+      esac
+      if test $supports_anon_versioning = yes; then
+        archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+$echo "local: *; };" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+      else
+        archive_expsym_cmds="$tmp_archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = yes; then
+      runpath_var=LD_RUN_PATH
+      hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+      export_dynamic_flag_spec='${wl}--export-dynamic'
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       whole_archive_flag_spec=
+      fi
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$link_static_flag"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.012|aix4.012.*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         hardcode_direct=yes
+         else
+         # We have old collect2
+         hardcode_direct=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L=yes
+         hardcode_libdir_flag_spec='-L$libdir'
+         hardcode_libdir_separator=
+         fi
+       esac
+       shared_flag='-shared'
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+       if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+       fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+       archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag="-z nodefs"
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag=' ${wl}-bernotok'
+         allow_undefined_flag=' ${wl}-berok'
+         # -bexpall does not export symbols beginning with underscore (_)
+         always_export_symbols=yes
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec=' '
+         archive_cmds_need_lc=yes
+         # This is similar to how AIX traditionally builds it's shared libraries.
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+
+    bsdi4*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+    if test "$GXX" = yes ; then
+      archive_cmds_need_lc=no
+      case "$host_os" in
+      rhapsody* | darwin1.[012])
+       allow_undefined_flag='-undefined suppress'
+       ;;
+      *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       allow_undefined_flag='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+       ;;
+      esac
+       lt_int_apple_cc_single_mod=no
+       output_verbose_link_cmd='echo'
+       if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+         lt_int_apple_cc_single_mod=yes
+       fi
+       if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+         archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+       else
+        archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      fi
+      module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+          archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        else
+          archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        fi
+          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      hardcode_direct=no
+      hardcode_automatic=yes
+      hardcode_shlibpath_var=unsupported
+      whole_archive_flag_spec='-all_load $convenience'
+      link_all_deplibs=yes
+    else
+      ld_shlibs=no
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10* | hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+         ;;
+       *)
+         archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       case "$host_cpu" in
+       hppa*64*)
+         hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+         hardcode_libdir_flag_spec_ld='+b $libdir'
+         hardcode_libdir_separator=:
+         hardcode_direct=no
+         hardcode_shlibpath_var=no
+         ;;
+       ia64*)
+         hardcode_libdir_flag_spec='-L$libdir'
+         hardcode_direct=no
+         hardcode_shlibpath_var=no
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L=yes
+         ;;
+       *)
+         hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+         hardcode_libdir_separator=:
+         hardcode_direct=yes
+         export_dynamic_flag_spec='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_ld='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      link_all_deplibs=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    openbsd*)
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec='${wl}-E'
+      else
+       case $host_os in
+        openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+          archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          hardcode_libdir_flag_spec='-R$libdir'
+          ;;
+        *)
+          archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+
+    sco3.2v5*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z text'
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+       whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds='$CC -r -o $output$reload_objs'
+         hardcode_direct=no
+        ;;
+       motorola)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4.2uw2*)
+      archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=no
+      hardcode_shlibpath_var=no
+      hardcode_runpath_var=yes
+      runpath_var=LD_RUN_PATH
+      ;;
+
+   sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      no_undefined_flag='${wl}-z ${wl}text'
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv5*)
+      no_undefined_flag=' -z text'
+      # $CC -shared without GNU ld will not create a library from C++
+      # object files and a static libstdc++, better avoid it by now
+      archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      hardcode_libdir_flag_spec=
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc=no
+        else
+         archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.01* | freebsdelf3.01*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '#line 9461 "configure"' > conftest.$ac_ext
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var " || \
+   test "X$hardcode_automatic"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+       else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+       ;;
+   *)
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != shl_load;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != dlopen;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_svld_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dld_link ();
+int
+main ()
+{
+dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_dld_link=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 10332 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 10430 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# Report which librarie types wil actually be built
+echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
+
+echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+  darwin* | rhapsody*)
+  if test "$GCC" = yes; then
+    archive_cmds_need_lc=no
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       allow_undefined_flag='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+      ;;
+    esac
+    output_verbose_link_cmd='echo'
+    archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
+    module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+    archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag  -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    hardcode_direct=no
+    hardcode_automatic=yes
+    hardcode_shlibpath_var=unsupported
+    whole_archive_flag_spec='-all_load $convenience'
+    link_all_deplibs=yes
+  else
+    ld_shlibs=no
+  fi
+    ;;
+esac
+echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
+
+echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler \
+    CC \
+    LD \
+    lt_prog_compiler_wl \
+    lt_prog_compiler_pic \
+    lt_prog_compiler_static \
+    lt_prog_compiler_no_builtin_flag \
+    export_dynamic_flag_spec \
+    thread_safe_flag_spec \
+    whole_archive_flag_spec \
+    enable_shared_with_static_runtimes \
+    old_archive_cmds \
+    old_archive_from_new_cmds \
+    predep_objects \
+    postdep_objects \
+    predeps \
+    postdeps \
+    compiler_lib_search_path \
+    archive_cmds \
+    archive_expsym_cmds \
+    postinstall_cmds \
+    postuninstall_cmds \
+    old_archive_from_expsyms_cmds \
+    allow_undefined_flag \
+    no_undefined_flag \
+    export_symbols_cmds \
+    hardcode_libdir_flag_spec \
+    hardcode_libdir_flag_spec_ld \
+    hardcode_libdir_separator \
+    hardcode_automatic \
+    module_cmds \
+    module_expsym_cmds \
+    lt_cv_prog_compiler_c_o \
+    exclude_expsyms \
+    include_expsyms; do
+
+    case $var in
+    old_archive_cmds | \
+    old_archive_from_new_cmds | \
+    archive_cmds | \
+    archive_expsym_cmds | \
+    module_cmds | \
+    module_expsym_cmds | \
+    old_archive_from_expsyms_cmds | \
+    export_symbols_cmds | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+
+  cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags or --without-tags was given.
+if test "${with_tags+set}" = set; then
+  withval="$with_tags"
+  tagnames="$withval"
+fi;
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+    else
+      { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+    fi
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+    "") ;;
+    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+       ;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+       if test -n "$CXX" && test "X$CXX" != "Xno"; then
+         ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cc
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+  lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+       grep 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_CXX=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+ld_shlibs_CXX=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+       for ld_flag in $LDFLAGS; do
+         case $ld_flag in
+         *-brtl*)
+           aix_use_runtimelinking=yes
+           break
+           ;;
+         esac
+       done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    archive_cmds_CXX=''
+    hardcode_direct_CXX=yes
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.012|aix4.012.*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+       collect2name=`${CC} -print-prog-name=collect2`
+       if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+       then
+         # We have reworked collect2
+         hardcode_direct_CXX=yes
+       else
+         # We have old collect2
+         hardcode_direct_CXX=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L_CXX=yes
+         hardcode_libdir_flag_spec_CXX='-L$libdir'
+         hardcode_libdir_separator_CXX=
+       fi
+      esac
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+       shared_flag='-G'
+      else
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag='${wl}-G'
+       else
+         shared_flag='${wl}-bM:SRE'
+       fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    always_export_symbols_CXX=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag_CXX='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+      hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+       hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+       allow_undefined_flag_CXX="-z nodefs"
+       archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+       # Warning - without using the other run time loading flags,
+       # -berok will link without error, but may produce a broken library.
+       no_undefined_flag_CXX=' ${wl}-bernotok'
+       allow_undefined_flag_CXX=' ${wl}-berok'
+       # -bexpall does not export symbols beginning with underscore (_)
+       always_export_symbols_CXX=yes
+       # Exported symbols can be pulled into shared objects from archives
+       whole_archive_flag_spec_CXX=' '
+       archive_cmds_need_lc_CXX=yes
+       # This is similar to how AIX traditionally builds it's shared libraries.
+       archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+  chorus*)
+    case $cc_basename in
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+    # as there is no search path for DLLs.
+    hardcode_libdir_flag_spec_CXX='-L$libdir'
+    allow_undefined_flag_CXX=unsupported
+    always_export_symbols_CXX=no
+    enable_shared_with_static_runtimes_CXX=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+       cp $export_symbols $output_objdir/$soname.def;
+      else
+       echo EXPORTS > $output_objdir/$soname.def;
+       cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+  ;;
+
+  darwin* | rhapsody*)
+  if test "$GXX" = yes; then
+    archive_cmds_need_lc_CXX=no
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag_CXX='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag_CXX='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+      ;;
+    esac
+    lt_int_apple_cc_single_mod=no
+    output_verbose_link_cmd='echo'
+    if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+      lt_int_apple_cc_single_mod=yes
+    fi
+    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+      archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    else
+      archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    fi
+    module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+
+    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+      archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    hardcode_direct_CXX=no
+    hardcode_automatic_CXX=yes
+    hardcode_shlibpath_var_CXX=unsupported
+    whole_archive_flag_spec_CXX='-all_load $convenience'
+    link_all_deplibs_CXX=yes
+  else
+    ld_shlibs_CXX=no
+  fi
+    ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      ghcx)
+       # Green Hills C++ Compiler
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  freebsd12*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    ld_shlibs_CXX=no
+    ;;
+  freebsd-elf*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  freebsd* | kfreebsd*-gnu)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    ld_shlibs_CXX=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    hardcode_direct_CXX=yes
+    hardcode_minus_L_CXX=yes # Not in the search PATH,
+                               # but as the default
+                               # location of the library.
+
+    case $cc_basename in
+    CC)
+      # FIXME: insert proper C++ library support
+      ld_shlibs_CXX=no
+      ;;
+    aCC)
+      archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      case "$host_cpu" in
+      hppa*64*)
+       hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+       hardcode_libdir_flag_spec_ld_CXX='+b $libdir'
+       hardcode_libdir_separator_CXX=:
+        ;;
+      ia64*)
+       hardcode_libdir_flag_spec_CXX='-L$libdir'
+        ;;
+      *)
+       hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator_CXX=:
+       export_dynamic_flag_spec_CXX='${wl}-E'
+        ;;
+      esac
+    fi
+    case "$host_cpu" in
+    hppa*64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      ;;
+    ia64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                             # but as the default
+                                             # location of the library.
+      ;;
+    *)
+      hardcode_direct_CXX=yes
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                             # but as the default
+                                             # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      aCC)
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+         ;;
+       *)
+         archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       esac
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test $with_gnu_ld = no; then
+           case "$host_cpu" in
+           ia64*|hppa*64*)
+             archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+             ;;
+           *)
+             archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           esac
+         fi
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC)
+       # SGI C++
+       archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+       # Archives containing C++ object files must be created using
+       # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test "$with_gnu_ld" = no; then
+           archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+         else
+           archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+         fi
+       fi
+       link_all_deplibs_CXX=yes
+       ;;
+    esac
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    ;;
+  linux*)
+    case $cc_basename in
+      KCC)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+       archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+       hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+       export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+       ;;
+      icpc)
+       # Intel C++
+       with_gnu_ld=yes
+       archive_cmds_need_lc_CXX=no
+       archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+       whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+       ;;
+      cxx)
+       # Compaq C++
+       archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+       runpath_var=LD_RUN_PATH
+       hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      hardcode_libdir_flag_spec_CXX='-R$libdir'
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+       ;;
+      RCC)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      cxx)
+       allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+         archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+         hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+         hardcode_libdir_separator_CXX=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Archives containing C++ object files must be created using
+       # the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+       ;;
+      RCC)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      cxx)
+       allow_undefined_flag_CXX=' -expect_unresolved \*'
+       archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+       archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+         echo "-hidden">> $lib.exp~
+         $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~
+         $rm $lib.exp'
+
+       hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+        archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+         hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+         hardcode_libdir_separator_CXX=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  sco*)
+    archive_cmds_need_lc_CXX=no
+    case $cc_basename in
+      CC)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC)
+       # Sun C++ 4.x
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      lcc)
+       # Lucid
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC)
+       # Sun C++ 4.2, 5.x and Centerline C++
+       no_undefined_flag_CXX=' -zdefs'
+       archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+       archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+       hardcode_libdir_flag_spec_CXX='-R$libdir'
+       hardcode_shlibpath_var_CXX=no
+       case $host_os in
+         solaris2.0-5 | solaris2.0-5.*) ;;
+         *)
+           # The C++ compiler is used as linker so we must use $wl
+           # flag to pass the commands to the underlying system
+           # linker.
+           # Supported since Solaris 2.6 (maybe 2.5.1?)
+           whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+           ;;
+       esac
+       link_all_deplibs_CXX=yes
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+       # Archives containing C++ object files must be created using
+       # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+       ;;
+      gcx)
+       # Green Hills C++ Compiler
+       archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+       # The C++ compiler must be used to create the archive.
+       old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+       ;;
+      *)
+       # GNU C++ compiler with Solaris linker
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+         if $CC --version | grep -v '^2\.7' > /dev/null; then
+           archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         else
+           # g++ 2.7 appears to require `-G' NOT `-shared' on this
+           # platform.
+           archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         fi
+
+         hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+       fi
+       ;;
+    esac
+    ;;
+  sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC)
+       # NonStop-UX NCC 3.20
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+esac
+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`"
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+         || test $p = "-R"; then
+        prev=$p
+        continue
+       else
+        prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        case $p in
+        -L* | -R*)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$compiler_lib_search_path_CXX"; then
+            compiler_lib_search_path_CXX="${prev}${p}"
+          else
+            compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$postdeps_CXX"; then
+          postdeps_CXX="${prev}${p}"
+        else
+          postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+        fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$predep_objects_CXX"; then
+          predep_objects_CXX="$p"
+        else
+          predep_objects_CXX="$predep_objects_CXX $p"
+        fi
+       else
+        if test -z "$postdep_objects_CXX"; then
+          postdep_objects_CXX="$p"
+        else
+          postdep_objects_CXX="$postdep_objects_CXX $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       ;;
+      *)
+       lt_prog_compiler_pic_CXX='-fPIC'
+       ;;
+      esac
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         lt_prog_compiler_static_CXX='-Bstatic'
+       else
+         lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68)
+         # Green Hills C++ Compiler
+         # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++)
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         ghcx)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | kfreebsd*-gnu)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+           if test "$host_cpu" != ia64; then
+             lt_prog_compiler_pic_CXX='+Z'
+           fi
+           ;;
+         aCC)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+           case "$host_cpu" in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             lt_prog_compiler_pic_CXX='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux*)
+       case $cc_basename in
+         KCC)
+           # KAI C++ Compiler
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           ;;
+         icpc)
+           # Intel C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         cxx)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx)
+           lt_prog_compiler_pic_CXX='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd*)
+       ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC)
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           ;;
+         RCC)
+           # Rational C++ 2.4.1
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         cxx)
+           # Digital/Compaq C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      sco*)
+       case $cc_basename in
+         CC)
+           lt_prog_compiler_pic_CXX='-fPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           lt_prog_compiler_wl_CXX='-Qoption ld '
+           ;;
+         gcx)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC)
+           # Sun C++ 4.x
+           lt_prog_compiler_pic_CXX='-pic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         lcc)
+           # Lucid
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC)
+           # NonStop-UX NCC 3.20
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      unixware*)
+       ;;
+      vxworks*)
+       ;;
+      *)
+       lt_prog_compiler_can_build_shared_CXX=no
+       ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_CXX=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12609: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:12613: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6
+
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12669: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:12673: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+
+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc_CXX=no
+        else
+         archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.01* | freebsdelf3.01*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '#line 13180 "configure"' > conftest.$ac_ext
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+   test -n "$runpath_var CXX" || \
+   test "X$hardcode_automatic_CXX"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6
+
+if test "$hardcode_action_CXX" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+       else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+       ;;
+   *)
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != shl_load;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != dlopen;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_svld_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dld_link ();
+int
+main ()
+{
+dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_dld_link=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 14051 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 14149 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_CXX \
+    CC_CXX \
+    LD_CXX \
+    lt_prog_compiler_wl_CXX \
+    lt_prog_compiler_pic_CXX \
+    lt_prog_compiler_static_CXX \
+    lt_prog_compiler_no_builtin_flag_CXX \
+    export_dynamic_flag_spec_CXX \
+    thread_safe_flag_spec_CXX \
+    whole_archive_flag_spec_CXX \
+    enable_shared_with_static_runtimes_CXX \
+    old_archive_cmds_CXX \
+    old_archive_from_new_cmds_CXX \
+    predep_objects_CXX \
+    postdep_objects_CXX \
+    predeps_CXX \
+    postdeps_CXX \
+    compiler_lib_search_path_CXX \
+    archive_cmds_CXX \
+    archive_expsym_cmds_CXX \
+    postinstall_cmds_CXX \
+    postuninstall_cmds_CXX \
+    old_archive_from_expsyms_cmds_CXX \
+    allow_undefined_flag_CXX \
+    no_undefined_flag_CXX \
+    export_symbols_cmds_CXX \
+    hardcode_libdir_flag_spec_CXX \
+    hardcode_libdir_flag_spec_ld_CXX \
+    hardcode_libdir_separator_CXX \
+    hardcode_automatic_CXX \
+    module_cmds_CXX \
+    module_expsym_cmds_CXX \
+    lt_cv_prog_compiler_c_o_CXX \
+    exclude_expsyms_CXX \
+    include_expsyms_CXX; do
+
+    case $var in
+    old_archive_cmds_CXX | \
+    old_archive_from_new_cmds_CXX | \
+    archive_cmds_CXX | \
+    archive_expsym_cmds_CXX | \
+    module_cmds_CXX | \
+    module_expsym_cmds_CXX | \
+    old_archive_from_expsyms_cmds_CXX | \
+    export_symbols_cmds_CXX | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_CXX"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+       else
+         tagname=""
+       fi
+       ;;
+
+      F77)
+       if test -n "$F77" && test "X$F77" != "Xno"; then
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="      program t\n      end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+compiler_F77=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
+
+echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  test "$enable_shared" = yes && enable_static=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
+
+echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
+
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_F77='-Wl,'
+    lt_prog_compiler_static_F77='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_F77='-fno-common'
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_F77=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_F77=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_F77='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_F77='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_F77='-Bstatic'
+      else
+       lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_F77='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    linux*)
+      case $CC in
+      icc* | ecc*)
+       lt_prog_compiler_wl_F77='-Wl,'
+       lt_prog_compiler_pic_F77='-KPIC'
+       lt_prog_compiler_static_F77='-static'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_F77='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_F77='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_prog_compiler_pic_F77='-Kpic'
+      lt_prog_compiler_static_F77='-dn'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_F77='-Qoption ld '
+      lt_prog_compiler_pic_F77='-PIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic_F77='-Kconform_pic'
+       lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_F77='-pic'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_F77=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_F77"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:14976: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:14980: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_prog_compiler_pic_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6
+
+if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
+    case $lt_prog_compiler_pic_F77 in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+     esac
+else
+    lt_prog_compiler_pic_F77=
+     lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_F77=
+    ;;
+  *)
+    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+    ;;
+esac
+
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_F77=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:15036: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:15040: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       lt_cv_prog_compiler_c_o_F77=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  runpath_var=
+  allow_undefined_flag_F77=
+  enable_shared_with_static_runtimes_F77=no
+  archive_cmds_F77=
+  archive_expsym_cmds_F77=
+  old_archive_From_new_cmds_F77=
+  old_archive_from_expsyms_cmds_F77=
+  export_dynamic_flag_spec_F77=
+  whole_archive_flag_spec_F77=
+  thread_safe_flag_spec_F77=
+  hardcode_libdir_flag_spec_F77=
+  hardcode_libdir_flag_spec_ld_F77=
+  hardcode_libdir_separator_F77=
+  hardcode_direct_F77=no
+  hardcode_minus_L_F77=no
+  hardcode_shlibpath_var_F77=unsupported
+  link_all_deplibs_F77=unknown
+  hardcode_automatic_F77=no
+  module_cmds_F77=
+  module_expsym_cmds_F77=
+  always_export_symbols_F77=no
+  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_F77=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_F77=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs_F77=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_F77=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag_F77=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs_F77=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=no
+      enable_shared_with_static_runtimes_F77=yes
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       ld_shlibs_F77=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_F77=no
+      fi
+      ;;
+
+    sunos4*)
+      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+  linux*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_cmds_F77="$tmp_archive_cmds"
+      supports_anon_versioning=no
+      case `$LD -v 2>/dev/null` in
+        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+        *\ 2.11.*) ;; # other 2.11 versions
+        *) supports_anon_versioning=yes ;;
+      esac
+      if test $supports_anon_versioning = yes; then
+        archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+$echo "local: *; };" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+      else
+        archive_expsym_cmds_F77="$tmp_archive_cmds"
+      fi
+    else
+      ld_shlibs_F77=no
+    fi
+    ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_F77=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_F77" = yes; then
+      runpath_var=LD_RUN_PATH
+      hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+      export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       whole_archive_flag_spec_F77=
+      fi
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=yes
+      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_F77=yes
+      if test "$GCC" = yes && test -z "$link_static_flag"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct_F77=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_F77=''
+      hardcode_direct_F77=yes
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.012|aix4.012.*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         hardcode_direct_F77=yes
+         else
+         # We have old collect2
+         hardcode_direct_F77=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L_F77=yes
+         hardcode_libdir_flag_spec_F77='-L$libdir'
+         hardcode_libdir_separator_F77=
+         fi
+       esac
+       shared_flag='-shared'
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+       if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+       fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_F77=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag_F77='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_f77_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+       archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag_F77="-z nodefs"
+         archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_f77_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag_F77=' ${wl}-bernotok'
+         allow_undefined_flag_F77=' ${wl}-berok'
+         # -bexpall does not export symbols beginning with underscore (_)
+         always_export_symbols_F77=yes
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec_F77=' '
+         archive_cmds_need_lc_F77=yes
+         # This is similar to how AIX traditionally builds it's shared libraries.
+         archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_F77=no
+      ;;
+
+    bsdi4*)
+      export_dynamic_flag_spec_F77=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_F77=' '
+      allow_undefined_flag_F77=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_F77='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_F77=yes
+      ;;
+
+    darwin* | rhapsody*)
+    if test "$GXX" = yes ; then
+      archive_cmds_need_lc_F77=no
+      case "$host_os" in
+      rhapsody* | darwin1.[012])
+       allow_undefined_flag_F77='-undefined suppress'
+       ;;
+      *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       allow_undefined_flag_F77='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag_F77='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag_F77='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+       ;;
+      esac
+       lt_int_apple_cc_single_mod=no
+       output_verbose_link_cmd='echo'
+       if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+         lt_int_apple_cc_single_mod=yes
+       fi
+       if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+         archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+       else
+        archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      fi
+      module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+          archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        else
+          archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        fi
+          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      hardcode_direct_F77=no
+      hardcode_automatic_F77=yes
+      hardcode_shlibpath_var_F77=unsupported
+      whole_archive_flag_spec_F77='-all_load $convenience'
+      link_all_deplibs_F77=yes
+    else
+      ld_shlibs_F77=no
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_F77=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu)
+      archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_direct_F77=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-E'
+      ;;
+
+    hpux10* | hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+         ;;
+       *)
+         archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       case "$host_cpu" in
+       hppa*64*)
+         hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+         hardcode_libdir_flag_spec_ld_F77='+b $libdir'
+         hardcode_libdir_separator_F77=:
+         hardcode_direct_F77=no
+         hardcode_shlibpath_var_F77=no
+         ;;
+       ia64*)
+         hardcode_libdir_flag_spec_F77='-L$libdir'
+         hardcode_direct_F77=no
+         hardcode_shlibpath_var_F77=no
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L_F77=yes
+         ;;
+       *)
+         hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+         hardcode_libdir_separator_F77=:
+         hardcode_direct_F77=yes
+         export_dynamic_flag_spec_F77='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L_F77=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      link_all_deplibs_F77=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    newsos6)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    openbsd*)
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_F77='${wl}-E'
+      else
+       case $host_os in
+        openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+          archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          hardcode_libdir_flag_spec_F77='-R$libdir'
+          ;;
+        *)
+          archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      allow_undefined_flag_F77=unsupported
+      archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag_F77=' -expect_unresolved \*'
+       archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag_F77=' -expect_unresolved \*'
+       archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    sco3.2v5*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='${wl}-Bexport'
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ;;
+
+    solaris*)
+      no_undefined_flag_F77=' -z text'
+      if test "$GCC" = yes; then
+       archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_shlibpath_var_F77=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+       whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;;
+      esac
+      link_all_deplibs_F77=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_F77=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds_F77='$CC -r -o $output$reload_objs'
+         hardcode_direct_F77=no
+        ;;
+       motorola)
+         archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var_F77=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs_F77=yes
+      fi
+      ;;
+
+    sysv4.2uw2*)
+      archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_runpath_var=yes
+      runpath_var=LD_RUN_PATH
+      ;;
+
+   sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      no_undefined_flag_F77='${wl}-z ${wl}text'
+      if test "$GCC" = yes; then
+       archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv5*)
+      no_undefined_flag_F77=' -z text'
+      # $CC -shared without GNU ld will not create a library from C++
+      # object files and a static libstdc++, better avoid it by now
+      archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      hardcode_libdir_flag_spec_F77=
+      hardcode_shlibpath_var_F77=no
+      runpath_var='LD_RUN_PATH'
+      ;;
+
+    uts4*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      ld_shlibs_F77=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_F77=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_F77 in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_F77
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+        allow_undefined_flag_F77=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc_F77=no
+        else
+         archive_cmds_need_lc_F77=yes
+        fi
+        allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.01* | freebsdelf3.01*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '#line 16350 "configure"' > conftest.$ac_ext
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" || \
+   test -n "$runpath_var F77" || \
+   test "X$hardcode_automatic_F77"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_F77" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+     test "$hardcode_minus_L_F77" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_F77=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_F77=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_F77=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6
+
+if test "$hardcode_action_F77" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+       else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+       ;;
+   *)
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    ;;
+  esac
+fi
+
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_F77 \
+    CC_F77 \
+    LD_F77 \
+    lt_prog_compiler_wl_F77 \
+    lt_prog_compiler_pic_F77 \
+    lt_prog_compiler_static_F77 \
+    lt_prog_compiler_no_builtin_flag_F77 \
+    export_dynamic_flag_spec_F77 \
+    thread_safe_flag_spec_F77 \
+    whole_archive_flag_spec_F77 \
+    enable_shared_with_static_runtimes_F77 \
+    old_archive_cmds_F77 \
+    old_archive_from_new_cmds_F77 \
+    predep_objects_F77 \
+    postdep_objects_F77 \
+    predeps_F77 \
+    postdeps_F77 \
+    compiler_lib_search_path_F77 \
+    archive_cmds_F77 \
+    archive_expsym_cmds_F77 \
+    postinstall_cmds_F77 \
+    postuninstall_cmds_F77 \
+    old_archive_from_expsyms_cmds_F77 \
+    allow_undefined_flag_F77 \
+    no_undefined_flag_F77 \
+    export_symbols_cmds_F77 \
+    hardcode_libdir_flag_spec_F77 \
+    hardcode_libdir_flag_spec_ld_F77 \
+    hardcode_libdir_separator_F77 \
+    hardcode_automatic_F77 \
+    module_cmds_F77 \
+    module_expsym_cmds_F77 \
+    lt_cv_prog_compiler_c_o_F77 \
+    exclude_expsyms_F77 \
+    include_expsyms_F77; do
+
+    case $var in
+    old_archive_cmds_F77 | \
+    old_archive_from_new_cmds_F77 | \
+    archive_cmds_F77 | \
+    archive_expsym_cmds_F77 | \
+    module_cmds_F77 | \
+    module_expsym_cmds_F77 | \
+    old_archive_from_expsyms_cmds_F77 | \
+    export_symbols_cmds_F77 | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_F77"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+       else
+         tagname=""
+       fi
+       ;;
+
+      GCJ)
+       if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17091: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:17095: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_GCJ='-Wl,'
+    lt_prog_compiler_static_GCJ='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_GCJ='-fno-common'
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_GCJ=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_GCJ=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_GCJ='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_GCJ='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      else
+       lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_GCJ='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    linux*)
+      case $CC in
+      icc* | ecc*)
+       lt_prog_compiler_wl_GCJ='-Wl,'
+       lt_prog_compiler_pic_GCJ='-KPIC'
+       lt_prog_compiler_static_GCJ='-static'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_GCJ='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_GCJ='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_prog_compiler_pic_GCJ='-Kpic'
+      lt_prog_compiler_static_GCJ='-dn'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_GCJ='-Qoption ld '
+      lt_prog_compiler_pic_GCJ='-PIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic_GCJ='-Kconform_pic'
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_GCJ='-pic'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_GCJ=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17324: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:17328: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_prog_compiler_pic_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6
+
+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+    case $lt_prog_compiler_pic_GCJ in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+     esac
+else
+    lt_prog_compiler_pic_GCJ=
+     lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_GCJ=
+    ;;
+  *)
+    lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+    ;;
+esac
+
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_GCJ=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17384: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:17388: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       lt_cv_prog_compiler_c_o_GCJ=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+  runpath_var=
+  allow_undefined_flag_GCJ=
+  enable_shared_with_static_runtimes_GCJ=no
+  archive_cmds_GCJ=
+  archive_expsym_cmds_GCJ=
+  old_archive_From_new_cmds_GCJ=
+  old_archive_from_expsyms_cmds_GCJ=
+  export_dynamic_flag_spec_GCJ=
+  whole_archive_flag_spec_GCJ=
+  thread_safe_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_ld_GCJ=
+  hardcode_libdir_separator_GCJ=
+  hardcode_direct_GCJ=no
+  hardcode_minus_L_GCJ=no
+  hardcode_shlibpath_var_GCJ=unsupported
+  link_all_deplibs_GCJ=unknown
+  hardcode_automatic_GCJ=no
+  module_cmds_GCJ=
+  module_expsym_cmds_GCJ=
+  always_export_symbols_GCJ=no
+  export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_GCJ=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_GCJ=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs_GCJ=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_GCJ=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag_GCJ=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=no
+      enable_shared_with_static_runtimes_GCJ=yes
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       ld_shlibs_GCJ=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    sunos4*)
+      archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+  linux*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_cmds_GCJ="$tmp_archive_cmds"
+      supports_anon_versioning=no
+      case `$LD -v 2>/dev/null` in
+        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+        *\ 2.11.*) ;; # other 2.11 versions
+        *) supports_anon_versioning=yes ;;
+      esac
+      if test $supports_anon_versioning = yes; then
+        archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+$echo "local: *; };" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+      else
+        archive_expsym_cmds_GCJ="$tmp_archive_cmds"
+      fi
+    else
+      ld_shlibs_GCJ=no
+    fi
+    ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_GCJ" = yes; then
+      runpath_var=LD_RUN_PATH
+      hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+      export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       whole_archive_flag_spec_GCJ=
+      fi
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=yes
+      archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_GCJ=yes
+      if test "$GCC" = yes && test -z "$link_static_flag"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct_GCJ=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_GCJ=''
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.012|aix4.012.*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         hardcode_direct_GCJ=yes
+         else
+         # We have old collect2
+         hardcode_direct_GCJ=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L_GCJ=yes
+         hardcode_libdir_flag_spec_GCJ='-L$libdir'
+         hardcode_libdir_separator_GCJ=
+         fi
+       esac
+       shared_flag='-shared'
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+       if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+       fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_GCJ=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag_GCJ='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+       archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag_GCJ="-z nodefs"
+         archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag_GCJ=' ${wl}-bernotok'
+         allow_undefined_flag_GCJ=' ${wl}-berok'
+         # -bexpall does not export symbols beginning with underscore (_)
+         always_export_symbols_GCJ=yes
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec_GCJ=' '
+         archive_cmds_need_lc_GCJ=yes
+         # This is similar to how AIX traditionally builds it's shared libraries.
+         archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_GCJ=no
+      ;;
+
+    bsdi4*)
+      export_dynamic_flag_spec_GCJ=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ=' '
+      allow_undefined_flag_GCJ=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_GCJ='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_GCJ=yes
+      ;;
+
+    darwin* | rhapsody*)
+    if test "$GXX" = yes ; then
+      archive_cmds_need_lc_GCJ=no
+      case "$host_os" in
+      rhapsody* | darwin1.[012])
+       allow_undefined_flag_GCJ='-undefined suppress'
+       ;;
+      *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+       allow_undefined_flag_GCJ='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag_GCJ='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag_GCJ='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+       ;;
+      esac
+       lt_int_apple_cc_single_mod=no
+       output_verbose_link_cmd='echo'
+       if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+         lt_int_apple_cc_single_mod=yes
+       fi
+       if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+         archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+       else
+        archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      fi
+      module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+          archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        else
+          archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        fi
+          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      hardcode_direct_GCJ=no
+      hardcode_automatic_GCJ=yes
+      hardcode_shlibpath_var_GCJ=unsupported
+      whole_archive_flag_spec_GCJ='-all_load $convenience'
+      link_all_deplibs_GCJ=yes
+    else
+      ld_shlibs_GCJ=no
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_GCJ=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu)
+      archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_direct_GCJ=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      ;;
+
+    hpux10* | hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case "$host_cpu" in
+       hppa*64*|ia64*)
+         archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+         ;;
+       *)
+         archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       case "$host_cpu" in
+       hppa*64*)
+         hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+         hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+         hardcode_libdir_separator_GCJ=:
+         hardcode_direct_GCJ=no
+         hardcode_shlibpath_var_GCJ=no
+         ;;
+       ia64*)
+         hardcode_libdir_flag_spec_GCJ='-L$libdir'
+         hardcode_direct_GCJ=no
+         hardcode_shlibpath_var_GCJ=no
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L_GCJ=yes
+         ;;
+       *)
+         hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+         hardcode_libdir_separator_GCJ=:
+         hardcode_direct_GCJ=yes
+         export_dynamic_flag_spec_GCJ='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L_GCJ=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    newsos6)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    openbsd*)
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_GCJ='${wl}-E'
+      else
+       case $host_os in
+        openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+          archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          hardcode_libdir_flag_spec_GCJ='-R$libdir'
+          ;;
+        *)
+          archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      allow_undefined_flag_GCJ=unsupported
+      archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag_GCJ=' -expect_unresolved \*'
+       archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag_GCJ=' -expect_unresolved \*'
+       archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    sco3.2v5*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ;;
+
+    solaris*)
+      no_undefined_flag_GCJ=' -z text'
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+       whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
+      esac
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_GCJ=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+         hardcode_direct_GCJ=no
+        ;;
+       motorola)
+         archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var_GCJ=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs_GCJ=yes
+      fi
+      ;;
+
+    sysv4.2uw2*)
+      archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_runpath_var=yes
+      runpath_var=LD_RUN_PATH
+      ;;
+
+   sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      no_undefined_flag_GCJ='${wl}-z ${wl}text'
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv5*)
+      no_undefined_flag_GCJ=' -z text'
+      # $CC -shared without GNU ld will not create a library from C++
+      # object files and a static libstdc++, better avoid it by now
+      archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      hardcode_libdir_flag_spec_GCJ=
+      hardcode_shlibpath_var_GCJ=no
+      runpath_var='LD_RUN_PATH'
+      ;;
+
+    uts4*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      ld_shlibs_GCJ=no
+      ;;
+    esac
+  fi
+
+echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_GCJ=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_GCJ in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_GCJ
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+        allow_undefined_flag_GCJ=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc_GCJ=no
+        else
+         archive_cmds_need_lc_GCJ=yes
+        fi
+        allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.01* | freebsdelf3.01*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '#line 18718 "configure"' > conftest.$ac_ext
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+   test -n "$runpath_var GCJ" || \
+   test "X$hardcode_automatic_GCJ"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_GCJ" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+     test "$hardcode_minus_L_GCJ" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_GCJ=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_GCJ=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_GCJ=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6
+
+if test "$hardcode_action_GCJ" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+       else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+       ;;
+   *)
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != shl_load;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != dlopen;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_svld_dlopen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dld_link ();
+int
+main ()
+{
+dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_dld_link=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 19589 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 19687 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_GCJ \
+    CC_GCJ \
+    LD_GCJ \
+    lt_prog_compiler_wl_GCJ \
+    lt_prog_compiler_pic_GCJ \
+    lt_prog_compiler_static_GCJ \
+    lt_prog_compiler_no_builtin_flag_GCJ \
+    export_dynamic_flag_spec_GCJ \
+    thread_safe_flag_spec_GCJ \
+    whole_archive_flag_spec_GCJ \
+    enable_shared_with_static_runtimes_GCJ \
+    old_archive_cmds_GCJ \
+    old_archive_from_new_cmds_GCJ \
+    predep_objects_GCJ \
+    postdep_objects_GCJ \
+    predeps_GCJ \
+    postdeps_GCJ \
+    compiler_lib_search_path_GCJ \
+    archive_cmds_GCJ \
+    archive_expsym_cmds_GCJ \
+    postinstall_cmds_GCJ \
+    postuninstall_cmds_GCJ \
+    old_archive_from_expsyms_cmds_GCJ \
+    allow_undefined_flag_GCJ \
+    no_undefined_flag_GCJ \
+    export_symbols_cmds_GCJ \
+    hardcode_libdir_flag_spec_GCJ \
+    hardcode_libdir_flag_spec_ld_GCJ \
+    hardcode_libdir_separator_GCJ \
+    hardcode_automatic_GCJ \
+    module_cmds_GCJ \
+    module_expsym_cmds_GCJ \
+    lt_cv_prog_compiler_c_o_GCJ \
+    exclude_expsyms_GCJ \
+    include_expsyms_GCJ; do
+
+    case $var in
+    old_archive_cmds_GCJ | \
+    old_archive_from_new_cmds_GCJ | \
+    archive_cmds_GCJ | \
+    archive_expsym_cmds_GCJ | \
+    module_cmds_GCJ | \
+    module_expsym_cmds_GCJ | \
+    old_archive_from_expsyms_cmds_GCJ | \
+    export_symbols_cmds_GCJ | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_GCJ"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+       else
+         tagname=""
+       fi
+       ;;
+
+      RC)
+
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_RC \
+    CC_RC \
+    LD_RC \
+    lt_prog_compiler_wl_RC \
+    lt_prog_compiler_pic_RC \
+    lt_prog_compiler_static_RC \
+    lt_prog_compiler_no_builtin_flag_RC \
+    export_dynamic_flag_spec_RC \
+    thread_safe_flag_spec_RC \
+    whole_archive_flag_spec_RC \
+    enable_shared_with_static_runtimes_RC \
+    old_archive_cmds_RC \
+    old_archive_from_new_cmds_RC \
+    predep_objects_RC \
+    postdep_objects_RC \
+    predeps_RC \
+    postdeps_RC \
+    compiler_lib_search_path_RC \
+    archive_cmds_RC \
+    archive_expsym_cmds_RC \
+    postinstall_cmds_RC \
+    postuninstall_cmds_RC \
+    old_archive_from_expsyms_cmds_RC \
+    allow_undefined_flag_RC \
+    no_undefined_flag_RC \
+    export_symbols_cmds_RC \
+    hardcode_libdir_flag_spec_RC \
+    hardcode_libdir_flag_spec_ld_RC \
+    hardcode_libdir_separator_RC \
+    hardcode_automatic_RC \
+    module_cmds_RC \
+    module_expsym_cmds_RC \
+    lt_cv_prog_compiler_c_o_RC \
+    exclude_expsyms_RC \
+    include_expsyms_RC; do
+
+    case $var in
+    old_archive_cmds_RC | \
+    old_archive_from_new_cmds_RC | \
+    archive_cmds_RC | \
+    archive_expsym_cmds_RC | \
+    module_cmds_RC | \
+    module_expsym_cmds_RC | \
+    old_archive_from_expsyms_cmds_RC | \
+    export_symbols_cmds_RC | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_RC"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+       ;;
+
+      *)
+       { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+       ;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+        if test -n "$PYTHON"; then
+      # If the user set $PYTHON, use it and don't search something else.
+      echo "$as_me:$LINENO: checking whether $PYTHON version >= 2.2" >&5
+echo $ECHO_N "checking whether $PYTHON version >= 2.2... $ECHO_C" >&6
+      prog="import sys, string
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('2.2', '.')) + [0, 0, 0]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i]
+sys.exit(sys.hexversion < minverhex)"
+  if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5
+   ($PYTHON -c "$prog") >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  { { echo "$as_me:$LINENO: error: too old" >&5
+echo "$as_me: error: too old" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+      am_display_PYTHON=$PYTHON
+    else
+      # Otherwise, try each interpreter until we find one that satisfies
+      # VERSION.
+      echo "$as_me:$LINENO: checking for a Python interpreter with version >= 2.2" >&5
+echo $ECHO_N "checking for a Python interpreter with version >= 2.2... $ECHO_C" >&6
+if test "${am_cv_pathless_PYTHON+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       for am_cv_pathless_PYTHON in python python2 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 none; do
+         test "$am_cv_pathless_PYTHON" = none && break
+         prog="import sys, string
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('2.2', '.')) + [0, 0, 0]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i]
+sys.exit(sys.hexversion < minverhex)"
+  if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5
+   ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then
+  break
+fi
+
+       done
+fi
+echo "$as_me:$LINENO: result: $am_cv_pathless_PYTHON" >&5
+echo "${ECHO_T}$am_cv_pathless_PYTHON" >&6
+      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
+      if test "$am_cv_pathless_PYTHON" = none; then
+       PYTHON=:
+      else
+        # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args.
+set dummy $am_cv_pathless_PYTHON; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_PYTHON+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PYTHON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+
+if test -n "$PYTHON"; then
+  echo "$as_me:$LINENO: result: $PYTHON" >&5
+echo "${ECHO_T}$PYTHON" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+      fi
+      am_display_PYTHON=$am_cv_pathless_PYTHON
+    fi
+
+
+  if test "$PYTHON" = :; then
+      :
+  else
+
+
+  echo "$as_me:$LINENO: checking for $am_display_PYTHON version" >&5
+echo $ECHO_N "checking for $am_display_PYTHON version... $ECHO_C" >&6
+if test "${am_cv_python_version+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"`
+fi
+echo "$as_me:$LINENO: result: $am_cv_python_version" >&5
+echo "${ECHO_T}$am_cv_python_version" >&6
+  PYTHON_VERSION=$am_cv_python_version
+
+
+
+  PYTHON_PREFIX='${prefix}'
+
+  PYTHON_EXEC_PREFIX='${exec_prefix}'
+
+
+
+  echo "$as_me:$LINENO: checking for $am_display_PYTHON platform" >&5
+echo $ECHO_N "checking for $am_display_PYTHON platform... $ECHO_C" >&6
+if test "${am_cv_python_platform+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`
+fi
+echo "$as_me:$LINENO: result: $am_cv_python_platform" >&5
+echo "${ECHO_T}$am_cv_python_platform" >&6
+  PYTHON_PLATFORM=$am_cv_python_platform
+
+
+
+
+                echo "$as_me:$LINENO: checking for $am_display_PYTHON script directory" >&5
+echo $ECHO_N "checking for $am_display_PYTHON script directory... $ECHO_C" >&6
+if test "${am_cv_python_pythondir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
+     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+fi
+echo "$as_me:$LINENO: result: $am_cv_python_pythondir" >&5
+echo "${ECHO_T}$am_cv_python_pythondir" >&6
+  pythondir=$am_cv_python_pythondir
+
+
+
+  pkgpythondir=\${pythondir}/$PACKAGE
+
+
+            echo "$as_me:$LINENO: checking for $am_display_PYTHON extension module directory" >&5
+echo $ECHO_N "checking for $am_display_PYTHON extension module directory... $ECHO_C" >&6
+if test "${am_cv_python_pyexecdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
+     echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`
+fi
+echo "$as_me:$LINENO: result: $am_cv_python_pyexecdir" >&5
+echo "${ECHO_T}$am_cv_python_pyexecdir" >&6
+  pyexecdir=$am_cv_python_pyexecdir
+
+
+
+  pkgpyexecdir=\${pyexecdir}/$PACKAGE
+
+
+
+  fi
+
+  # need python2.2+ for build
+
+
+if test "$PYTHON" != :; then
+  HAVE_PYTHON_TRUE=
+  HAVE_PYTHON_FALSE='#'
+else
+  HAVE_PYTHON_TRUE='#'
+  HAVE_PYTHON_FALSE=
+fi
+
+
+# Checks for header files.
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  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 <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  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 <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#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);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+
+
+
+for ac_header in fcntl.h float.h limits.h memory.h stdlib.h string.h strings.h sys/time.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to zettair@cs.rmit.edu.au ##
+## ------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# determine endian-ness of target compiler (sets WORDS_BIGENDIAN if true)
+echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
+if test "${ac_cv_c_bigendian+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_bigendian=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_bigendian=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+# It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+  # try to guess the endianness by grepping values into an object file
+  ac_cv_c_bigendian=unknown
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+  ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+  if test "$ac_cv_c_bigendian" = unknown; then
+    ac_cv_c_bigendian=no
+  else
+    # finding both strings is unlikely to happen, but who knows?
+    ac_cv_c_bigendian=unknown
+  fi
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+int
+main ()
+{
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_bigendian=no
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
+case $ac_cv_c_bigendian in
+  yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+ ;;
+  no)
+     ;;
+  *)
+    { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+
+
+echo "$as_me:$LINENO: checking for uint_fast32_t" >&5
+echo $ECHO_N "checking for uint_fast32_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint_fast32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((uint_fast32_t *) 0)
+  return 0;
+if (sizeof (uint_fast32_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_uint_fast32_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint_fast32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint_fast32_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint_fast32_t" >&6
+if test $ac_cv_type_uint_fast32_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint_fast32_t unsigned long int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for uint32_t" >&5
+echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((uint32_t *) 0)
+  return 0;
+if (sizeof (uint32_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_uint32_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint32_t" >&6
+if test $ac_cv_type_uint32_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint32_t unsigned long int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for uint16_t" >&5
+echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint16_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((uint16_t *) 0)
+  return 0;
+if (sizeof (uint16_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_uint16_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint16_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint16_t" >&6
+if test $ac_cv_type_uint16_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint16_t unsigned short int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for uint8_t" >&5
+echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint8_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((uint8_t *) 0)
+  return 0;
+if (sizeof (uint8_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_uint8_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint8_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint8_t" >&6
+if test $ac_cv_type_uint8_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint8_t unsigned char
+_ACEOF
+
+fi
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset x;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *ccp;
+  char **p;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  ccp = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++ccp;
+  p = (char**) ccp;
+  ccp = (char const *const *) p;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+  }
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+  return 0;
+if (sizeof (size_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_size_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_size_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_time=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+# Checks for library functions.
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to zettair@cs.rmit.edu.au ##
+## ------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
+echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_malloc_0_nonnull=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if STDC_HEADERS || HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+exit (malloc (0) ? 0 : 1);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_malloc_0_nonnull=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
+if test $ac_cv_func_malloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 0
+_ACEOF
+
+   case $LIBOBJS in
+    "malloc.$ac_objext"   | \
+  *" malloc.$ac_objext"   | \
+    "malloc.$ac_objext "* | \
+  *" malloc.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define malloc rpl_malloc
+_ACEOF
+
+fi
+
+
+
+echo "$as_me:$LINENO: checking for working memcmp" >&5
+echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6
+if test "${ac_cv_func_memcmp_working+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_working=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+  /* Some versions of memcmp are not 8-bit clean.  */
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+    exit (1);
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    char foo[21];
+    char bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+       char *a = foo + i;
+       char *b = bar + i;
+       strcpy (a, "--------01111111");
+       strcpy (b, "--------10000000");
+       if (memcmp (a, b, 16) >= 0)
+         exit (1);
+      }
+    exit (0);
+  }
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_memcmp_working=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_memcmp_working=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
+echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6
+test $ac_cv_func_memcmp_working = no && case $LIBOBJS in
+    "memcmp.$ac_objext"   | \
+  *" memcmp.$ac_objext"   | \
+    "memcmp.$ac_objext "* | \
+  *" memcmp.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;;
+esac
+
+
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to zettair@cs.rmit.edu.au ##
+## ------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5
+echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6
+if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_realloc_0_nonnull=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if STDC_HEADERS || HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *realloc ();
+#endif
+
+int
+main ()
+{
+exit (realloc (0, 0) ? 0 : 1);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_realloc_0_nonnull=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_realloc_0_nonnull=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6
+if test $ac_cv_func_realloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_REALLOC 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_REALLOC 0
+_ACEOF
+
+   case $LIBOBJS in
+    "realloc.$ac_objext"   | \
+  *" realloc.$ac_objext"   | \
+    "realloc.$ac_objext "* | \
+  *" realloc.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define realloc rpl_realloc
+_ACEOF
+
+fi
+
+
+
+echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
+echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6
+if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f conftest.sym conftest.file
+echo >conftest.file
+if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_lstat_dereferences_slashed_symlink=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+     /* Linux will dereference the symlink and fail.
+       That is better in the sense that it means we will not
+       have to compile and use the lstat wrapper.  */
+     exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+else
+  # If the `ln -s' command failed, then we probably don't even
+  # have an lstat function.
+  ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f conftest.sym conftest.file
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6
+
+test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+
+if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+  case $LIBOBJS in
+    "lstat.$ac_objext"   | \
+  *" lstat.$ac_objext"   | \
+    "lstat.$ac_objext "* | \
+  *" lstat.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
+esac
+
+fi
+
+echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
+echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6
+if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_stat_empty_string_bug=yes
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+  exit (stat ("", &sbuf) ? 1 : 0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_stat_empty_string_bug=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_stat_empty_string_bug=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
+echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6
+if test $ac_cv_func_stat_empty_string_bug = yes; then
+  case $LIBOBJS in
+    "stat.$ac_objext"   | \
+  *" stat.$ac_objext"   | \
+    "stat.$ac_objext "* | \
+  *" stat.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STAT_EMPTY_STRING_BUG 1
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in getcwd gettimeofday memmove memset strcasecmp strchr strerror strncasecmp strrchr strtol
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# check for libraries that we use
+
+echo "$as_me:$LINENO: checking for deflate in -lz" >&5
+echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6
+if test "${ac_cv_lib_z_deflate+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char deflate ();
+int
+main ()
+{
+deflate ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_z_deflate=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_z_deflate=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5
+echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6
+if test $ac_cv_lib_z_deflate = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+  LIBS="-lz $LIBS"
+
+fi
+
+
+echo "$as_me:$LINENO: checking for sqrt in -lm" >&5
+echo $ECHO_N "checking for sqrt in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_sqrt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sqrt ();
+int
+main ()
+{
+sqrt ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_sqrt=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_sqrt=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5
+echo "${ECHO_T}$ac_cv_lib_m_sqrt" >&6
+if test $ac_cv_lib_m_sqrt = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+
+
+echo "$as_me:$LINENO: checking for sqrtf in -lmx" >&5
+echo $ECHO_N "checking for sqrtf in -lmx... $ECHO_C" >&6
+if test "${ac_cv_lib_mx_sqrtf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmx  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sqrtf ();
+int
+main ()
+{
+sqrtf ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_mx_sqrtf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_mx_sqrtf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_mx_sqrtf" >&5
+echo "${ECHO_T}$ac_cv_lib_mx_sqrtf" >&6
+if test $ac_cv_lib_mx_sqrtf = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMX 1
+_ACEOF
+
+  LIBS="-lmx $LIBS"
+
+else
+  # mx contains the floating point functions on darwin
+
+  # failed, look for sqrtf in libm
+  echo "$as_me:$LINENO: checking for sqrtf in -lm" >&5
+echo $ECHO_N "checking for sqrtf in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_sqrtf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sqrtf ();
+int
+main ()
+{
+sqrtf ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_sqrtf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_sqrtf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrtf" >&5
+echo "${ECHO_T}$ac_cv_lib_m_sqrtf" >&6
+if test $ac_cv_lib_m_sqrtf = yes; then
+  # on success, do nothing (prevents -lm being added twice)
+    echo -n ""
+else
+  # define away sqrtf and friends in the firstinclude file, since we
+    # can't find them.  Filter out previous #define's first.
+    echo "reconfiguring to use double functions instead of float functions"
+     cat src/include/$osinclude/firstinclude.h | grep -v "define sqrtf" | grep -v "define logf" | grep -v "define ldexpf" | grep -v "define frexpf" > firstinclude.h
+     echo "#ifndef sqrtf /* define sqrtf */" >> firstinclude.h
+     echo "#define sqrtf sqrt" >> firstinclude.h
+     echo "#endif /* define sqrtf */" >> firstinclude.h
+     echo "#ifndef logf /* define logf */" >> firstinclude.h
+     echo "#define logf log" >> firstinclude.h
+     echo "#endif /* define logf */" >> firstinclude.h
+     echo "#ifndef ldexpf /* define ldexpf */" >> firstinclude.h
+     echo "#define ldexpf ldexp" >> firstinclude.h
+     echo "#endif /* define ldexpf */" >> firstinclude.h
+     echo "#ifndef frexpf /* define frexpf */" >> firstinclude.h
+     echo "#define frexpf frexp" >> firstinclude.h
+     echo "#endif /* define frexpf */" >> firstinclude.h
+     mv firstinclude.h src/include/$osinclude/firstinclude.h
+
+fi
+
+fi
+
+
+          ac_config_files="$ac_config_files Makefile"
+cat >confcache <<\_ACEOF
+# 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, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# 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 \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[    ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[      ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_PYTHON_TRUE}" && test -z "${HAVE_PYTHON_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by zettair $as_me 0.9.3, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+                  instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+zettair config.status 0.9.3
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  "src/include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/include/config.h:src/include/config_h.in" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@target@,$target,;t t
+s,@target_cpu@,$target_cpu,;t t
+s,@target_vendor@,$target_vendor,;t t
+s,@target_os@,$target_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@OS@,$OS,;t t
+s,@OSINCLUDE@,$OSINCLUDE,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LN_S@,$LN_S,;t t
+s,@ECHO@,$ECHO,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@CPP@,$CPP,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
+s,@CXXDEPMODE@,$CXXDEPMODE,;t t
+s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
+s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
+s,@CXXCPP@,$CXXCPP,;t t
+s,@F77@,$F77,;t t
+s,@FFLAGS@,$FFLAGS,;t t
+s,@ac_ct_F77@,$ac_ct_F77,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@PYTHON@,$PYTHON,;t t
+s,@PYTHON_VERSION@,$PYTHON_VERSION,;t t
+s,@PYTHON_PREFIX@,$PYTHON_PREFIX,;t t
+s,@PYTHON_EXEC_PREFIX@,$PYTHON_EXEC_PREFIX,;t t
+s,@PYTHON_PLATFORM@,$PYTHON_PLATFORM,;t t
+s,@pythondir@,$pythondir,;t t
+s,@pkgpythondir@,$pkgpythondir,;t t
+s,@pyexecdir@,$pyexecdir,;t t
+s,@pkgpyexecdir@,$pkgpyexecdir,;t t
+s,@HAVE_PYTHON_TRUE@,$HAVE_PYTHON_TRUE,;t t
+s,@HAVE_PYTHON_FALSE@,$HAVE_PYTHON_FALSE,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # 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_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                    sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# 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=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        # Do quote $f, to prevent DOS paths from being IFS'd.
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[      ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# 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.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# 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.undefs <<\_ACEOF
+s,^[    ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[     ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[     ]*#[    ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[     ]*#[    ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
+  fi
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X$ac_file : 'X\(//\)[^/]' \| \
+        X$ac_file : 'X\(//\)$' \| \
+        X$ac_file : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_dest" : 'X\(//\)[^/]' \| \
+        X"$ac_dest" : 'X\(//\)$' \| \
+        X"$ac_dest" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+          ac_config_files="$ac_config_files setup.py"
+cat >confcache <<\_ACEOF
+# 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, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# 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 \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[    ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[      ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_PYTHON_TRUE}" && test -z "${HAVE_PYTHON_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by zettair $as_me 0.9.3, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+                  instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+zettair config.status 0.9.3
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "setup.py" ) CONFIG_FILES="$CONFIG_FILES setup.py" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  "src/include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/include/config.h:src/include/config_h.in" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@target@,$target,;t t
+s,@target_cpu@,$target_cpu,;t t
+s,@target_vendor@,$target_vendor,;t t
+s,@target_os@,$target_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@OS@,$OS,;t t
+s,@OSINCLUDE@,$OSINCLUDE,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LN_S@,$LN_S,;t t
+s,@ECHO@,$ECHO,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@CPP@,$CPP,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
+s,@CXXDEPMODE@,$CXXDEPMODE,;t t
+s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
+s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
+s,@CXXCPP@,$CXXCPP,;t t
+s,@F77@,$F77,;t t
+s,@FFLAGS@,$FFLAGS,;t t
+s,@ac_ct_F77@,$ac_ct_F77,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@PYTHON@,$PYTHON,;t t
+s,@PYTHON_VERSION@,$PYTHON_VERSION,;t t
+s,@PYTHON_PREFIX@,$PYTHON_PREFIX,;t t
+s,@PYTHON_EXEC_PREFIX@,$PYTHON_EXEC_PREFIX,;t t
+s,@PYTHON_PLATFORM@,$PYTHON_PLATFORM,;t t
+s,@pythondir@,$pythondir,;t t
+s,@pkgpythondir@,$pkgpythondir,;t t
+s,@pyexecdir@,$pyexecdir,;t t
+s,@pkgpyexecdir@,$pkgpyexecdir,;t t
+s,@HAVE_PYTHON_TRUE@,$HAVE_PYTHON_TRUE,;t t
+s,@HAVE_PYTHON_FALSE@,$HAVE_PYTHON_FALSE,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # 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_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                    sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# 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=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        # Do quote $f, to prevent DOS paths from being IFS'd.
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[      ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# 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.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# 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.undefs <<\_ACEOF
+s,^[    ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[     ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[     ]*#[    ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[     ]*#[    ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
+  fi
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X$ac_file : 'X\(//\)[^/]' \| \
+        X$ac_file : 'X\(//\)$' \| \
+        X$ac_file : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_dest" : 'X\(//\)[^/]' \| \
+        X"$ac_dest" : 'X\(//\)$' \| \
+        X"$ac_dest" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..03b2807
--- /dev/null
@@ -0,0 +1,216 @@
+# This file gets processed with autoconf to produce a configure script
+AC_INIT(zettair, 0.9.3, zettair@cs.rmit.edu.au)
+
+# calculate variables for target system
+AC_CANONICAL_TARGET()
+
+# check for valgrind
+AC_ARG_WITH(valgrind, 
+  AC_HELP_STRING([--with-valgrind[=DIR]], [integrate valgrind support for better error detetion]))
+
+if test "x$with_valgrind" != "x"; then
+    AC_DEFINE(WITH_VALGRIND, 1, [indicates whether to use valgrind])
+    # check in various locations for valgrind headers
+
+    # note that we use CHECK_FILES instead of CHECK_HEADERS, because
+    # CHECK_HEADERS tries to compile the headers, which fails and
+    # causes confusion
+
+    if test "x$with_valgrind" != "xyes"; then
+
+        # also note that trying to get valgrind_include, HAVE_VALGRIND_H
+        # and HAVE_MEMCHECK_H defined properly in this ridiculous
+        # frankenstein of a so-called programming environment is absurdly
+        # complicated, hence the mess below
+        path=$with_valgrind
+        if test "x$valgrind_include" == "x"; then
+            AC_CHECK_FILE($path/valgrind.h, [valgrind_include=$path])
+            if test "x$valgrind_include" != "x"; then
+                AC_CHECK_FILE($path/memcheck.h, [memcheck=yes])
+                if test "x$memcheck" == "xyes"; then
+                    AC_DEFINE(HAVE_MEMCHECK_H, 1, [memcheck.h])
+                fi
+                AC_DEFINE(HAVE_VALGRIND_H, 1, [valgrind.h])
+            fi
+        fi
+
+        path=$with_valgrind/include
+        if test "x$valgrind_include" == "x"; then
+            AC_CHECK_FILE($path/valgrind.h, [valgrind_include=$path])
+            if test "x$valgrind_include" != "x"; then
+                AC_CHECK_FILE($path/memcheck.h, [memcheck=yes])
+                if test "x$memcheck" == "xyes"; then
+                    AC_DEFINE(HAVE_MEMCHECK_H, 1, [memcheck.h])
+                fi
+                AC_DEFINE(HAVE_VALGRIND_H, 1, [valgrind.h])
+            fi
+        fi
+
+        path=$with_valgrind/include/valgrind
+        if test "x$valgrind_include" == "x"; then
+            AC_CHECK_FILE($path/valgrind.h, [valgrind_include=$path])
+            if test "x$valgrind_include" != "x"; then
+                AC_CHECK_FILE($path/memcheck.h, [memcheck=yes])
+                if test "x$memcheck" == "xyes"; then
+                    AC_DEFINE(HAVE_MEMCHECK_H, 1, [memcheck.h])
+                fi
+                AC_DEFINE(HAVE_VALGRIND_H, 1, [valgrind.h])
+            fi
+        fi
+
+        path=$with_valgrind/valgrind
+        if test "x$valgrind_include" == "x"; then
+            AC_CHECK_FILE($path/valgrind.h, [valgrind_include=$path])
+            if test "x$valgrind_include" != "x"; then
+                AC_CHECK_FILE($path/memcheck.h, [memcheck=yes])
+                if test "x$memcheck" == "xyes"; then
+                    AC_DEFINE(HAVE_MEMCHECK_H, 1, [memcheck.h])
+                fi
+                AC_DEFINE(HAVE_VALGRIND_H, 1, [valgrind.h])
+            fi
+        fi
+    fi
+
+    path=/usr/include/valgrind
+    if test "x$valgrind_include" == "x"; then
+        AC_CHECK_FILE($path/valgrind.h, [valgrind_include=$path])
+        if test "x$valgrind_include" != "x"; then
+            AC_CHECK_FILE($path/memcheck.h, [memcheck=yes])
+            if test "x$memcheck" == "xyes"; then
+                AC_DEFINE(HAVE_MEMCHECK_H, 1, [memcheck.h])
+            fi
+            AC_DEFINE(HAVE_VALGRIND_H, 1, [valgrind.h])
+        fi
+    fi
+
+    path=/usr/include/
+    if test "x$valgrind_include" == "x"; then
+        AC_CHECK_FILE($path/valgrind.h, [valgrind_include=$path])
+        if test "x$valgrind_include" != "x"; then
+            AC_CHECK_FILE($path/memcheck.h, [memcheck=yes])
+            if test "x$memcheck" == "xyes"; then
+                AC_DEFINE(HAVE_MEMCHECK_H, 1, [memcheck.h])
+            fi
+            AC_DEFINE(HAVE_VALGRIND_H, 1, [valgrind.h])
+        fi
+    fi
+
+    path=/usr/local/include/
+    if test "x$valgrind_include" == "x"; then
+        AC_CHECK_FILE($path/valgrind.h, [valgrind_include=$path])
+        if test "x$valgrind_include" != "x"; then
+            AC_CHECK_FILE($path/memcheck.h, [memcheck=yes])
+            if test "x$memcheck" == "xyes"; then
+                AC_DEFINE(HAVE_MEMCHECK_H, 1, [memcheck.h])
+            fi
+            AC_DEFINE(HAVE_VALGRIND_H, 1, [valgrind.h])
+        fi
+    fi
+
+    if test "x$valgrind_include" == "x"; then
+        AC_MSG_ERROR([Can't find valgrind.h include file])
+    fi
+fi
+
+if test "x$valgrind_include" != "x"; then
+    CPPFLAGS="$CPPFLAGS -I $valgrind_include"
+fi
+
+# note that we've switch from config.h.in to config_h.in for
+# compatibility with various crappy win32 zip programs :o(
+AM_CONFIG_HEADER([src/include/config.h:src/include/config_h.in])
+#AM_INIT_AUTOMAKE(subdir-objects)
+AM_INIT_AUTOMAKE(dist-bzip2 dist-zip subdir-objects)
+
+AC_CONFIG_SRCDIR(src/commandline.c)
+
+# figure out which OS specific include directory should be used (FIXME)
+case $target_os in
+*linux*)
+  AC_SUBST(OS, LINUX) 
+  osinclude=linux ;;
+*solaris*) 
+  AC_SUBST(OS, SUNOS) 
+  osinclude=sunos ;;
+*freebsd*) 
+  AC_SUBST(OS, FREEBSD) 
+  osinclude=freebsd ;;
+*darwin*) 
+  AC_SUBST(OS, DARWIN) 
+  osinclude=darwin ;;
+*cygwin*)
+  AC_SUBST(OS, CYGWIN) 
+  osinclude=cygwin ;;
+default)
+  AC_SUBST(OS, LINUX) 
+  osinclude=linux ;;
+esac
+
+# export variable for use in makefile
+AC_SUBST(OSINCLUDE, [$osinclude]) 
+
+# checks for programs
+AM_PROG_CC_C_O()    # support subdir objects for automake
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AM_PATH_PYTHON(2.2,,:)  # need python2.2+ for build
+AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([fcntl.h float.h limits.h memory.h stdlib.h string.h strings.h sys/time.h unistd.h])
+
+# determine endian-ness of target compiler (sets WORDS_BIGENDIAN if true)
+AC_C_BIGENDIAN()
+
+AC_CHECK_TYPE(uint_fast32_t, unsigned long int)
+AC_CHECK_TYPE(uint32_t, unsigned long int)
+AC_CHECK_TYPE(uint16_t, unsigned short int)
+AC_CHECK_TYPE(uint8_t, unsigned char)
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_MEMCMP
+AC_FUNC_REALLOC
+AC_FUNC_STAT
+AC_CHECK_FUNCS([getcwd gettimeofday memmove memset strcasecmp strchr strerror strncasecmp strrchr strtol])
+
+# check for libraries that we use
+AC_CHECK_LIB(z, deflate)
+AC_CHECK_LIB(m, sqrt)
+AC_CHECK_LIB(mx, sqrtf, [], # mx contains the floating point functions on darwin
+
+  # failed, look for sqrtf in libm
+  [AC_CHECK_LIB(m, sqrtf, 
+
+    # on success, do nothing (prevents -lm being added twice)
+    [echo -n ""], 
+
+    # define away sqrtf and friends in the firstinclude file, since we
+    # can't find them.  Filter out previous #define's first.
+    [echo "reconfiguring to use double functions instead of float functions"
+     cat src/include/$osinclude/firstinclude.h | grep -v "define sqrtf" | grep -v "define logf" | grep -v "define ldexpf" | grep -v "define frexpf" > firstinclude.h
+     echo "#ifndef sqrtf /* define sqrtf */" >> firstinclude.h
+     echo "#define sqrtf sqrt" >> firstinclude.h
+     echo "#endif /* define sqrtf */" >> firstinclude.h
+     echo "#ifndef logf /* define logf */" >> firstinclude.h
+     echo "#define logf log" >> firstinclude.h
+     echo "#endif /* define logf */" >> firstinclude.h
+     echo "#ifndef ldexpf /* define ldexpf */" >> firstinclude.h
+     echo "#define ldexpf ldexp" >> firstinclude.h
+     echo "#endif /* define ldexpf */" >> firstinclude.h
+     echo "#ifndef frexpf /* define frexpf */" >> firstinclude.h
+     echo "#define frexpf frexp" >> firstinclude.h
+     echo "#endif /* define frexpf */" >> firstinclude.h
+     mv firstinclude.h src/include/$osinclude/firstinclude.h
+    ])])
+     
+AC_OUTPUT(Makefile)
+AC_OUTPUT(setup.py)
+
diff --git a/depcomp b/depcomp
new file mode 100755 (executable)
index 0000000..11e2d3b
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,522 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2004-05-31.23
+
+# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit 0
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit 0
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # Dependencies are output in .lo.d with libtool 1.4.
+      # With libtool 1.5 they are output both in $dir.libs/$base.o.d
+      # and in $dir.libs/$base.o.d and $dir$base.o.d.  We process the
+      # latter, because the former will be cleaned when $dir.libs is
+      # erased.
+      tmpdepfile1="$dir.libs/$base.lo.d"
+      tmpdepfile2="$dir$base.o.d"
+      tmpdepfile3="$dir.libs/$base.d"
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1="$dir$base.o.d"
+      tmpdepfile2="$dir$base.d"
+      tmpdepfile3="$dir$base.d"
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   elif test -f "$tmpdepfile2"; then
+      tmpdepfile="$tmpdepfile2"
+   else
+      tmpdepfile="$tmpdepfile3"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+       set fnord "$@"
+       shift
+       shift
+       ;;
+    *)
+       set fnord "$@" "$arg"
+       shift
+       shift
+       ;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
+  echo "       " >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/doc/Build.html b/doc/Build.html
new file mode 100644 (file)
index 0000000..3d02be3
--- /dev/null
@@ -0,0 +1,192 @@
+<html>
+  <head>
+    <title>Zettair Index Build</title>
+  </head>
+  <link rel="stylesheet" type="text/css" href="style.css">
+  <body bgcolor="#ffffff">
+
+  <h1>Zettair Index Build</h1>
+  <p>
+  Zettair can build inverted indexes by parsing different types of 
+  source collections.  Please read the format descriptions to understand 
+  fully how an index is constructed from the given data. Currently, the 
+  following index types are supported:
+
+  <ul>
+    <li><a href="#HTMLFORMAT">HTML</a></li>
+    <li><a HREF="#TRECFORMAT">TREC</a></li>            
+  </ul>
+  </p>
+
+  <p>
+  Usage: <span class="usage">zet -i file1 ...  fileN</span>
+  </p>
+
+  <p>Index construction options<br>
+
+  <ul class="option-list">
+    <li>
+    <span class="option-flag">-i,--index</span>
+    <p class="option-explanation">
+    Put Zettair into index construction mode (as opposed to <a
+      href="Search.html" target="mainContent">searching mode</a>).
+    </p>
+    </li>
+
+    <li><span class="option-flag"><span 
+        class="option-argument">file1 ... fileN</span></span>
+    <p class="option-explanation">
+    The given files (<span class="option-argument">file1 ... 
+      fileN</span>) are files to index for
+    searching.  If no files are given then a list of filenames, 
+    seperated by whitespace, is read from stdin.  This allows you to 
+    pipe a list of filenames to index in from a file or shell
+    command.  The command:
+    </p>
+    <div class="shell-command">find . -name "*.c" -or -name 
+      "*.h" | ./zet -i -f source_index</div>
+    <p class="option-explanation">
+    would find all files with c and h extensions and index them,
+    placing the result into a set of files that start with
+    source_index.
+    </p>
+    </li>
+
+    <li>
+    <span class="option-flag">-f,--filename <span
+        class="option-argument">prefix</span></span>
+    <p class="option-explanation">
+    give the name of the index to use.  If no name is given, 'index'
+    will be used as the default.  The prefix can include directory
+    path components.
+    </p>
+    </li>
+
+    <li>
+    <span class="option-flag">-c,--config <span
+        class="option-argument">config_file</span></span>
+    <p class="option-explanation">
+    use this configuration file for the parser.  The configuration
+    file determines which tags the parser attempts to extract text
+    from.  The format is a simple text file where the name of a tag
+    (minus the angled brackets) is followed by a number that
+    indicates whether parsing should be turned on or off after this
+    tag.  See config/psettings.xml for an example.
+    </p>
+    </li>
+
+    <li><span class="option-flag">--big-and-fast</span>
+    <p class="option-explanation">
+    causes zettair to use around 500MB of memory during indexing (by
+    default, around 20MB is used)
+    </p>
+    </li>
+
+    <li><span class="option-flag">-a,--add</span>
+    <p class="option-explanation">
+    allow zettair to add new postings to an existing index.  By
+    default, this causes an error.
+    </p>
+    </li>
+
+    <li>
+    <span class="option-flag">--stem<span
+        class="option-argument">{ none | eds | light | porters }</span></span>
+    <p class="option-explanation">
+    Use given stemming algorithm during index construction.  None is
+    no stemming.  eds removes 'e', 'ed', and 's'.
+    light is a custom stemmer that is fast, but slightly less
+    effective than Porter's stemming.
+    Porter's stemming is a slow, complex, well-known stemming algorithm.
+    </p>
+    </li>
+
+    <li>
+    <span class="option-flag">--anh-impact</span>
+    <p class="option-explanation">
+    Generate impact-ordered inverted lists during construction.  This
+    is required to use impact-ordered evaluation during querying.
+    </p>
+    </li>
+
+    <li><span class="option-flag">-t { TREC | HTML }</span>
+    <p class="option-explanation">
+    select the type of the index, TREC or HTML (default: autodetect)
+    </p>
+    </li>
+  </ul>
+  </p>
+
+  <p>
+  Sample Command Line: 
+  </p>
+  <div class="shell-command">zet -i -f disk45 -c
+    /research/zettair/config/parser_settings.trec -t TREC
+    /research/TREC/disk45/fbis /research/TREC/disk45/fr
+    /research/TREC/disk45/ft /research/TREC/disk45/latimes</div>
+  <p>
+  This command will use the TREC parser
+  to create an inverted index from the four listed files.
+  You should then find the following index files:
+  <ul>
+    <li><span class="file-name">disk45.map</span></li>
+    <li><span class="file-name">disk45.v.0</span></li>
+    <li><span class="file-name">disk45.param.0</span></li>
+    <li><span class="file-name">disk45.vocab.0</span></li>
+  </ul>
+  </p>
+
+  <h2><a name="FORMAT">Index Types</a></h2>
+  <h3><a name="HTMLFORMAT">HTML Format</a></h3>
+  <p>    
+  The HTML parser treats each file as one document in HTML format.  Text is
+  extracted from HTML documents according to the parser settings file,
+  documented above. 
+  </p>
+  <h3><a name="TRECFORMAT">TREC Format</a></h3>
+  <p>
+  It is often advantageous to combine several (thousand) documents in 
+  one file and be able to index and search on one single file rather 
+  than a few thousand files. This can be done by writing the information 
+  of several files into one file and formatting the one file in such a 
+  way that original document boundaries can be detected by the parser. 
+  The parser will extract words from the given file in much the same way 
+  as in <a href="#HTMLFORMAT">HTML</a> mode.  Additionally, the TREC 
+  parser looks for tags: <span class="input-word">&lt;DOC&gt;</span>
+  and <span class="input-word">&lt;/DOC&gt;</span> to signal the 
+  beginning or end of a document, and identifies the documents via their 
+  TREC document number, which is found between a 
+  <span class="input-word">&lt;DOCNO&gt;</span> and 
+  <span class="input-word">&lt;/DOCNO&gt;</span> tags.  
+  The TREC format is named as such because it is the format used by the 
+  <a href="http://trec.nist.gov">Text Retrieval Conference (TREC)</a> for
+  experimental data.
+  </p>
+
+  <p>
+  The following excerpt from the Bible represents, for instance, 
+  8 documents (of which 4 documents contain only one word).
+  </p>
+  <p>
+  <table bgcolor="#bbbbbb" border="0" width="100%">
+    <tr> 
+      <td>
+        <code>
+          &lt;DOC&gt; And the sons of Noah, that went forth of the ark, were Shem, and Ham,<br>
+          and Japheth: and Ham is the father of Canaan. &lt;/DOC&gt;<br>
+          &lt;DOC&gt; genesis &lt;/DOC&gt;<br>
+          &lt;DOC&gt; These are the three sons of Noah: and of them was the whole earth overspread.&lt;/DOC&gt;<br>
+          &lt;DOC&gt; genesis &lt;/DOC&gt;<br>
+          &lt;DOC&gt; And Noah began to be an husbandman, and he planted a vineyard:&lt;/DOC&gt;<br>
+          &lt;DOC&gt; genesis &lt;/DOC&gt;<br>
+          &lt;DOC&gt; And he drank of the wine, and was drunken; and he was uncovered within his tent.&lt;/DOC&gt;<br>
+          &lt;DOC&gt; genesis &lt;/DOC&gt;<br>
+        </code>
+      </td>
+      </tr><caption valign="bottom" align="left">TABLE 1: An excerpt of a 
+      TREC file</caption>
+  </table>
+  </p>
+
+  </body>
+</html>
diff --git a/doc/Content.html b/doc/Content.html
new file mode 100644 (file)
index 0000000..a660fab
--- /dev/null
@@ -0,0 +1,50 @@
+<html>
+  <head>
+    <title>Package Contents</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+  </head>
+  <body bgcolor="#ffffff">
+    <a href="http://www.seg.rmit.edu.au"><img src="logo.gif" width=138 height=165 align="right" alt="search engine group logo"/></a>
+    <h1>The Zettair Search Engine</h1>
+
+    <h2>Description</h2>
+
+    <p>
+    Search engines are usually based on a special structure, 
+    called inverted index, which is used to answer queries quickly. 
+    There are two disadvantages resulting from this approach.
+    First, the inverted index structure most be constructed prior to 
+    searching it, and secondly, the index structure takes up additional 
+    space on a computer's hard-disk. However, both problems mentioned 
+    above are negligible, if an index is queried a few hundred times a day,
+    and can be used to find information that would otherwise be lost 
+    in the depths of a pile of documents.
+    </p>
+
+    <p>
+    An inverted index is a well researched and understood structure. 
+    It is documented and discussed in a few research papers and books, 
+    such as
+    <a href="http://www.cs.mu.oz.au/mg/">MG ("Managing Gigabytes")</a>.
+    </p>
+
+    <p>
+    These pages begin with a <b><a href="Tutorial.html">tutorial
+        overview of using Zettair</a></b>.  Then they document in more 
+    detail how 
+    you to use Zettair to <b><a href="Build.html">build an index </a>
+    </b> and how to <b><a href="Search.html">query that index</a></b>.  There
+    are also some pointers for those wishing to <b><a href="hacking.html">hack
+        the Zettair source code</a></b>.
+    </p>
+
+    <p>
+    Feel free to drop us (the Search Engine Group) a line at 
+    <a href="mailto:zettair@cs.rmit.edu.au">zettair@cs.rmit.edu.au</a> 
+    if you have any questions or comments.  Or visit the 
+    <a href="http://www.seg.rmit.edu.au/zettair">Zettair home page</a> 
+    for more information.
+    </p>
+
+  </body>
+</html>
diff --git a/doc/Credits.html b/doc/Credits.html
new file mode 100644 (file)
index 0000000..3e82f2b
--- /dev/null
@@ -0,0 +1,30 @@
+<html>
+  <head>
+    <title>Credits</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+  </head>
+  <body bgcolor="#ffffff">
+    <h1>Credits</h1>
+
+    <p>
+    Zettair contains research contributions primarily from Justin Zobel, 
+    Hugh Williams, Falk Scholer, John Yiannis, Steffen Heinz, Nicholas Lester, 
+    William Webber, Alistair Moffat and Anh Vo.
+    </p>
+
+    <p>
+    Zettair contains source code contributions from Nicholas Lester, 
+    Hugh Williams, Justin Zobel, Falk Scholer, Dirk Bahle, John Yiannis, 
+    Bodo von Billerbeck, Steven Garcia and William Webber.
+    </p>
+
+    <p> 
+    Please make sure that you read the 
+    <a HREF="copying.html">license agreement</a>
+    before you start using this software. You may freely distribute 
+    and use this software, as long, as it is accompanied by the 
+    original documentation and license agreement.
+    </p>
+
+  </body>
+</html>
diff --git a/doc/Disclaimer.html b/doc/Disclaimer.html
new file mode 100644 (file)
index 0000000..53028cf
--- /dev/null
@@ -0,0 +1,18 @@
+<HTML>
+<HEAD>
+<TITLE>Package Contents</TITLE>
+</HEAD>
+<link rel="stylesheet" type="text/css" href="style.css">
+<BODY bgcolor="#ffffff">
+<H1> LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY </H1>
+ <p> 
+The authors have used their best efforts in preparing this software.  
+These efforts include the development, research, and testing of the 
+theories and programs to determine their effectiveness. The authors
+make no warranty of any kind, express or implied, with regard to
+these programs or the documentation. The authors shall not be liable in
+any event for incidental or consequential damages in connection with,
+or arising out of, the furnishing, performance, or use of these programs.
+</p>
+</BODY>
+</HTML>
diff --git a/doc/README.TXT b/doc/README.TXT
new file mode 100644 (file)
index 0000000..9f14250
--- /dev/null
@@ -0,0 +1 @@
+Open file Readme.html in a web/html browser.
\ No newline at end of file
diff --git a/doc/Readme.html b/doc/Readme.html
new file mode 100644 (file)
index 0000000..9d081d9
--- /dev/null
@@ -0,0 +1,10 @@
+<html>
+  <head>
+    <title>Zettair User Guide</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+  </head>
+  <frameset cols="25%,*" border="1">
+    <frame name=Index src=index.html>
+    <frame name=mainContent src=Content.html>
+  </frameset>
+</html>
diff --git a/doc/Search.html b/doc/Search.html
new file mode 100644 (file)
index 0000000..3dcfafc
--- /dev/null
@@ -0,0 +1,427 @@
+<html>
+  <head>
+    <title>Index Search</title>
+  </head>
+  <link rel="stylesheet" type="text/css" href="style.css">
+  <body bgcolor="#ffffff">
+    <p>This page documents how you can use Zettair to query an inverted 
+    index.  There are two executables that can be used for querying indexes
+    build by <a href="Build.html" target="mainContent">Zettair</a>:
+    <ul>
+      <li><a href="#QUERY"><span class="program-name">zet</span></a> Used for 
+      general querying</li>
+      <li><a href="#TRECQUERY"><span class="program-name">zet_trec</span></a> 
+      Used for TREC experiments.  The input is a TREC topic file, and the 
+      output is in a format that can be used with the 
+      <a href="ftp://ftp.cs.cornell.edu/pub/smart/"><span
+          class="program-name">trec_eval</span></a> program.
+      </li>            
+    </ul>
+    </p>
+
+    <h1>Metric Options</h1>
+    <p>
+      These can be used with either zet or zet_trec to change the
+      similarity metric used by Zettair.
+    </p>
+
+    <ul>
+      <li>
+      <span class="option-flag">--okapi</span>
+      <p class="option-explanation">
+      Use the Okapi BM25 metric.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">-1,--k1=<span
+          class="option-argument">floatnum</span></span>
+      <p class="option-explanation">
+      Set the k1 parameter for the Okapi BM25 metric to the specified
+      floating point value.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">-b,--b=<span
+          class="option-argument">floatnum</span></span>
+      <p class="option-explanation">
+      Set the b parameter for the Okapi BM25 metric to the specified
+      floating point value.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">-3,--k3=<span
+          class="option-argument">floatnum</span></span>
+      <p class="option-explanation">
+      Set the k3 parameter for the Okapi BM25 metric to the specified
+      floating point value.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--pivoted-cosine=<span
+          class="option-argument">floatnum</span></span>
+      <p class="option-explanation">
+      Use the pivoted cosine metric, with the pivot provided as a
+      floating point value.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--cosine</span>
+      <p class="option-explanation">
+      Use the cosine metric.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--hawkapi=<span
+          class="option-argument">floatnum</span></span>
+      <p class="option-explanation">
+      Use Dave Hawking's adaptation of the Okapi BM25 metric, with the
+      alpha value provided as a floating point number.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--anh-impact</span>
+      <p class="option-explanation">
+      Use Anh and Moffat's impact-ordered evaluation,  including
+      separate metric.  --anh-impact must have been used when building
+      the index in order to employ impact-ordered query evaluation.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--dirichlet=<span
+          class="option-argument">uintnum</span></span>
+      <p class="option-explanation">
+      Use the Dirichlet-smoothed, query-likelihood language modelling
+      metric with mu value given as an unsigned integer.
+      </p>
+      </li>
+    </ul>
+
+    <h1>Index Search</h1>
+    <a name="QUERY"></a>
+    <p>
+    Usage: <span class="usage">zet [query1 ... queryN]</span>
+    </p>
+    <p>
+    Index querying options:<br>
+    <ul class="option-list">
+      <li>
+      <span class="option-flag">-f <span
+          class="option-argument">prefix</span></span>
+      <p class="option-explanation">
+      Give the name of the index to use.  If no name is given then
+      'index' is used by default.  The prefix may contain directory
+      path elements.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">-n <span 
+          class="option-argument">results</span></span>
+      <p class="option-explanation">
+      Sets the maximum number of results returned in response to each
+      query.  The default is 20.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--query-list=<span 
+          class="option-argument">filename</span></span>
+      <p class="option-explanation">
+      Instructs Zettair to read queries from the given file, instead
+      of from stdin.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--query-stop<span 
+          class="option-argument">=[filename]</span></span>
+      <p class="option-explanation">
+      Uses the words contained in the given filename as stop words
+      (not evaluated) during querying.  If no filename is given, a
+      default stop list is loaded.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--big-and-fast</span>
+      <p class="option-explanation">
+      Instructs Zettair to use approximately 500MB of memory while
+      querying.  The default memory usage should be around 20MB.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">-b <span 
+          class="option-argument">first_result</span></span>
+      <p class="option-explanation">
+      Sets the number of results to skip for each query.  This can be
+      useful in obtaining more results for a query without repeating
+      those already obtained.  The default is 0.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">--summary={ plain | capitalise | tag | 
+        none }</span>
+      <p class="option-explanation">Choose the type of document 
+      summarisation to perform. <span class="option-flag">none</span>
+      means do not provide document summaries with the query results;
+      this is the default.  The other alternatives specify how to
+      highlight the search terms in the summary.  
+      <span class="option-flag">plain</span> specifies not 
+      to highlight the search terms.  <span class="option-flag">capitalise</span>
+      highlights the search terms by capitalising them.
+      <span class="option-flag">tag</span> highlights them by 
+      surrounding them with <span class="output-name">&lt;b&gt;</span> 
+      tags.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag"><span
+          class="option-argument">query1 ... queryN</span></span>
+      <p class="option-explanation">
+      For searching, the given queries (query1 ... queryN) 
+      are <a href="http://www.google.com/">Google-like</a> queries that 
+      are used to search the index. Queries consist of keywords and 
+      phrases (represented <span class="input-word">"like this"</span>) 
+      optionally separated by the 
+      operators <span class="input-word">AND</span> and 
+      <span class="input-word">OR</span> (operators MUST be 
+      capitalised). The default operator is 
+      <span class="input-word">OR</span>. Search is case-insensitive, 
+      except for recognition of <span class="input-word">AND</span> 
+      and <span class="input-word">OR</span>.  Stopping and stemming are 
+      not performed.  All results are ranked by relevance. Note that 
+      the Google operator '<span class="input-word">-</span>' 
+      and modifiers are not currently supported.
+      </p>
+
+      <p class="option-explanation">
+      If no queries are found in the command line, Zettair will start in 
+      interactive mode.  In this mode queries are read from standard
+      input and executed.  Interactive mode exits once it can no longer
+      read from standard input.  You can cause it to exit by entering
+      the end-of-file control character, typically 
+      <span class="shell-name">control-d</span>.
+      </p>
+      </li>
+
+      <li>
+      <span class="option-flag">-v</span>
+      <p class="option-explanation">print version information</p>
+
+      <li>
+      <span class="option-flag">-h</span>
+      <p class="option-explanation">print a help message</p>
+      </UL>
+
+      <p>Sample Command Line:</p>
+
+      <div class="shell-command">zet -n 10 -f disk45</div>
+
+      <p>
+      Example queries:
+      <ul class="query-list">
+        <li><span class="sample-query">mail configuration</span> 
+        <div class="query-explanation">searches for the word 'mail' and the word
+          'configuration'.  Pages returned can have either word, or both 
+          (<span class="input-word">OR</span> query) in upper, lower or 
+          mixed case.</div>
+        </li>
+        <li>
+        <span class="sample-query">mail AND configuration</span> 
+        <div class="query-explanation">searches for pages that have the 
+          words 'mail' and 'configuration' in them.</div>
+        </li>
+        <li>
+        <span class="sample-query">shakespeare "to be or not to be"</span>
+        <div class="query-explanation">searches for the word 'shakespeare' and 
+          the phrase 'to be or not to be'.</div>
+        </li>
+      </ul>
+      </p>
+
+      <p>
+      Note that if you are entering queries at the command line, you will 
+      probably have to escape (using the backslash or other means) double 
+      quotes for phrases. e.g. 
+      <div class="shell-command">
+        &gt; zet "this is a query \"with a phrase\""
+      </div>
+      </p>
+
+      <h1>TREC Index Search</h1>
+      <a name="TRECQUERY"></a>
+      <p>
+      Usage: <span class="usage">zet_trec index</span>
+      </p>
+
+      <p>
+      TREC querying options:<br>
+      <ul class="option-list">
+        <li>
+        <span class="option-flag">-f,--file=<span
+            class="option-argument">topic_file</span></span>
+        <p class="option-explanation">
+        Add TREC <span class="option-argument">topic_file</span> to list 
+        of topic files to process.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">-F,--file-list=<span 
+            class="option-argument">file</span></span>
+        <p class="option-explanation">
+        Add files listed in <span class="option-argument">file</span> to 
+        list of topic files to process
+        </p>
+
+        <li>
+        <span class="option-flag">-r,--runid=<span
+            class="option-argument">run_id</span></span>
+        <p class="option-explanation">
+        Output <span class="option-argument">run_id</span> as id for 
+        this evaluation (run_id is a text field 
+        in <a href="ftp://ftp.cs.cornell.edu/pub/smart/"><span
+            class="program-name">trec_eval</span></a> 
+        output)
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">-n,--number-results=<span
+            class="option-argument">results</span></span>
+        <p class="option-explanation">
+        Number of results to output per query.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">-t,--title</span>
+        <p class="option-explanation">
+        Use topic titles in queries (this is the default if none of
+        -t, -a or -d are specified).
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">-d,--description</span>
+        <p class="option-explanation">
+        Use topic descriptions in queries.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">-a,--narrative</span>
+        <p class="option-explanation">
+        Use topic narratives in queries.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">--print-queries</span>
+        <p class="option-explanation">
+        Print queries to stderr as they are constructed from the topic
+        file and resolved.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">--timing</span>
+        <p class="option-explanation">
+        Print the total time taken in querying to stderr after all
+        topics have been resolved.  The time printed excludes index
+        loading time.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">--dummy</span>
+        <p class="option-explanation">
+        Insert dummy entries for topics that have no answers in the
+        results set.  This has been required for TREC terabyte submissions in the past.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">--non-stop</span>
+        <p class="option-explanation">
+        Don't stop if a query cannot be constructed from a topic.
+        Useful when running large, noisy query logs.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">--query-stop<span 
+            class="option-argument">=[filename]</span></span>
+        <p class="option-explanation">
+        Uses the words contained in the given filename as stop words
+        (not evaluated) during querying.  If no filename is given, a
+        default stop list is loaded.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">--big-and-fast</span>
+        <p class="option-explanation">
+        Instructs Zettair to use approximately 500MB of memory while
+        querying.  The default memory usage should be around 20MB.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">--qrels=<span
+            class="option-argument">=[filename]</span></span>
+        <p class="option-explanation">
+        Instead of printing search results in TREC format, the results
+        are evaluated against the given Qrels file, in TREC Qrel
+        format, and trec_eval-like output is produced.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag"><span
+            class="option-argument">index</span></span>
+        <p class="option-explanation">
+        The name of the index that is queried using the TREC topic files.
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">-h,--help</span>
+        <p class="option-explanation">
+        Print help message
+        </p>
+        </li>
+
+        <li>
+        <span class="option-flag">-v,--version</span>
+        <p class="option-explanation">
+        Print version information
+        </p>
+        </li>
+      </ul>
+      </p>
+
+      <p>
+      Sample Command Line: 
+      </p>
+      <div class="shell-command">./zet_trec -f
+        /research/TREC-7/topics.351-400 -n 1000 disk45 &gt; query.log</div>
+      <p>
+      The file <span class="file-name">query.log</span> can then be evaluated 
+      with <span class="program-name">trec_eval</span> against
+      pre-prepared relevance judgements.
+      </p>
+
+    </body>
+  </html>
diff --git a/doc/Tutorial.html b/doc/Tutorial.html
new file mode 100644 (file)
index 0000000..794a072
--- /dev/null
@@ -0,0 +1,216 @@
+<html>
+  <head>
+    <title>Tutorial</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+  </head>
+  <body bgcolor="#ffffff">
+
+    <h1>Zettair -- A Tutorial Introduction</h1>
+
+    <h2>Introduction</h2>
+
+    <p>This page contains a tutorial-style introduction to Zettair.
+    It will show you how to index a document collection using Zettair,
+    and how to run queries against that index.  It only introduces the
+    basic functionality for each use.  For more details, see the
+    pages on <a href="Build.html">building</a> and 
+    <a href="Search.html">searching</a> using Zettair.</p>
+
+    <p>This tutorial assumes that you have downloaded, unpacked,
+    compiled, and installed the Zettair distribution.  If you have
+    not done so, please grab Zettair from 
+    <a href="http://www.seg.rmit.edu.au/zettair">the Zettair home
+      page</a>, unpack it, and follow the installation instructions
+    in the INSTALL file contained within the distribution.  We also
+    assume that the <span class="program-name">zet</span> executable
+    has been installed in your <span class="shell-name">PATH</span>.
+    If not, use the full path for the executable (for instance,
+    <span class="program-name">/usr/local/zettair/bin/zet</span>).</p>
+
+    <h2>Building an index</h2>
+
+    <p>To help you get up and running quickly with Zettair, we have
+    included the full text for Herman Melville's 
+    <span class="book-name">Moby Dick</span> as a sample 
+    document collection for you to play around with.  This can be
+    found in the subdirectory 
+    <span class="file-name">txt</span> of the Zettair
+    distribution.</p>
+
+    <p>Let's begin by indexing Moby Dick.  To do this, change your current
+    directory to <span class="file-name">txt</span>.  (You can index it 
+    from anywhere, but this is simplest.)  We'll assume that the 
+    <span class="program-name">zet</span> executable is in
+    your PATH; otherwise, substitute the full pathname to the executable
+    wherever you see 'zet' below.  So, let's build this index:</p>
+    
+    <div class="shell-command">
+      $ zet -i moby.txt
+    </div>
+    
+    <p>The '-i' argument tells zet that we're building a new index.  
+    The text of Moby Dick is less than 1.3 MBs in length, so this
+    won't take long to run - Zettair is more used to working with document
+    collections of 10 GB or more, but it won't complain.  When it's
+    finished running, you should see four new files in the current
+    directory, all prefixed with &quot;index&quot;
+    These are Zettair's index files.</p>
+    
+     <h2>Querying the index</h2>
+    
+    <p>So now we're ready to run some queries.  To do this, we run zet again,
+    this time without any options:</p>
+    
+    <div class="shell-command">
+      $ zet
+    </div>
+    
+    <p>Zettair will load up the index (very quickly, in this case), and then
+    prompt you for input.  Let's test the rumour that Moby Dick has
+    something to say about whales:</p>
+    
+<pre><div class="zettair-output">&gt; whale
+1. Chapter 32, Paragraph 46 (score 0.814503, docid 713)
+2. Chapter 32, Paragraph 23 (score 0.687340, docid 690)
+3. Chapter 32, Paragraph 25 (score 0.542362, docid 692)
+4. Chapter 32, Paragraph 8 (score 0.489850, docid 675)
+5. Chapter 32, Paragraph 22 (score 0.488983, docid 689)
+6. Chapter 32, Paragraph 26 (score 0.484616, docid 693)
+7. Chapter 75, Paragraph 10 (score 0.453542, docid 1552)
+8. Chapter 32, Paragraph 21 (score 0.433975, docid 688)
+9. Chapter 41, Paragraph 7 (score 0.403410, docid 875)
+10. Chapter 81, Paragraph 47 (score 0.402218, docid 1646)
+11. Chapter 41, Paragraph 3 (score 0.378583, docid 871)
+12. Chapter 56, Paragraph 5 (score 0.367106, docid 1236)
+13. Chapter 0, Paragraph 74 (score 0.340201, docid 74)
+14. Chapter 45, Paragraph 17 (score 0.333519, docid 969)
+15. Chapter 32, Paragraph 35 (score 0.332929, docid 702)
+16. Chapter 45, Paragraph 5 (score 0.331750, docid 957)
+17. Chapter 87, Paragraph 21 (score 0.330964, docid 1723)
+18. Chapter 91, Paragraph 6 (score 0.327630, docid 1796)
+19. Chapter 55, Paragraph 7 (score 0.326381, docid 1223)
+20. Chapter 68, Paragraph 6 (score 0.324882, docid 1411)
+
+20 results of 791 shown (took 0.000702 seconds)</div></pre>
+    
+    <p>This tells us that the word "whale" occurs in 791 documents in the
+    collection (which is to say, paragraphs in Moby Dick).  Zettair thinks
+    the most pertinent paragraph is paragraph 46 of chapter 32.  We can
+    ask Zettair to print out this document using the 'cache' directive and
+    specifying the document's docid:</p>
+    
+<pre><div class="zettair-output">&gt; [cache:713]
+
+&lt;DOC&gt;
+&lt;DOCNO&gt;Chapter 32, Paragraph 46&lt;/DOCNO&gt;
+Beyond the DUODECIMO, this system does not proceed, inasmuch as the
+Porpoise is the smallest of the whales.  Above, you have all the
+Leviathans of note.  But there are a rabble of uncertain, fugitive,
+half-fabulous whales, which, as an American whaleman, I know by
+reputation, but not personally.  I shall enumerate them by their
+fore-castle appellations; for possibly such a list may be valuable to
+future investigators, who may complete what I have here but begun.
+If any of the following whales, shall hereafter be caught and marked,
+then he can readily be incorporated into this System, according to
+his Folio, Octavo, or Duodecimo magnitude:--The Bottle-Nose Whale;
+the Junk Whale; the Pudding-Headed Whale; the Cape Whale; the Leading
+Whale; the Cannon Whale; the Scragg Whale; the Coppered Whale; the
+Elephant Whale; the Iceberg Whale; the Quog Whale; the Blue Whale; etc.
+&lt;From Icelandic, Dutch, and old English authorities, there might
+be quoted other lists of uncertain whales, blessed with all manner of
+uncouth names.  But I omit them as altogether obsolete; and can
+hardly help suspecting them for mere sounds, full of Leviathanism,
+but signifying nothing.
+&lt;DOC&gt;&gt;</div></pre>
+
+    <p>
+    Don't worry about the <span class="output-name">&lt;DOC&gt;</span> 
+    and <span class="output-name">&lt;DOCNO&gt;</span> tags: that's just 
+    part of the TREC format we've used to mark up Moby Dick for indexing.  
+    You'll notice that the word 'whale' occurs often, which is why Zettair 
+    thinks this is probably the paragraph you're looking for.
+    </p>
+
+    <h2>Queries with multiple terms</h2>
+    
+    <p>You can, of course, query for more than one word at a time.  Say we
+    were looking for a particular kind of whale:</p>
+    
+<pre><div class="zettair-output">&gt; white whale
+
+1. Chapter 42, Paragraph 4 (score 1.429675, docid 897)
+[...]
+20. Chapter 48, Paragraph 2 (score 0.752030, docid 1002)
+
+
+20 results of 852 shown (took 0.000801 seconds)</div></pre>
+    
+    <p>Hmm, 852 paragraphs--but "whale" only occurs in 791!  Well, what
+    Zettair is reporting here is all the documents with either "white"
+    <i>or</i> "whale" in them.  We can tell specify that we only want documents
+    that <i>both</i> occur in:</p>
+    
+<pre><div class="zettair-output">&gt; white AND whale
+
+1. Chapter 59, Paragraph 4 (score 1.255408, docid 1269)
+[...]
+20. Chapter 54, Paragraph 88 (score 0.806199, docid 1191)
+
+20 results of 130 shown (took 0.000330 seconds)</div></pre>
+    
+    <p>or, probably more to the point, only documents that the exact phrase
+    "white whale" occurs in:</p>
+    
+<pre><div class="zettair-output">&gt; "white whale"
+
+1. Chapter 36, Paragraph 41 (score 1.357970, docid 789)
+[...]
+20. Chapter 52, Paragraph 4 (score 0.840175, docid 1088)
+
+20 results of 91 shown (took 0.000307 seconds)</div></pre>
+
+    <h2>Document summaries</h2>
+    
+    <p>This is great so far (or at least, we hope you think so), but it gets
+    tiresome having to individually request each document to see if it's
+    what we're looking for, especially if the documents are longer than a
+    single paragraph.  What we really want is for the list of results to
+    include a summary of each document.  And we can ask Zettair to provide
+    just this to us.</p>
+    
+    <p>To do so, we'll have to restart Zettair.  Hit 
+    <span class="shell-name">CONTROL-D</span> or whatever
+    key combination indicates end of input on your system to end your
+    current session.  This time, we'll run the zet executable with the
+    '--summary' option to indicate that we'd like to see document summaries, and
+    what form we want these summaries to be in.  We'll also restrict
+    output to just the top 2 results:</p>
+    
+    <div class="shell-command">
+      $ zet --summary=capitalise -n 2
+    </div>
+    
+    <p>Zettair can highlight your search terms within the document summaries
+    in a number of different ways, <span class="shell-name">capitalise</span> 
+    being one of them.  So,
+    let's try out some summaries:</p>
+    
+<pre><div class="zettair-output">&gt; ship sea storm
+
+1. Chapter 9, Paragraph 18 (score 2.973852, docid 261)
+A dreadful STORM comes on, the SHIP is like to break... He sees no black sky and raging SEA, feels not the reeling timbers, and little hears he or heeds he the far rush of the mighty whale, which even now with open mouth is cleaving the SEAS after him.
+2. Chapter 121, Paragraph 4 (score 2.431819, docid 2294)
+What's the mighty difference between holding a mast's lightning-rod in the STORM, and standing close by a mast that hasn't got any lightning-rod at all in a STORM?
+
+2 results of 650 shown (took 0.002139 seconds)
+
+&gt; "dark blue ocean"
+
+1. Chapter 35, Paragraph 11 (score 4.953089, docid 745)
+"Roll on, thou deep and DARK BLUE OCEAN, roll!  Ten thousand blubber-hunters sweep over thee in vain."
+
+1 results of 1 shown (took 0.002945 seconds)</div></pre>
+    
+    <p>And that concludes our tour.</p>
+  </body>
+</html>
diff --git a/doc/copying.html b/doc/copying.html
new file mode 100644 (file)
index 0000000..cb9cda3
--- /dev/null
@@ -0,0 +1,48 @@
+<html>
+  <head>
+    <title>Zettair License</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+  </head>
+
+  <body bgcolor="#ffffff">
+
+    <p>
+    Copyright (c) 2004, Search Engine Group<br>
+    All rights reserved.
+    </p>
+
+    <p>
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions are
+    met:
+    </p>
+
+    <p>
+    <ul>
+      <li>Redistributions of source code must retain the above copyright 
+      notice, this list of conditions and the following disclaimer.</li>
+
+      <li>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.</li>
+
+      <li>Neither the name of the Search Engine Group nor the names of its 
+      contributors may be used to endorse or promote products derived from 
+      this software without specific prior written permission.</li>
+    </ul>
+    </p>
+
+    <p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    "AS IS" AND ANY EXPRESS 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 THE COPYRIGHT
+    OWNER OR 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.</p>
+  </body>
+</html>
diff --git a/doc/hacking.html b/doc/hacking.html
new file mode 100644 (file)
index 0000000..b5c922f
--- /dev/null
@@ -0,0 +1,37 @@
+<html>
+  <head>
+    <title>Hacking Zettair</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+  </head>
+  <body bgcolor="#ffffff">
+    <h1>Hacking</h1>
+
+    <p>
+    Zettair is designed to be as clean, simple, flexible and fast as possible.
+    While it is currently a work in progress, Zettair handles simple
+    searching quite well, and has sufficient architecture to be
+    extended in many different directions.
+    </p>
+
+    <p>
+    The core search code is seperated from the different front-end
+    access methods.  The core searching methods are documented in
+    <span class="file-name">include/index.h</span>.
+    </p>
+
+    <p>
+    Zettair also has a number of compile-time configuration options and
+    length limitations.  These can all be found and changed in
+    <code>src/include/def.h</code>, although the default settings
+    should suffice for most people.
+    </p>
+
+    <p>
+    Apart from reading the source code, if you want to know more
+    about any part of Zettair feel free to contact us at 
+    <a href="mailto:zettair@cs.rmit.edu.au">zettair@cs.rmit.edu.au</a>.
+    </p>
+
+  </body>
+</html>
+
diff --git a/doc/index.html b/doc/index.html
new file mode 100644 (file)
index 0000000..5a76671
--- /dev/null
@@ -0,0 +1,33 @@
+
+<html>
+<head>                                                     
+       <link rel="stylesheet" type="text/css" href="style.css">
+       <title>Manual Navigation</title>
+</head>
+
+<body bgcolor="#999999" link="#000000" vlink="#000000">
+
+<ul>
+       <li> <font color="#ffffff"> <A HREF="Content.html" target="mainContent">Overview</a></font></li>
+       <li> <font color="#ffffff"> <A HREF="Tutorial.html"
+          target="mainContent">Tutorial</a></font></li>
+       <li> <font color="#ffffff"> Index Build </font>
+               <ul>
+                       <li> <font color="#000000"> <A HREF="Build.html" target="mainContent">Program Usage </a></font></li>
+               </ul>
+       </li>
+       
+       <li> <font color="#ffffff"> Index Search </font>
+               <ul>
+                       <li> <A HREF="Search.html" target="mainContent">Program Usage </a></li>
+               </ul>
+       </li>
+
+       <li> <A HREF="Credits.html" target="mainContent">Credits</A></li>
+       <li> <A HREF="hacking.html" target="mainContent">Hacking Guide</A></li>
+       <li> <A HREF="copying.html" target="mainContent">Copyright Agreement</A></li>
+       <li> <A HREF="Disclaimer.html" target="mainContent">Disclaimer</A></li>
+</ul> 
+
+</body>
+</html>
diff --git a/doc/logo.gif b/doc/logo.gif
new file mode 100644 (file)
index 0000000..80bc7d8
Binary files /dev/null and b/doc/logo.gif differ
diff --git a/doc/style.css b/doc/style.css
new file mode 100644 (file)
index 0000000..a1a10e7
--- /dev/null
@@ -0,0 +1,80 @@
+body         {font-family: Verdana, Arial, Helvetica;
+              font-size: 12pt;
+             }
+p            {font-family: Verdana, Arial, Helvetica;
+              font-size: 12pt;
+             }
+LI            {font-family: Verdana, Arial, Helvetica;
+              font-size: 12pt;
+             }
+H1           {font-family: Helvetica;
+              font-size: 16pt;
+              font-weight:bold
+             }
+             
+H2           {font-family: Helvetica;
+              font-size: 14pt;
+             }
+
+H3           {font-family: Helvetica;
+              font-size: 12pt;
+              font-weight:bold
+             }
+
+TD           {font-family: Verdana, Arial, Helvetica;
+              font-size: 12pt;
+             }
+
+CODE         {font-family: Courier;
+              font-size: 12pt;
+             }
+
+PRE          {font-family: Courier;
+              font-size: 8pt;
+             }
+CAPTION      {font-family: Courier;
+              font-size: 8pt;
+             }        
+
+.program-name { font-family: Courier }
+.file-name    { font-family: Courier }
+.shell-name   { font-family: Courier }
+.book-name    { font-family: Verdana, Arial, Helvetica;
+                font-style: italic }
+.output-name  { font-family: Courier }
+.input-word   { font-family: Courier }
+
+.shell-command { font-family: Courier;
+                 margin-left: 5%; }
+.remark        { font-size: 10pt;
+                 font-family: Verdana, Arial, Helvetica;
+                 margin-left: 10%;
+                 margin-right: 10% }
+.zettair-output { font-family: Courier;
+                  font-size: 11pt;
+                  margin-left: 5%; }
+.file-contents  { font-family: Courier;
+                  font-size: 11pt;
+                  margin-left: 5% }
+                   
+
+.usage       { font-family: Courier;
+               font-size: 12pt; }
+.option-flag { font-family: Courier;
+               font-size: 12pt; }
+.option-explanation {font-family: Verdana, Arial, Helvetica;
+              font-size: 12pt;
+             }
+.option-argument { font-style: italic }
+
+UL.option-list { list-style-position: outside;
+                 list-style-type: disk }
+UL.query-list { list-style-position: outside;
+                list-style-type: none }
+               
+.query-explanation { margin-left: 5%; 
+                     margin-top: 0.5em;
+                     margin-bottom: 1em;
+                     font-family: Verdana, Arial, Helvetica; }
+.sample-query   { font-family: Courier;
+                  font-size: 13pt }
diff --git a/include/index.h b/include/index.h
new file mode 100644 (file)
index 0000000..42766cd
--- /dev/null
@@ -0,0 +1,378 @@
+/* index.h declares high level operations for a simple, non-distributed search 
+ * engine index
+ *
+ * written nml 2003-04-14
+ *
+ */
+
+#ifndef INDEX_H
+#define INDEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* FIXME instead of these fixed-length buffers, there should be an
+   index_results structure that holds the individual results and a pool
+   of memory used for these string fields. */
+#define INDEX_SUMMARYLEN 350        /* Maximum size of document summary */
+#define INDEX_TITLELEN 50           /* Maximum size of document title */
+#define INDEX_AUXILIARYLEN 150      /* Maximum size of auxiliary fields */
+
+enum index_summary_type {
+    INDEX_SUMMARISE_NONE = 0, /* no summary */
+    INDEX_SUMMARISE_PLAIN = 1, /* summarise without highlighting */
+    INDEX_SUMMARISE_TAG = 2, /* summarise using bold tags to highlight */
+    INDEX_SUMMARISE_CAPITALISE = 3 /* summarise using capitalisation */
+};
+
+struct index;
+extern const char *index_doctype_names[];
+
+/* FIXME: this should really go elsewhere, but where? */
+enum index_doctype {
+    INDEX_DOCTYPE_ERR = 0,
+    INDEX_DOCTYPE_HTML = 1,
+    INDEX_DOCTYPE_TREC = 2,
+    INDEX_DOCTYPE_INEX = 3,
+    INDEX_DOCTYPE_LAST = 4    /* placeholder entry to indicate end of list */
+};
+
+enum index_stem {
+    INDEX_STEM_NONE = 0,            /* no stemming algorithm */
+    INDEX_STEM_PORTERS = 1,         /* use Porter's stemming algorithm */
+    INDEX_STEM_EDS = 2,             /* use 'eds' stemming algorithm */
+    INDEX_STEM_LIGHT = 3            /* use light stemming algorithm */
+};
+
+/* options to be passed to index_new */
+enum index_new_opts {
+    INDEX_NEW_NOOPT = 0,            /* pass this to indicate no options */
+    INDEX_NEW_VOCAB = (1 << 0),     /* option to create an index with postings 
+                                     * of size less than the size you specify 
+                                     * (as an unsigned int) in the 
+                                     * vocabulary */
+    INDEX_NEW_STEM = (1 << 4),      /* use stemming algorithm (passed as 
+                                     * stemmer) to stem the index */
+    INDEX_NEW_MAXFILESIZE           /* set maximum filesize created */
+      = (1 << 5),
+    INDEX_NEW_ENDIAN = (1 << 6),    /* set the endian-ness of the generated 
+                                     * index (supply bigendian, which is 0 for
+                                     * little-endian and non-zero for 
+                                     * bigendian) */
+    INDEX_NEW_STOP = (1 << 8),      /* stop at indexing time, using the file 
+                                     * given as stop_file */
+    INDEX_NEW_QSTOP = (1 << 11),    /* stop at query time, using the file 
+                                     * given as qstop_file (or NULL for default
+                                     * stoplist) */
+    INDEX_NEW_TABLESIZE = (1 << 9), /* dictate how large the postings 
+                                     * hashtable is */
+    INDEX_NEW_PARSEBUF = (1 << 10)  /* dictate how large the postings 
+                                     * hashtable is */
+};
+
+/* XXX: comment me */
+struct index_new_opt {
+    unsigned int vocab_size;
+    enum index_stem stemmer;        /* stemming algorithm used */
+    const char *stop_file;
+    unsigned long int maxfilesize;
+    int bigendian;
+    unsigned int tablesize;
+    unsigned int parsebuf;
+    const char *qstop_file;
+};
+
+/* create a new, empty index.  config can now be NULL if default compile-time 
+ * configuration is to be used */
+struct index *index_new(const char *name, const char *config, 
+  unsigned int memory, int opts, struct index_new_opt *opt);
+
+/* options to be passed to index_load */
+enum index_load_opts {
+    INDEX_LOAD_NOOPT = 0,           /* pass this to indicate no options */
+    INDEX_LOAD_VOCAB = (1 << 0),    /* option to load index with updates of 
+                                     * postings of size less than the size you 
+                                     * specify (as an unsigned int) in the 
+                                     * vocabulary */
+    INDEX_LOAD_MAXFLIST = (1 << 2), /* option to load index, with updates to 
+                                     * lists greater than the unsigned int you 
+                                     * specify causing the creation of a new 
+                                     * inverted list */
+    INDEX_LOAD_IGNORE_VERSION = (1 << 5), /* if the index file format
+                                      * version doesn't match, warn, but
+                                      * try loading the index anyway. */
+    INDEX_LOAD_TABLESIZE = (1 << 7), /* dictate how large the postings 
+                                      * hashtable is */
+    INDEX_LOAD_PARSEBUF = (1 << 8),  /* dictate how large the parsing buffer 
+                                      * is */
+    INDEX_LOAD_QSTOP = (1 << 11),    /* stop at query time, using the file 
+                                      * given as qstop_list (or NULL for 
+                                      * default stoplist) */
+    INDEX_LOAD_DOCMAP_CACHE = (1 << 12)  /* specify which values to cache 
+                                      * in-memory when the docmap loads */
+};
+
+/* XXX: comment me */
+struct index_load_opt {
+    unsigned int vocab_size;
+    unsigned int maxflist_size;
+    unsigned int tablesize;
+    unsigned int parsebuf;
+    const char *qstop_file;
+    int docmap_cache;
+};
+
+#define INDEX_MEMORY_UNLIMITED 0    /* Don't limit memory usage */
+
+/* read an index off of disk. memory is an indication of how much
+   memory the user wants the system to use; INDEX_MEMORY_UNLIMITED 
+   leaves it up to the system. */
+struct index *index_load(const char *name, unsigned int memory, int opts, 
+  struct index_load_opt *opt);
+
+/* remove the index from disk.  Returns 0 on success, 
+   negative failure.  Does _not_ perform index_delete.*/
+int index_rm(struct index *idx);
+
+/* destruct the index object */
+void index_delete(struct index *idx);
+
+/* remove index files then delete the index */
+void index_cleanup(struct index *idx);
+
+/* struct to record statistics about the index */
+struct index_stats {
+    unsigned long int dterms;       /* distinct terms in the index */
+    unsigned int terms_high;        /* high word of total terms in index */
+    unsigned int terms_low;         /* low word of total terms in index */
+    unsigned long int docs;         /* number of documents in the index */
+    unsigned int maxtermlen;        /* maximum length of a term in the index */
+    unsigned int vocab_listsize;    /* size of lists that go in vocab */
+    unsigned int updates;           /* number of times the index has actually 
+                                     * been updated (not necessarily number of 
+                                     * times index_add was called) */
+    unsigned int tablesize;         /* hashtable size constant used */
+    unsigned int parsebuf;          /* memory used for parser */
+    int sorted;                     /* whether vectors are sorted */
+    unsigned int doc_order_vectors; /* whether has doc-order vectors */
+    unsigned int doc_order_word_pos_vectors; /* whether has doc-order with word 
+                                      positions vectors are in index */
+    unsigned int impact_vectors; /* indicates if impact ordered vectors are in
+                                    index */
+};
+
+/* struct to record statistics about the index that take a while to 
+ * calculate */
+struct index_expensive_stats {
+    double avg_weight;              /* average document weight */
+    double avg_words;               /* average number of words in a document */
+    double avg_length;              /* average document length in bytes */
+    unsigned int vocab_leaves;      /* number of leaves in vocab btree */
+    unsigned int vocab_pages;       /* total number of pages (incl leaves) in 
+                                     * vocab btree */
+    unsigned int pagesize;          /* pagesize used by btree */
+    double vectors;                 /* total size of inverted lists */
+    double vectors_files;           /* total size of lists in files */
+    double vectors_vocab;           /* total size of lists in the vocab */
+    double allocated_files;         /* total size of space allocated to lists
+                                     * in files */
+    double vocab_info;              /* size of non-structural information 
+                                     * stored in the vocabulary */
+    double vocab_structure;         /* size of structural information stored 
+                                     * in the vocabulary */
+    /* XXX: size of query processing vectors? */
+    /* XXX: docmap aux string size? */
+};
+
+/* get statistics about the index, (statistics are written into stats 
+ * structure) returning true on success.  index_expensive_stats returns stats
+ * that take time to calculate. */
+int index_stats(const struct index *idx, struct index_stats *stats);
+int index_expensive_stats(const struct index *idx, 
+  struct index_expensive_stats *stats);
+
+/* struct that is returned for each document found by search */
+struct index_result {
+    unsigned long int docno;        /* the distinct number given to this doc */
+    float score;                    /* strength of the match to query */
+    char summary                    /* a summary of the document */
+      [INDEX_SUMMARYLEN + 1];
+    char title                      /* the title of the document */
+      [INDEX_TITLELEN + 1];
+    char auxilliary                 /* auxilliary information about the */
+      [INDEX_AUXILIARYLEN + 1];     /* document, such its TREC number or URL */
+};
+
+/* options that can be passed to index_search.  Note that OKAPI and COSINE are
+ * mutually exclusive. */
+enum index_search_opts {
+    INDEX_SEARCH_NOOPT = 0,              /* pass this to indicate no flags */
+    INDEX_SEARCH_OKAPI_RANK = (1 << 0),  /* use Okapi ranking scheme with 
+                                          * supplied parameters (must supply 
+                                          * k1, k3, b as doubles) */
+    INDEX_SEARCH_PCOSINE_RANK = (1 << 1),/* use pivoted cosine ranking scheme 
+                                          * with supplied pivot point (must 
+                                          * supply pivot as a double).  Note
+                                          * that a pivot of 0 effectively turns
+                                          * off pivoting, and 0.2 is a
+                                          * reasonable starting value */
+    INDEX_SEARCH_COSINE_RANK = (1 << 7), /* use basic cosine measurement with 
+                                          * query length normalisation */
+    INDEX_SEARCH_WORD_LIMIT = (1 << 2),  /* supply (as unsigned int) the maximum
+                                          * number of words used from the query.
+                                          * A default limit applies if not
+                                          * supplied */
+
+    /* use language model ranking with dirichlet smoothing as found in 
+     * Zhai & Lafferty, A study of smoothing methods, 
+     * ACM TOIS 2004 vol 22 num 2, 179-214.  Must provide mu parameter as an
+     * option */
+    INDEX_SEARCH_DIRICHLET_RANK = (1 << 5),
+
+    /* use Dave Hawking's anchor-text oriented Okapi variant, as described in
+     * 'Toward Better Weighting of Anchors', by Hawking, Upstill and Craswell.
+     * you'll need to provide the two parameters alpha and k3. */
+    INDEX_SEARCH_HAWKAPI_RANK = (1 << 8),
+
+    /* use the impact-ordered ranking hueristic as proposed by Anh and Moffat 
+     * in 'Impact Transformation: Effective and Efficient Web Retrieval'.
+     * Requires impact ordered vectors to have been built previously. */
+    INDEX_SEARCH_ANH_IMPACT_RANK = (1 << 10),
+
+    /* query biased document summary type*/
+    INDEX_SEARCH_SUMMARY_TYPE = (1 << 6),
+
+    /* explicitly set the accumulator limit, rather than using the
+     * default ACCUMULATOR_LIMIT adjusted to a minimum of 1%.  Note that
+     * if you explicitly set the accumulator limit, then _no_ adjustment
+     * is made for either collection size or number of results requested. */
+    INDEX_SEARCH_ACCUMULATOR_LIMIT = (1 << 9)
+};
+
+/* FIXME: comment me */
+struct index_search_opt {
+    union {
+        struct {
+            float k1;
+            float k3;
+            float b;
+        } okapi_k3;
+
+        struct {
+            float pivot;
+        } pcosine;
+
+        struct {
+            float mu;
+        } dirichlet;
+
+        struct {
+            float alpha;
+            float k3;
+        } hawkapi;
+    } u;
+
+    unsigned int word_limit;
+    unsigned int accumulator_limit;
+    enum index_summary_type summary_type;
+};
+
+/* search the index.  idx is a loaded or created index, query is a
+ * NUL-terminated query string (see queryparse.h for format), startdoc is the
+ * number of results to skip, len is the number of results to return, result is
+ * an array of length len to hold the results.  Options is a bitfield in which
+ * you can pass options in enum above (with corresponding parameters afterward).
+ * Returns true on success and 0 on failure.  On successful return, the number
+ * of results returned is written into *results, and the total number of
+ * matching documents is written into *total_results.  value written into est
+ * indicates whether *total_results is estimated (non-zero) or exact (zero). */
+int index_search(struct index *idx, const char *query, 
+  unsigned long int startdoc, unsigned long int len, 
+  struct index_result *result, unsigned int *results, 
+  double *total_results, int *est, int opts, struct index_search_opt *opt);
+
+/* retrieve a portion of a document from the index cache.  idx is the index,
+ * docno is the document number to retrieve, offset is the offset in the
+ * document from which to start retrieval.  dst is a buffer of size dstsize that
+ * will be filled with document data on successful return.  The number of bytes
+ * read will be returned on success, -1 on failure */
+unsigned int index_retrieve(const struct index *idx, unsigned long int docno,
+  unsigned long int offset, void *dst, unsigned int dstsize); 
+
+/* Retrieve the auxiliary data for a document.  AUX_BUF is the buffer
+   the auxiliary data will be written into; AUX_BUF_LEN is the length
+   of this buffer. AUX_LEN is the length of the auxiliary data.
+   Returns true on success, false on failure.  If the buffer is too
+   small, this counts as a failure; the required size will be written
+   into AUX_LEN in this case. */
+int index_retrieve_doc_aux(const struct index *idx, unsigned long int docno,
+  char *aux_buf, unsigned int aux_buf_len, unsigned int *aux_len);
+
+/* Retrieve the length of a document in bytes.  Returns UINT_MAX
+   on error; we assume there is no document this length. */
+unsigned int index_retrieve_doc_bytes(const struct index *idx,
+  unsigned long int docno);
+/* retrieve document statistics from the index.  the length (written into
+ * bytes), number of words in (written into words), number of distinct words in
+ * (written into distinct_words) cosine weight of (written into weight) and 
+ * auxilliary data (written into aux) of docno are retrieved.  Returns true on 
+ * success. */
+int index_retrieve_stats(const struct index *idx, unsigned long int docno, 
+  unsigned int *bytes, unsigned int *words, unsigned int *distinct_words,
+  double *weight, const char **aux);
+
+/* options that can be passed to index_add */
+enum index_commit_opts {
+    INDEX_COMMIT_NOOPT = 0,              /* pass this to indicate no flags */
+    INDEX_COMMIT_DUMPBUF = (1 << 1),     /* buffer update writing (supply size 
+                                          * of buffer as unsigned int) */
+    INDEX_COMMIT_ANH_IMPACTS = (1 << 10) /* create Anh impact-ordered vectors */
+};
+
+struct index_commit_opt {
+    unsigned int dumpbuf;
+};
+
+/* options that can be passed to index_add */
+enum index_add_opts {
+    INDEX_ADD_NOOPT = 0,                 /* pass this to indicate no flags */
+    INDEX_ADD_ACCBUF = (1 << 0),         /* buffer updates (supply size of 
+                                          * buffer as unsigned int) */
+    INDEX_ADD_ACCDOC = (1 << 1),         /* buffer this number of documents 
+                                          * (supply number as unsigned int) */
+    INDEX_ADD_FLUSH = (1 << 2)           /* commit changes after this addition*/
+};
+
+struct index_add_opt {
+    unsigned int accbuf;
+    unsigned int accdoc;
+    const char *detected_type;           /* contains type that file was 
+                                          * indexed with after method call */
+};
+
+/* add a new document to the index.  file specifies what file to add, with type
+ * giving the type of the file.  on successful return (non-zero return value),
+ * *docno is written with the first assigned docno, and docs with the number of
+ * *docs with the number of documents extracted from the file.  opts specify
+ * options to use when updating the index.  You can supply options for the
+ * adding operation using opt(s), and options for commits that occur during the
+ * process using commitopt(s) */
+int index_add(struct index *idx, const char *file, const char *mimetype,
+  unsigned long int *docno, unsigned int *docs, 
+  unsigned int opts, struct index_add_opt *opt, 
+  unsigned int commitopts, struct index_commit_opt *commitopt);
+/* write all changes to the index to disk (returns true on success) (XXX: talk
+ * about options) */
+int index_commit(struct index *idx, unsigned int opts, 
+  struct index_commit_opt *opt,
+  unsigned int addopts, struct index_add_opt *addopt);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/install-sh b/install-sh
new file mode 100755 (executable)
index 0000000..dd97db7
--- /dev/null
@@ -0,0 +1,322 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2004-09-10.20
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit 0;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+       shift
+       shift
+       continue;;
+
+    -T) no_target_directory=true
+       shift
+       continue;;
+
+    --version) echo "$0 $scriptversion"; exit 0;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+       # When -t is used, the destination is already specified.
+       test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+       for arg
+       do
+          if test -n "$dstarg"; then
+           # $@ is not empty: it contains at least $arg.
+           set fnord "$@" "$dstarg"
+           shift # fnord
+         fi
+         shift # arg
+         dstarg=$arg
+       done
+       break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+       echo "$0: $dstarg: Is a directory" >&2
+       exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+        '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+       # mkdir can fail with a `File exist' error in case several
+       # install-sh are creating the directory concurrently.  This
+       # is OK.
+       test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+          # The rename failed, perhaps because mv can't rename something else
+          # to itself, or perhaps because mv is so ancient that it does not
+          # support -f.
+
+          # Now remove or move aside any old file at destination location.
+          # We try this two ways since rm can't unlink itself on some
+          # systems and the destination file might be busy for other
+          # reasons.  In this case, the final cleanup might fail but the new
+          # file should still install successfully.
+          {
+            if test -f "$dstdir/$dstfile"; then
+              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+              || {
+                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+                (exit 1); exit
+              }
+            else
+              :
+            fi
+          } &&
+
+          # Now rename the file to the real destination.
+          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+        }
+    }
+  fi || { (exit 1); exit; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/ltmain.sh b/ltmain.sh
new file mode 100644 (file)
index 0000000..23f82e3
--- /dev/null
+++ b/ltmain.sh
@@ -0,0 +1,6425 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# RH: define SED for historic ltconfig's generated by Libtool 1.3
+[ -z "$SED" ] && SED=sed
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.6
+TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
+
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo A|tr A '\301'` in
+ A) # EBCDIC based system
+  SP2NL="tr '\100' '\n'"
+  NL2SP="tr '\r\n' '\100\100'"
+  ;;
+ *) # Assume ASCII based system
+  SP2NL="tr '\040' '\012'"
+  NL2SP="tr '\015\012' '\040\040'"
+  ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+  save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS="      
+"}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid () {
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+       sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
+      if test "X$win32_nmres" = "Ximport" ; then
+        win32_libid_type="x86 archive import"
+      else
+        win32_libid_type="x86 archive static"
+      fi
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag () {
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+       case $arg in
+         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+       for z in $available_tags; do
+         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+           # Evaluate the configuration.
+           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+           CC_quoted=
+           for arg in $CC; do
+           # Double-quote args containing other shell metacharacters.
+           case $arg in
+             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
+             arg="\"$arg\""
+             ;;
+           esac
+           CC_quoted="$CC_quoted $arg"
+         done
+           case "$@ " in
+             " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+             # The compiler in the base compile command matches
+             # the one in the tagged configuration.
+             # Assume this is the tagged configuration we want.
+             tagname=$z
+             break
+             ;;
+           esac
+         fi
+       done
+       # If $tagname still isn't set, then no tagged configuration
+       # was found and let the user know that the "--tag" command
+       # line option must be used.
+       if test -z "$tagname"; then
+         $echo "$modename: unable to infer tagged configuration"
+         $echo "$modename: specify a tag with \`--tag'" 1>&2
+         exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+       fi
+       ;;
+      esac
+    fi
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+       $echo "$progname: invalid tag name: $tagname" 1>&2
+       exit $EXIT_FAILURE
+       ;;
+      esac
+
+      case $tagname in
+      CC)
+       # Don't test for the "default" C tag, as we know, it's there, but
+       # not specially marked.
+       ;;
+      *)
+       if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+         taglist="$taglist $tagname"
+         # Evaluate the configuration.
+         eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+       else
+         $echo "$progname: ignoring unknown tag $tagname" 1>&2
+       fi
+       ;;
+      esac
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    $echo
+    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
+    $echo "This is free software; see the source for copying conditions.  There is NO"
+    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    exit $EXIT_SUCCESS
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $EXIT_SUCCESS
+    ;;
+
+  --debug)
+    $echo "$progname: enabling shell trace mode"
+    set -x
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    $echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $echo "enable shared libraries"
+    else
+      $echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $echo "enable static libraries"
+    else
+      $echo "disable static libraries"
+    fi
+    exit $EXIT_SUCCESS
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag) prevopt="--tag" prev=tag ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
+    case $nonopt in
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+       case $arg in
+       -c)
+          mode=compile
+          break
+          ;;
+       esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+       if test -n "$nonopt"; then
+         $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+       else
+         $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+       fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+
+    for arg
+    do
+      case "$arg_mode" in
+      arg  )
+       # do not "continue".  Instead, add this to base_compile
+       lastarg="$arg"
+       arg_mode=normal
+       ;;
+
+      target )
+       libobj="$arg"
+       arg_mode=normal
+       continue
+       ;;
+
+      normal )
+       # Accept any command-line options.
+       case $arg in
+       -o)
+         if test -n "$libobj" ; then
+           $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         arg_mode=target
+         continue
+         ;;
+
+       -static | -prefer-pic | -prefer-non-pic)
+         later="$later $arg"
+         continue
+         ;;
+
+       -no-suppress)
+         suppress_opt=no
+         continue
+         ;;
+
+       -Xcompiler)
+         arg_mode=arg  #  the next one goes into the "base_compile" arg list
+         continue      #  The current "srcfile" will either be retained or
+         ;;            #  replaced later.  I would guess that would be a bug.
+
+       -Wc,*)
+         args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+         lastarg=
+         save_ifs="$IFS"; IFS=','
+         for arg in $args; do
+           IFS="$save_ifs"
+
+           # Double-quote args containing other shell metacharacters.
+           # Many Bourne shells cannot handle close brackets correctly
+           # in scan sets, so we specify it separately.
+           case $arg in
+             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
+             arg="\"$arg\""
+             ;;
+           esac
+           lastarg="$lastarg $arg"
+         done
+         IFS="$save_ifs"
+         lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+         # Add the arguments to base_compile.
+         base_compile="$base_compile $lastarg"
+         continue
+         ;;
+
+       * )
+         # Accept the current argument as the source file.
+         # The previous "srcfile" becomes the current argument.
+         #
+         lastarg="$srcfile"
+         srcfile="$arg"
+         ;;
+       esac  #  case $arg
+       ;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      case $lastarg in
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       lastarg="\"$lastarg\""
+       ;;
+      esac
+
+      base_compile="$base_compile $lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
+      ;;
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *)
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+       build_old_libs=yes
+       continue
+       ;;
+
+      -prefer-pic)
+       pic_mode=yes
+       continue
+       ;;
+
+      -prefer-non-pic)
+       pic_mode=no
+       continue
+       ;;
+      esac
+    done
+
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+       $show "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+       $echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+      $echo $srcfile > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+       command="$base_compile $srcfile $pic_flag"
+      else
+       # Don't build PIC code
+       command="$base_compile $srcfile"
+      fi
+
+      if test ! -d "${xdir}$objdir"; then
+       $show "$mkdir ${xdir}$objdir"
+       $run $mkdir ${xdir}$objdir
+       status=$?
+       if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
+         exit $status
+       fi
+      fi
+
+      if test -z "$output_obj"; then
+       # Place PIC objects in $objdir
+       command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+       test -n "$output_obj" && $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+       $show "$mv $output_obj $lobj"
+       if $run $mv $output_obj $lobj; then :
+       else
+         error=$?
+         $run $rm $removelist
+         exit $error
+       fi
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+       # Don't build PIC code
+       command="$base_compile $srcfile"
+      else
+       command="$base_compile $srcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+       command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$obj" "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+       $show "$mv $output_obj $obj"
+       if $run $mv $output_obj $obj; then :
+       else
+         error=$?
+         $run $rm $removelist
+         exit $error
+       fi
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $run $mv "${libobj}T" "${libobj}"
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static)
+       if test "X$arg" = "X-all-static"; then
+         if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+           $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+         fi
+         if test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+       else
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+       fi
+       build_libtool_libs=no
+       build_old_libs=yes
+       prefer_static_libs=yes
+       break
+       ;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+       ;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+       case $prev in
+       output)
+         compile_command="$compile_command @OUTPUT@"
+         finalize_command="$finalize_command @OUTPUT@"
+         ;;
+       esac
+
+       case $prev in
+       dlfiles|dlprefiles)
+         if test "$preload" = no; then
+           # Add the symbol object into the linking commands.
+           compile_command="$compile_command @SYMFILE@"
+           finalize_command="$finalize_command @SYMFILE@"
+           preload=yes
+         fi
+         case $arg in
+         *.la | *.lo) ;;  # We handle these cases below.
+         force)
+           if test "$dlself" = no; then
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         self)
+           if test "$prev" = dlprefiles; then
+             dlself=yes
+           elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+             dlself=yes
+           else
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         *)
+           if test "$prev" = dlfiles; then
+             dlfiles="$dlfiles $arg"
+           else
+             dlprefiles="$dlprefiles $arg"
+           fi
+           prev=
+           continue
+           ;;
+         esac
+         ;;
+       expsyms)
+         export_symbols="$arg"
+         if test ! -f "$arg"; then
+           $echo "$modename: symbol file \`$arg' does not exist"
+           exit $EXIT_FAILURE
+         fi
+         prev=
+         continue
+         ;;
+       expsyms_regex)
+         export_symbols_regex="$arg"
+         prev=
+         continue
+         ;;
+       inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
+       precious_regex)
+         precious_files_regex="$arg"
+         prev=
+         continue
+         ;;
+       release)
+         release="-$arg"
+         prev=
+         continue
+         ;;
+       objectlist)
+         if test -f "$arg"; then
+           save_arg=$arg
+           moreargs=
+           for fil in `cat $save_arg`
+           do
+#            moreargs="$moreargs $fil"
+             arg=$fil
+             # A libtool-controlled object.
+
+             # Check to see that this really is a libtool object.
+             if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+               pic_object=
+               non_pic_object=
+
+               # Read the .lo file
+               # If there is no directory component, then add one.
+               case $arg in
+               */* | *\\*) . $arg ;;
+               *) . ./$arg ;;
+               esac
+
+               if test -z "$pic_object" || \
+                  test -z "$non_pic_object" ||
+                  test "$pic_object" = none && \
+                  test "$non_pic_object" = none; then
+                 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+                 exit $EXIT_FAILURE
+               fi
+
+               # Extract subdirectory from the argument.
+               xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+               if test "X$xdir" = "X$arg"; then
+                 xdir=
+               else
+                 xdir="$xdir/"
+               fi
+
+               if test "$pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 pic_object="$xdir$pic_object"
+
+                 if test "$prev" = dlfiles; then
+                   if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+                     dlfiles="$dlfiles $pic_object"
+                     prev=
+                     continue
+                   else
+                     # If libtool objects are unsupported, then we need to preload.
+                     prev=dlprefiles
+                   fi
+                 fi
+
+                 # CHECK ME:  I think I busted this.  -Ossama
+                 if test "$prev" = dlprefiles; then
+                   # Preload the old-style object.
+                   dlprefiles="$dlprefiles $pic_object"
+                   prev=
+                 fi
+
+                 # A PIC object.
+                 libobjs="$libobjs $pic_object"
+                 arg="$pic_object"
+               fi
+
+               # Non-PIC object.
+               if test "$non_pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 non_pic_object="$xdir$non_pic_object"
+
+                 # A standard non-PIC object
+                 non_pic_objects="$non_pic_objects $non_pic_object"
+                 if test -z "$pic_object" || test "$pic_object" = none ; then
+                   arg="$non_pic_object"
+                 fi
+               fi
+             else
+               # Only an error if not doing a dry-run.
+               if test -z "$run"; then
+                 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+                 exit $EXIT_FAILURE
+               else
+                 # Dry-run case.
+
+                 # Extract subdirectory from the argument.
+                 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+                 if test "X$xdir" = "X$arg"; then
+                   xdir=
+                 else
+                   xdir="$xdir/"
+                 fi
+
+                 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+                 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+                 libobjs="$libobjs $pic_object"
+                 non_pic_objects="$non_pic_objects $non_pic_object"
+               fi
+             fi
+           done
+         else
+           $echo "$modename: link input file \`$save_arg' does not exist"
+           exit $EXIT_FAILURE
+         fi
+         arg=$save_arg
+         prev=
+         continue
+         ;;
+       rpath | xrpath)
+         # We need an absolute path.
+         case $arg in
+         [\\/]* | [A-Za-z]:[\\/]*) ;;
+         *)
+           $echo "$modename: only absolute run-paths are allowed" 1>&2
+           exit $EXIT_FAILURE
+           ;;
+         esac
+         if test "$prev" = rpath; then
+           case "$rpath " in
+           *" $arg "*) ;;
+           *) rpath="$rpath $arg" ;;
+           esac
+         else
+           case "$xrpath " in
+           *" $arg "*) ;;
+           *) xrpath="$xrpath $arg" ;;
+           esac
+         fi
+         prev=
+         continue
+         ;;
+       xcompiler)
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         compile_command="$compile_command $qarg"
+         finalize_command="$finalize_command $qarg"
+         continue
+         ;;
+       xlinker)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $wl$qarg"
+         prev=
+         compile_command="$compile_command $wl$qarg"
+         finalize_command="$finalize_command $wl$qarg"
+         continue
+         ;;
+       xcclinker)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         compile_command="$compile_command $qarg"
+         finalize_command="$finalize_command $qarg"
+         continue
+         ;;
+       shrext)
+         shrext_cmds="$arg"
+         prev=
+         continue
+         ;;
+       *)
+         eval "$prev=\"\$arg\""
+         prev=
+         continue
+         ;;
+       esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+       if test -n "$link_static_flag"; then
+         compile_command="$compile_command $link_static_flag"
+         finalize_command="$finalize_command $link_static_flag"
+       fi
+       continue
+       ;;
+
+      -allow-undefined)
+       # FIXME: remove this flag sometime in the future.
+       $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+       continue
+       ;;
+
+      -avoid-version)
+       avoid_version=yes
+       continue
+       ;;
+
+      -dlopen)
+       prev=dlfiles
+       continue
+       ;;
+
+      -dlpreopen)
+       prev=dlprefiles
+       continue
+       ;;
+
+      -export-dynamic)
+       export_dynamic=yes
+       continue
+       ;;
+
+      -export-symbols | -export-symbols-regex)
+       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+         $echo "$modename: more than one -exported-symbols argument is not allowed"
+         exit $EXIT_FAILURE
+       fi
+       if test "X$arg" = "X-export-symbols"; then
+         prev=expsyms
+       else
+         prev=expsyms_regex
+       fi
+       continue
+       ;;
+
+      -inst-prefix-dir)
+       prev=inst_prefix
+       continue
+       ;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+       case $with_gcc/$host in
+       no/*-*-irix* | /*-*-irix*)
+         compile_command="$compile_command $arg"
+         finalize_command="$finalize_command $arg"
+         ;;
+       esac
+       continue
+       ;;
+
+      -L*)
+       dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         absdir=`cd "$dir" && pwd`
+         if test -z "$absdir"; then
+           $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         dir="$absdir"
+         ;;
+       esac
+       case "$deplibs " in
+       *" -L$dir "*) ;;
+       *)
+         deplibs="$deplibs -L$dir"
+         lib_search_path="$lib_search_path $dir"
+         ;;
+       esac
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         case :$dllsearchpath: in
+         *":$dir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$dir";;
+         esac
+         ;;
+       esac
+       continue
+       ;;
+
+      -l*)
+       if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+         case $host in
+         *-*-cygwin* | *-*-pw32* | *-*-beos*)
+           # These systems don't actually have a C or math library (as such)
+           continue
+           ;;
+         *-*-mingw* | *-*-os2*)
+           # These systems don't actually have a C library (as such)
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-openbsd* | *-*-freebsd*)
+           # Do not include libc due to us having libc/libc_r.
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C and math libraries are in the System framework
+           deplibs="$deplibs -framework System"
+           continue
+         esac
+       elif test "X$arg" = "X-lc_r"; then
+        case $host in
+        *-*-openbsd* | *-*-freebsd*)
+          # Do not include libc_r directly, use -pthread flag.
+          continue
+          ;;
+        esac
+       fi
+       deplibs="$deplibs $arg"
+       continue
+       ;;
+
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+       deplibs="$deplibs $arg"
+       continue
+       ;;
+
+      -module)
+       module=yes
+       continue
+       ;;
+
+      # gcc -m* arguments should be passed to the linker via $compiler_flags
+      # in order to pass architecture information to the linker
+      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
+      # but this is not reliable with gcc because gcc may use -mfoo to
+      # select a different linker, different libraries, etc, while
+      # -Wl,-mfoo simply passes -mfoo to the linker.
+      -m*)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        if test "$with_gcc" = "yes" ; then
+          compiler_flags="$compiler_flags $arg"
+        fi
+        continue
+        ;;
+
+      -shrext)
+       prev=shrext
+       continue
+       ;;
+
+      -no-fast-install)
+       fast_install=no
+       continue
+       ;;
+
+      -no-install)
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         # The PATH hackery in wrapper scripts is required on Windows
+         # in order for the loader to find any dlls it needs.
+         $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+         $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+         fast_install=no
+         ;;
+       *) no_install=yes ;;
+       esac
+       continue
+       ;;
+
+      -no-undefined)
+       allow_undefined=no
+       continue
+       ;;
+
+      -objectlist)
+       prev=objectlist
+       continue
+       ;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+       prev=precious_regex
+       continue
+       ;;
+
+      -release)
+       prev=release
+       continue
+       ;;
+
+      -rpath)
+       prev=rpath
+       continue
+       ;;
+
+      -R)
+       prev=xrpath
+       continue
+       ;;
+
+      -R*)
+       dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         $echo "$modename: only absolute run-paths are allowed" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+       case "$xrpath " in
+       *" $dir "*) ;;
+       *) xrpath="$xrpath $dir" ;;
+       esac
+       continue
+       ;;
+
+      -static)
+       # The effects of -static are defined in a previous loop.
+       # We used to do the same as -all-static on platforms that
+       # didn't have a PIC flag, but the assumption that the effects
+       # would be equivalent was wrong.  It would break on at least
+       # Digital Unix and AIX.
+       continue
+       ;;
+
+      -thread-safe)
+       thread_safe=yes
+       continue
+       ;;
+
+      -version-info)
+       prev=vinfo
+       continue
+       ;;
+      -version-number)
+       prev=vinfo
+       vinfo_number=yes
+       continue
+       ;;
+
+      -Wc,*)
+       args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+         case $flag in
+           *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
+           flag="\"$flag\""
+           ;;
+         esac
+         arg="$arg $wl$flag"
+         compiler_flags="$compiler_flags $flag"
+       done
+       IFS="$save_ifs"
+       arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+       ;;
+
+      -Wl,*)
+       args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+         case $flag in
+           *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
+           flag="\"$flag\""
+           ;;
+         esac
+         arg="$arg $wl$flag"
+         compiler_flags="$compiler_flags $wl$flag"
+         linker_flags="$linker_flags $flag"
+       done
+       IFS="$save_ifs"
+       arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+       ;;
+
+      -Xcompiler)
+       prev=xcompiler
+       continue
+       ;;
+
+      -Xlinker)
+       prev=xlinker
+       continue
+       ;;
+
+      -XCClinker)
+       prev=xcclinker
+       continue
+       ;;
+
+      # Some other compiler flag.
+      -* | +*)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       ;;
+
+      *.$objext)
+       # A standard object.
+       objs="$objs $arg"
+       ;;
+
+      *.lo)
+       # A libtool-controlled object.
+
+       # Check to see that this really is a libtool object.
+       if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         pic_object=
+         non_pic_object=
+
+         # Read the .lo file
+         # If there is no directory component, then add one.
+         case $arg in
+         */* | *\\*) . $arg ;;
+         *) . ./$arg ;;
+         esac
+
+         if test -z "$pic_object" || \
+            test -z "$non_pic_object" ||
+            test "$pic_object" = none && \
+            test "$non_pic_object" = none; then
+           $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         # Extract subdirectory from the argument.
+         xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+         if test "X$xdir" = "X$arg"; then
+           xdir=
+         else
+           xdir="$xdir/"
+         fi
+
+         if test "$pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           pic_object="$xdir$pic_object"
+
+           if test "$prev" = dlfiles; then
+             if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+               dlfiles="$dlfiles $pic_object"
+               prev=
+               continue
+             else
+               # If libtool objects are unsupported, then we need to preload.
+               prev=dlprefiles
+             fi
+           fi
+
+           # CHECK ME:  I think I busted this.  -Ossama
+           if test "$prev" = dlprefiles; then
+             # Preload the old-style object.
+             dlprefiles="$dlprefiles $pic_object"
+             prev=
+           fi
+
+           # A PIC object.
+           libobjs="$libobjs $pic_object"
+           arg="$pic_object"
+         fi
+
+         # Non-PIC object.
+         if test "$non_pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           non_pic_object="$xdir$non_pic_object"
+
+           # A standard non-PIC object
+           non_pic_objects="$non_pic_objects $non_pic_object"
+           if test -z "$pic_object" || test "$pic_object" = none ; then
+             arg="$non_pic_object"
+           fi
+         fi
+       else
+         # Only an error if not doing a dry-run.
+         if test -z "$run"; then
+           $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+           exit $EXIT_FAILURE
+         else
+           # Dry-run case.
+
+           # Extract subdirectory from the argument.
+           xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+           if test "X$xdir" = "X$arg"; then
+             xdir=
+           else
+             xdir="$xdir/"
+           fi
+
+           pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+           non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+           libobjs="$libobjs $pic_object"
+           non_pic_objects="$non_pic_objects $non_pic_object"
+         fi
+       fi
+       ;;
+
+      *.$libext)
+       # An archive.
+       deplibs="$deplibs $arg"
+       old_deplibs="$old_deplibs $arg"
+       continue
+       ;;
+
+      *.la)
+       # A libtool-controlled library.
+
+       if test "$prev" = dlfiles; then
+         # This library was specified with -dlopen.
+         dlfiles="$dlfiles $arg"
+         prev=
+       elif test "$prev" = dlprefiles; then
+         # The library was specified with -dlpreopen.
+         dlprefiles="$dlprefiles $arg"
+         prev=
+       else
+         deplibs="$deplibs $arg"
+       fi
+       continue
+       ;;
+
+      # Some other compiler argument.
+      *)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       ;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+       compile_command="$compile_command $arg"
+       finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d "$output_objdir"; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      status=$?
+      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
+       exit $status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      duplicate_compiler_generated_deps=yes
+      ;;
+    *)
+      duplicate_compiler_generated_deps=$duplicate_deps
+      ;;
+    esac
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+       case "$libs " in
+       *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+       esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+       for pre_post_dep in $predeps $postdeps; do
+         case "$pre_post_deps " in
+         *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+         esac
+         pre_post_deps="$pre_post_deps $pre_post_dep"
+       done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+    case $linkmode in
+    lib)
+       passes="conv link"
+       for file in $dlfiles $dlprefiles; do
+         case $file in
+         *.la) ;;
+         *)
+           $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+           exit $EXIT_FAILURE
+           ;;
+         esac
+       done
+       ;;
+    prog)
+       compile_deplibs=
+       finalize_deplibs=
+       alldeplibs=no
+       newdlfiles=
+       newdlprefiles=
+       passes="conv scan dlopen dlpreopen link"
+       ;;
+    *)  passes="conv"
+       ;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+        test "$linkmode,$pass" = "prog,scan"; then
+       libs="$deplibs"
+       deplibs=
+      fi
+      if test "$linkmode" = prog; then
+       case $pass in
+       dlopen) libs="$dlfiles" ;;
+       dlpreopen) libs="$dlprefiles" ;;
+       link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+       esac
+      fi
+      if test "$pass" = dlopen; then
+       # Collect dlpreopened libraries
+       save_deplibs="$deplibs"
+       deplibs=
+      fi
+      for deplib in $libs; do
+       lib=
+       found=no
+       case $deplib in
+       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+         if test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           deplibs="$deplib $deplibs"
+         fi
+         continue
+         ;;
+       -l*)
+         if test "$linkmode" != lib && test "$linkmode" != prog; then
+           $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+           continue
+         fi
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+           continue
+         fi
+         name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+         for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+           for search_ext in .la $std_shrext .so .a; do
+             # Search the libtool library
+             lib="$searchdir/lib${name}${search_ext}"
+             if test -f "$lib"; then
+               if test "$search_ext" = ".la"; then
+                 found=yes
+               else
+                 found=no
+               fi
+               break 2
+             fi
+           done
+         done
+         if test "$found" != yes; then
+           # deplib doesn't seem to be a libtool library
+           if test "$linkmode,$pass" = "prog,link"; then
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             deplibs="$deplib $deplibs"
+             test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+           fi
+           continue
+         else # deplib is a libtool library
+           # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+           # We need to do some special things here, and not later.
+           if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+             case " $predeps $postdeps " in
+             *" $deplib "*)
+               if (${SED} -e '2q' $lib |
+                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+                 library_names=
+                 old_library=
+                 case $lib in
+                 */* | *\\*) . $lib ;;
+                 *) . ./$lib ;;
+                 esac
+                 for l in $old_library $library_names; do
+                   ll="$l"
+                 done
+                 if test "X$ll" = "X$old_library" ; then # only static version available
+                   found=no
+                   ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+                   test "X$ladir" = "X$lib" && ladir="."
+                   lib=$ladir/$old_library
+                   if test "$linkmode,$pass" = "prog,link"; then
+                     compile_deplibs="$deplib $compile_deplibs"
+                     finalize_deplibs="$deplib $finalize_deplibs"
+                   else
+                     deplibs="$deplib $deplibs"
+                     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+                   fi
+                   continue
+                 fi
+               fi
+               ;;
+             *) ;;
+             esac
+           fi
+         fi
+         ;; # -l
+       -L*)
+         case $linkmode in
+         lib)
+           deplibs="$deplib $deplibs"
+           test "$pass" = conv && continue
+           newdependency_libs="$deplib $newdependency_libs"
+           newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+           ;;
+         prog)
+           if test "$pass" = conv; then
+             deplibs="$deplib $deplibs"
+             continue
+           fi
+           if test "$pass" = scan; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+           ;;
+         *)
+           $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+           ;;
+         esac # linkmode
+         continue
+         ;; # -L
+       -R*)
+         if test "$pass" = link; then
+           dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+           # Make sure the xrpath contains only unique directories.
+           case "$xrpath " in
+           *" $dir "*) ;;
+           *) xrpath="$xrpath $dir" ;;
+           esac
+         fi
+         deplibs="$deplib $deplibs"
+         continue
+         ;;
+       *.la) lib="$deplib" ;;
+       *.$libext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+           continue
+         fi
+         case $linkmode in
+         lib)
+           if test "$deplibs_check_method" != pass_all; then
+             $echo
+             $echo "*** Warning: Trying to link with static lib archive $deplib."
+             $echo "*** I have the capability to make that library automatically link in when"
+             $echo "*** you link to this library.  But I can only do this if you have a"
+             $echo "*** shared version of the library, which you do not appear to have"
+             $echo "*** because the file extensions .$libext of this argument makes me believe"
+             $echo "*** that it is just a static archive that I should not used here."
+           else
+             $echo
+             $echo "*** Warning: Linking the shared library $output against the"
+             $echo "*** static library $deplib is not portable!"
+             deplibs="$deplib $deplibs"
+           fi
+           continue
+           ;;
+         prog)
+           if test "$pass" != link; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           continue
+           ;;
+         esac # linkmode
+         ;; # *.$libext
+       *.lo | *.$objext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+         elif test "$linkmode" = prog; then
+           if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+             # If there is no dlopen support or we're linking statically,
+             # we need to preload.
+             newdlprefiles="$newdlprefiles $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             newdlfiles="$newdlfiles $deplib"
+           fi
+         fi
+         continue
+         ;;
+       %DEPLIBS%)
+         alldeplibs=yes
+         continue
+         ;;
+       esac # case $deplib
+       if test "$found" = yes || test -f "$lib"; then :
+       else
+         $echo "$modename: cannot find the library \`$lib'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$ladir" = "X$lib" && ladir="."
+
+       dlname=
+       dlopen=
+       dlpreopen=
+       libdir=
+       library_names=
+       old_library=
+       # If the library was installed with an old release of libtool,
+       # it will not redefine variables installed, or shouldnotlink
+       installed=yes
+       shouldnotlink=no
+
+       # Read the .la file
+       case $lib in
+       */* | *\\*) . $lib ;;
+       *) . ./$lib ;;
+       esac
+
+       if test "$linkmode,$pass" = "lib,link" ||
+          test "$linkmode,$pass" = "prog,scan" ||
+          { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+         test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+         test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+       fi
+
+       if test "$pass" = conv; then
+         # Only check for convenience libraries
+         deplibs="$lib $deplibs"
+         if test -z "$libdir"; then
+           if test -z "$old_library"; then
+             $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+             exit $EXIT_FAILURE
+           fi
+           # It is a libtool convenience library, so add in its objects.
+           convenience="$convenience $ladir/$objdir/$old_library"
+           old_convenience="$old_convenience $ladir/$objdir/$old_library"
+           tmp_libs=
+           for deplib in $dependency_libs; do
+             deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+               case "$tmp_libs " in
+               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+               esac
+              fi
+             tmp_libs="$tmp_libs $deplib"
+           done
+         elif test "$linkmode" != prog && test "$linkmode" != lib; then
+           $echo "$modename: \`$lib' is not a convenience library" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         continue
+       fi # $pass = conv
+
+
+       # Get the name of the library we link against.
+       linklib=
+       for l in $old_library $library_names; do
+         linklib="$l"
+       done
+       if test -z "$linklib"; then
+         $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # This library was specified with -dlopen.
+       if test "$pass" = dlopen; then
+         if test -z "$libdir"; then
+           $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         if test -z "$dlname" ||
+            test "$dlopen_support" != yes ||
+            test "$build_libtool_libs" = no; then
+           # If there is no dlname, no dlopen support or we're linking
+           # statically, we need to preload.  We also need to preload any
+           # dependent libraries so libltdl's deplib preloader doesn't
+           # bomb out in the load deplibs phase.
+           dlprefiles="$dlprefiles $lib $dependency_libs"
+         else
+           newdlfiles="$newdlfiles $lib"
+         fi
+         continue
+       fi # $pass = dlopen
+
+       # We need an absolute path.
+       case $ladir in
+       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+       *)
+         abs_ladir=`cd "$ladir" && pwd`
+         if test -z "$abs_ladir"; then
+           $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+           $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+           abs_ladir="$ladir"
+         fi
+         ;;
+       esac
+       laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+       # Find the relevant object directory and library name.
+       if test "X$installed" = Xyes; then
+         if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           $echo "$modename: warning: library \`$lib' was moved." 1>&2
+           dir="$ladir"
+           absdir="$abs_ladir"
+           libdir="$abs_ladir"
+         else
+           dir="$libdir"
+           absdir="$libdir"
+         fi
+       else
+         dir="$ladir/$objdir"
+         absdir="$abs_ladir/$objdir"
+         # Remove this search path later
+         notinst_path="$notinst_path $abs_ladir"
+       fi # $installed = yes
+       name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+       # This library was specified with -dlpreopen.
+       if test "$pass" = dlpreopen; then
+         if test -z "$libdir"; then
+           $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         # Prefer using a static library (so that no silly _DYNAMIC symbols
+         # are required to link).
+         if test -n "$old_library"; then
+           newdlprefiles="$newdlprefiles $dir/$old_library"
+         # Otherwise, use the dlname, so that lt_dlopen finds it.
+         elif test -n "$dlname"; then
+           newdlprefiles="$newdlprefiles $dir/$dlname"
+         else
+           newdlprefiles="$newdlprefiles $dir/$linklib"
+         fi
+       fi # $pass = dlpreopen
+
+       if test -z "$libdir"; then
+         # Link the convenience library
+         if test "$linkmode" = lib; then
+           deplibs="$dir/$old_library $deplibs"
+         elif test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$dir/$old_library $compile_deplibs"
+           finalize_deplibs="$dir/$old_library $finalize_deplibs"
+         else
+           deplibs="$lib $deplibs" # used for prog,scan pass
+         fi
+         continue
+       fi
+
+
+       if test "$linkmode" = prog && test "$pass" != link; then
+         newlib_search_path="$newlib_search_path $ladir"
+         deplibs="$lib $deplibs"
+
+         linkalldeplibs=no
+         if test "$link_all_deplibs" != no || test -z "$library_names" ||
+            test "$build_libtool_libs" = no; then
+           linkalldeplibs=yes
+         fi
+
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           case $deplib in
+           -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+           esac
+           # Need to link against all dependency_libs?
+           if test "$linkalldeplibs" = yes; then
+             deplibs="$deplib $deplibs"
+           else
+             # Need to hardcode shared library paths
+             # or/and link against static libraries
+             newdependency_libs="$deplib $newdependency_libs"
+           fi
+           if test "X$duplicate_deps" = "Xyes" ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done # for deplib
+         continue
+       fi # $linkmode = prog...
+
+       if test "$linkmode,$pass" = "prog,link"; then
+         if test -n "$library_names" &&
+            { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+           # We need to hardcode the library path
+           if test -n "$shlibpath_var"; then
+             # Make sure the rpath contains only unique directories.
+             case "$temp_rpath " in
+             *" $dir "*) ;;
+             *" $absdir "*) ;;
+             *) temp_rpath="$temp_rpath $dir" ;;
+             esac
+           fi
+
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) compile_rpath="$compile_rpath $absdir"
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) finalize_rpath="$finalize_rpath $libdir"
+             esac
+             ;;
+           esac
+         fi # $linkmode,$pass = prog,link...
+
+         if test "$alldeplibs" = yes &&
+            { test "$deplibs_check_method" = pass_all ||
+              { test "$build_libtool_libs" = yes &&
+                test -n "$library_names"; }; }; then
+           # We only need to search for static libraries
+           continue
+         fi
+       fi
+
+       link_static=no # Whether the deplib will be linked statically
+       if test -n "$library_names" &&
+          { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+         if test "$installed" = no; then
+           notinst_deplibs="$notinst_deplibs $lib"
+           need_relink=yes
+         fi
+         # This is a shared library
+
+         # Warn about portability, can't link against -module's on
+         # some systems (darwin)
+         if test "$shouldnotlink" = yes && test "$pass" = link ; then
+           $echo
+           if test "$linkmode" = prog; then
+             $echo "*** Warning: Linking the executable $output against the loadable module"
+           else
+             $echo "*** Warning: Linking the shared library $output against the loadable module"
+           fi
+           $echo "*** $linklib is not portable!"
+         fi
+         if test "$linkmode" = lib &&
+            test "$hardcode_into_libs" = yes; then
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) compile_rpath="$compile_rpath $absdir"
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) finalize_rpath="$finalize_rpath $libdir"
+             esac
+             ;;
+           esac
+         fi
+
+         if test -n "$old_archive_from_expsyms_cmds"; then
+           # figure out the soname
+           set dummy $library_names
+           realname="$2"
+           shift; shift
+           libname=`eval \\$echo \"$libname_spec\"`
+           # use dlname if we got it. it's perfectly good, no?
+           if test -n "$dlname"; then
+             soname="$dlname"
+           elif test -n "$soname_spec"; then
+             # bleh windows
+             case $host in
+             *cygwin* | mingw*)
+               major=`expr $current - $age`
+               versuffix="-$major"
+               ;;
+             esac
+             eval soname=\"$soname_spec\"
+           else
+             soname="$realname"
+           fi
+
+           # Make a new name for the extract_expsyms_cmds to use
+           soroot="$soname"
+           soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+           newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+           # If the library has no export list, then create one now
+           if test -f "$output_objdir/$soname-def"; then :
+           else
+             $show "extracting exported symbol list from \`$soname'"
+             save_ifs="$IFS"; IFS='~'
+             cmds=$extract_expsyms_cmds
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+             done
+             IFS="$save_ifs"
+           fi
+
+           # Create $newlib
+           if test -f "$output_objdir/$newlib"; then :; else
+             $show "generating import library for \`$soname'"
+             save_ifs="$IFS"; IFS='~'
+             cmds=$old_archive_from_expsyms_cmds
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+             done
+             IFS="$save_ifs"
+           fi
+           # make sure the library variables are pointing to the new library
+           dir=$output_objdir
+           linklib=$newlib
+         fi # test -n "$old_archive_from_expsyms_cmds"
+
+         if test "$linkmode" = prog || test "$mode" != relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           lib_linked=yes
+           case $hardcode_action in
+           immediate | unsupported)
+             if test "$hardcode_direct" = no; then
+               add="$dir/$linklib"
+               case $host in
+                 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
+                 *-*-darwin* )
+                   # if the lib is a module then we can not link against
+                   # it, someone is ignoring the new warnings I added
+                   if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
+                     $echo "** Warning, lib $linklib is a module, not a shared library"
+                     if test -z "$old_library" ; then
+                       $echo
+                       $echo "** And there doesn't seem to be a static archive available"
+                       $echo "** The link will probably fail, sorry"
+                     else
+                       add="$dir/$old_library"
+                     fi
+                   fi
+               esac
+             elif test "$hardcode_minus_L" = no; then
+               case $host in
+               *-*-sunos*) add_shlibpath="$dir" ;;
+               esac
+               add_dir="-L$dir"
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = no; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           relink)
+             if test "$hardcode_direct" = yes; then
+               add="$dir/$linklib"
+             elif test "$hardcode_minus_L" = yes; then
+               add_dir="-L$dir"
+               # Try looking first in the location we're being installed to.
+               if test -n "$inst_prefix_dir"; then
+                 case "$libdir" in
+                   [\\/]*)
+                     add_dir="$add_dir -L$inst_prefix_dir$libdir"
+                     ;;
+                 esac
+               fi
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = yes; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           *) lib_linked=no ;;
+           esac
+
+           if test "$lib_linked" != yes; then
+             $echo "$modename: configuration error: unsupported hardcode properties"
+             exit $EXIT_FAILURE
+           fi
+
+           if test -n "$add_shlibpath"; then
+             case :$compile_shlibpath: in
+             *":$add_shlibpath:"*) ;;
+             *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+             esac
+           fi
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+             test -n "$add" && compile_deplibs="$add $compile_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+             if test "$hardcode_direct" != yes && \
+                test "$hardcode_minus_L" != yes && \
+                test "$hardcode_shlibpath_var" = yes; then
+               case :$finalize_shlibpath: in
+               *":$libdir:"*) ;;
+               *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+               esac
+             fi
+           fi
+         fi
+
+         if test "$linkmode" = prog || test "$mode" = relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           # Finalize command for both is simple: just hardcode it.
+           if test "$hardcode_direct" = yes; then
+             add="$libdir/$linklib"
+           elif test "$hardcode_minus_L" = yes; then
+             add_dir="-L$libdir"
+             add="-l$name"
+           elif test "$hardcode_shlibpath_var" = yes; then
+             case :$finalize_shlibpath: in
+             *":$libdir:"*) ;;
+             *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+             esac
+             add="-l$name"
+           elif test "$hardcode_automatic" = yes; then
+             if test -n "$inst_prefix_dir" &&
+                test -f "$inst_prefix_dir$libdir/$linklib" ; then
+               add="$inst_prefix_dir$libdir/$linklib"
+             else
+               add="$libdir/$linklib"
+             fi
+           else
+             # We cannot seem to hardcode it, guess we'll fake it.
+             add_dir="-L$libdir"
+             # Try looking first in the location we're being installed to.
+             if test -n "$inst_prefix_dir"; then
+               case "$libdir" in
+                 [\\/]*)
+                   add_dir="$add_dir -L$inst_prefix_dir$libdir"
+                   ;;
+               esac
+             fi
+             add="-l$name"
+           fi
+
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+           fi
+         fi
+       elif test "$linkmode" = prog; then
+         # Here we assume that one of hardcode_direct or hardcode_minus_L
+         # is not unsupported.  This is valid on all known static and
+         # shared platforms.
+         if test "$hardcode_direct" != unsupported; then
+           test -n "$old_library" && linklib="$old_library"
+           compile_deplibs="$dir/$linklib $compile_deplibs"
+           finalize_deplibs="$dir/$linklib $finalize_deplibs"
+         else
+           compile_deplibs="-l$name -L$dir $compile_deplibs"
+           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+         fi
+       elif test "$build_libtool_libs" = yes; then
+         # Not a shared library
+         if test "$deplibs_check_method" != pass_all; then
+           # We're trying link a shared library against a static one
+           # but the system doesn't support it.
+
+           # Just print a warning and add the library to dependency_libs so
+           # that the program can be linked against the static library.
+           $echo
+           $echo "*** Warning: This system can not link to static lib archive $lib."
+           $echo "*** I have the capability to make that library automatically link in when"
+           $echo "*** you link to this library.  But I can only do this if you have a"
+           $echo "*** shared version of the library, which you do not appear to have."
+           if test "$module" = yes; then
+             $echo "*** But as you try to build a module library, libtool will still create "
+             $echo "*** a static module, that should work as long as the dlopening application"
+             $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+             if test -z "$global_symbol_pipe"; then
+               $echo
+               $echo "*** However, this would only work if libtool was able to extract symbol"
+               $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+               $echo "*** not find such a program.  So, this module is probably useless."
+               $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+             fi
+             if test "$build_old_libs" = no; then
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         else
+           convenience="$convenience $dir/$old_library"
+           old_convenience="$old_convenience $dir/$old_library"
+           deplibs="$dir/$old_library $deplibs"
+           link_static=yes
+         fi
+       fi # link shared/static library?
+
+       if test "$linkmode" = lib; then
+         if test -n "$dependency_libs" &&
+            { test "$hardcode_into_libs" != yes ||
+              test "$build_old_libs" = yes ||
+              test "$link_static" = yes; }; then
+           # Extract -R from dependency_libs
+           temp_deplibs=
+           for libdir in $dependency_libs; do
+             case $libdir in
+             -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+                  case " $xrpath " in
+                  *" $temp_xrpath "*) ;;
+                  *) xrpath="$xrpath $temp_xrpath";;
+                  esac;;
+             *) temp_deplibs="$temp_deplibs $libdir";;
+             esac
+           done
+           dependency_libs="$temp_deplibs"
+         fi
+
+         newlib_search_path="$newlib_search_path $absdir"
+         # Link against this library
+         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+         # ... and its dependency_libs
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           newdependency_libs="$deplib $newdependency_libs"
+           if test "X$duplicate_deps" = "Xyes" ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done
+
+         if test "$link_all_deplibs" != no; then
+           # Add the search paths of all dependency libraries
+           for deplib in $dependency_libs; do
+             case $deplib in
+             -L*) path="$deplib" ;;
+             *.la)
+               dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+               test "X$dir" = "X$deplib" && dir="."
+               # We need an absolute path.
+               case $dir in
+               [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+               *)
+                 absdir=`cd "$dir" && pwd`
+                 if test -z "$absdir"; then
+                   $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+                   absdir="$dir"
+                 fi
+                 ;;
+               esac
+               if grep "^installed=no" $deplib > /dev/null; then
+                 path="$absdir/$objdir"
+               else
+                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+                 if test -z "$libdir"; then
+                   $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+                   exit $EXIT_FAILURE
+                 fi
+                 if test "$absdir" != "$libdir"; then
+                   $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+                 fi
+                 path="$absdir"
+               fi
+               depdepl=
+               case $host in
+               *-*-darwin*)
+                 # we do not want to link against static libs,
+                 # but need to link against shared
+                 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+                 if test -n "$deplibrary_names" ; then
+                   for tmp in $deplibrary_names ; do
+                     depdepl=$tmp
+                   done
+                   if test -f "$path/$depdepl" ; then
+                     depdepl="$path/$depdepl"
+                   fi
+                   # do not add paths which are already there
+                   case " $newlib_search_path " in
+                   *" $path "*) ;;
+                   *) newlib_search_path="$newlib_search_path $path";;
+                   esac
+                 fi
+                 path=""
+                 ;;
+               *)
+                 path="-L$path"
+                 ;;
+               esac
+               ;;
+             -l*)
+               case $host in
+               *-*-darwin*)
+                 # Again, we only want to link against shared libraries
+                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+                 for tmp in $newlib_search_path ; do
+                   if test -f "$tmp/lib$tmp_libs.dylib" ; then
+                     eval depdepl="$tmp/lib$tmp_libs.dylib"
+                     break
+                   fi
+                 done
+                 path=""
+                 ;;
+               *) continue ;;
+               esac
+               ;;
+             *) continue ;;
+             esac
+             case " $deplibs " in
+             *" $depdepl "*) ;;
+             *) deplibs="$depdepl $deplibs" ;;
+             esac
+             case " $deplibs " in
+             *" $path "*) ;;
+             *) deplibs="$deplibs $path" ;;
+             esac
+           done
+         fi # link_all_deplibs != no
+       fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+       # Link the dlpreopened libraries before other libraries
+       for deplib in $save_deplibs; do
+         deplibs="$deplib $deplibs"
+       done
+      fi
+      if test "$pass" != dlopen; then
+       if test "$pass" != conv; then
+         # Make sure lib_search_path contains only unique directories.
+         lib_search_path=
+         for dir in $newlib_search_path; do
+           case "$lib_search_path " in
+           *" $dir "*) ;;
+           *) lib_search_path="$lib_search_path $dir" ;;
+           esac
+         done
+         newlib_search_path=
+       fi
+
+       if test "$linkmode,$pass" != "prog,link"; then
+         vars="deplibs"
+       else
+         vars="compile_deplibs finalize_deplibs"
+       fi
+       for var in $vars dependency_libs; do
+         # Add libraries to $var in reverse order
+         eval tmp_libs=\"\$$var\"
+         new_libs=
+         for deplib in $tmp_libs; do
+           # FIXME: Pedantically, this is the right thing to do, so
+           #        that some nasty dependency loop isn't accidentally
+           #        broken:
+           #new_libs="$deplib $new_libs"
+           # Pragmatically, this seems to cause very few problems in
+           # practice:
+           case $deplib in
+           -L*) new_libs="$deplib $new_libs" ;;
+           -R*) ;;
+           *)
+             # And here is the reason: when a library appears more
+             # than once as an explicit dependence of a library, or
+             # is implicitly linked in more than once by the
+             # compiler, it is considered special, and multiple
+             # occurrences thereof are not removed.  Compare this
+             # with having the same library being listed as a
+             # dependency of multiple other libraries: in this case,
+             # we know (pedantically, we assume) the library does not
+             # need to be listed more than once, so we keep only the
+             # last copy.  This is not always right, but it is rare
+             # enough that we require users that really mean to play
+             # such unportable linking tricks to link the library
+             # using -Wl,-lname, so that libtool does not consider it
+             # for duplicate removal.
+             case " $specialdeplibs " in
+             *" $deplib "*) new_libs="$deplib $new_libs" ;;
+             *)
+               case " $new_libs " in
+               *" $deplib "*) ;;
+               *) new_libs="$deplib $new_libs" ;;
+               esac
+               ;;
+             esac
+             ;;
+           esac
+         done
+         tmp_libs=
+         for deplib in $new_libs; do
+           case $deplib in
+           -L*)
+             case " $tmp_libs " in
+             *" $deplib "*) ;;
+             *) tmp_libs="$tmp_libs $deplib" ;;
+             esac
+             ;;
+           *) tmp_libs="$tmp_libs $deplib" ;;
+           esac
+         done
+         eval $var=\"$tmp_libs\"
+       done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+       case " $predeps $postdeps $compiler_lib_search_path " in
+       *" $i "*)
+         i=""
+         ;;
+       esac
+       if test -n "$i" ; then
+         tmp_libs="$tmp_libs $i"
+       fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$deplibs"; then
+       $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+       $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+       $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+       $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+       name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+       eval shared_ext=\"$shrext_cmds\"
+       eval libname=\"$libname_spec\"
+       ;;
+      *)
+       if test "$module" = no; then
+         $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       if test "$need_lib_prefix" != no; then
+         # Add the "lib" prefix for modules if required
+         name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+         eval shared_ext=\"$shrext_cmds\"
+         eval libname=\"$libname_spec\"
+       else
+         libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+       fi
+       ;;
+      esac
+
+      if test -n "$objs"; then
+       if test "$deplibs_check_method" != pass_all; then
+         $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+         exit $EXIT_FAILURE
+       else
+         $echo
+         $echo "*** Warning: Linking the shared library $output against the non-libtool"
+         $echo "*** objects $objs is not portable!"
+         libobjs="$libobjs $objs"
+       fi
+      fi
+
+      if test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test "$#" -gt 2; then
+       $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+       if test "$build_libtool_libs" = yes; then
+         # Building a libtool convenience library.
+         # Some compilers have problems with a `.al' extension so
+         # convenience libraries should have the same extension an
+         # archive normally would.
+         oldlibs="$output_objdir/$libname.$libext $oldlibs"
+         build_libtool_libs=convenience
+         build_old_libs=yes
+       fi
+
+       if test -n "$vinfo"; then
+         $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+       fi
+
+       if test -n "$release"; then
+         $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+       fi
+      else
+
+       # Parse the version information argument.
+       save_ifs="$IFS"; IFS=':'
+       set dummy $vinfo 0 0 0
+       IFS="$save_ifs"
+
+       if test -n "$8"; then
+         $echo "$modename: too many parameters to \`-version-info'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # convert absolute version numbers to libtool ages
+       # this retains compatibility with .la files and attempts
+       # to make the code below a bit more comprehensible
+
+       case $vinfo_number in
+       yes)
+         number_major="$2"
+         number_minor="$3"
+         number_revision="$4"
+         #
+         # There are really only two kinds -- those that
+         # use the current revision as the major version
+         # and those that subtract age and use age as
+         # a minor version.  But, then there is irix
+         # which has an extra 1 added just for fun
+         #
+         case $version_type in
+         darwin|linux|osf|windows)
+           current=`expr $number_major + $number_minor`
+           age="$number_minor"
+           revision="$number_revision"
+           ;;
+         freebsd-aout|freebsd-elf|sunos)
+           current="$number_major"
+           revision="$number_minor"
+           age="0"
+           ;;
+         irix|nonstopux)
+           current=`expr $number_major + $number_minor - 1`
+           age="$number_minor"
+           revision="$number_minor"
+           ;;
+         esac
+         ;;
+       no)
+         current="$2"
+         revision="$3"
+         age="$4"
+         ;;
+       esac
+
+       # Check that each of the things are valid numbers.
+       case $current in
+       [0-9]*) ;;
+       *)
+         $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       case $revision in
+       [0-9]*) ;;
+       *)
+         $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       case $age in
+       [0-9]*) ;;
+       *)
+         $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       if test "$age" -gt "$current"; then
+         $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Calculate the version variables.
+       major=
+       versuffix=
+       verstring=
+       case $version_type in
+       none) ;;
+
+       darwin)
+         # Like Linux, but with the current version available in
+         # verstring for coding it into the library header
+         major=.`expr $current - $age`
+         versuffix="$major.$age.$revision"
+         # Darwin ld doesn't like 0 for these options...
+         minor_current=`expr $current + 1`
+         verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+         ;;
+
+       freebsd-aout)
+         major=".$current"
+         versuffix=".$current.$revision";
+         ;;
+
+       freebsd-elf)
+         major=".$current"
+         versuffix=".$current";
+         ;;
+
+       irix | nonstopux)
+         major=`expr $current - $age + 1`
+
+         case $version_type in
+           nonstopux) verstring_prefix=nonstopux ;;
+           *)         verstring_prefix=sgi ;;
+         esac
+         verstring="$verstring_prefix$major.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$revision
+         while test "$loop" -ne 0; do
+           iface=`expr $revision - $loop`
+           loop=`expr $loop - 1`
+           verstring="$verstring_prefix$major.$iface:$verstring"
+         done
+
+         # Before this point, $major must not contain `.'.
+         major=.$major
+         versuffix="$major.$revision"
+         ;;
+
+       linux)
+         major=.`expr $current - $age`
+         versuffix="$major.$age.$revision"
+         ;;
+
+       osf)
+         major=.`expr $current - $age`
+         versuffix=".$current.$age.$revision"
+         verstring="$current.$age.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$age
+         while test "$loop" -ne 0; do
+           iface=`expr $current - $loop`
+           loop=`expr $loop - 1`
+           verstring="$verstring:${iface}.0"
+         done
+
+         # Make executables depend on our current version.
+         verstring="$verstring:${current}.0"
+         ;;
+
+       sunos)
+         major=".$current"
+         versuffix=".$current.$revision"
+         ;;
+
+       windows)
+         # Use '-' rather than '.', since we only want one
+         # extension on DOS 8.3 filesystems.
+         major=`expr $current - $age`
+         versuffix="-$major"
+         ;;
+
+       *)
+         $echo "$modename: unknown library version type \`$version_type'" 1>&2
+         $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       # Clear the version info if we defaulted, and they specified a release.
+       if test -z "$vinfo" && test -n "$release"; then
+         major=
+         case $version_type in
+         darwin)
+           # we can't check for "0.0" in archive_cmds due to quoting
+           # problems, so we reset it completely
+           verstring=
+           ;;
+         *)
+           verstring="0.0"
+           ;;
+         esac
+         if test "$need_version" = no; then
+           versuffix=
+         else
+           versuffix=".0.0"
+         fi
+       fi
+
+       # Remove version info from name if versioning should be avoided
+       if test "$avoid_version" = yes && test "$need_version" = no; then
+         major=
+         versuffix=
+         verstring=""
+       fi
+
+       # Check to see if the archive will have undefined symbols.
+       if test "$allow_undefined" = yes; then
+         if test "$allow_undefined_flag" = unsupported; then
+           $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+           build_libtool_libs=no
+           build_old_libs=yes
+         fi
+       else
+         # Don't allow undefined symbols.
+         allow_undefined_flag="$no_undefined_flag"
+       fi
+      fi
+
+      if test "$mode" != relink; then
+       # Remove our outputs, but don't remove object files since they
+       # may have been created when compiling PIC objects.
+       removelist=
+       tempremovelist=`$echo "$output_objdir/*"`
+       for p in $tempremovelist; do
+         case $p in
+           *.$objext)
+              ;;
+           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+              if test "X$precious_files_regex" != "X"; then
+                if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+                then
+                  continue
+                fi
+              fi
+              removelist="$removelist $p"
+              ;;
+           *) ;;
+         esac
+       done
+       if test -n "$removelist"; then
+         $show "${rm}r $removelist"
+         $run ${rm}r $removelist
+       fi
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+       oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+       # Transform .lo files to .o files.
+       oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      for path in $notinst_path; do
+       lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+       deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+       dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+      done
+
+      if test -n "$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       temp_xrpath=
+       for libdir in $xrpath; do
+         temp_xrpath="$temp_xrpath -R$libdir"
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_rpath="$finalize_rpath $libdir" ;;
+         esac
+       done
+       if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+         dependency_libs="$temp_xrpath $dependency_libs"
+       fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+       case " $dlprefiles $dlfiles " in
+       *" $lib "*) ;;
+       *) dlfiles="$dlfiles $lib" ;;
+       esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+       case "$dlprefiles " in
+       *" $lib "*) ;;
+       *) dlprefiles="$dlprefiles $lib" ;;
+       esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+       if test -n "$rpath"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+           # these systems don't actually have a c library (as such)!
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C library is in the System framework
+           deplibs="$deplibs -framework System"
+           ;;
+         *-*-netbsd*)
+           # Don't link with libc until the a.out ld.so is fixed.
+           ;;
+         *-*-openbsd* | *-*-freebsd*)
+           # Do not include libc due to us having libc/libc_r.
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *)
+           # Add libc to deplibs on all other systems if necessary.
+           if test "$build_libtool_need_lc" = "yes"; then
+             deplibs="$deplibs -lc"
+           fi
+           ;;
+         esac
+       fi
+
+       # Transform deplibs into only deplibs that can be linked in shared.
+       name_save=$name
+       libname_save=$libname
+       release_save=$release
+       versuffix_save=$versuffix
+       major_save=$major
+       # I'm not sure if I'm treating the release correctly.  I think
+       # release should show up in the -l (ie -lgmp5) so we don't want to
+       # add it in twice.  Is that correct?
+       release=""
+       versuffix=""
+       major=""
+       newdeplibs=
+       droppeddeps=no
+       case $deplibs_check_method in
+       pass_all)
+         # Don't check for shared/static.  Everything works.
+         # This might be a little naive.  We might want to check
+         # whether the library exists or not.  But this is on
+         # osf3 & osf4 and I'm not really sure... Just
+         # implementing what was already the behavior.
+         newdeplibs=$deplibs
+         ;;
+       test_compile)
+         # This code stresses the "libraries are programs" paradigm to its
+         # limits. Maybe even breaks it.  We compile a program, linking it
+         # against the deplibs as a proxy for the library.  Then we can check
+         # whether they linked in statically or dynamically with ldd.
+         $rm conftest.c
+         cat > conftest.c <<EOF
+         int main() { return 0; }
+EOF
+         $rm conftest
+         $LTCC -o conftest conftest.c $deplibs
+         if test "$?" -eq 0 ; then
+           ldd_output=`ldd conftest`
+           for i in $deplibs; do
+             name="`expr $i : '-l\(.*\)'`"
+             # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" -ne "0"; then
+               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                 case " $predeps $postdeps " in
+                 *" $i "*)
+                   newdeplibs="$newdeplibs $i"
+                   i=""
+                   ;;
+                 esac
+               fi
+               if test -n "$i" ; then
+                 libname=`eval \\$echo \"$libname_spec\"`
+                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                 set dummy $deplib_matches
+                 deplib_match=$2
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                   newdeplibs="$newdeplibs $i"
+                 else
+                   droppeddeps=yes
+                   $echo
+                   $echo "*** Warning: dynamic linker does not accept needed library $i."
+                   $echo "*** I have the capability to make that library automatically link in when"
+                   $echo "*** you link to this library.  But I can only do this if you have a"
+                   $echo "*** shared version of the library, which I believe you do not have"
+                   $echo "*** because a test_compile did reveal that the linker did not use it for"
+                   $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+                 fi
+               fi
+             else
+               newdeplibs="$newdeplibs $i"
+             fi
+           done
+         else
+           # Error occurred in the first compile.  Let's try to salvage
+           # the situation: Compile a separate program for each library.
+           for i in $deplibs; do
+             name="`expr $i : '-l\(.*\)'`"
+             # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+               $rm conftest
+               $LTCC -o conftest conftest.c $i
+               # Did it work?
+               if test "$?" -eq 0 ; then
+                 ldd_output=`ldd conftest`
+                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                   case " $predeps $postdeps " in
+                   *" $i "*)
+                     newdeplibs="$newdeplibs $i"
+                     i=""
+                     ;;
+                   esac
+                 fi
+                 if test -n "$i" ; then
+                   libname=`eval \\$echo \"$libname_spec\"`
+                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                   set dummy $deplib_matches
+                   deplib_match=$2
+                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                     newdeplibs="$newdeplibs $i"
+                   else
+                     droppeddeps=yes
+                     $echo
+                     $echo "*** Warning: dynamic linker does not accept needed library $i."
+                     $echo "*** I have the capability to make that library automatically link in when"
+                     $echo "*** you link to this library.  But I can only do this if you have a"
+                     $echo "*** shared version of the library, which you do not appear to have"
+                     $echo "*** because a test_compile did reveal that the linker did not use this one"
+                     $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+                   fi
+                 fi
+               else
+                 droppeddeps=yes
+                 $echo
+                 $echo "*** Warning!  Library $i is needed by this library but I was not able to"
+                 $echo "***  make it link in!  You will probably need to install it or some"
+                 $echo "*** library that it depends on before this library will be fully"
+                 $echo "*** functional.  Installing it before continuing would be even better."
+               fi
+             else
+               newdeplibs="$newdeplibs $i"
+             fi
+           done
+         fi
+         ;;
+       file_magic*)
+         set dummy $deplibs_check_method
+         file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+         for a_deplib in $deplibs; do
+           name="`expr $a_deplib : '-l\(.*\)'`"
+           # If $name is empty we are operating on a -L argument.
+            if test "$name" != "" && test  "$name" != "0"; then
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                     # Follow soft links.
+                     if ls -lLd "$potent_lib" 2>/dev/null \
+                        | grep " -> " >/dev/null; then
+                       continue
+                     fi
+                     # The statement above tries to avoid entering an
+                     # endless loop below, in case of cyclic links.
+                     # We might still enter an endless loop, since a link
+                     # loop can be closed while we follow links,
+                     # but so what?
+                     potlib="$potent_lib"
+                     while test -h "$potlib" 2>/dev/null; do
+                       potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+                       case $potliblink in
+                       [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+                       *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+                       esac
+                     done
+                     if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+                        | ${SED} 10q \
+                        | $EGREP "$file_magic_regex" > /dev/null; then
+                       newdeplibs="$newdeplibs $a_deplib"
+                       a_deplib=""
+                       break 2
+                     fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               $echo
+               $echo "*** Warning: linker path does not have real file for library $a_deplib."
+               $echo "*** I have the capability to make that library automatically link in when"
+               $echo "*** you link to this library.  But I can only do this if you have a"
+               $echo "*** shared version of the library, which you do not appear to have"
+               $echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $echo "*** with $libname but no candidates were found. (...for file magic test)"
+               else
+                 $echo "*** with $libname and none of the candidates passed a file format test"
+                 $echo "*** using a file magic. Last file checked: $potlib"
+               fi
+             fi
+           else
+             # Add a -L argument.
+             newdeplibs="$newdeplibs $a_deplib"
+           fi
+         done # Gone through all deplibs.
+         ;;
+       match_pattern*)
+         set dummy $deplibs_check_method
+         match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+         for a_deplib in $deplibs; do
+           name="`expr $a_deplib : '-l\(.*\)'`"
+           # If $name is empty we are operating on a -L argument.
+           if test -n "$name" && test "$name" != "0"; then
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                   potlib="$potent_lib" # see symlink-check above in file_magic test
+                   if eval $echo \"$potent_lib\" 2>/dev/null \
+                       | ${SED} 10q \
+                       | $EGREP "$match_pattern_regex" > /dev/null; then
+                     newdeplibs="$newdeplibs $a_deplib"
+                     a_deplib=""
+                     break 2
+                   fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               $echo
+               $echo "*** Warning: linker path does not have real file for library $a_deplib."
+               $echo "*** I have the capability to make that library automatically link in when"
+               $echo "*** you link to this library.  But I can only do this if you have a"
+               $echo "*** shared version of the library, which you do not appear to have"
+               $echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+               else
+                 $echo "*** with $libname and none of the candidates passed a file format test"
+                 $echo "*** using a regex pattern. Last file checked: $potlib"
+               fi
+             fi
+           else
+             # Add a -L argument.
+             newdeplibs="$newdeplibs $a_deplib"
+           fi
+         done # Gone through all deplibs.
+         ;;
+       none | unknown | *)
+         newdeplibs=""
+         tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+           -e 's/ -[LR][^ ]*//g'`
+         if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+           for i in $predeps $postdeps ; do
+             # can't use Xsed below, because $i might contain '/'
+             tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+           done
+         fi
+         if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
+           | grep . >/dev/null; then
+           $echo
+           if test "X$deplibs_check_method" = "Xnone"; then
+             $echo "*** Warning: inter-library dependencies are not supported in this platform."
+           else
+             $echo "*** Warning: inter-library dependencies are not known to be supported."
+           fi
+           $echo "*** All declared inter-library dependencies are being dropped."
+           droppeddeps=yes
+         fi
+         ;;
+       esac
+       versuffix=$versuffix_save
+       major=$major_save
+       release=$release_save
+       libname=$libname_save
+       name=$name_save
+
+       case $host in
+       *-*-rhapsody* | *-*-darwin1.[012])
+         # On Rhapsody replace the C library is the System framework
+         newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+         ;;
+       esac
+
+       if test "$droppeddeps" = yes; then
+         if test "$module" = yes; then
+           $echo
+           $echo "*** Warning: libtool could not satisfy all declared inter-library"
+           $echo "*** dependencies of module $libname.  Therefore, libtool will create"
+           $echo "*** a static module, that should work as long as the dlopening"
+           $echo "*** application is linked with the -dlopen flag."
+           if test -z "$global_symbol_pipe"; then
+             $echo
+             $echo "*** However, this would only work if libtool was able to extract symbol"
+             $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+             $echo "*** not find such a program.  So, this module is probably useless."
+             $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+           fi
+           if test "$build_old_libs" = no; then
+             oldlibs="$output_objdir/$libname.$libext"
+             build_libtool_libs=module
+             build_old_libs=yes
+           else
+             build_libtool_libs=no
+           fi
+         else
+           $echo "*** The inter-library dependencies that have been dropped here will be"
+           $echo "*** automatically added whenever a program is linked with this library"
+           $echo "*** or is declared to -dlopen it."
+
+           if test "$allow_undefined" = no; then
+             $echo
+             $echo "*** Since this library must not contain undefined symbols,"
+             $echo "*** because either the platform does not support them or"
+             $echo "*** it was explicitly requested with -no-undefined,"
+             $echo "*** libtool will only create a static version of it."
+             if test "$build_old_libs" = no; then
+               oldlibs="$output_objdir/$libname.$libext"
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         fi
+       fi
+       # Done checking deplibs!
+       deplibs=$newdeplibs
+      fi
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+       if test "$hardcode_into_libs" = yes; then
+         # Hardcode the library paths
+         hardcode_libdirs=
+         dep_rpath=
+         rpath="$finalize_rpath"
+         test "$mode" != relink && rpath="$compile_rpath$rpath"
+         for libdir in $rpath; do
+           if test -n "$hardcode_libdir_flag_spec"; then
+             if test -n "$hardcode_libdir_separator"; then
+               if test -z "$hardcode_libdirs"; then
+                 hardcode_libdirs="$libdir"
+               else
+                 # Just accumulate the unique libdirs.
+                 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+                   ;;
+                 *)
+                   hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+                   ;;
+                 esac
+               fi
+             else
+               eval flag=\"$hardcode_libdir_flag_spec\"
+               dep_rpath="$dep_rpath $flag"
+             fi
+           elif test -n "$runpath_var"; then
+             case "$perm_rpath " in
+             *" $libdir "*) ;;
+             *) perm_rpath="$perm_rpath $libdir" ;;
+             esac
+           fi
+         done
+         # Substitute the hardcoded libdirs into the rpath.
+         if test -n "$hardcode_libdir_separator" &&
+            test -n "$hardcode_libdirs"; then
+           libdir="$hardcode_libdirs"
+           if test -n "$hardcode_libdir_flag_spec_ld"; then
+             eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+           else
+             eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+           fi
+         fi
+         if test -n "$runpath_var" && test -n "$perm_rpath"; then
+           # We should set the runpath_var.
+           rpath=
+           for dir in $perm_rpath; do
+             rpath="$rpath$dir:"
+           done
+           eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+         fi
+         test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+       fi
+
+       shlibpath="$finalize_shlibpath"
+       test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+       if test -n "$shlibpath"; then
+         eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+       fi
+
+       # Get the real and link names of the library.
+       eval shared_ext=\"$shrext_cmds\"
+       eval library_names=\"$library_names_spec\"
+       set dummy $library_names
+       realname="$2"
+       shift; shift
+
+       if test -n "$soname_spec"; then
+         eval soname=\"$soname_spec\"
+       else
+         soname="$realname"
+       fi
+       if test -z "$dlname"; then
+         dlname=$soname
+       fi
+
+       lib="$output_objdir/$realname"
+       for link
+       do
+         linknames="$linknames $link"
+       done
+
+       # Use standard objects if they are pic
+       test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+       # Prepare the list of exported symbols
+       if test -z "$export_symbols"; then
+         if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+           $show "generating symbol list for \`$libname.la'"
+           export_symbols="$output_objdir/$libname.exp"
+           $run $rm $export_symbols
+           cmds=$export_symbols_cmds
+           save_ifs="$IFS"; IFS='~'
+           for cmd in $cmds; do
+             IFS="$save_ifs"
+             eval cmd=\"$cmd\"
+             if len=`expr "X$cmd" : ".*"` &&
+              test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+               skipped_export=false
+             else
+               # The command line is too long to execute in one step.
+               $show "using reloadable object file for export list..."
+               skipped_export=:
+             fi
+           done
+           IFS="$save_ifs"
+           if test -n "$export_symbols_regex"; then
+             $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+             $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+             $run eval '$mv "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+       fi
+
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+       fi
+
+       tmp_deplibs=
+       for test_deplib in $deplibs; do
+               case " $convenience " in
+               *" $test_deplib "*) ;;
+               *)
+                       tmp_deplibs="$tmp_deplibs $test_deplib"
+                       ;;
+               esac
+       done
+       deplibs="$tmp_deplibs"
+
+       if test -n "$convenience"; then
+         if test -n "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+         else
+           gentop="$output_objdir/${outputname}x"
+           $show "${rm}r $gentop"
+           $run ${rm}r "$gentop"
+           $show "$mkdir $gentop"
+           $run $mkdir "$gentop"
+           status=$?
+           if test "$status" -ne 0 && test ! -d "$gentop"; then
+             exit $status
+           fi
+           generated="$generated $gentop"
+
+           for xlib in $convenience; do
+             # Extract the objects.
+             case $xlib in
+             [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+             *) xabs=`pwd`"/$xlib" ;;
+             esac
+             xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+             xdir="$gentop/$xlib"
+
+             $show "${rm}r $xdir"
+             $run ${rm}r "$xdir"
+             $show "$mkdir $xdir"
+             $run $mkdir "$xdir"
+             status=$?
+             if test "$status" -ne 0 && test ! -d "$xdir"; then
+               exit $status
+             fi
+             # We will extract separately just the conflicting names and we will no
+             # longer touch any unique names. It is faster to leave these extract
+             # automatically by $AR in one run.
+             $show "(cd $xdir && $AR x $xabs)"
+             $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+             if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+               :
+             else
+               $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+               $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+               $AR t "$xabs" | sort | uniq -cd | while read -r count name
+               do
+                 i=1
+                 while test "$i" -le "$count"
+                 do
+                  # Put our $i before any first dot (extension)
+                  # Never overwrite any file
+                  name_to="$name"
+                  while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+                  do
+                    name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+                  done
+                  $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+                  $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+                  i=`expr $i + 1`
+                 done
+               done
+             fi
+
+             libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+           done
+         fi
+       fi
+
+       if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+         eval flag=\"$thread_safe_flag_spec\"
+         linker_flags="$linker_flags $flag"
+       fi
+
+       # Make a backup of the uninstalled library when relinking
+       if test "$mode" = relink; then
+         $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+       fi
+
+       # Do each of the archive commands.
+       if test "$module" = yes && test -n "$module_cmds" ; then
+         if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+           eval test_cmds=\"$module_expsym_cmds\"
+           cmds=$module_expsym_cmds
+         else
+           eval test_cmds=\"$module_cmds\"
+           cmds=$module_cmds
+         fi
+       else
+       if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+         eval test_cmds=\"$archive_expsym_cmds\"
+         cmds=$archive_expsym_cmds
+       else
+         eval test_cmds=\"$archive_cmds\"
+         cmds=$archive_cmds
+         fi
+       fi
+
+       if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
+          test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         :
+       else
+         # The command line is too long to link in one step, link piecewise.
+         $echo "creating reloadable object files..."
+
+         # Save the value of $output and $libobjs because we want to
+         # use them later.  If we have whole_archive_flag_spec, we
+         # want to use save_libobjs as it was before
+         # whole_archive_flag_spec was expanded, because we can't
+         # assume the linker understands whole_archive_flag_spec.
+         # This may have to be revisited, in case too many
+         # convenience libraries get linked in and end up exceeding
+         # the spec.
+         if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+         fi
+         save_output=$output
+
+         # Clear the reloadable object creation command queue and
+         # initialize k to one.
+         test_cmds=
+         concat_cmds=
+         objlist=
+         delfiles=
+         last_robj=
+         k=1
+         output=$output_objdir/$save_output-${k}.$objext
+         # Loop over the list of objects to be linked.
+         for obj in $save_libobjs
+         do
+           eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+           if test "X$objlist" = X ||
+              { len=`expr "X$test_cmds" : ".*"` &&
+                test "$len" -le "$max_cmd_len"; }; then
+             objlist="$objlist $obj"
+           else
+             # The command $test_cmds is almost too long, add a
+             # command to the queue.
+             if test "$k" -eq 1 ; then
+               # The first file doesn't have a previous command to add.
+               eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+             else
+               # All subsequent reloadable object files will link in
+               # the last one created.
+               eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+             fi
+             last_robj=$output_objdir/$save_output-${k}.$objext
+             k=`expr $k + 1`
+             output=$output_objdir/$save_output-${k}.$objext
+             objlist=$obj
+             len=1
+           fi
+         done
+         # Handle the remaining objects by creating one last
+         # reloadable object file.  All subsequent reloadable object
+         # files will link in the last one created.
+         test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+         eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+         if ${skipped_export-false}; then
+           $show "generating symbol list for \`$libname.la'"
+           export_symbols="$output_objdir/$libname.exp"
+           $run $rm $export_symbols
+           libobjs=$output
+           # Append the command to create the export file.
+           eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+          fi
+
+         # Set up a command to remove the reloadale object files
+         # after they are used.
+         i=0
+         while test "$i" -lt "$k"
+         do
+           i=`expr $i + 1`
+           delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
+         done
+
+         $echo "creating a temporary reloadable object file: $output"
+
+         # Loop through the commands generated above and execute them.
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $concat_cmds; do
+           IFS="$save_ifs"
+           $show "$cmd"
+           $run eval "$cmd" || exit $?
+         done
+         IFS="$save_ifs"
+
+         libobjs=$output
+         # Restore the value of output.
+         output=$save_output
+
+         if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+         fi
+         # Expand the library linking commands again to reset the
+         # value of $libobjs for piecewise linking.
+
+         # Do each of the archive commands.
+         if test "$module" = yes && test -n "$module_cmds" ; then
+           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+             cmds=$module_expsym_cmds
+           else
+             cmds=$module_cmds
+           fi
+         else
+         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+           cmds=$archive_expsym_cmds
+         else
+           cmds=$archive_cmds
+           fi
+         fi
+
+         # Append the command to remove the reloadable object files
+         # to the just-reset $cmds.
+         eval cmds=\"\$cmds~\$rm $delfiles\"
+       fi
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $show "$cmd"
+         $run eval "$cmd" || exit $?
+       done
+       IFS="$save_ifs"
+
+       # Restore the uninstalled library and exit
+       if test "$mode" = relink; then
+         $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+         exit $EXIT_SUCCESS
+       fi
+
+       # Create links to the real library.
+       for linkname in $linknames; do
+         if test "$realname" != "$linkname"; then
+           $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+           $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+         fi
+       done
+
+       # If -module or -export-dynamic was specified, set the dlname.
+       if test "$module" = yes || test "$export_dynamic" = yes; then
+         # On all known operating systems, these are identical.
+         dlname="$soname"
+       fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+       $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+       $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+       $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+       if test -n "$objs$old_deplibs"; then
+         $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       libobj="$output"
+       obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+       ;;
+      *)
+       libobj=
+       obj="$output"
+       ;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl=
+
+      if test -n "$convenience"; then
+       if test -n "$whole_archive_flag_spec"; then
+         eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+       else
+         gentop="$output_objdir/${obj}x"
+         $show "${rm}r $gentop"
+         $run ${rm}r "$gentop"
+         $show "$mkdir $gentop"
+         $run $mkdir "$gentop"
+         status=$?
+         if test "$status" -ne 0 && test ! -d "$gentop"; then
+           exit $status
+         fi
+         generated="$generated $gentop"
+
+         for xlib in $convenience; do
+           # Extract the objects.
+           case $xlib in
+           [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+           *) xabs=`pwd`"/$xlib" ;;
+           esac
+           xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+           xdir="$gentop/$xlib"
+
+           $show "${rm}r $xdir"
+           $run ${rm}r "$xdir"
+           $show "$mkdir $xdir"
+           $run $mkdir "$xdir"
+           status=$?
+           if test "$status" -ne 0 && test ! -d "$xdir"; then
+             exit $status
+           fi
+           # We will extract separately just the conflicting names and we will no
+           # longer touch any unique names. It is faster to leave these extract
+           # automatically by $AR in one run.
+           $show "(cd $xdir && $AR x $xabs)"
+           $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+           if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+             :
+           else
+             $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+             $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+             $AR t "$xabs" | sort | uniq -cd | while read -r count name
+             do
+               i=1
+               while test "$i" -le "$count"
+               do
+                # Put our $i before any first dot (extension)
+                # Never overwrite any file
+                name_to="$name"
+                while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+                do
+                  name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+                done
+                $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+                $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+                i=`expr $i + 1`
+               done
+             done
+           fi
+
+           reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+         done
+       fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      cmds=$reload_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+       IFS="$save_ifs"
+       eval cmd=\"$cmd\"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+       if test -n "$gentop"; then
+         $show "${rm}r $gentop"
+         $run ${rm}r $gentop
+       fi
+
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+       if test -n "$gentop"; then
+         $show "${rm}r $gentop"
+         $run ${rm}r $gentop
+       fi
+
+       # Create an invalid libtool object if no PIC, so that we don't
+       # accidentally link it into a program.
+       # $show "echo timestamp > $libobj"
+       # $run eval "echo timestamp > $libobj" || exit $?
+       exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+       # Only do commands if we really have different PIC objects.
+       reload_objs="$libobjs $reload_conv_objs"
+       output="$libobj"
+       cmds=$reload_cmds
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $show "$cmd"
+         $run eval "$cmd" || exit $?
+       done
+       IFS="$save_ifs"
+      fi
+
+      if test -n "$gentop"; then
+       $show "${rm}r $gentop"
+       $run ${rm}r $gentop
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+       *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+       if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+          test "$dlopen_self_static" = unknown; then
+         $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+       fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+       # On Rhapsody replace the C library is the System framework
+       compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+       finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+       ;;
+      esac
+
+      case $host in
+      *darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
+        ;;
+      esac
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       for libdir in $rpath $xrpath; do
+         # This is the magic to use -rpath.
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_rpath="$finalize_rpath $libdir" ;;
+         esac
+       done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           rpath="$rpath $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$perm_rpath " in
+         *" $libdir "*) ;;
+         *) perm_rpath="$perm_rpath $libdir" ;;
+         esac
+       fi
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         case :$dllsearchpath: in
+         *":$libdir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$libdir";;
+         esac
+         ;;
+       esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           rpath="$rpath $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$finalize_perm_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+         esac
+       fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+       # Transform all the library objects into standard objects.
+       compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+       finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       if test -n "$NM" && test -n "$global_symbol_pipe"; then
+         dlsyms="${outputname}S.c"
+       else
+         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+       fi
+      fi
+
+      if test -n "$dlsyms"; then
+       case $dlsyms in
+       "") ;;
+       *.c)
+         # Discover the nlist of each of the dlfiles.
+         nlist="$output_objdir/${outputname}.nm"
+
+         $show "$rm $nlist ${nlist}S ${nlist}T"
+         $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+         # Parse the name list into a source file.
+         $show "creating $output_objdir/$dlsyms"
+
+         test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+         if test "$dlself" = yes; then
+           $show "generating symbol list for \`$output'"
+
+           test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+           # Add our own program objects to the symbol list.
+           progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+           for arg in $progfiles; do
+             $show "extracting global C symbols from \`$arg'"
+             $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+           done
+
+           if test -n "$exclude_expsyms"; then
+             $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+             $run eval '$mv "$nlist"T "$nlist"'
+           fi
+
+           if test -n "$export_symbols_regex"; then
+             $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+             $run eval '$mv "$nlist"T "$nlist"'
+           fi
+
+           # Prepare the list of exported symbols
+           if test -z "$export_symbols"; then
+             export_symbols="$output_objdir/$output.exp"
+             $run $rm $export_symbols
+             $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+           else
+             $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+             $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+             $run eval 'mv "$nlist"T "$nlist"'
+           fi
+         fi
+
+         for arg in $dlprefiles; do
+           $show "extracting global C symbols from \`$arg'"
+           name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+           $run eval '$echo ": $name " >> "$nlist"'
+           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+         done
+
+         if test -z "$run"; then
+           # Make sure we have at least an empty file.
+           test -f "$nlist" || : > "$nlist"
+
+           if test -n "$exclude_expsyms"; then
+             $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+             $mv "$nlist"T "$nlist"
+           fi
+
+           # Try sorting and uniquifying the output.
+           if grep -v "^: " < "$nlist" |
+               if sort -k 3 </dev/null >/dev/null 2>&1; then
+                 sort -k 3
+               else
+                 sort +2
+               fi |
+               uniq > "$nlist"S; then
+             :
+           else
+             grep -v "^: " < "$nlist" > "$nlist"S
+           fi
+
+           if test -f "$nlist"S; then
+             eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+           else
+             $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+           fi
+
+           $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+           eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+           $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+         fi
+
+         pic_flag_for_symtable=
+         case $host in
+         # compiling the symbol table file with pic_flag works around
+         # a FreeBSD bug that causes programs to crash when -lm is
+         # linked before any other PIC object.  But we must not use
+         # pic_flag when linking with -static.  The problem exists in
+         # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+         *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+           case "$compile_command " in
+           *" -static "*) ;;
+           *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+           esac;;
+         *-*-hpux*)
+           case "$compile_command " in
+           *" -static "*) ;;
+           *) pic_flag_for_symtable=" $pic_flag";;
+           esac
+         esac
+
+         # Now compile the dynamic symbol file.
+         $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+         $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+         # Clean up the generated files.
+         $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+         $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+         # Transform the symbol file into the correct name.
+         compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+         ;;
+       *)
+         $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+      else
+       # We keep going just in case the user didn't refer to
+       # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+       # really was required.
+
+       # Nullify the symbol file.
+       compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+       # Replace the output file specification.
+       compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       link_command="$compile_command$compile_rpath"
+
+       # We have no uninstalled library dependencies, so finalize right now.
+       $show "$link_command"
+       $run eval "$link_command"
+       status=$?
+
+       # Delete the generated files.
+       if test -n "$dlsyms"; then
+         $show "$rm $output_objdir/${outputname}S.${objext}"
+         $run $rm "$output_objdir/${outputname}S.${objext}"
+       fi
+
+       exit $status
+      fi
+
+      if test -n "$shlibpath_var"; then
+       # We should set the shlibpath_var
+       rpath=
+       for dir in $temp_rpath; do
+         case $dir in
+         [\\/]* | [A-Za-z]:[\\/]*)
+           # Absolute path.
+           rpath="$rpath$dir:"
+           ;;
+         *)
+           # Relative path: add a thisdir entry.
+           rpath="$rpath\$thisdir/$dir:"
+           ;;
+         esac
+       done
+       temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+       compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+       finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+       if test -n "$perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $perm_rpath; do
+           rpath="$rpath$dir:"
+         done
+         compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+       if test -n "$finalize_perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $finalize_perm_rpath; do
+           rpath="$rpath$dir:"
+         done
+         finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+      fi
+
+      if test "$no_install" = yes; then
+       # We don't need to create a wrapper script.
+       link_command="$compile_var$compile_command$compile_rpath"
+       # Replace the output file specification.
+       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       # Delete the old output file.
+       $run $rm $output
+       # Link the executable and exit
+       $show "$link_command"
+       $run eval "$link_command" || exit $?
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+       # Fast installation is not supported
+       link_command="$compile_var$compile_command$compile_rpath"
+       relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+       $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+       $echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+       if test "$fast_install" != no; then
+         link_command="$finalize_var$compile_command$finalize_rpath"
+         if test "$fast_install" = yes; then
+           relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+         else
+           # fast_install is set to needless
+           relink_command=
+         fi
+       else
+         link_command="$compile_var$compile_command$compile_rpath"
+         relink_command="$finalize_var$finalize_command$finalize_rpath"
+       fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+       # Preserve any variables that may affect compiler behavior
+       for var in $variables_saved_for_relink; do
+         if eval test -z \"\${$var+set}\"; then
+           relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+         elif eval var_value=\$$var; test -z "$var_value"; then
+           relink_command="$var=; export $var; $relink_command"
+         else
+           var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+           relink_command="$var=\"$var_value\"; export $var; $relink_command"
+         fi
+       done
+       relink_command="(cd `pwd`; $relink_command)"
+       relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+       case $progpath in
+       [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+       *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+       esac
+       qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+       qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+       # win32 will think the script is a binary if it has
+       # a .exe suffix, so we strip it off here.
+       case $output in
+         *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+       esac
+       # test for cygwin because mv fails w/o .exe extensions
+       case $host in
+         *cygwin*)
+           exeext=.exe
+           outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+         *) exeext= ;;
+       esac
+       case $host in
+         *cygwin* | *mingw* )
+           cwrappersource=`$echo ${objdir}/lt-${output}.c`
+           cwrapper=`$echo ${output}.exe`
+           $rm $cwrappersource $cwrapper
+           trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+           cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+           cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+#define HAVE_DOS_BASED_FILE_SYSTEM
+#ifndef DIR_SEPARATOR_2
+#define DIR_SEPARATOR_2 '\\'
+#endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+char * basename (const char *name);
+char * fnqualify(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup ((char *) basename (argv[0]));
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+           cat >> $cwrappersource <<EOF
+  newargz[0] = "$SHELL";
+EOF
+
+           cat >> $cwrappersource <<"EOF"
+  newargz[1] = fnqualify(argv[0]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+EOF
+
+           cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+
+           cat >> $cwrappersource <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+char *
+basename (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha (name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return (char *) base;
+}
+
+char *
+fnqualify(const char *path)
+{
+  size_t size;
+  char *p;
+  char tmp[LT_PATHMAX + 1];
+
+  assert(path != NULL);
+
+  /* Is it qualified already? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha (path[0]) && path[1] == ':')
+    return xstrdup (path);
+#endif
+  if (IS_DIR_SEPARATOR (path[0]))
+    return xstrdup (path);
+
+  /* prepend the current directory */
+  /* doesn't handle '~' */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
+  p = XMALLOC(char, size);
+  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
+  return p;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+          const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+         # we should really use a build-platform specific compiler
+         # here, but OTOH, the wrappers (shell script and this C one)
+         # are only useful if you want to execute the "real" binary.
+         # Since the "real" binary is built for $host, then this
+         # wrapper might as well be built for $host, too.
+         $run $LTCC -s -o $cwrapper $cwrappersource
+         ;;
+       esac
+       $rm $output
+       trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+       $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+       $echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+       if test "$fast_install" = yes; then
+         $echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+         $echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+       $echo \"\$relink_command_output\" >&2
+       $rm \"\$progdir/\$file\"
+       exit $EXIT_FAILURE
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+       else
+         $echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+       fi
+
+       $echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+       # Export our shlibpath_var if we have one.
+       if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+         $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+       fi
+
+       # fixup the dll searchpath if we need to.
+       if test -n "$dllsearchpath"; then
+         $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+       fi
+
+       $echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+       case $host in
+       # Backslashes separate directories on plain windows
+       *-*-mingw | *-*-os2*)
+         $echo >> $output "\
+      exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+         ;;
+
+       *)
+         $echo >> $output "\
+      exec \$progdir/\$program \${1+\"\$@\"}
+"
+         ;;
+       esac
+       $echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit $EXIT_FAILURE
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi\
+"
+       chmod +x $output
+      fi
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+       oldobjs="$libobjs_save"
+       addlibs="$convenience"
+       build_libtool_libs=no
+      else
+       if test "$build_libtool_libs" = module; then
+         oldobjs="$libobjs_save"
+         build_libtool_libs=no
+       else
+         oldobjs="$old_deplibs $non_pic_objects"
+       fi
+       addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+       gentop="$output_objdir/${outputname}x"
+       $show "${rm}r $gentop"
+       $run ${rm}r "$gentop"
+       $show "$mkdir $gentop"
+       $run $mkdir "$gentop"
+       status=$?
+       if test "$status" -ne 0 && test ! -d "$gentop"; then
+         exit $status
+       fi
+       generated="$generated $gentop"
+
+       # Add in members from convenience archives.
+       for xlib in $addlibs; do
+         # Extract the objects.
+         case $xlib in
+         [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+         *) xabs=`pwd`"/$xlib" ;;
+         esac
+         xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+         xdir="$gentop/$xlib"
+
+         $show "${rm}r $xdir"
+         $run ${rm}r "$xdir"
+         $show "$mkdir $xdir"
+         $run $mkdir "$xdir"
+         status=$?
+         if test "$status" -ne 0 && test ! -d "$xdir"; then
+           exit $status
+         fi
+         # We will extract separately just the conflicting names and we will no
+         # longer touch any unique names. It is faster to leave these extract
+         # automatically by $AR in one run.
+         $show "(cd $xdir && $AR x $xabs)"
+         $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+         if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+           :
+         else
+           $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+           $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+           $AR t "$xabs" | sort | uniq -cd | while read -r count name
+           do
+             i=1
+             while test "$i" -le "$count"
+             do
+              # Put our $i before any first dot (extension)
+              # Never overwrite any file
+              name_to="$name"
+              while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+              do
+                name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+              done
+              $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+              $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+              i=`expr $i + 1`
+             done
+           done
+         fi
+
+         oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+       done
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+       eval cmds=\"$old_archive_cmds\"
+
+       if len=`expr "X$cmds" : ".*"` &&
+            test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         cmds=$old_archive_cmds
+       else
+         # the command line is too long to link in one step, link in parts
+         $echo "using piecewise archive linking..."
+         save_RANLIB=$RANLIB
+         RANLIB=:
+         objlist=
+         concat_cmds=
+         save_oldobjs=$oldobjs
+         # GNU ar 2.10+ was changed to match POSIX; thus no paths are
+         # encoded into archives.  This makes 'ar r' malfunction in
+         # this piecewise linking case whenever conflicting object
+         # names appear in distinct ar calls; check, warn and compensate.
+           if (for obj in $save_oldobjs
+           do
+             $echo "X$obj" | $Xsed -e 's%^.*/%%'
+           done | sort | sort -uc >/dev/null 2>&1); then
+           :
+         else
+           $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
+           $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
+           AR_FLAGS=cq
+         fi
+         # Is there a better way of finding the last object in the list?
+         for obj in $save_oldobjs
+         do
+           last_oldobj=$obj
+         done
+         for obj in $save_oldobjs
+         do
+           oldobjs="$objlist $obj"
+           objlist="$objlist $obj"
+           eval test_cmds=\"$old_archive_cmds\"
+           if len=`expr "X$test_cmds" : ".*"` &&
+              test "$len" -le "$max_cmd_len"; then
+             :
+           else
+             # the above command should be used before it gets too long
+             oldobjs=$objlist
+             if test "$obj" = "$last_oldobj" ; then
+               RANLIB=$save_RANLIB
+             fi
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+             objlist=
+           fi
+         done
+         RANLIB=$save_RANLIB
+         oldobjs=$objlist
+         if test "X$oldobjs" = "X" ; then
+           eval cmds=\"\$concat_cmds\"
+         else
+           eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+         fi
+       fi
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+        eval cmd=\"$cmd\"
+       IFS="$save_ifs"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+       if eval test -z \"\${$var+set}\"; then
+         relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+       elif eval var_value=\$$var; test -z "$var_value"; then
+         relink_command="$var=; export $var; $relink_command"
+       else
+         var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+         relink_command="$var=\"$var_value\"; export $var; $relink_command"
+       fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+       relink_command=
+      fi
+
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+       for installed in no yes; do
+         if test "$installed" = yes; then
+           if test -z "$install_libdir"; then
+             break
+           fi
+           output="$output_objdir/$outputname"i
+           # Replace all uninstalled libtool libraries with the installed ones
+           newdependency_libs=
+           for deplib in $dependency_libs; do
+             case $deplib in
+             *.la)
+               name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+               if test -z "$libdir"; then
+                 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+                 exit $EXIT_FAILURE
+               fi
+               newdependency_libs="$newdependency_libs $libdir/$name"
+               ;;
+             *) newdependency_libs="$newdependency_libs $deplib" ;;
+             esac
+           done
+           dependency_libs="$newdependency_libs"
+           newdlfiles=
+           for lib in $dlfiles; do
+             name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+             eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+             if test -z "$libdir"; then
+               $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+               exit $EXIT_FAILURE
+             fi
+             newdlfiles="$newdlfiles $libdir/$name"
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+             eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+             if test -z "$libdir"; then
+               $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+               exit $EXIT_FAILURE
+             fi
+             newdlprefiles="$newdlprefiles $libdir/$name"
+           done
+           dlprefiles="$newdlprefiles"
+         else
+           newdlfiles=
+           for lib in $dlfiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             newdlfiles="$newdlfiles $abs"
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             newdlprefiles="$newdlprefiles $abs"
+           done
+           dlprefiles="$newdlprefiles"
+         fi
+         $rm $output
+         # place dlname in correct position for cygwin
+         tdlname=$dlname
+         case $host,$output,$installed,$module,$dlname in
+           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+         esac
+         $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+         if test "$installed" = no && test "$need_relink" = yes; then
+           $echo >> $output "\
+relink_command=\"$relink_command\""
+         fi
+       done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
+       arg="\"$arg\""
+       ;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg="$nonopt"
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \      ]*|*]*)
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+       files="$files $dest"
+       dest="$arg"
+       continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) prev="-f" ;;
+      -g) prev="-g" ;;
+      -m) prev="-m" ;;
+      -o) prev="-o" ;;
+      -s)
+       stripme=" -s"
+       continue
+       ;;
+      -*) ;;
+
+      *)
+       # If the previous option needed an argument, then skip it.
+       if test -n "$prev"; then
+         prev=
+       else
+         dest="$arg"
+         continue
+       fi
+       ;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
+       arg="\"$arg\""
+       ;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+       $echo "$modename: no file or destination specified" 1>&2
+      else
+       $echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test "$#" -gt 2; then
+       $echo "$modename: \`$dest' is not a directory" 1>&2
+       $echo "$help" 1>&2
+       exit $EXIT_FAILURE
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+       case $file in
+       *.lo) ;;
+       *)
+         $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+       # Do the static libraries later.
+       staticlibs="$staticlibs $file"
+       ;;
+
+      *.la)
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       library_names=
+       old_library=
+       relink_command=
+       # If there is no directory component, then add one.
+       case $file in
+       */* | *\\*) . $file ;;
+       *) . ./$file ;;
+       esac
+
+       # Add the libdir to current_libdirs if it is the destination.
+       if test "X$destdir" = "X$libdir"; then
+         case "$current_libdirs " in
+         *" $libdir "*) ;;
+         *) current_libdirs="$current_libdirs $libdir" ;;
+         esac
+       else
+         # Note the libdir as a future libdir.
+         case "$future_libdirs " in
+         *" $libdir "*) ;;
+         *) future_libdirs="$future_libdirs $libdir" ;;
+         esac
+       fi
+
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+       test "X$dir" = "X$file/" && dir=
+       dir="$dir$objdir"
+
+       if test -n "$relink_command"; then
+         # Determine the prefix the user has applied to our future dir.
+         inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+         # Don't allow the user to place us outside of our expected
+         # location b/c this prevents finding dependent libraries that
+         # are installed to the same prefix.
+         # At present, this check doesn't affect windows .dll's that
+         # are installed into $libdir/../bin (currently, that works fine)
+         # but it's something to keep an eye on.
+         if test "$inst_prefix_dir" = "$destdir"; then
+           $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         if test -n "$inst_prefix_dir"; then
+           # Stick the inst_prefix_dir data into the link command.
+           relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+         else
+           relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+         fi
+
+         $echo "$modename: warning: relinking \`$file'" 1>&2
+         $show "$relink_command"
+         if $run eval "$relink_command"; then :
+         else
+           $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+           exit $EXIT_FAILURE
+         fi
+       fi
+
+       # See the names of the shared library.
+       set dummy $library_names
+       if test -n "$2"; then
+         realname="$2"
+         shift
+         shift
+
+         srcname="$realname"
+         test -n "$relink_command" && srcname="$realname"T
+
+         # Install the shared library and build the symlinks.
+         $show "$install_prog $dir/$srcname $destdir/$realname"
+         $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+         if test -n "$stripme" && test -n "$striplib"; then
+           $show "$striplib $destdir/$realname"
+           $run eval "$striplib $destdir/$realname" || exit $?
+         fi
+
+         if test "$#" -gt 0; then
+           # Delete the old symlinks, and create new ones.
+           for linkname
+           do
+             if test "$linkname" != "$realname"; then
+               $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+               $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+             fi
+           done
+         fi
+
+         # Do each command in the postinstall commands.
+         lib="$destdir/$realname"
+         cmds=$postinstall_cmds
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $cmds; do
+           IFS="$save_ifs"
+           eval cmd=\"$cmd\"
+           $show "$cmd"
+           $run eval "$cmd" || exit $?
+         done
+         IFS="$save_ifs"
+       fi
+
+       # Install the pseudo-library for information purposes.
+       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+       instname="$dir/$name"i
+       $show "$install_prog $instname $destdir/$name"
+       $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+       # Maybe install the static library, too.
+       test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+       ;;
+
+      *.lo)
+       # Install (i.e. copy) a libtool object.
+
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+         destfile="$destdir/$destfile"
+       fi
+
+       # Deduce the name of the destination old-style object file.
+       case $destfile in
+       *.lo)
+         staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+         ;;
+       *.$objext)
+         staticdest="$destfile"
+         destfile=
+         ;;
+       *)
+         $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       # Install the libtool object if requested.
+       if test -n "$destfile"; then
+         $show "$install_prog $file $destfile"
+         $run eval "$install_prog $file $destfile" || exit $?
+       fi
+
+       # Install the old object if enabled.
+       if test "$build_old_libs" = yes; then
+         # Deduce the name of the old-style object file.
+         staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+         $show "$install_prog $staticobj $staticdest"
+         $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+       fi
+       exit $EXIT_SUCCESS
+       ;;
+
+      *)
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+         destfile="$destdir/$destfile"
+       fi
+
+       # If the file is missing, and there is a .exe on the end, strip it
+       # because it is most likely a libtool script we actually want to
+       # install
+       stripped_ext=""
+       case $file in
+         *.exe)
+           if test ! -f "$file"; then
+             file=`$echo $file|${SED} 's,.exe$,,'`
+             stripped_ext=".exe"
+           fi
+           ;;
+       esac
+
+       # Do a test to see if this is really a libtool program.
+       case $host in
+       *cygwin*|*mingw*)
+           wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+           ;;
+       *)
+           wrapper=$file
+           ;;
+       esac
+       if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+         notinst_deplibs=
+         relink_command=
+
+         # To insure that "foo" is sourced, and not "foo.exe",
+         # finese the cygwin/MSYS system by explicitly sourcing "foo."
+         # which disallows the automatic-append-.exe behavior.
+         case $build in
+         *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+         *) wrapperdot=${wrapper} ;;
+         esac
+         # If there is no directory component, then add one.
+         case $file in
+         */* | *\\*) . ${wrapperdot} ;;
+         *) . ./${wrapperdot} ;;
+         esac
+
+         # Check the variables that should have been set.
+         if test -z "$notinst_deplibs"; then
+           $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         finalize=yes
+         for lib in $notinst_deplibs; do
+           # Check to see that each library is installed.
+           libdir=
+           if test -f "$lib"; then
+             # If there is no directory component, then add one.
+             case $lib in
+             */* | *\\*) . $lib ;;
+             *) . ./$lib ;;
+             esac
+           fi
+           libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+           if test -n "$libdir" && test ! -f "$libfile"; then
+             $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+             finalize=no
+           fi
+         done
+
+         relink_command=
+         # To insure that "foo" is sourced, and not "foo.exe",
+         # finese the cygwin/MSYS system by explicitly sourcing "foo."
+         # which disallows the automatic-append-.exe behavior.
+         case $build in
+         *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+         *) wrapperdot=${wrapper} ;;
+         esac
+         # If there is no directory component, then add one.
+         case $file in
+         */* | *\\*) . ${wrapperdot} ;;
+         *) . ./${wrapperdot} ;;
+         esac
+
+         outputname=
+         if test "$fast_install" = no && test -n "$relink_command"; then
+           if test "$finalize" = yes && test -z "$run"; then
+             tmpdir="/tmp"
+             test -n "$TMPDIR" && tmpdir="$TMPDIR"
+             tmpdir="$tmpdir/libtool-$$"
+             save_umask=`umask`
+             umask 0077
+             if $mkdir "$tmpdir"; then
+               umask $save_umask
+             else
+               umask $save_umask
+               $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+               continue
+             fi
+             file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+             outputname="$tmpdir/$file"
+             # Replace the output file specification.
+             relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+             $show "$relink_command"
+             if $run eval "$relink_command"; then :
+             else
+               $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+               ${rm}r "$tmpdir"
+               continue
+             fi
+             file="$outputname"
+           else
+             $echo "$modename: warning: cannot relink \`$file'" 1>&2
+           fi
+         else
+           # Install the binary that we compiled earlier.
+           file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+         fi
+       fi
+
+       # remove .exe since cygwin /usr/bin/install will append another
+       # one anyways
+       case $install_prog,$host in
+       */usr/bin/install*,*cygwin*)
+         case $file:$destfile in
+         *.exe:*.exe)
+           # this is ok
+           ;;
+         *.exe:*)
+           destfile=$destfile.exe
+           ;;
+         *:*.exe)
+           destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+           ;;
+         esac
+         ;;
+       esac
+       $show "$install_prog$stripme $file $destfile"
+       $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+       test -n "$outputname" && ${rm}r "$tmpdir"
+       ;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+       $show "$old_striplib $oldlib"
+       $run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      cmds=$old_postinstall_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+       IFS="$save_ifs"
+       eval cmd=\"$cmd\"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+       libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+       if test -n "$finish_cmds"; then
+         # Do each command in the finish commands.
+         cmds=$finish_cmds
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $cmds; do
+           IFS="$save_ifs"
+           eval cmd=\"$cmd\"
+           $show "$cmd"
+           $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+         done
+         IFS="$save_ifs"
+       fi
+       if test -n "$finish_eval"; then
+         # Do the single finish_eval.
+         eval cmds=\"$finish_eval\"
+         $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+       fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = : && exit $EXIT_SUCCESS
+
+    $echo "----------------------------------------------------------------------"
+    $echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $echo "   $libdir"
+    done
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo "----------------------------------------------------------------------"
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit $EXIT_FAILURE
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+       $echo "$modename: \`$file' is not a file" 1>&2
+       $echo "$help" 1>&2
+       exit $EXIT_FAILURE
+      fi
+
+      dir=
+      case $file in
+      *.la)
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Read the libtool library.
+       dlname=
+       library_names=
+
+       # If there is no directory component, then add one.
+       case $file in
+       */* | *\\*) . $file ;;
+       *) . ./$file ;;
+       esac
+
+       # Skip this library if it cannot be dlopened.
+       if test -z "$dlname"; then
+         # Warn if it was a shared library.
+         test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+         continue
+       fi
+
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$dir" = "X$file" && dir=.
+
+       if test -f "$dir/$objdir/$dlname"; then
+         dir="$dir/$objdir"
+       else
+         $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       ;;
+
+      *.lo)
+       # Just add the directory containing the .lo file.
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$dir" = "X$file" && dir=.
+       ;;
+
+      *)
+       $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+       continue
+       ;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+       eval "$shlibpath_var=\"\$dir\""
+      else
+       eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+       # Do a test to see if this is really a libtool program.
+       if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         # If there is no directory component, then add one.
+         case $file in
+         */* | *\\*) . $file ;;
+         *) . ./$file ;;
+         esac
+
+         # Transform arg to wrapped name.
+         file="$progdir/$program"
+       fi
+       ;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+       # Export the shlibpath_var.
+       eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      if test "${save_LC_ALL+set}" = set; then
+       LC_ALL="$save_LC_ALL"; export LC_ALL
+      fi
+      if test "${save_LANG+set}" = set; then
+       LANG="$save_LANG"; export LANG
+      fi
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+       $echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+       dir=.
+       objdir="$origobjdir"
+      else
+       objdir="$dir/$origobjdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+       case " $rmdirs " in
+         *" $objdir "*) ;;
+         *) rmdirs="$rmdirs $objdir" ;;
+       esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+       || (test -h "$file") >/dev/null 2>&1 \
+       || test -f "$file"; then
+       :
+      elif test -d "$file"; then
+       exit_status=1
+       continue
+      elif test "$rmforce" = yes; then
+       continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+       # Possibly a libtool archive, so verify it.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         . $dir/$name
+
+         # Delete the libtool libraries and symlinks.
+         for n in $library_names; do
+           rmfiles="$rmfiles $objdir/$n"
+         done
+         test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+         test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+         if test "$mode" = uninstall; then
+           if test -n "$library_names"; then
+             # Do each command in the postuninstall commands.
+             cmds=$postuninstall_cmds
+             save_ifs="$IFS"; IFS='~'
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd"
+               if test "$?" -ne 0 && test "$rmforce" != yes; then
+                 exit_status=1
+               fi
+             done
+             IFS="$save_ifs"
+           fi
+
+           if test -n "$old_library"; then
+             # Do each command in the old_postuninstall commands.
+             cmds=$old_postuninstall_cmds
+             save_ifs="$IFS"; IFS='~'
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd"
+               if test "$?" -ne 0 && test "$rmforce" != yes; then
+                 exit_status=1
+               fi
+             done
+             IFS="$save_ifs"
+           fi
+           # FIXME: should reinstall the best remaining shared library.
+         fi
+       fi
+       ;;
+
+      *.lo)
+       # Possibly a libtool object, so verify it.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+         # Read the .lo file
+         . $dir/$name
+
+         # Add PIC object to the list of files to remove.
+         if test -n "$pic_object" \
+            && test "$pic_object" != none; then
+           rmfiles="$rmfiles $dir/$pic_object"
+         fi
+
+         # Add non-PIC object to the list of files to remove.
+         if test -n "$non_pic_object" \
+            && test "$non_pic_object" != none; then
+           rmfiles="$rmfiles $dir/$non_pic_object"
+         fi
+       fi
+       ;;
+
+      *)
+       if test "$mode" = clean ; then
+         noexename=$name
+         case $file in
+         *.exe)
+           file=`$echo $file|${SED} 's,.exe$,,'`
+           noexename=`$echo $name|${SED} 's,.exe$,,'`
+           # $file with .exe has already been added to rmfiles,
+           # add $file without .exe
+           rmfiles="$rmfiles $file"
+           ;;
+         esac
+         # Do a test to see if this is a libtool program.
+         if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+           relink_command=
+           . $dir/$noexename
+
+           # note $name still contains .exe if it was in $file originally
+           # as does the version of $file that was added into $rmfiles
+           rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+           if test "$fast_install" = yes && test -n "$relink_command"; then
+             rmfiles="$rmfiles $objdir/lt-$name"
+           fi
+           if test "X$noexename" != "X$name" ; then
+             rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+           fi
+         fi
+       fi
+       ;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+       $show "rmdir $dir"
+       $run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+  exit $EXIT_SUCCESS
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                   try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                   try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                   specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+  ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $EXIT_SUCCESS
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/missing b/missing
new file mode 100755 (executable)
index 0000000..64b5f90
--- /dev/null
+++ b/missing
@@ -0,0 +1,353 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2004-09-07.08
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit 0
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit 0
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+       case "$firstarg" in
+       *o*)
+           firstarg=`echo "$firstarg" | sed s/o//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+       case "$firstarg" in
+       *h*)
+           firstarg=`echo "$firstarg" | sed s/h//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/scripts/metric.py b/scripts/metric.py
new file mode 100644 (file)
index 0000000..6d2ac41
--- /dev/null
@@ -0,0 +1,864 @@
+""" metric.py is a small script to turn psuedo-c metric descriptions
+    into executable c code as needed by zettair.  Usage:
+
+      metric.py [--debug | --help] metricname.metric
+
+    If you want to debug your metric, i suggest you insert printf statements, 
+    as there's nothing stopping you doing so.
+
+    Our input format is this:
+
+    - comments are allowed at any point in the file, using either # at the
+      start of the comment and continuing to the end of the line.  e.g.
+
+      # this is a comment
+
+    - a parameters section, where you provide whatever parameters the
+      metric needs by putting the word 'parameter ' before a c declaration of 
+      the parameter, with a default if necessary.  Each parameter declaration 
+      must be on a single line. e.g.
+
+      parameter float k1;
+
+    - two functions, decode and post, declared as:
+
+      post() {
+
+      }
+
+    - these functions contain an initial declarations section, where
+      you can declare intermediate quantities in c declarations as needed.  i.e.
+
+      decode() {
+          float w_t;
+      }
+
+    - a series of expressions and logic involving the parameters,
+      intermediate quantities, special quantities.  To find out the
+      special quantities available, type python metric.py --help.
+
+    - note: you are almost certainly better off using the ternary
+      operator in decode calculations, as if statement processing is fragile
+
+    written nml 2004-12-15
+"""
+
+import getopt
+import sys
+import string
+import operator
+from time import strftime, gmtime
+
+def indent(str, dent = 0, prestr = ' '):
+    '''Simple function to uniformly indent lines.'''
+    return '\n'.join(map(lambda x: (prestr * dent) + x, str.split('\n')))
+
+def dedent(str, dent = 0):
+    """Simple function to uniformly remove whitespace from the front of
+       lines."""
+    lines = str.split('\n')
+    try: 
+        dent = reduce(min, map(lambda x: len(x) - len(x.lstrip()), 
+          filter(lambda x: len(x.lstrip()) > 0, lines)))
+    except TypeError:
+        dent = 0
+    return '\n'.join(map(lambda x: len(x.lstrip()) > 0 and x[dent:] or x, lines))
+
+def isop(char):
+    """Simple function to determine whether a character is a c 
+       operator character (not including semi-colon)."""
+    if ((char == '-') or (char == '+') or (char == ',') or (char == '=') 
+      or (char == '(') or (char == ')') or (char == '?') or (char == ':') 
+      or (char == '*') or (char == '/') or (char == '~') or (char == '!') 
+      or (char == '^') or (char == '|') or (char == '&') or (char == '[') 
+      or (char == ']') or (char == '{') or (char == '}') or (char == '%')
+      or (char == '<') or (char == '>')):
+        return 1
+    else:
+        return 0
+
+def isdecl(word):
+    if (word == 'float' or word == 'double' or word == 'long' 
+      or word == 'unsigned' or word == 'signed' or word == 'const' 
+      or word == 'volatile' or word == 'int' or word == 'short' 
+      or word == 'char' or word == 'register' or word == 'void' 
+      or word == 'union' or word == 'struct' or word == '*' 
+      or word == '**' or word == '***' or word == '****'):
+        return 1
+    else:
+        return 0
+
+# function to filter whitespace tokens from ctok
+def ctok_nspace(line):
+    toks, chars = ctok(line)
+
+    filtered = filter(lambda x: not x[0].isspace(), zip(toks, chars))
+
+    toks = map(lambda x: x[0], filtered)
+    chars = map(lambda x: x[1], filtered)
+
+    return toks, chars
+
+def ctok(line):
+    toks = []
+    chars = []
+    char = 0
+    while (len(line)):
+        c = line[0]
+        schar = char
+        line = line[1:]
+        if (c.isspace()):
+            tok = c
+            while (len(line) and line[0].isspace()):
+                tok = tok + line[0]
+                line = line[1:]
+                char += 1
+            toks.append(tok)
+            chars.append(schar)
+        elif (isop(c) == 1):
+            tok = c
+            while (len(line) and isop(line[0])):
+                tok = tok + line[0]
+                line = line[1:]
+                char += 1
+            toks.append(tok)
+            chars.append(schar)
+        elif (c == ';'):
+            toks.append(';')
+            chars.append(schar)
+        else:
+            tok = c
+            while (len(line) and isop(line[0]) == 0 
+              and line[0] != ';' and not line[0].isspace()):
+                tok = tok + line[0]
+                line = line[1:]
+                char += 1
+            toks.append(tok)
+            chars.append(schar)
+        char += 1
+    return toks, chars
+
+def usage(progname, decode = None, post = None):
+    print 'usage: %s [--debug] metricfile templatefile' \
+      % progname
+
+    if (decode != None):
+        dkeys = decode.keys()
+        dkeys.sort()
+        print
+        print 'these quantities are available in decode routines:'
+        for d in dkeys:
+            print '   ', d + ':', decode[d].ex
+
+    if (post != None):
+        dkeys = post.keys()
+        dkeys.sort()
+        print
+        print 'these quantities are available in post routines:'
+        for d in dkeys:
+            print '   ', d + ':', post[d].ex
+
+class Decl:
+    def __init__(self, lineno, name, type, init, level, macro, 
+      comment, fninit, pre, contrib, ex):
+
+        self.pre = pre
+        self.lineno = lineno
+        self.name = name
+        self.type = type
+        self.init = init
+        # fn init is if we can't initialise by assignment, which happens 
+        # sometimes (only available to built-in quantities)
+        self.fninit = fninit  
+        self.level = level
+        self.macro = macro
+        self.comment = comment.strip()
+        # contrib is what happens if we have to calculate the
+        # contribution without a specific document 
+        self.contrib = contrib
+        self.ex = ex
+
+    def __repr__(self):
+        return self.__str__()
+
+    def __str__(self):
+        return "type/name/init/fninit %s %s %s %s; lvl %u line %s macro %s comment %s pre %s" \
+          % (self.type, self.name, self.init, self.fninit, self.level, self.lineno, self.macro, self.comment, self.pre)
+
+def ins_decl(namespaces, used, line, level, macro = '', 
+  lineno = -1, fninit = '', pre = '', contrib = '', ex = ''):
+    # check for and remove trailing comment
+    comment = ''
+    pos = line.find('#')
+    if (pos > 0):
+        comment = line[pos + 1:]
+        line = line[0:pos]
+    pos = line.find('/*')
+    if (pos > 0):
+        pos2 = line.find('*/')
+        if (pos2 > 0):
+            pos2 += 2
+            comment = line[pos + 2:pos2 - 2]
+            line = line[0:pos] + line[pos2:]
+        else:
+            print '#line', lineno, '"' + args[0] + '"'
+            print '#error "multiline comment in declaration"'
+
+    toks, chars = ctok_nspace(line.rstrip())
+
+    type = ''
+    while (len(toks) > 0 and isdecl(toks[0]) == 1):
+        # this token is part of the type
+
+        # skip tag in struct and union
+        if (toks[0] == 'struct' or toks[0] == 'union'):
+            type += toks[0] + ' '
+            toks = toks[1:]
+
+        type += toks[0] + ' '
+        toks = toks[1:]
+
+    if (len(toks)):
+        # check for namespace collisions
+        for n in namespaces:
+            if (n.has_key(toks[0])):
+                # collision
+                print '#line', lineno, '"' + args[0] + '"'
+                print '#error "duplicate','declaration \'', line.rstrip(), '\'"'
+                sys.exit(2)
+
+        # check for and remove semi-colon
+        if (toks[-1] == ';'):
+            toks = toks[0:-1]
+        else:
+            print '#line', lineno, '"' + args[0] + '"'
+            print '#error "declaration without semi-colon ending"'
+            sys.exit(2)
+
+        # identify initialiser without tokenising (makes the spacing odd 
+        # otherwise)
+        init = line[chars[len(chars) - len(toks)]:]
+        init = init[0:init.find(';')]
+
+        # identify quantities used
+        for t in toks[1:]:
+            for n in namespaces:
+                if (t in n):
+                    for u in used:
+                        u[t] = t
+
+        # accept declaration
+        for n in namespaces:
+            n[toks[0]] = Decl(lineno, toks[0], type.strip(), 
+              init.strip(), level, macro, comment, fninit, pre, contrib, ex)
+
+        # identify quantities used in contrib (XXX: we only insert
+        # them in the first namespace/used combo - this is dodgy) 
+        name = toks[0]
+        toks, chars = ctok_nspace(contrib)
+        for t in toks:
+            if (t in namespaces[0]):
+                used[0] = t
+    else:
+        # huh?
+        print '#line', lineno, '"' + args[0] + '"'
+        print '#error "error parsing declaration\'',\
+          line.rstrip(), '\'"'
+        sys.exit(2)
+def process_decl(file, decl, decl_used, lineno):
+    """Function to process declarations in post, decode sections.  
+       Returns first line that isn't a declaration."""
+
+    # start with next line
+    line = file.readline()
+    lineno += 1
+
+    while (line != '' and line.rstrip() != '}'):
+        # in decl section
+        if (len(line.strip()) > 0 and line.strip()[0] != '#'):
+            toks, chars = ctok_nspace(line)
+            # tokenise line and process it
+            if (isdecl(toks[0]) == 1):
+                ins_decl([decl], [decl_used], line=line, level=1, macro='', lineno=lineno, contrib='', ex='user declared quantity')
+            else:
+                return [lineno, line]
+
+        # next line
+        line = file.readline()
+        lineno += 1
+
+    if (line == ''):
+        print '#line', lineno, '"' + args[0] + '"'
+        print '#error "unexpected EOF"'
+        sys.exit(2)
+
+    return [lineno, line]
+
+def levelise(file, line, lineno, decl, list, used):
+    """assign lines in a file to a list, annotating them with logical levels."""
+
+    # declarations processed, now for statements
+    while (line != '' and line.rstrip() != '}'):
+        # process statements 
+        toks, chars = ctok_nspace(line)
+        if (len(toks) > 2 
+          and (toks[0] in decl.keys())
+          and (toks[1] == '=' or toks[1] == '+='
+            or toks[1] == '-=' or toks[1] == '/='
+            or toks[1] == '*=' or toks[1] == '&='
+            or toks[1] == '|=' or toks[1] == '^=')):
+
+            # assignment statement
+
+            # extend logical 'line' and tokenise it
+            while (toks[-1] != ';'):
+                nline = file.readline()
+                lineno += 1
+                ntoks, nchars = ctok_nspace(nline)
+                toks.extend(ntoks)
+                line = line.rstrip() + ' ' + nline
+
+            target = decl[toks[0]]
+            level = 1
+
+            # check that we're not assigning to something
+            # we're not supposed to
+            if (target.lineno == 0 
+              and target.type[0:len('const')] == 'const'):
+                print '#line', lineno, '"' + args[0] + '"'
+                print '#error "assigning to const quantity"'
+
+            used[toks[0]] = toks[0]
+
+            for t in toks[2:]:
+                if (t in decl.keys()):
+                    used[t] = t
+                    if (decl[t].level == 6):
+                        print '#line', lineno, '"' + args[0] + '"'
+                        print '#error "accumulator used as rvalue"'
+                    elif (decl[t].level > level):
+                        level = decl[t].level
+
+            # increase level of assigned quantity, providing basic level
+            # inference 
+            if (toks[0] in decl.keys()):
+                decl[toks[0]].level = level
+
+            list.append([lineno, level, line.strip()])
+        elif (len(toks) and line.strip()[0] == '#'):
+            list.append([lineno, 1, '/* ' + line.strip()[1:].lstrip() + ' */'])
+        else:
+            # its a different type of statement, check level differently 
+            level = 1
+            for t in toks:
+                if (t in decl.keys()):
+                    used[t] = t
+                    if (decl[t].level == 6):
+                        print '#line', lineno, '"' + args[0] + '"'
+                        print '#error "accumulator used as rvalue"'
+                    elif (decl[t].level > level):
+                        level = decl[t].level
+
+            list.append([lineno, level, line.strip()])
+
+        # next line
+        line = file.readline()
+        lineno += 1
+
+    return [lineno, line]
+
+def propagate(statements):
+    """function to propagate levels from inside of braced statements
+       to the whole braced statement."""
+    # FIXME: needs to handle multiline blocks properly
+    prevlevel = 0
+    for s in statements:
+        if (s[2].find('}') >= 0):
+            if (s[2].find('{') < 0):
+                if (prevlevel > s[1]):
+                    s[1] = prevlevel
+        prevlevel = s[1]
+
+    rev = map(lambda x: x, statements)
+    rev.reverse
+
+    prevlevel = 0
+    for s in rev:
+        if (s[2].find('{') >= 0):
+            if (s[2].find('}') < 0):
+                if (prevlevel > s[1]):
+                    s[1] = prevlevel
+        prevlevel = s[1]
+
+def output_decl(definitions, dent, mfile, params, macros):
+    prevline = -1
+
+    definitions.sort(lambda x, y: x.lineno - y.lineno)
+
+    for d in definitions:
+        # check that it isn't a pre-defined quantity that we've
+        # already declared
+        if (d.lineno != -1 or len(d.macro) > 0 or len(d.init) > 0 or len(d.fninit) > 0):
+            # check if we have to output a #line directive
+            if (d.lineno != prevline + 1 and d.lineno != -1):
+                #print '#line', d.lineno, '"' + mfile + '"'
+                pass
+            prevline = d.lineno
+
+            if (not len(d.macro)):
+                str = dent + d.type
+                if (len(d.type) and d.type[-1] == '*'):
+                    str += d.name
+                else:
+                    str += ' ' + d.name
+
+                if (len(d.init)):
+                    str += ' '
+                    # output the line, replacing parameters
+                    toks, spaces = ctok(d.init)
+                    for t in toks:
+                        if (t in macros):
+                            str += macros[t]
+                        else:
+                            str += t
+                    print
+
+                str += ';'
+                print str
+
+    num = 0
+    for d in definitions:
+        # check that it isn't a pre-defined quantity that we've
+        # already declared
+        if (len(d.fninit) > 0):
+            print indent(dedent(d.fninit), len(dent))
+
+def print_level(statements, level, dent, name, macros):
+    # output statements that depend on level
+    prevline = -1
+    while (len(statements)):
+        l, statements = statements[0], statements[1:]
+        if (l[1] == level):
+
+            # check if we have to output a #line directive
+            if (l[0] != prevline + 1):
+                #print '#line', l[0], '"' + args[0] + '"'
+                pass
+            prevline = l[0]
+
+            # check if we need to decrease the dent (has to be before
+            # output for ending } brackets to be indented properly)
+            if (l[2].find('}') >= 0):
+                if (l[2].find('{') < 0):
+                    dent -= 4
+
+            # output the line, replacing parameters
+            toks, spaces = ctok(l[2])
+            sys.stdout.write(' ' * dent)
+            for t in toks:
+                if (t in macros):
+                    sys.stdout.write(macros[t])
+                else:
+                    sys.stdout.write(t)
+            print
+
+            # check if we need to increase the dent
+            if (l[2].find('{') >= 0):
+                if (l[2].find('}') < 0):
+                    dent += 4
+
+# get the next non-whitespace token, or nothing if there isn't one
+def next_tok(toks):
+    while (len(toks) and toks[0].isspace() == True):
+        toks = toks[1:]
+    return toks
+
+def contrib_replace(x):
+    if (len(x.contrib)):
+        return x.contrib
+    else:
+        return x.macro
+
+def get_replace_map(decls, fn = (lambda x: x.macro)):
+    map = {}
+    for i in filter(lambda x: len(fn(decls[x])) > 0, decls):
+        map[i] = '(' + fn(decls[i]) + ')'
+    return map
+
+if __name__ == "__main__":
+    try:
+        (options, args) = getopt.getopt(sys.argv[1:], 'hv', 
+            ['help', 'version', 'debug'])
+    except getopt.GetoptError:
+        usage(sys.argv[0])
+        sys.exit(2)
+
+    # simple processing of options
+    header = False
+    body = False
+    debug = False
+    help = False
+    for opt, arg in options:
+        if opt in ['--help', '-h']:
+            help = True
+        elif opt in ['--version', '-v']:
+            print '%s version 0.2\n' % sys.argv[0]
+            sys.exit(2)
+        elif opt == '--debug':
+            debug = True
+
+    if (len(args) != 2 and not help):
+        usage(sys.argv[0])
+        sys.exit(2)
+
+    params = {}      # parameter declarations
+    post_decl = {}   # declarations in post
+    post = []        # statements in post
+    post_used = {}   # quantities used in post
+    decode_decl = {} # declarations in decode
+    decode = []      # statements in decode
+    comments = []    # initial comments
+    decode_used = {} # quantities used in decode
+
+    # define pre-declared quantities in all three function namespaces
+    #
+    # levels are:
+    #   - 0: undetermined
+    #   - 1: depends on nothing
+    #   - 2: depends on docno
+    #   - 3: depends on f_dt
+    #   - 4: depends on offset
+    #   - 5: depends on attr
+
+    # declarations for inherent quantities (these are not output directly) 
+    ins_decl([decode_decl], [decode_used], 'const unsigned int f_t;', 1, 'query->term[qterm].f_t', 
+      ex='number of documents in collection term occurs in')
+    ins_decl([decode_decl], [decode_used], 'const unsigned int F_t;', 1, 'query->term[qterm].F_t',
+      ex='number of times term occurs in collection')
+    ins_decl([decode_decl], [decode_used], 'const unsigned int f_dt;', 3,
+      ex='number of times term occurs in current document')
+    #ins_decl([decode_decl], [decode_used], 'const unsigned int offset;', 4)
+    #ins_decl([decode_decl], [decode_used], 'const unsigned int attr;', 5)
+
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'float accumulator;', 2, 'acc->acc.weight',
+      ex='accumulated score of document')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const unsigned int dterms = iobtree_size(idx->vocab);', 1,
+      ex='number of distinct terms in the collection')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const double terms = ((double) UINT_MAX) * idx->stats.terms_high + idx->stats.terms_low;', 1,
+      ex='number of terms in the collection')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const unsigned int N = docmap_entries(idx->map);', 1,
+      ex='number of documents in the collection')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'double avg_D_bytes;', 1, '', -1, 
+      '''\
+         if (docmap_avg_bytes(idx->map, &avg_D_bytes) != DOCMAP_OK) {
+             return SEARCH_EINVAL;
+         }''',
+      ex='average bytes per document in the collection')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'double avg_D_terms;', 1, '', -1,
+      '''\
+         if (docmap_avg_words(idx->map, &avg_D_terms) != DOCMAP_OK) {
+             return SEARCH_EINVAL;
+         }''',
+      ex='average terms per document in the collection')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'double avg_D_dterms;', 1, '', -1,
+      '''\
+         if (docmap_avg_distinct_words(idx->map, &avg_D_dterms) != DOCMAP_OK) {
+             return SEARCH_EINVAL;
+         }''',
+      ex='average distinct terms per document in the collection')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'double avg_D_weight;', 1, '', -1,
+      '''if (docmap_avg_weight(idx->map, &avg_D_weight) != DOCMAP_OK) {
+             return SEARCH_EINVAL;
+         }''',
+      ex='average cosine weight per document in the collection')
+    # ins_decl([decode_decl, post_decl], None, 'const unsigned int Q_bytes;', 1, 'qstat->bytes',
+    #  ex='number of bytes in the query string')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const unsigned int Q_terms = search_qterms(query);', 1,
+      ex='number of terms in the query')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const unsigned int Q_dterms;', 1, 'query->terms',
+      ex='number of distinct terms in the query')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const float Q_weight = search_qweight(query);', 1,
+      ex='cosine weight of query')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const unsigned int D_bytes;', 2, 'docmap_get_bytes_cached(idx->map, acc->acc.docno)', -1, '', 
+      'if (docmap_cache(idx->map, docmap_get_cache(idx->map) | DOCMAP_CACHE_BYTES) != DOCMAP_OK) return SEARCH_EINVAL;', '((float) avg_D_bytes)',
+      ex='number of bytes in the current document')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const unsigned int D_terms;', 2, 'DOCMAP_GET_WORDS(idx->map, acc->acc.docno)', -1, '',
+      'if (docmap_cache(idx->map, docmap_get_cache(idx->map) | DOCMAP_CACHE_WORDS) != DOCMAP_OK) return SEARCH_EINVAL;', '((float) avg_D_terms)',
+      ex='number of terms in the current document')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const unsigned int D_dterms;', 2, 'DOCMAP_GET_DISTINCT_WORDS(idx->map, acc->acc.docno)', -1, '',
+      'if (docmap_cache(idx->map, docmap_get_cache(idx->map) | DOCMAP_CACHE_DISTINCT_WORDS) != DOCMAP_OK) return SEARCH_EINVAL;', '((float) avg_D_dterms)',
+      ex='number of distinct terms in the current document')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const float D_weight;', 2, 'DOCMAP_GET_WEIGHT(idx->map, acc->acc.docno)', -1, '',
+      'if (docmap_cache(idx->map, docmap_get_cache(idx->map) | DOCMAP_CACHE_WEIGHT) != DOCMAP_OK) return SEARCH_EINVAL;', '((float) avg_D_weight)',
+      ex='cosine weight of the current document')
+    ins_decl([decode_decl, post_decl], [decode_used, post_used], 
+      'const unsigned int f_qt;', 1, 'query->term[qterm].f_qt',
+      ex='number of times the current term occurred in the query')
+
+    if (help):
+        usage(sys.argv[0], decode_decl, post_decl)
+        sys.exit(2)
+
+    path = args[0].split('/')
+    parts = path[-1].split('.')
+    if (len(parts) > 0):
+        name = parts[0]
+    else:
+        name = args[0]
+
+    try:
+        file = open(args[0])
+
+        lineno = 1
+        line = file.readline()
+        while (line != ''):
+            sline = line.strip()
+            words = line.split()
+
+            if (len(sline) == 0 or sline[0] == '#'):
+                # its a or empty comment, do nothing
+                if (lineno <= len(comments) + 1):
+                    # preserve initial comments for insertion into
+                    # final file
+                    if (len(sline) > 0):
+                        comments.append(line.strip()[1:].lstrip())
+                    else:
+                        comments.append('')
+            elif (len(words) > 1 and words[0] == 'parameter'):
+                # got parameter, process it (MUST be one line)
+
+                vname = words[1:]
+                while (isdecl(vname[0]) == 1):
+                    vname = vname[1:]
+                vname = vname[0].strip()
+                if (vname[-1] == ';'):
+                    vname = vname[0:-1]
+
+                ins_decl([params, post_decl, decode_decl], 
+                  [decode_used, post_used], line[len('parameter'):], 
+                  level=1, lineno=lineno, 
+                  macro='opt->u.' + name + '.' + vname)
+
+            elif (len(words) == 2 and words[0] == 'post()' 
+              and words[1] == '{'):
+                # in post section
+
+                [lineno, line] = process_decl(file, post_decl, post_used, lineno)
+
+                [lineno, line] = levelise(file, line, lineno, post_decl, 
+                  post, post_used)
+
+                if (line == ''):
+                    print '#line', lineno, '"' + args[0] + '"'
+                    print '#error "unexpected EOF in post"'
+                    sys.exit(2)
+
+            elif (len(words) == 2 and words[0] == 'decode()' 
+              and words[1] == '{'):
+                # in decode section
+
+                [lineno, line] = process_decl(file, decode_decl, decode_used, lineno)
+
+                [lineno, line] = levelise(file, line, lineno, decode_decl, 
+                  decode, decode_used)
+
+                if (line == ''):
+                    print '#line', lineno, '"' + args[0] + '"'
+                    print '#error "unexpected EOF in decode"'
+                    sys.exit(2)
+
+            else:
+                print '#line', lineno, '"' + args[0] + '"'
+                print '#error "unexpected line:', line.rstrip(), '"'
+                sys.exit(2)
+       
+            # next line
+            line = file.readline()
+            lineno += 1
+        file.close()
+    except IOError:
+        # error reading from file
+        print 'error opening file', args[0]
+        sys.exit(2)
+
+    # remove empty lines from the end of comments
+    while (len(comments) > 0 and comments[-1] == ''):
+        comments = comments[0:-1]
+
+    # propagate levels backward to start/end of braced statements
+    propagate(post)
+    propagate(decode)
+
+    # infer what goes into pre
+    pre_infer = lambda used, decl: map(lambda x: decl[x].pre, filter(lambda x: x in used and len(decl[x].pre) > 0, decl))
+    pre = pre_infer(post_used, post_decl)
+    pre.extend(pre_infer(decode_used, decode_decl))
+
+    if (debug): 
+        # just dump everything
+        print 'comments'
+        print comments
+        print
+        print 'params'
+        print params
+        print
+        print 'decode_decl'
+        print decode_decl
+        print
+        print 'decode'
+        print decode
+        print
+        print 'decode_used'
+        print decode_used
+        print
+        print 'post_decl'
+        print post_decl
+        print
+        print 'post'
+        print post
+        print
+        print 'post_used'
+        print post_used
+    else:
+        try:
+            template = open(args[1])
+
+            # insert our comment
+            str = '''\
+              /* %s.c implements the %s metric for the zettair query
+               * subsystem.  This file was automatically generated from
+               * %s and %s
+               * by %s on %s.  
+               *
+               * DO NOT MODIFY THIS FILE, as changes will be lost upon 
+               * subsequent regeneration (and this code is repetitive enough 
+               * that you probably don't want to anyway).  
+               * Go modify %s or %s instead.  
+               * 
+               * Comments from %s.metric:
+               *'''
+            print (dedent(str) % (name.lower(), name, args[0], args[1], 
+              sys.argv[0], strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime()), 
+              args[0], args[1], name))
+
+            for l in comments:
+                print ' *', l
+
+            if (len(comments) > 0):
+                print ' *'
+
+            print ' */'
+            print 
+
+            # process the file, tokenising so we can process comments
+            # that aren't the only thing on a line
+            first = 1
+            currline = 0
+            for l in template:
+                currline += 1
+                if (first):
+                    if (l.find('*/') != -1):
+                        # first comment over, print out line we're at in 
+                        # the template
+                        first = 0
+                        #print '#line %u "%s"' % (currline, args[1])
+                else:
+                    toks, chars = ctok(l)
+                    dent = len(l) - len(l.lstrip()) 
+
+                    while (len(toks)):
+                        nt = next_tok(toks[1:])
+                        nnt = next_tok(nt[1:])
+                        if (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_NAME'):
+                            print '/* METRIC_NAME */', name,
+                            toks = nnt[1:]
+                        elif (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_DEPENDS_POST'):
+                            print '/* METRIC_DEPENDS_POST */', len(post),
+                            toks = nnt[1:]
+                        elif (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_PRE'):
+                            print '/* METRIC_PRE */'
+                            for l in pre:
+                                print indent(l, dent)
+                            #print '#line %u "%s"' % (currline, args[1])
+                            toks = nnt[1:]
+                        elif (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_POST'):
+                            print '/* METRIC_POST */'
+                            output_decl(map(lambda x: post_decl[x], post_used.keys()), dent * ' ', args[0], params,
+                              get_replace_map(post_decl))
+                            print_level(post, 1, dent, name, 
+                              get_replace_map(post_decl))
+                            #print '#line %u "%s"' % (currline, args[1])
+                            toks = nnt[1:]
+                        elif (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_POST_PER_DOC'):
+                            print '/* METRIC_POST_PER_DOC */'
+                            print_level(post, 2, dent, name, 
+                              get_replace_map(post_decl))
+                            #print '#line %u "%s"' % (currline, args[1])
+                            toks = nnt[1:]
+                        elif (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_DECL'):
+                            print '/* METRIC_DECL */'
+                            output_decl(map(lambda x: decode_decl[x], decode_used.keys()), dent * ' ', args[0], params,
+                              get_replace_map(decode_decl))
+                            toks = nnt[1:]
+                        elif (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_PER_CALL'):
+                            print '/* METRIC_PER_CALL */'
+                            # output level one stuff
+                            print_level(decode, 1, dent, name, 
+                              get_replace_map(decode_decl))
+                            #print '#line %u "%s"' % (currline, args[1])
+                            toks = nnt[1:]
+                        elif (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_PER_DOC'):
+                            print '/* METRIC_PER_DOC */'
+                            # output level two and level three stuff
+                            print_level(decode, 2, dent, name, 
+                              get_replace_map(decode_decl))
+                            print_level(decode, 3, dent, name,
+                              get_replace_map(decode_decl))
+                            #print '#line %u "%s"' % (currline, args[1])
+                            toks = nnt[1:]
+                        elif (toks[0] == '/*' and len(nnt) and nnt[0] == '*/' 
+                          and nt[0] == 'METRIC_CONTRIB'):
+                            print '/* METRIC_CONTRIB */'
+                            # output level two and three stuff,
+                            # but using averages instead of specific
+                            # doc values
+                            print_level(decode, 2, dent, name, 
+                              get_replace_map(decode_decl, contrib_replace))
+                            print_level(decode, 3, dent, name,
+                              get_replace_map(decode_decl, contrib_replace))
+                            #print '#line %u "%s"' % (currline, args[1])
+                            toks = nnt[1:]
+                        else:
+                            sys.stdout.write(toks[0])
+                            toks = toks[1:]
+        except IOError:
+            # error reading from file
+            print 'error opening file', args[1]
+            sys.exit(2)
+
diff --git a/scripts/mime.py b/scripts/mime.py
new file mode 100644 (file)
index 0000000..d68bd9b
--- /dev/null
@@ -0,0 +1,693 @@
+"""mime.py is a script to turn lists of media types into a c 
+   module for manipulating MIME types (mime.[ch]).
+
+   this module accepts lists of MIME types in various formats.  I
+   strongly suggest that you use the canonical list at 
+   http://www.isi.edu/in-notes/iana/assignments/media-types/media-types
+   and the list of important MIME types at src/mime-types.txt when
+   regenerating the MIME module.
+
+   FIXME: should compress trie recognition code down for recognition
+   of shared sequences (i.e. for 'application', after first 'a' there
+   is no non-error divergence until whole thing is matched)
+
+   written nml 2004-06-11
+"""
+
+import getopt
+import sys
+import string
+import operator
+from time import strftime, gmtime
+
+def dedent(str, dent = 0):
+    """Simple function to uniformly remove whitespace from the front of
+       lines."""
+    lines = str.split('\n')
+    try: 
+        dent = reduce(min, map(lambda x: len(x) - len(x.lstrip()), 
+          filter(lambda x: len(x.lstrip()) > 0, lines)))
+    except TypeError:
+        dent = 0
+    return '\n'.join(map(lambda x: len(x.lstrip()) > 0 and x[dent:] or x, lines))
+
+def indent(str, dent):
+    """Simple function to uniformly add whitespace to the front of lines."""
+    return '\n'.join(map(lambda x: ' ' * dent + x, str.split('\n')))
+
+def maptrans(string):
+    """Remove c-incompatible characters from mime types."""
+    return string.upper().replace('-', '_').replace('.', '_')\
+      .replace('$', '').replace('+', '_')
+
+def get_prefix(string_list):
+    '''Returns the common prefix between a list of strings'''
+    if (len(string_list) == 0):
+        return ''
+    elif (len(string_list) == 1):
+        return string_list[0]
+    else:
+        pre = string_list[0]
+        lpre = len(pre)
+        for s in string_list[1:]:
+            while (pre != s[0:lpre]):
+                lpre -= 1
+                pre = pre[0:lpre]
+        return pre
+
+class TopType:
+    """Class to represent a top-level MIME type."""
+
+    def __init__(self, name):
+        self._name = name;
+        self._members = {}
+        self._size = 0;
+        self._types = 1
+
+    def addType(self, type):
+        key = maptrans(type)
+        if (self._members.has_key(key)):
+            if (self._members[key][2] != type):
+                # stupid lists defined two very similar mime types!
+                #sys.stderr.writelines('key clash b/w %s (%s) and %s (%s)\n' 
+                  #% (type, key, self._members[key][2], self._members[key][1]))
+                self._members[key][3] = 1
+            else:
+                self._members[key][3] += 1
+        else:
+            self._members[key] = [self._name, key, type, 1]
+        self._size += 1
+
+    def __str__(self):
+        return self._name
+
+    def cmp(self, toptype):
+        if (self._size < toptype._size):
+            return -1
+        elif (self._size > toptype._size):
+            return 1
+        elif (self._name < toptype._name):
+            return -1
+        elif (self._name > toptype._name):
+            return 1
+        else:
+            return 0
+
+#class TopTypeCombo:
+    #def __init__(self, left, right):
+        #self._name = left._name + "/" + right._name
+        #self._size = left._size + right._size
+        #self._left = left
+        #self._right = right
+        #self._types = left._types + right._types
+
+    #def cmp(self, toptype):
+        #if (self._size < toptype._size):
+            #return -1
+        #elif (self._size > toptype._size):
+            #return 1
+        #elif (self._name < toptype._name):
+            #return -1
+        #elif (self._name > toptype._name):
+            #return 1
+        #else:
+            #return 0
+
+#class Huffman:
+    #def __init__(self, types, cmp):
+        #while (len(types) > 1):
+            # sort list with comparsion function
+            #types.sort(cmp)
+
+            # merge bottom two
+            #types[0:2] = [TopTypeCombo(types[0], types[1])]
+
+        # form codes
+        #depth = 0
+        #stack = []
+        #tt = types.pop()
+        #code = []
+        #self._codes = {}
+
+        #print "push", stack[0], stack[0]._left, stack[0]._right
+        #while (tt != None):
+            #if (tt._types == 1):
+                # now form the huffman code by combining and reversing all of
+                # the stuff in code
+                #assert(depth == len(code))
+                #num = 0
+                #for i in range(depth):
+                    #num += code[i] << i
+
+                #print 'think about', tt._name, tt._size, depth, code, num
+                #self._codes[tt._name] = [num, depth]
+
+                #try:
+                    #tt, depth, code = stack.pop()
+                    #print 'pop', tt._name, depth, code
+                #except IndexError:
+                    #tt = None
+            #else:
+                #depth += 1
+                #code.append(1)
+                ##print 'push', tt._right._name, depth, code
+                #stack.append([tt._right, depth, copy.copy(code)])
+                #code.pop()
+                #code.append(0)
+                #print 'follow', tt._left._name, depth, code
+                #tt = tt._left
+
+    #def codes(self):
+        #return self._codes
+
+def typecmp(x, y):
+    # compare by number of occurrances, and then inverse string length
+    if (x[3] == y[3]):
+        xlen = len(x[0]) + len(x[2])
+        ylen = len(y[0]) + len(y[2])
+        if (xlen == ylen):
+            if (x[0] == y[0]):
+                return -1 * cmp(x[2], y[2])
+            else:
+                return -1 * cmp(x[0], y[0])
+        else:
+            return -1 * cmp(xlen, ylen)
+    else:
+        return cmp(x[3], y[3])
+
+def usage(progname):
+    print 'usage: %s [--c-header|--c-body|--debug] mimefile*' % progname
+
+def maketrie(list, prefix):
+    """function to make a trie in c code from a list of strings representing
+       mime_types."""
+    if (len(prefix) > 0):
+        print '%s_label:' % maptrans(prefix).replace("/", "_").lower()
+
+    # get first characters from list
+    chars = map(lambda x: len(x) > 0 and x[0] or "", list)
+
+    # count duplicates
+    counted = {}
+    count = 0
+    for c in chars:
+        if counted.has_key(c):
+            counted[c][0] = counted[c][0] + 1
+        else:
+            counted[c] = [1, count]
+        count += 1
+
+    print '    switch (*str++) {'
+    for c in counted:
+        if (len(c)):
+            print '    case \'%s\':' % c
+            if (c in string.lowercase):
+                print '    case \'%s\':' % c.upper()
+            if (counted[c][0] == 1):
+                print '        /* must be \'%s\' or unrecognised */' % (prefix + list[counted[c][1]])
+                print '        if (!str_casecmp(str, '
+                print '          &lookup[MIME_TYPE_%s].name[%u])) {' % (maptrans(prefix + list[counted[c][1]]).replace("/", "_").upper(), len(prefix) + 1)
+                print '            return MIME_TYPE_%s;' % maptrans(prefix + list[counted[c][1]]).replace("/", "_").upper()
+                print '        } else {'
+                print '            return MIME_TYPE_UNKNOWN_UNKNOWN;'
+                print '        }'
+                print '        break;'
+            else:
+                nprefix = get_prefix(list[counted[c][1]:counted[c][1] + counted[c][0]])
+                assert(len(nprefix) >= 1);
+                counted[c].append(nprefix)
+                if (nprefix == c):
+                    # can't remove any further characters without
+                    # branches, go to next label
+                    print '        goto %s_label;' % maptrans(prefix + c[0]).replace("/", "_").lower()
+                else:
+                    print '        /* skip to prefix \'%s\' */' % (prefix + nprefix)
+                    print '        if (!str_ncasecmp(str, "%s", %d)) {' \
+                      % (nprefix[1:], len(nprefix[1:]))
+                    print '            str += %d;' % (len(nprefix[1:]))
+                    print '            goto %s_label;' % maptrans(prefix + nprefix).replace("/", "_").lower()
+                    print '        } else {'
+                    print '            return MIME_TYPE_UNKNOWN_UNKNOWN;'
+                    print '        }'
+        else:
+            print '    case \'\\0\':'
+            print '        return MIME_TYPE_%s;' % maptrans(prefix).replace("/", "_").upper()
+        print
+
+    print '    default: '
+    print '        return MIME_TYPE_UNKNOWN_UNKNOWN;'
+    print '    }'
+
+    for c in counted:
+        if (len(c) and counted[c][0] > 1):
+            assert(len(counted[c]) == 3)
+            print
+            nprefix = prefix + counted[c][2]
+            maketrie(map(lambda x: x[len(counted[c][2]):], list[counted[c][1]:counted[c][1] + counted[c][0]]), nprefix)
+
+if __name__ == "__main__":
+    try:
+        (options, args) = getopt.getopt(sys.argv[1:], 'hv', 
+            ['help', 'version', 'c-header', 'c-body', 'debug'])
+    except getopt.GetoptError:
+        usage(sys.argv[0])
+        sys.exit(2)
+
+    # simple processing of options
+    header = False
+    body = False
+    debug = False
+    for opt, arg in options:
+        if opt in ['--help', '-h']:
+            usage(sys.argv[0])
+            sys.exit(2)
+        elif opt in ['--version', '-v']:
+            print '%s version 0.1\n' % sys.argv[0]
+            sys.exit(2)
+        elif opt == '--c-header':
+            header = True
+            debug = False
+            body = False
+        elif opt == '--c-body':
+            header = False
+            debug = False
+            body = True
+        elif opt == '--debug':
+            header = False
+            body = False
+            debug = True
+
+    if (not header and not body and not debug):
+        usage(sys.argv[0])
+        sys.exit(2)
+
+    types = {}
+
+    for filename in args:
+        try: 
+            file = open(filename)
+
+            # process files by treating them as three sections: a preamble that we
+            # want to ignore (before), a meaningful section that we need to
+            # process, and references and discussion at the end that we need to
+            # ignore (after).  The key to this is recognising lines that have no
+            # whitespace at the start of the line, since the meaningful section
+            # starts and ends with these lines.  We match the first word with known
+            # toplevel types to figure out where things start and end
+
+            before = 1
+            after = 0
+            toptype = None
+            toptypes = ['text', 'multipart', 'message', 'chemical', 'application', 
+                'image', 'audio', 'video', 'model', 'inode']
+
+            for line in file:
+                if (not after):
+                    # two blank lines end section we process
+                    if (len(line.lstrip()) == 0 or line.lstrip()[0] == '#'):
+                        # blank, ignore
+                        pass
+                    elif (line.lstrip() == line): 
+                        # toplevel type specified first on this line
+                        words = line.split()
+
+                        # handle lines listed as topleveltype/subtype
+                        if (words[0].find('/') != -1):
+                            words = words[0].split('/')
+
+                        if ((words[0] in toptypes)
+                          or (words[0][0:2] == 'x-')):
+                            # start of a new top-level type
+                            if (types.has_key(words[0])):
+                                toptype = types[words[0]]
+                            else:
+                                toptype = TopType(words[0])
+                                types[words[0]] = toptype
+
+                            # need conditional to exclude stupid inconsistency 
+                            # with model type (doesn't have first subtype on same
+                            # line
+                            if (len(words) > 1 
+                              and (words[1][0] != '[' or words[1][-1] != ']')):
+                                toptype.addType(words[1])
+                            before = 0
+                        elif (not before):
+                            # end of types section
+                            after = 1
+                    elif (not before):
+                        words = line.split()
+                        toptype.addType(words[0])
+                else:
+                    # after
+                    pass
+
+            file.close()
+        except IOError:
+            # error reading from file, ignore it
+            pass
+
+    # form a list of all types
+    ordtypes = reduce(operator.add, 
+      map(lambda x: types[x]._members.values(), types))
+    ordtypes.sort(typecmp)
+    ordtypes.reverse()
+
+    # number them 
+    i = 0
+    for t in ordtypes:
+        t.append(i)
+        i += 1
+
+    if (debug):
+        for l in ordtypes:
+            print l
+    elif (header):
+        # resort types to look pretty
+        ordtypes.sort()
+
+        # print out c header file 
+        str = '''\
+          /* mime.h provides support for MIME types as originally proposed 
+           * by RFCs 1521 and 1522, and updated by RFCs 2045 through 2049.
+           * It provides enumerations for convenient representation of 
+           * recognised MIME types, as well as a functions for determining
+           * MIME types for given MIME names and file contents.
+           *
+           * DO NOT modify this file, as it is automatically generated 
+           * and changes will be lost upon subsequent regeneration.
+           *
+           * It is automatically generated from media-type files describing 
+           * valid MIME types by %s.  The definitive list can be found at 
+           * %s, 
+           * although %s will accept multiple files (in the same format), 
+           * allowing you to define your own MIME types as convenient.
+           *
+           * This file was generated on %s 
+           * by %s
+           *
+           */''' 
+               
+        print dedent(str) % (sys.argv[0], 
+          'http://www.isi.edu/in-notes/iana/assignments/media-types/' \
+            + 'media-types', sys.argv[0], 
+            strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()),
+            sys.argv[0])
+
+        print
+        print dedent('''\
+          #ifndef MIME_H
+          #define MIME_H
+
+          #ifdef _cplusplus
+          extern "C" {
+          #endif''')
+                            
+        print
+        print 'enum mime_top_types {'
+        i = 0
+        sorttypes = types.keys()
+        sorttypes.sort()
+        for tt in sorttypes:
+            print '    MIME_TOP_TYPE_' + maptrans(tt).upper(), '= %u,' % i
+            i += 1
+        print '    MIME_TOP_TYPE_ERR = -1'
+        print '};'
+        print
+
+        print '/* numbered so that (hopefully) commonly used MIME types have '
+        print '   low numbers */'
+        print 'enum mime_types {'
+        prevtt = ordtypes[0][0]
+        for tt, key, type, freq, rank in ordtypes:
+            if (tt != prevtt):
+                print
+            print '    MIME_TYPE_%s_%s = %u,' \
+              % (maptrans(tt).upper(), maptrans(type).upper(), rank)
+            prevtt = tt
+        print
+        print '    MIME_TYPE_UNKNOWN_UNKNOWN = -1'
+        print '};'
+        print
+
+        print '/* returns string representation of mime type */'
+        print 'const char *mime_string(enum mime_types mtype);'
+        print
+
+        print '/* determine which toplevel-type a given mimetype is */'
+        print 'enum mime_top_types mime_top_type(enum mime_types mtype);'
+        print
+
+        print '/* attempts to hueristically identify MIME types by content, '
+        print ' * returns MIME_TYPE_APPLICATION_OCTET_STREAM if unable to do '
+        print ' * so. */'
+        print 'enum mime_types mime_content_guess(const void *buf, unsigned int len);'
+
+        print
+        print '/* returns the mime type indicated by the provided string.  '
+        print ' * This function probably needs to be turned '
+        print ' * into an object accepting a stream at some stage. */'
+        print 'enum mime_types mime_type(const char *str);'
+
+        print
+        print dedent('''\
+          #ifdef _cplusplus
+          }
+          #endif
+          
+          #endif''')
+        print
+             
+    elif (body):
+        # generate c definitions
+        str = '''\
+          /* mime.c implements the interface declared by mime.h
+           *
+           * DO NOT modify this file, as it is automatically generated 
+           * and changes will be lost upon subsequent regeneration.
+           *
+           * It is automatically generated from media-type files describing 
+           * valid MIME types by %s.  The definitive list can be found at 
+           * %s, 
+           * although %s will accept multiple files (in the same format), 
+           * allowing you to define your own MIME types as convenient.
+           *
+           * This file was generated on %s 
+           * by %s
+           *
+           */
+               
+          #include "firstinclude.h"
+
+          #include "mime.h"
+
+          #include "str.h"
+
+          #include <ctype.h>
+          ''' 
+               
+        print dedent(str) % (sys.argv[0], 
+          'http://www.isi.edu/in-notes/iana/assignments/media-types/' \
+            + 'media-types', sys.argv[0], 
+            strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()),
+            sys.argv[0])
+
+        print dedent('''\
+          struct mime_lookup {
+              const char *name;
+              enum mime_top_types toptype;
+          };
+          ''')
+        print 'static const struct mime_lookup lookup[] = {'
+        for tt, key, type, freq, rank in ordtypes:
+            if (len(tt) + len(type) < 28):
+                print '    {"%s/%s", MIME_TOP_TYPE_%s},' \
+                  % (tt, type, maptrans(tt).upper())
+            else:
+                print '    {"%s/%s",' % (tt, type)
+                print '      MIME_TOP_TYPE_%s},' % (maptrans(tt).upper())
+        print
+        print '    {NULL, MIME_TOP_TYPE_ERR}'
+        print '};'
+        print
+
+        print dedent('''\
+          const char *mime_string(enum mime_types mtype) {
+              if (mtype <= %u) {
+                  return lookup[mtype].name;
+              } else {
+                  return NULL;
+              }
+          }''') % len(ordtypes)
+        print
+
+        print dedent('''\
+          enum mime_top_types mime_top_type(enum mime_types mtype) {
+              if (mtype <= %u) {
+                  return lookup[mtype].toptype;
+              } else {
+                  return MIME_TOP_TYPE_ERR;
+              }
+          }''') % len(ordtypes)
+        print
+        print '''\
+       
+/* FIXME: do this properly, using parsing-type stuff */
+enum mime_types mime_content_guess(const void *buf, unsigned int len) {
+    const char *cbuf = buf;
+
+    if (len >= 4) {
+        /* test for JPEG */
+        if ((cbuf[0] == (char) 0xff) && (cbuf[1] == (char) 0xd8) 
+          && (cbuf[2] == (char) 0xff) && (cbuf[3] == (char) 0xe0)) {
+            return MIME_TYPE_IMAGE_JPEG;
+        }
+    }
+
+    if (len >= 6) {
+        /* test for GIF */
+        if (!str_ncmp(cbuf, "GIF8", 4) && ((cbuf[4] == '9') || (cbuf[4] == '7'))
+          && (cbuf[5] == 'a')) {
+            return MIME_TYPE_IMAGE_GIF;
+        }
+    }
+
+    if (len >= 4) {
+        /* test for MS cbuf (badly) */
+        if ((cbuf[0] == (char) 0xd0) && (cbuf[1] == (char) 0xcf) 
+          && (cbuf[2] == (char) 0x11) && (cbuf[3] == (char) 0xe0)) {
+            /* XXX: not strictly true, its just an OLE document, but most of 
+             * them are MS cbuf docs anyway.  Testing for MS cbuf requires 
+             * looking further into the document, so we won't be doing that 
+             * here. */
+            return MIME_TYPE_APPLICATION_MSWORD;
+        }
+
+        if (len == 2) {
+            if ((cbuf[0] == (char) 0x31) && (cbuf[1] == (char) 0xbe) 
+              && (cbuf[0] == '\\0')) {
+                /* more MS cbuf stuff :o( */
+                return MIME_TYPE_APPLICATION_MSWORD;
+            } else if ((cbuf[0] == (char) 0xfe) && (cbuf[1] == '7') 
+              && (cbuf[0] == '\\0')) {
+                /* office document */
+                return MIME_TYPE_APPLICATION_MSWORD;
+            }
+        }
+    }
+
+    /* test for wordperfect files */
+    if (len >= 4) {
+        if ((cbuf[0] == (char) 0xff) && (cbuf[1] == 'W') && (cbuf[2] == 'P') 
+          && (cbuf[3] == 'C')) {
+            return MIME_TYPE_APPLICATION_WORDPERFECT5_1;
+        }
+    }
+
+    /* test for postscript files */
+    if (len >= 2) {
+        if ((cbuf[0] == '%') && (cbuf[1] == '!')) {
+            return MIME_TYPE_APPLICATION_POSTSCRIPT;
+        }
+    }
+
+    /* test for PDF files */
+    if (len >= 5) {
+        if ((cbuf[0] == '%') && (cbuf[1] == 'P') && (cbuf[2] == 'D') 
+          && (cbuf[3] == 'F') && (cbuf[4] == '-')) {
+            return MIME_TYPE_APPLICATION_PDF;
+        }
+    }
+
+    /* test for markup languages, first locating the first
+     * non-whitespace character */
+    while (isspace(*cbuf) && len) {
+        cbuf++;
+        len--;
+    }
+
+    /* TREC documents */
+    if (((len >= str_len("<doc>")) 
+        && !str_ncasecmp("<doc>", cbuf, str_len("<doc>")))) {
+        return MIME_TYPE_APPLICATION_X_TREC;
+    }
+
+    /* INEX documents */
+    if (((len >= str_len("<article>")) 
+        && !str_ncasecmp("<article>", cbuf, str_len("<article>")))) {
+        return MIME_TYPE_APPLICATION_X_INEX;
+    }
+
+    /* HTML */
+    if (((len >= str_len("<!doctype html")) 
+        && !str_ncasecmp("<!doctype html", cbuf, str_len("<!doctype html")))
+      || ((len >= str_len("<head")) 
+        && !str_ncasecmp("<head", cbuf, str_len("<head")))
+      || ((len >= str_len("<title")) 
+        && !str_ncasecmp("<title", cbuf, str_len("<title")))
+      || ((len >= str_len("<html")) 
+        && !str_ncasecmp("<html", cbuf, str_len("<html")))) {
+        return MIME_TYPE_TEXT_HTML;
+    }
+
+    /* SGML */
+    if (((len >= str_len("<!doctype ")) 
+        && !str_ncasecmp("<!doctype ", cbuf, str_len("<!doctype ")))
+      || ((len >= str_len("<subdoc")) 
+        && !str_ncasecmp("<subdoc", cbuf, str_len("<subdoc")))) {
+        return MIME_TYPE_TEXT_SGML;
+    }
+
+    /* XML */
+    if (((len >= str_len("<?xml")) 
+        && !str_ncasecmp("<?xml", cbuf, str_len("<?xml")))) {
+        return MIME_TYPE_TEXT_XML;
+    }
+
+    /* XXX: test for tar files */
+
+    return MIME_TYPE_APPLICATION_OCTET_STREAM;
+}
+
+enum mime_types mime_type(const char *str) {
+'''
+
+        # for tt, key, type, freq, rank in ordtypes:
+
+        # trie to identify types
+        listtypes = map(lambda x: x[0].lower() + "/" + x[2].lower(), ordtypes)
+        listtypes.sort()
+
+        maketrie(listtypes, "")
+        print '}'
+        print
+
+        print '#ifdef MIME_TEST'
+        print 
+        print '#include <stdlib.h>'
+        print '#include <stdio.h>'
+        print '#include "str.h"'
+        print
+        print 'int main() {'
+        print '    char buf[BUFSIZ + 1];'
+        print '    enum mime_types mtype;'
+        print 
+        print '    while (fgets(buf, BUFSIZ, stdin)) {'
+        print '        str_rtrim(buf);'
+        print '        mtype = mime_type(str_ltrim(buf));'
+        print '        printf("%s\\n", mime_string(mtype));'
+        print '    }'
+        print
+        print '    return EXIT_SUCCESS;'
+        print '}'
+        print
+        print '#endif'
+        print
+    else:
+        assert(False)
+
+
+
+
+
+
diff --git a/setup.py.in b/setup.py.in
new file mode 100644 (file)
index 0000000..b935dbc
--- /dev/null
@@ -0,0 +1,18 @@
+from distutils.core import setup, Extension
+
+zet_module = Extension('zet', 
+        include_dirs = ['include', 'src/include', 'src/include/@OSINCLUDE@',
+        'src/include/compat' ],
+        libraries = ['zet'],
+        # FIXME next should be @libdir@, but configure replaces this
+        # with the Makefile variable ${exec_prefix}.  The following
+        # is a hack, which will not work if exec_prefix != prefix
+        library_dirs = ['@prefix@/lib'],
+        sources = ['src/pyzet/zetmodule.c'])
+
+setup (name = 'PyZettair',
+       version = '0.6.0',
+       package_dir = { '': 'src/pyzet' },
+       description = 'This is a python wrapper for libzet',
+       py_modules = ["pzet"],
+       ext_modules = [zet_module])
diff --git a/src/alloc.c b/src/alloc.c
new file mode 100644 (file)
index 0000000..82f4260
--- /dev/null
@@ -0,0 +1,23 @@
+/* alloc.c implements wrappers around system malloc and free.
+ *
+ * written nml 2005-03-10
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "alloc.h"
+
+#include <stdlib.h>
+
+void *alloc_malloc(void *opaque, unsigned int size) {
+    return malloc(size);
+}
+
+void alloc_free(void *opaque, void *ptr) {
+    free(ptr);
+    return;
+}
+
+const struct alloc alloc_system = {NULL, alloc_malloc, alloc_free};
+
diff --git a/src/binsearch.c b/src/binsearch.c
new file mode 100644 (file)
index 0000000..dc9ac20
--- /dev/null
@@ -0,0 +1,126 @@
+/* binsearch.c implements a function for binary searching that is much like
+ * the standard library qsort
+ *
+ * written nml 2002-12-12
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "binsearch.h"
+
+#include "bit.h"
+
+/* FIXME: can be optimised by looping until number of elements between l and r
+ * is 0 */
+
+void* binsearch(const void* key, const void* base, size_t nel, 
+  size_t width, int (*compar)(const void* one, const void* two)) {
+    const char* cbase = base;          /* to do dodgy pointer arithmetic on */
+    unsigned int l = 0,                /* left end of search */
+                 r = nel - 1,          /* right end of search */
+                 m;                    /* middle of search */
+    int res;                           /* result of comparison */
+
+    /* indexes must be unsigned int, else risk overflow, but unsigned int gives
+     * us problems moving r to the left of m below */
+
+    /* if nel is 0, then r is (unsigned) -1, so check for it */
+    if (!nel || !width) {
+        return (void*) cbase;
+    }
+
+    while (l <= r) {
+        m = (r + l) >> 1;
+        if ((res = compar(key, cbase + m * width)) > 0) {
+            l = m + 1;
+        } else if (res < 0) {
+            if (m) {
+                r = m - 1;
+            } else {
+                /* avoid underflow of r (and prevention of crossing) */
+                return (void*) cbase;
+            }
+        } else {
+            return (void*) (cbase + m * width);
+        }
+    }
+
+    return (void*) (cbase + l * width);
+}
+
+#if 0
+
+/* this version of binsearch contains a possible optimisation based on
+ * eliminating multiplication from the loop, but it doesn't seem to work, since
+ * you still need some multiplication (although its only by 0 or 1).  The below
+ * implementation has bugs. */
+
+void* binsearch(const void* key, const void* base, size_t nel, 
+  size_t width, int (*compar)(const void* one, const void* two)) {
+    const char *l = base,           /* left end of search */
+               *r,                  /* right end of search */
+               *m;                  /* middle of search */
+    int res,                        /* result of comparison */
+        odd;                        /* whether last division was odd */
+    unsigned int halfwidth;         /* half of width */
+
+    /* check for degenerate cases */
+    if (!nel || !width) {
+        return (void*) base;
+    }
+
+    halfwidth = BIT_DIV2(width, 1);
+
+    /* FIXME: more... initialise r to the end of the array */
+    for (r = l + (nel - 1) * width; nel; nel = BIT_DIV2(nel - 1, 1)) {
+
+        odd = BIT_MOD2(nel, 1);
+
+        /* the middle is halfway in between l and r, (l + (r - l) / 2),
+         * except that if theres an odd number of elements between them we 
+         * have to subtract the half an element that would otherwise screw up 
+         * our calculations (this is the price of not using multiplication) */
+        m = l + BIT_DIV2(r - l, 1);
+        
+        if (odd) {
+            /* correct for incorrect division due to oddness */
+            m -= halfwidth;           
+
+            /* compare them */
+            res = compar(key, m);
+
+            if (res > 0) {
+                /* if the key is greater than the middle, we need to shift the 
+                 * left bounds past the middle */
+                l = m + width;
+            } else if (res < 0) {
+                /* if the key is less than the middle, we need to shift the 
+                 * right bounds past the middle */
+                r = m - width;
+            } else {
+                return (void*) m;
+            }
+        } else {
+            /* compare them */
+            res = compar(key, m);
+
+            if (res > 0) {
+                /* if the key is greater than the middle, we need to shift the 
+                 * left bounds past the middle */
+                l = m + width;
+                nel -= 1;
+            } else if (res < 0) {
+                /* if the key is less than the middle, we need to shift the 
+                 * right bounds past the middle */
+                r = m - width;
+            } else {
+                return (void*) m;
+            }
+        }
+    }
+
+    return (void*) l;
+}
+#endif
+
diff --git a/src/bit.c b/src/bit.c
new file mode 100644 (file)
index 0000000..ecd4e1a
--- /dev/null
+++ b/src/bit.c
@@ -0,0 +1,170 @@
+/* bit.c declares data for the bit.h macros to utilise
+ *
+ * written nml 2003-05-07
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "bit.h"
+
+#include <limits.h>
+
+unsigned long int bit_lbits[] = {
+    0, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff, 0x7ff, 
+    0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff, 0x1ffff, 0x3ffff, 0x7ffff, 
+    0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 0x3ffffff, 
+    0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff
+#if (0xffffffffffffffffUL <= ULONG_MAX)
+    , 0x1ffffffffUL, 0x3ffffffffUL, 0x7ffffffffUL, 0xfffffffffUL, 
+    0x1fffffffffUL, 0x3fffffffffUL, 0x7fffffffffUL, 0xffffffffffUL, 
+    0x1ffffffffffUL, 0x3ffffffffffUL, 0x7ffffffffffUL, 0xfffffffffffUL, 
+    0x1fffffffffffUL, 0x3fffffffffffUL, 0x7fffffffffffUL, 0xffffffffffffUL, 
+    0x1ffffffffffffUL, 0x3ffffffffffffUL, 0x7ffffffffffffUL, 0xfffffffffffffUL,
+    0x1fffffffffffffUL, 0x3fffffffffffffUL, 0x7fffffffffffffUL, 
+    0xffffffffffffffUL, 0x1ffffffffffffffUL, 0x3ffffffffffffffUL, 
+    0x7ffffffffffffffUL, 0xfffffffffffffffUL, 0x1fffffffffffffffUL, 
+    0x3fffffffffffffffUL, 0x7fffffffffffffffUL, 0xffffffffffffffffUL
+#elif (0xffffffffffffffffUL < ULONG_MAX)
+#error "bit.h not > 64 bit ready"
+#endif
+};
+
+unsigned char bit_revbits[] = {
+    0x0, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 
+    0x30, 0xb0, 0x70, 0xf0, 0x8, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 
+    0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x4, 0x84, 0x44, 0xc4, 
+    0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 
+    0xc, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 
+    0x3c, 0xbc, 0x7c, 0xfc, 0x2, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 
+    0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0xa, 0x8a, 0x4a, 0xca, 
+    0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 
+    0x6, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 
+    0x36, 0xb6, 0x76, 0xf6, 0xe, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 
+    0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x1, 0x81, 0x41, 0xc1, 
+    0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 
+    0x9, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 
+    0x39, 0xb9, 0x79, 0xf9, 0x5, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 
+    0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0xd, 0x8d, 0x4d, 0xcd, 
+    0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 
+    0x3, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 
+    0x33, 0xb3, 0x73, 0xf3, 0xb, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 
+    0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x7, 0x87, 0x47, 0xc7, 
+    0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 
+    0xf, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 
+    0x3f, 0xbf, 0x7f, 0xff
+};
+
+unsigned int bit_log2(unsigned long int num) {
+    unsigned int i = 1,
+                 bits = BIT_FROM_BYTE(sizeof(unsigned long int));
+
+    while ((i < bits) && !(num & BIT_UMASK(i))) {
+        i++;
+    }
+
+    return bits - i;
+}
+
+unsigned int bit_rev(unsigned int src, unsigned int byte_width) {
+    unsigned int dst,
+                 i;
+
+    switch (byte_width) {
+    case 1:
+        dst = bit_revbits[src];
+        break;
+
+    case 2:
+        dst = (bit_revbits[src & BIT_LMASK(8)] << 8)
+              | bit_revbits[src >> 8];
+        break;
+
+    case 4:
+        dst = (bit_revbits[(src >> 0) & BIT_LMASK(8)] << 24)
+              | (bit_revbits[(src >> 8) & BIT_LMASK(8)] << 16)
+              | (bit_revbits[(src >> 16) & BIT_LMASK(8)] << 8)
+              | (bit_revbits[(src >> 24) & BIT_LMASK(8)] << 0);
+        break;
+
+#if (0xffffffffffffffff <= UINT_MAX)
+    case 8:
+        dst = (bit_revbits[(src >> 0) & BIT_LMASK(8)] << 56)
+              | (bit_revbits[(src >> 8) & BIT_LMASK(8)] << 48)
+              | (bit_revbits[(src >> 16) & BIT_LMASK(8)] << 40)
+              | (bit_revbits[(src >> 24) & BIT_LMASK(8)] << 32)
+              | (bit_revbits[(src >> 32) & BIT_LMASK(8)] << 24)
+              | (bit_revbits[(src >> 40) & BIT_LMASK(8)] << 16)
+              | (bit_revbits[(src >> 48) & BIT_LMASK(8)] << 8)
+              | (bit_revbits[(src >> 56) & BIT_LMASK(8)] << 0);
+        break;
+#endif
+
+    default:
+        dst = 0;
+        for (i = 0; i < sizeof(dst); i++) {
+            dst |= bit_revbits[(src >> BIT_FROM_BYTE(i)) & BIT_LMASK(8)]
+              << BIT_FROM_BYTE(sizeof(dst) - (i + 1));
+        }
+    }
+    return dst;
+}
+
+unsigned int bit_set(unsigned int var, unsigned int bit, unsigned int val) {
+    return BIT_SET(var, bit, val);
+}
+
+unsigned int bit_toggle(unsigned int var, unsigned int bit) {
+    return BIT_TOGGLE(var, bit);
+}
+
+unsigned int bit_get(unsigned int var, unsigned int bit) {
+    return BIT_GET(var, bit);
+}
+
+unsigned int bit_mul2(unsigned int num, unsigned int pow) {
+    return BIT_MUL2(num, pow);
+}
+
+unsigned int bit_div2(unsigned int num, unsigned int pow) {
+    return BIT_DIV2(num, pow);
+}
+
+unsigned int bit_mod2(unsigned int num, unsigned int pow) {
+    return BIT_MOD2(num, pow);
+}
+
+unsigned int bit_pow2(unsigned int pow) {
+    return BIT_POW2(pow);
+}
+
+unsigned int bit_umask(unsigned int bits) {
+    return BIT_UMASK(bits);
+}
+
+unsigned int bit_lmask(unsigned int bits) {
+    return BIT_LMASK(bits);
+}
+
+void bit_array_null(void *arr, unsigned int nmemb, unsigned int width) {
+    memset(arr, 0, nmemb * width);
+}
+
+unsigned int bit_to_byte(unsigned int bits) {
+    return BIT_TO_BYTE(bits);
+}
+
+unsigned int bit_from_byte(unsigned int bits) {
+    return BIT_FROM_BYTE(bits);
+}
+
+#ifdef BIT_TEST
+#include <stdio.h>
+#include <stdlib.h>
+int main() {
+    printf("log2 0 %u 1 %u 2 %u UINT_MAX %u\n", bit_log2(0), bit_log2(1),
+      bit_log2(2), bit_log2(UINT_MAX));
+    return EXIT_SUCCESS;
+}
+#endif
+
diff --git a/src/btbucket.c b/src/btbucket.c
new file mode 100644 (file)
index 0000000..3442b1e
--- /dev/null
@@ -0,0 +1,297 @@
+/* btbucket.c implements a set of utility functions for manipulating
+ * btree buckets
+ *
+ * written nml 2003-02-17
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "btbucket.h"
+#include "_btbucket.h"
+
+#include "_mem.h"
+
+#include "bit.h"
+#include "bucket.h"
+#include "str.h"
+
+#include <limits.h>
+
+void btbucket_new(void *btbucket, unsigned int bucketsize, 
+  unsigned int sib_fileno, unsigned int sib_offset, int leaf, void *prefix, 
+  unsigned int *prefix_size) {
+    struct btbucket *b = btbucket;
+
+    leaf = !!leaf;                           /* set leaf to 1 or 0 */
+
+    /* prefix_size can't exceed a 7 bit number, truncate prefix it if it does */
+    if (*prefix_size >= BIT_SET(0U, 7, 1)) {
+        *prefix_size = BIT_SET(0U, 7, 1) - 1;
+    }
+
+    /* combine leaf indication and prefix size into one stored variable */
+    b->u.s.prefixsize = BIT_SET(*prefix_size, 7, leaf);
+
+    /* tailsize is the amount of space in the btree bucket not allocated to the
+     * bucket itself.  If its a leaf then it has a sibling pointer ... */
+    b->u.s.tailsize = leaf * (sizeof(sib_fileno) + sizeof(sib_offset))
+      /* ... and all buckets have a prefix which takes space ... */
+      + *prefix_size 
+      /* ... and all buckets have two bytes overhead at the start ... */
+      + (b->u.s.bucket - b->u.mem);
+
+    /* copy in the prefix */
+    memcpy(&b->u.s.bucket[BTBUCKET_SIZE(btbucket, bucketsize)], prefix, 
+      *prefix_size);
+
+    /* copy sibling pointer in */
+    if (leaf) {
+        btbucket_set_sibling(btbucket, bucketsize, sib_fileno, sib_offset);
+    }
+}
+
+void btbucket_sibling(void *btbucket, unsigned int bucketsize, 
+  unsigned int *fileno, unsigned long int *offset) {
+    struct btbucket *b = btbucket;
+
+    assert(BIT_GET(b->u.s.prefixsize, 7));  /* has to be a leaf */
+
+    MEM_NTOH(fileno, &b->u.mem[bucketsize - sizeof(*fileno) - sizeof(*offset)], 
+      sizeof(*fileno));
+    MEM_NTOH(offset, &b->u.mem[bucketsize - sizeof(*offset)], sizeof(*offset));
+}
+
+void btbucket_set_sibling(void *btbucket, unsigned int bucketsize, 
+  unsigned int fileno, unsigned long int offset) {
+    struct btbucket *b = btbucket;
+
+    assert(BIT_GET(b->u.s.prefixsize, 7));  /* has to be a leaf */
+
+    MEM_HTON(&b->u.mem[bucketsize - sizeof(fileno) - sizeof(offset)], &fileno,
+      sizeof(fileno));
+    MEM_HTON(&b->u.mem[bucketsize - sizeof(offset)], &offset, sizeof(offset));
+}
+
+int btbucket_set_prefix(void *btbucket, unsigned int bucketsize, void *prefix, 
+  unsigned int *prefix_len) {
+
+    assert(0);
+    /* FIXME */
+    return 0;
+}
+
+unsigned int btbucket_size(void *btbucket, unsigned int bucketsize) {
+    return BTBUCKET_SIZE(btbucket, bucketsize);
+}
+
+void *btbucket_bucket(void *btbucket) {
+    return BTBUCKET_BUCKET(btbucket);
+}
+
+int btbucket_leaf(void *btbucket, unsigned int bucketsize) {
+    return BTBUCKET_LEAF(btbucket, bucketsize);
+}
+
+void *btbucket_prefix(void *btbucket, unsigned int bucketsize, 
+  unsigned int *prefix_len) {
+    return BTBUCKET_PREFIX(btbucket, bucketsize, prefix_len); 
+}
+
+unsigned int btbucket_entry_size() {
+    return BTBUCKET_ENTRY_SIZE();
+}
+
+void btbucket_entry(void *entry, unsigned int *fileno, 
+  unsigned long int *offset) {
+    BTBUCKET_ENTRY(entry, fileno, offset);
+}
+
+void btbucket_set_entry(void *entry, unsigned int fileno, 
+  unsigned long int offset) {
+    BTBUCKET_SET_ENTRY(entry, fileno, offset);
+}
+
+unsigned int btbucket_common_prefix(const char *one, 
+  unsigned int onelen, const char *two, unsigned int twolen, 
+  char *lastchar) {
+    unsigned int i,
+                 len = (onelen > twolen) ? twolen : onelen;
+
+    /* string one has to be lexographically smaller than two */
+    assert(str_ncmp(one, two, len) <= 0);
+
+    /* note: arr[index - 1 + !index] idiom prevents us from selecting array 
+     * offset -1 when index is 0 (selects 0 instead, which may be 
+     * not-quite-right but is much safer) */
+
+    /* check all but last character */
+    for (i = 0; i + 1 < len; i++) {
+        if (one[i] != two[i]) {
+            assert(one[i] < two[i]);
+            *lastchar = one[i - 1 + !i];
+            return i;
+        }
+    }
+
+    /* check last char (can do one char better if last chars are off by one) */
+    if (one[i] != two[i]) {
+        assert(one[i] < two[i]);
+        if ((one[i] == two[i] - 1) && (len == twolen)) {
+            *lastchar = two[i] - 1;
+            return i + 1;
+        } else {
+            *lastchar = one[i - 1 + !i];
+            return i;
+        }
+    }
+
+    *lastchar = one[len - 1 + !len];
+    return len;
+}
+
+unsigned int btbucket_split_term(const char *one, 
+  unsigned int onelen, const char *two, unsigned int twolen, char *lastchar) {
+    unsigned int i,
+                 len = (onelen > twolen) ? twolen : onelen;
+
+    for (i = 0; i < len; i++) {
+        if (one[i] != two[i]) {
+            /* pick a split point between the two, slightly right-biased */
+            *lastchar = (one[i] + two[i] + 1) / 2;
+            return i + 1;
+        }
+    }
+
+    if (len < onelen) {
+        *lastchar = (one[len] + 1) / 2;
+        return len + 1;
+    } else if (len < twolen) {
+        *lastchar = (two[len] + 1) / 2;
+        return len + 1;
+    } else {
+        /* strings are identical, we can't split them */
+        assert((onelen != twolen) 
+          || str_ncmp(one, two, onelen));
+        return 0;
+    }
+}
+
+/* function to find a stupid split term, which is the second term given */
+unsigned int btbucket_split_term_default(const char *one, 
+  unsigned int onelen, const char *two, unsigned int twolen, char *lastchar) {
+    *lastchar = two[twolen - 1];
+    return twolen;
+}
+
+/* helper function that prints the contents of a bucket to stdout */
+int bucket_print(void *bucket, unsigned int bucketsize, int strategy);
+int btbucket_print(void *btbucket, unsigned int bucketsize, int strategy) {
+    return bucket_print(BTBUCKET_BUCKET(btbucket), 
+      BTBUCKET_SIZE(btbucket, bucketsize), strategy);
+}
+#ifdef BTBUCKET_TEST
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void simsplit(const char *one, const char *two) {
+    char buf[101];
+    char buf1[101];
+    char buf2[101];
+    char buf3[101];
+    char lastchar;
+    unsigned int len,
+                 len1,
+                 len2,
+                 len3;
+
+    len3 = btbucket_common_prefix(one, str_len((char *) one), two, 
+        str_len((char *) two), &lastchar);
+
+    str_ncpy((char *) buf3, (char *) one, len3 - 1 + !len3);
+    buf3[len3 - 1 + !len3] = lastchar;
+    buf3[len3] = '\0';
+
+    len = btbucket_split_term(one, str_len((char *) one), two, 
+        str_len((char *) two), &lastchar);
+
+    assert(len < 100);
+
+    str_ncpy((char *) buf, (char *) two, len - 1 + !len);
+    buf[len - 1 + !len] = lastchar;
+    buf[len] = '\0';
+
+    len1 = btbucket_common_prefix(one, str_len((char *) one), buf, 
+        str_len((char *) buf), &lastchar);
+
+    str_ncpy((char *) buf1, (char *) one, len1 - 1 + !len1);
+    buf1[len1 - 1 + !len1] = lastchar;
+    buf1[len1] = '\0';
+
+    len2 = btbucket_common_prefix(buf, str_len((char *) buf), two, 
+        str_len((char *) two), &lastchar);
+
+    str_ncpy((char *) buf2, (char *) buf, len2 - 1 + !len2);
+    buf2[len2 - 1 + !len2] = lastchar;
+    buf2[len2] = '\0';
+
+    printf("[(%s) '%s', '%s') -> [(%s) '%s', '%s')  [(%s) '%s', '%s')\n", buf3, 
+      one + len3, two + len3, buf1, one + len1, buf + len1, buf2, buf + len2, 
+      two + len2);
+    return;
+}
+
+void writeprefix(const char *one, const char *two) {
+    char buf[101];
+    char lastchar;
+    unsigned int len;
+
+    len = btbucket_common_prefix(one, str_len((char *) one), two, 
+        str_len((char *) two), &lastchar);
+
+    if (len < 100) {
+        str_ncpy((char *) buf, (char *) one, len - 1);
+        buf[len - 1] = lastchar;
+        buf[len] = '\0';
+        printf("common prefix of strings [%s, %s) is '%s'\n", (char *) one, 
+          (char *) two, buf);
+    } else {
+        printf("common prefix of strings [%s, %s) is %u chars long (too long "
+          "for buf)\n", (char *) one, (char *) two, len);
+    }
+}
+
+void writesplit(const char *one, const char *two) {
+    char buf[101];
+    char lastchar;
+    unsigned int len;
+
+    len = btbucket_split_term(one, str_len((char *) one), two, 
+        str_len((char *) two), &lastchar);
+
+    if (len < 100) {
+        str_ncpy((char *) buf, (char *) one, len - 1);
+        buf[len - 1] = lastchar;
+        buf[len] = '\0';
+        printf("split term of strings [%s, %s) is '%s'\n", (char *) one, 
+          (char *) two, buf);
+    } else {
+        printf("split term of strings [%s, %s) is %u chars long (too long "
+          "for buf)\n", (char *) one, (char *) two, len);
+    }
+}
+
+int main(int argc, char **argv) {
+    if (argc != 3) {
+        fprintf(stderr, "usage: %s string1 string2\n", *argv);
+        return EXIT_FAILURE;
+    } else {
+        simsplit(argv[1], argv[2]);
+        return EXIT_SUCCESS;
+    }
+}
+#endif
+
+
diff --git a/src/btbulk.c b/src/btbulk.c
new file mode 100644 (file)
index 0000000..1fb7621
--- /dev/null
@@ -0,0 +1,701 @@
+/* btbulk.c implements a bulk-loading algorithm for bulk b-tree
+ * construction (technically a b+-tree).  Bulk loading is a fairly 
+ * straight-forward affair in concept.  Since you accept sorted input 
+ * entries they naturally form b-tree leaves by fitting them into buckets.  
+ * The nodes can then be formed by pushing up the first entry in each
+ * bucket into the next level to form index entries in the internal
+ * nodes, and continuing this process until we form only one node,
+ * which is the root.  A proper description of this process should be
+ * given in any good database book, and Database Management Systems by
+ * Ramakrishnan has a good section on it on page 104 (2nd ed).
+ *
+ * This algorithm also has the attractive property that it only
+ * requires that one bucket for each level of the b-tree being created
+ * be held in memory at any one time, which is essential for
+ * scalability.  We can accomodate this fairly easily in the
+ * algorithm, since we're only writing to one bucket on each level at
+ * a time.  However, the main complication comes in that we want to
+ * produce leaves that contain a pointer to its right sibling.  When
+ * we're processing a stream of insertions, we want to write out each
+ * b-tree leaf as it becomes full, but we don't know where its right
+ * sibling is going to be placed until the next bucket becomes full as
+ * well.  Our solution to that is to buffer them in memory until we can resolve
+ * the threading.
+ *
+ * Another difficulty with bulk-loading is propagating a bucket
+ * address and term up the index of the btree, since if we try to insert 
+ * when the btree bucket is first created, the term is known but the
+ * address isn't, and vice-versa if we try to insert when a bucket is
+ * being written out.  The solution here is to allocate space in the
+ * parent bucket when the child bucket is created, keep the pointer
+ * around (the parent bucket has to be buffered until its full, which
+ * won't happen until anther child bucket is created) and then fill in
+ * the space once we decide to write out the child bucket, placing it
+ * within the index. 
+ *
+ * Other problems with bulk loading come when considering additional
+ * b-tree compression hueristics like prefix b-trees (determining the
+ * optimal splitting point is a bit tricky while processing a stream
+ * of updates).  We don't handle that yet, i'll talk about it when we
+ * do.
+ *
+ * written nml 2003-05-21
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "btbulk.h"
+
+#include "bit.h"
+#include "bucket.h"
+#include "btbucket.h"
+#include "_btbucket.h"
+#include "mem.h"
+#include "_mem.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+#define NO_LAST_LEAF (-1)
+
+/* structure representing one btree bucket held in memory during bulk
+ * loading */
+struct btbulk_bucket {
+    struct btbulk_bucket *parent,     /* bucket that is next level up */
+                         *child;      /* bucket that is next level down */
+    void *parent_space;               /* space reserved in parent bucket for 
+                                       * locaion of this bucket when we find 
+                                       * out where it goes */
+    unsigned int used;                /* number of bytes used in bucket */
+    char mem[1];                      /* memory content of this bucket (struct 
+                                       * hack) */
+};
+
+/* states that the bulk insertion can be in */
+enum btbulk_states {
+    STATE_ERR,                        /* an error has occurred */
+    STATE_INSERT,                     /* ready to insert another entry */
+    STATE_WRITE,                      /* output of bucket required */
+    STATE_NEW,                        /* bucket needs to be initialised */
+    STATE_FINISH                      /* algorithm is finishing */
+};
+
+struct btbulk_state {
+    enum btbulk_states state;         /* current state of bulk construction */
+    struct btbulk_bucket *curr;       /* current btree bucket */
+    struct btbulk_bucket *btree;      /* pointer to bottom level of btree */
+    unsigned int pagesize;            /* pagesize of btree buckets */
+    unsigned long int maxfilesize;    /* maximum size of a file */
+    float fill;                       /* btree fill factor */
+    int leaf_strategy;                /* btree leaf node bucket strategy */
+    int node_strategy;                /* btree internal node bucket strategy */
+    unsigned int levels;              /* btree levels */
+    unsigned int lastleaf;            /* pointer to last leaf stored in outbuf, 
+                                       * so that we can thread it to the next 
+                                       * leaf.  Contains NO_LAST_LEAF if 
+                                       * absent. */
+
+    float overhead;                   /* estimate of overhead for each bucket */
+    double used;                      /* total bytes used in finished buckets */
+    double total;                     /* total bytes in finished buckets */
+
+    /* output buffer, so that we don't have to perform one write per bucket.
+     * Also allows us to thread leaf buckets together.  Note that we need at
+     * least as many pages in buffer as there are levels to do threading. */
+    char *outbuf;                     /* circular output buffer */
+    unsigned int outbuf_capacity;     /* number of b-tree pages that can be 
+                                       * stored in outbuf */
+    unsigned int outbuf_size;         /* number of b-tree pages that are 
+                                       * currently stored in outbuf */
+    unsigned int outbuf_start;        /* current start of buffer */
+};
+
+struct btbulk *btbulk_new(unsigned int pagesize, unsigned long int maxfilesize,
+  int leaf_strategy, int node_strategy, float fill_factor, 
+  unsigned int buffer_pages, struct btbulk *space) {
+    unsigned int size;
+
+    if (buffer_pages == 0) {
+        buffer_pages = 1;
+    }
+
+    if ((space->state = malloc(sizeof(*space->state))) 
+      && (space->state->curr = space->state->btree
+        = malloc(sizeof(*space->state->curr) + pagesize))
+      && (space->state->outbuf = malloc(pagesize * buffer_pages))) {
+
+        space->state->pagesize = pagesize;
+        if ((fill_factor > 0.0) && (fill_factor <= 1.0)) {
+            space->state->fill = fill_factor;
+        } else {
+            space->state->fill = 1.0;
+        }
+        space->state->pagesize = pagesize;
+        space->state->leaf_strategy = leaf_strategy;
+        space->state->node_strategy = node_strategy;
+        space->state->maxfilesize = maxfilesize;
+        space->state->state = STATE_INSERT;
+        space->state->btree->parent = NULL;
+        space->state->btree->child = NULL;
+        space->state->btree->parent_space = NULL;
+        space->state->outbuf_capacity = buffer_pages;
+        space->state->outbuf_size = space->state->outbuf_start = 0;
+        space->state->lastleaf = NO_LAST_LEAF;
+        space->state->levels = 1;
+        space->state->overhead = 0.2F; /* initial estimate, will recalculate 
+                                        * when we have information */
+        space->state->used = space->state->total = 0;
+
+        /* initialise current bucket */
+        size = 0;
+        btbucket_new(space->state->btree->mem, pagesize, -1, -1, 1, 
+          "", &size);
+        bucket_new(BTBUCKET_BUCKET(space->state->btree->mem), 
+          BTBUCKET_SIZE(space->state->btree->mem, pagesize), 
+          leaf_strategy);
+        return space;
+    } else {
+        if (space->state) {
+            if (space->state->curr) {
+                free(space->state->curr);
+            }
+            free(space->state);
+        }
+
+        return NULL;
+    }
+}
+
+void btbulk_delete(struct btbulk *bulk) {
+    struct btbulk_bucket *bucket = bulk->state->btree,
+                         *next;
+
+    /* iterate to bottom of btree bucket list (shouldn't be necessary, but we'll
+     * do it anyway) */
+    while (bucket->child) {
+        bucket = bucket->child;
+    }
+
+    /* iterate back up, freeing everything */
+    while (bucket) {
+        next = bucket->parent;
+        free(bucket); 
+        bucket = next; 
+    }
+
+    if (bulk->state->outbuf) {
+        free(bulk->state->outbuf);
+    }
+
+    free(bulk->state);
+    return;
+}
+
+/* internal function to calculate where a page will land given current position
+ * and buffering information */
+static unsigned long int location(unsigned int fileno, unsigned long int offset,
+  unsigned long int maxfilesize, unsigned int pagesize, unsigned int pages, 
+  unsigned int *dst_fileno) {
+
+    /* predict where this page will land */
+    assert(offset <= maxfilesize);
+    while (offset + pagesize * pages > maxfilesize - pagesize) {
+        fileno++;
+        offset = 0;
+        pages -= (maxfilesize - offset) / pagesize;
+    }
+
+    *dst_fileno = fileno;
+    return offset + pagesize * pages;
+}
+
+/* internal function to try to make room in the buffer by shuffling it around.
+ * Returns _OK if space was made, else returns _WRITE */
+static enum btbulk_ret shuffle_buffer(struct btbulk *bulk) {
+    /* if we're using shuffle_buffer regularly, the circular buffer should 
+     * never wrap */
+    assert(bulk->state->outbuf_size + bulk->state->outbuf_start 
+      <= bulk->state->outbuf_capacity);
+
+    if (bulk->state->outbuf_start) {
+        /* shuffle circular buffer to ensure that it starts at the physical 
+         * start.  This costs us some time moving memory around, but ultimately 
+         * saves us file writes, and so should be an efficiency win */
+        memmove(bulk->state->outbuf, &bulk->state->outbuf[
+            bulk->state->pagesize * bulk->state->outbuf_start], 
+          bulk->state->outbuf_size * bulk->state->pagesize);
+
+        bulk->state->outbuf_start = 0;
+        return BTBULK_OK;
+    } else {
+        return BTBULK_WRITE;
+    }
+}
+
+/* internal function to decide how much stuff to output */
+static enum btbulk_ret output(struct btbulk *bulk) {
+    assert(bulk->state->outbuf_size);
+    assert(!bulk->state->outbuf_start);  /* should call shuffle_buffer first */
+    bulk->output.write.next_out 
+      = &bulk->state->outbuf[bulk->state->outbuf_start * bulk->state->pagesize];
+
+    /* note that avail_out currently contains number of *pages*, not bytes */
+    bulk->output.write.avail_out = bulk->state->outbuf_size;
+
+    /* check that output region doesn't exceed circular limit */
+    if (bulk->state->outbuf_start + bulk->state->outbuf_size 
+      > bulk->state->outbuf_capacity) {
+        bulk->output.write.avail_out 
+          = bulk->state->outbuf_capacity - bulk->state->outbuf_start;
+    }
+
+    /* check that output region doesn't cross files */
+    if (bulk->offset > bulk->state->maxfilesize 
+      - bulk->state->pagesize * bulk->output.write.avail_out) {
+        /* note that this will set avail_out to 0 if we're at the end of the
+         * file */
+        bulk->output.write.avail_out 
+          = (bulk->state->maxfilesize - bulk->offset) / bulk->state->pagesize;
+    }
+
+    /* check that we're not outputting the last leaf */
+    if (bulk->state->lastleaf != NO_LAST_LEAF) {
+        if (bulk->output.write.avail_out > bulk->state->lastleaf) {
+            bulk->output.write.avail_out = bulk->state->lastleaf;
+        }
+
+        /* keep lastleaf as an offset number of pages from the start of the 
+         * circular buffer */
+        bulk->state->lastleaf -= bulk->output.write.avail_out;
+    }
+
+    bulk->state->outbuf_size -= bulk->output.write.avail_out;
+    bulk->state->outbuf_start += bulk->output.write.avail_out;
+    bulk->state->outbuf_start %= bulk->state->outbuf_capacity;
+    bulk->output.write.avail_out *= bulk->state->pagesize; /* pages to bytes */
+
+    if (bulk->output.write.avail_out) {
+        return BTBULK_WRITE;
+    } else {
+        /* should be at the end of the file */
+        assert(bulk->offset + bulk->state->pagesize > bulk->state->maxfilesize 
+          - bulk->output.write.avail_out);
+        return BTBULK_FLUSH;
+    }
+}
+
+int btbulk_insert(struct btbulk *bulk) {
+    struct btbulk_bucket *curr;
+    int toobig;
+    unsigned int size,
+                 fileno,
+                 pos;
+    unsigned long int offset;
+
+    /* jump to correct state */
+    switch (bulk->state->state) {
+    case STATE_INSERT: goto insert_label;
+    case STATE_WRITE: goto write_label;
+    case STATE_NEW: goto new_label;
+    default: goto err_label;
+    }
+
+/* insert an entry into the bottom bucket */
+insert_label:
+    /* write an entry into the vocab, checking for appropriate fill rate */
+    if (((bulk->state->fill < 1.0) 
+      && ((bulk->state->btree->used / (float) bulk->state->pagesize) 
+        + bulk->state->overhead > bulk->state->fill))
+      || !(bulk->output.ok.data 
+        = bucket_append(BTBUCKET_BUCKET(bulk->state->btree->mem), 
+            BTBUCKET_SIZE(bulk->state->btree->mem, bulk->state->pagesize),
+            bulk->state->leaf_strategy, bulk->term, 
+            bulk->termlen, bulk->datasize, &toobig))) {
+
+        /* have to page btree bucket out and start a new one */
+        bulk->state->curr = bulk->state->btree;
+        goto write_label;
+    }
+    bulk->state->btree->used += bulk->termlen + bulk->datasize;
+
+    bulk->state->state = STATE_INSERT;
+    return BTBULK_OK;
+
+write_label:
+    /* page out the current btree bucket and start a new one */
+    curr = bulk->state->curr;
+
+    /* lack of parent space allocation indicates that we need to push up a 
+     * new level of the btree */
+    if (!curr->parent_space) {
+        assert(!curr->parent);
+        if ((curr->parent 
+          = malloc(sizeof(*curr->parent) + bulk->state->pagesize))) {
+            curr->parent->parent = NULL;
+            curr->parent->parent_space = NULL;
+            curr->parent->used = btbucket_entry_size();
+            size = 0;
+            btbucket_new(curr->parent->mem, bulk->state->pagesize, 
+              -1, -1, 0, "", &size);
+            bucket_new(BTBUCKET_BUCKET(curr->parent->mem), 
+              BTBUCKET_SIZE(curr->parent->mem, bulk->state->pagesize), 
+              bulk->state->node_strategy);
+            curr->parent->child = curr;
+
+            /* insert NULL entry */
+            if ((curr->parent_space 
+              = bucket_alloc(BTBUCKET_BUCKET(curr->parent->mem),
+                BTBUCKET_SIZE(curr->parent->mem, bulk->state->pagesize),
+                bulk->state->node_strategy, "", 0, btbucket_entry_size(),  
+                &toobig, NULL))) {
+
+                /* allocation succeded, will fill it in below */
+                bulk->state->levels++;
+            } else {
+                goto err_label;
+            }
+        } else {
+            /* couldn't allocate */
+            goto err_label;
+        }
+
+        /* ensure we've got enough buffer space for all levels of tree */
+        if (bulk->state->outbuf_capacity <= bulk->state->levels) {
+            unsigned int pgsize = bulk->state->pagesize;
+            char *oldbuf = bulk->state->outbuf;
+            char *newbuf 
+              = malloc((bulk->state->levels + 1) * bulk->state->pagesize);
+
+            /* note that we can't just realloc, because that may insert space
+             * into the occupied portion of the circular buffer.  This is
+             * probably the easiest way to deal with the problem */
+
+            if (newbuf) {
+                if (bulk->state->outbuf_start + bulk->state->outbuf_size 
+                  > bulk->state->outbuf_capacity) {
+                    unsigned int split = bulk->state->outbuf_capacity 
+                      - bulk->state->outbuf_start;
+
+                    /* circular buffer in two pieces */
+                    memcpy(newbuf, &oldbuf[bulk->state->outbuf_start * pgsize], 
+                      split * pgsize);
+                    memcpy(&newbuf[split * pgsize], oldbuf, 
+                      (bulk->state->outbuf_capacity - split) * pgsize);
+                } else {
+                    /* circular buffer in one piece */
+                    memcpy(newbuf, &oldbuf[bulk->state->outbuf_start * pgsize], 
+                      bulk->state->outbuf_size * pgsize);
+                }
+                bulk->state->outbuf_start = 0;
+                free(oldbuf);
+                bulk->state->outbuf = newbuf;
+                bulk->state->outbuf_capacity = bulk->state->levels + 1;
+            } else {
+                /* couldn't allocate */
+                goto err_label;
+            }
+        }
+    }
+
+    /* predict where this page will land */
+    offset = location(bulk->fileno, bulk->offset, 
+        bulk->state->maxfilesize, bulk->state->pagesize, 
+        bulk->state->outbuf_size, &fileno);
+
+    /* write address into current bucket parent space pointer */
+    assert(((char *) curr->parent_space >= curr->parent->mem) 
+      && ((char *) curr->parent_space 
+        <= curr->parent->mem + bulk->state->pagesize));
+    BTBUCKET_SET_ENTRY(curr->parent_space, fileno, offset);
+
+    if (!curr->child && (bulk->state->lastleaf != NO_LAST_LEAF)) {
+        /* need to thread last leaf to where this one will go */
+        btbucket_set_sibling(&bulk->state->outbuf[
+          ((bulk->state->outbuf_start + bulk->state->lastleaf) 
+            % bulk->state->outbuf_capacity) * bulk->state->pagesize], 
+          bulk->state->pagesize, fileno, offset);
+        bulk->state->lastleaf = NO_LAST_LEAF;
+    }
+
+    /* ensure that there's space in the output buffer */
+    shuffle_buffer(bulk);
+    if (bulk->state->outbuf_size >= bulk->state->outbuf_capacity) {
+        bulk->state->state = STATE_WRITE; /* note that redo'ing this state 
+                                           * won't hurt */
+        return output(bulk);
+    }
+
+    /* have recorded location, now write bucket into buffer */
+    assert(bulk->state->outbuf_size < bulk->state->outbuf_capacity);
+    pos = (bulk->state->outbuf_start + bulk->state->outbuf_size) 
+      % bulk->state->outbuf_capacity;
+    memcpy(&bulk->state->outbuf[pos * bulk->state->pagesize], 
+        curr->mem, bulk->state->pagesize);
+    if (!curr->child) {
+        /* record last leaf position */
+        bulk->state->lastleaf = bulk->state->outbuf_size; 
+    }
+    bulk->state->outbuf_size++;
+    goto new_label;
+
+/* old bucket has been paged out, initialise new bucket and get back to
+ * insertion */
+new_label:
+
+    curr = bulk->state->curr;
+
+    /* initialise new bucket, recalculating overhead statistic along the way */
+
+    bulk->state->total += bulk->state->pagesize;
+    curr->used = 0;
+    if (BTBUCKET_LEAF(curr->mem, bulk->state->pagesize)) {
+        /* its a leaf */
+        bulk->state->used 
+          += bulk->state->pagesize - bucket_unused(BTBUCKET_BUCKET(curr->mem), 
+              BTBUCKET_SIZE(curr->mem, bulk->state->pagesize), 
+              bulk->state->leaf_strategy);
+        size = 0;
+        btbucket_new(curr->mem, bulk->state->pagesize, 
+          -1, -1, 1, "", &size);
+        bucket_new(BTBUCKET_BUCKET(curr->mem), 
+          BTBUCKET_SIZE(curr->mem, bulk->state->pagesize), 
+          bulk->state->leaf_strategy);
+    } else {
+        /* its a node */
+        bulk->state->used 
+          += bulk->state->pagesize - bucket_unused(BTBUCKET_BUCKET(curr->mem), 
+              BTBUCKET_SIZE(curr->mem, bulk->state->pagesize), 
+              bulk->state->node_strategy);
+        size = 0;
+        btbucket_new(curr->mem, bulk->state->pagesize, 
+          -1, -1, 0, "", &size);
+        bucket_new(BTBUCKET_BUCKET(curr->mem), 
+          BTBUCKET_SIZE(curr->mem, bulk->state->pagesize), 
+          bulk->state->node_strategy);
+    }
+    bulk->state->overhead 
+      = (float) (1 - bulk->state->used / bulk->state->total);
+    assert(bulk->state->overhead >= 0.0 && bulk->state->overhead < 1.0);
+
+    /* propagate split up the tree and allocation back down it (look
+     * carefully, this code is a little mind-bending) */
+    while (curr) {
+        assert(curr->parent);
+        if (((bulk->state->fill < 1.0) 
+          && ((curr->parent->used / (float) bulk->state->pagesize) 
+            + bulk->state->overhead > bulk->state->fill))
+          || (!(curr->parent_space 
+            = bucket_alloc(BTBUCKET_BUCKET(curr->parent->mem), 
+              BTBUCKET_SIZE(curr->parent->mem, bulk->state->pagesize),
+              bulk->state->node_strategy, bulk->term, bulk->termlen,
+              btbucket_entry_size(), &toobig, NULL)))) {
+
+            /* couldn't allocate space from parent bucket, have to
+             * perform the same procedure on it */
+            bulk->state->curr = curr->parent;
+            goto write_label;
+        }
+        curr->parent->used += btbucket_entry_size() + bulk->termlen;
+        curr = curr->child;
+    }
+    goto insert_label;
+
+err_label:
+    bulk->state->state = STATE_ERR;
+    return BTBULK_ERR;
+}
+
+int btbulk_finalise(struct btbulk *bulk, unsigned int *root_fileno, 
+  unsigned long int *root_offset) {
+    struct btbulk_bucket *curr;
+    unsigned int fileno,
+                 pos;
+    unsigned long int offset;
+
+    if (bulk->state->state == STATE_INSERT) {
+        /* need to initialise algorithm to the lowest level of btree */
+        curr = bulk->state->curr = bulk->state->btree;
+
+        /* predict where this page will land */
+        offset = location(bulk->fileno, bulk->offset,
+            bulk->state->maxfilesize, bulk->state->pagesize, 
+            bulk->state->outbuf_size, &fileno);
+
+        /* thread this final leaf page to itself */
+        btbucket_set_sibling(curr->mem, bulk->state->pagesize, 
+          fileno, offset);
+
+        if (bulk->state->lastleaf != NO_LAST_LEAF) {
+            /* thread previous leaf to this one */
+            btbucket_set_sibling(&bulk->state->outbuf[
+              ((bulk->state->outbuf_start + bulk->state->lastleaf) 
+                % bulk->state->outbuf_capacity) * bulk->state->pagesize], 
+              bulk->state->pagesize, fileno, offset);
+            bulk->state->lastleaf = NO_LAST_LEAF;
+        }
+    } else if (bulk->state->state == STATE_FINISH) {
+        /* pick up where we left off */
+        curr = bulk->state->curr;
+    } else {
+        /* attempt to start from some weird state */
+        return BTBULK_ERR;
+    }
+
+    bulk->state->state = STATE_FINISH;
+
+    /* write out btree buckets */
+    while (curr) {
+         /* ensure that there's space in the output buffer */
+         shuffle_buffer(bulk);
+         if (bulk->state->outbuf_size >= bulk->state->outbuf_capacity) {
+             return output(bulk);
+         }
+
+        /* predict where this page will land */
+        offset = location(bulk->fileno, bulk->offset, 
+            bulk->state->maxfilesize, bulk->state->pagesize, 
+            bulk->state->outbuf_size, &fileno);
+
+        if (curr->parent_space) {
+            /* encode pointer into parent bucket */
+            assert(((char *) curr->parent_space >= curr->parent->mem)
+              && ((char *) curr->parent_space 
+                <= curr->parent->mem + bulk->state->pagesize));
+            BTBUCKET_SET_ENTRY(curr->parent_space, fileno, offset);
+        } else {
+            /* this is the root node */
+            *root_fileno = fileno;
+            *root_offset = offset;
+        }
+
+        /* write bucket into buffer */
+        assert(bulk->state->outbuf_size < bulk->state->outbuf_capacity);
+        pos = (bulk->state->outbuf_start + bulk->state->outbuf_size) 
+          % bulk->state->outbuf_capacity;
+        memcpy(&bulk->state->outbuf[pos * bulk->state->pagesize], 
+            curr->mem, bulk->state->pagesize);
+        bulk->state->outbuf_size++;
+
+        /* iterate up to next btree bucket */
+        curr = bulk->state->curr = curr->parent;
+    }
+
+    shuffle_buffer(bulk);
+    if (bulk->state->outbuf_size) {
+        return output(bulk);
+    }
+    assert(bulk->state->lastleaf == NO_LAST_LEAF);
+    assert(bulk->state->outbuf_size == 0);
+    return BTBULK_FINISH;
+}
+
+struct btbulk_read_state {
+    unsigned int fileno;             /* fileno of current btree bucket */
+    unsigned long int offset;        /* offset of current btree bucket */
+    unsigned int term;               /* term index in current btree bucket */
+    const char *btbucket;            /* cached pointer to current bucket */
+    unsigned long int inpos;         /* input offset_in when we cached current 
+                                      * btbucket pointer */
+    unsigned int inlen;              /* input avail_in when we cached current 
+                                      * btbucket pointer */
+    unsigned int pagesize;           /* btree bucket size */
+    int strategy;                    /* btree leaf node strategy */
+};
+
+struct btbulk_read *btbulk_read_new(unsigned int pagesize, 
+  int strategy, unsigned int first_page_fileno, 
+  unsigned long int first_page_offset, struct btbulk_read *space) {
+
+    if ((space->state = malloc(sizeof(*space->state)))) {
+        space->next_in = NULL;
+        space->avail_in = 0;
+        space->fileno_in = 0;
+        space->offset_in = 0;
+        space->output.ok.term = NULL;
+        space->output.ok.data = NULL;
+        space->output.ok.datalen = 0;
+        space->output.ok.termlen = 0;
+
+        space->state->fileno = first_page_fileno;
+        space->state->offset = first_page_offset;
+        space->state->btbucket = NULL;
+        space->state->strategy = strategy;
+        space->state->pagesize = pagesize;
+        return space;
+    } else {
+        return NULL;
+    }
+}
+
+void btbulk_read_delete(struct btbulk_read *bulk) {
+    free(bulk->state);
+}
+
+enum btbulk_ret btbulk_read(struct btbulk_read *bulk) {
+    unsigned int fileno;
+    unsigned long int offset;
+
+    /* ensure that we're got the correct page */
+    do {
+        if (!bulk->state->btbucket
+          || (bulk->fileno_in != bulk->state->fileno)
+          || (bulk->offset_in != bulk->state->inpos)
+          || (bulk->avail_in != bulk->state->inlen)) {
+            /* correct bucket not in pointer, search input buffer for it */
+            if ((bulk->fileno_in == bulk->state->fileno) 
+              && (bulk->offset_in <= bulk->state->offset)
+              && (bulk->avail_in >= bulk->state->pagesize)
+              && (bulk->offset_in + bulk->avail_in - bulk->state->pagesize 
+                >= bulk->state->offset)) {
+
+                /* bucket is in input buffer, save pointer to it */ 
+                bulk->state->inpos = bulk->offset_in;
+                bulk->state->inlen = bulk->avail_in;
+                bulk->state->btbucket 
+                  = bulk->next_in + bulk->state->offset - bulk->offset_in;
+                bulk->state->term = 0;
+            } else {
+                bulk->output.read.fileno = bulk->state->fileno;
+                bulk->output.read.offset = bulk->state->offset;
+                return BTBULK_READ;
+            }
+        }
+
+        /* should now have the correct leaf node at btbucket pointer */
+        assert(bulk->state->btbucket);
+        assert(BTBUCKET_LEAF(bulk->state->btbucket, bulk->state->pagesize));
+
+        if ((bulk->output.ok.term 
+          = bucket_term_at(BTBUCKET_BUCKET(bulk->state->btbucket), 
+              BTBUCKET_SIZE(bulk->state->btbucket, bulk->state->pagesize), 
+            bulk->state->strategy, bulk->state->term, &bulk->output.ok.termlen, 
+            (void **) &bulk->output.ok.data, &bulk->output.ok.datalen))) {
+
+            /* got next term, return */
+            bulk->state->term++;
+            return BTBULK_OK;
+        } else {
+            /* no more terms in this bucket, go to next leaf bucket */
+            fileno = bulk->state->fileno;
+            offset = bulk->state->offset;
+
+            btbucket_sibling((void *) bulk->state->btbucket, 
+              bulk->state->pagesize, &bulk->state->fileno, 
+              &bulk->state->offset);
+            
+            /* invalidate saved pointer, since we need to move to a new 
+             * bucket */
+            bulk->state->btbucket = NULL;
+        }
+    } while ((fileno != bulk->state->fileno) 
+      || (offset != bulk->state->offset));
+
+    /* iteration finished */
+    return BTBULK_FINISH;
+}
+
+unsigned long int btbulk_read_offset(struct btbulk_read *bulk) {
+    return bulk->state->offset;
+}
+
diff --git a/src/bucket.c b/src/bucket.c
new file mode 100644 (file)
index 0000000..f669347
--- /dev/null
@@ -0,0 +1,2389 @@
+/* bucket.c implements a structure that manages short inverted lists by 
+ * keeping them in fixed size buckets.
+ *
+ * actually, since i need to do some experimentation to find the best bucket
+ * design, it will probably implement a number of structures.  There are a
+ * number of good reasons for having different bucket structures around,
+ * including specialising to match the current architecture endianness and
+ * reducing costs for fixed-length entries and keys.
+ *
+ * The first bucket design that we will use is as follows:
+ *
+ * +-------------------------------+
+ * |num|t1p|t1l|t2p|t2l|           |
+ * +-------------------------------+
+ * |   |xxxxx,term2|xxxxxxxxx,term1|
+ * +-------------------------------+
+ *
+ * term vectors are stored in lexographic order with the corresponding term 
+ * immediately afterward. (shown as xxxx,term1 etc).  
+ * The term length is stored in the directory as t1l, t2l etc.  
+ * The term pointers (t1p, t2p etc) point to the start of the entry for that 
+ * term, where entries are kept packed to the back of the bucket (to allow 
+ * easy appending of new entries).  All entries in the directory (shown on top 
+ * row) are fixed length numbers of size 16 bits (stored in big-endian format),
+ * which allows quick lookup given the index of the term.  
+ * The term pointers combined with knowledge of the size of the bucket 
+ * and the term lengths can be used to deduce the length of each vector.  
+ *
+ * Bucket design 2 is the same as one, except that all entries have uniform
+ * length and are stored (once) at the start of the bucket. 
+ *
+ * +-------------------------------+
+ * |num|size|t1p|t2p|              |
+ * +-------------------------------+
+ * |   |xxxxx,term2|xxxxxxxxx,term1|
+ * +-------------------------------+
+ *
+ * written nml 2003-10-06
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "bucket.h"
+
+#include "_mem.h"
+
+#include "bit.h"
+#include "mem.h"
+#include "str.h"      /* for str_ncmp use in assert */
+#include "vec.h"
+#include "zstdint.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* return address of entries (it's at the start of memory) for bucket designs
+ * 1 and 2 */
+#define B1_ENTRIES_ADDR(base) (base)
+#define B2_ENTRIES_ADDR(base) (base)
+
+/* return address of the pointer for entries for bucket designs 1 and 2 */
+#define B1_PTR(entry) (sizeof(uint16_t) * (2 * (entry) + 1))
+#define B1_PTR_ADDR(base, entry) (((char *) base) + B1_PTR(entry))
+#define B2_PTR(entry) (sizeof(uint16_t) * ((entry) + 2))
+#define B2_PTR_ADDR(base, entry) (((char *) base) + B2_PTR(entry))
+
+/* return address of the size for an entry for bucket designs 1 and 2 */
+#define B1_SIZE(entry) (sizeof(uint16_t) * (2 * (entry) + 2))
+#define B1_SIZE_ADDR(base, entry) (((char *) base) + B1_SIZE(entry))
+#define B2_SIZE(entry) (sizeof(uint16_t))
+#define B2_SIZE_ADDR(base, entry) (((char *) base) + B1_SIZE(entry))
+
+/* macro to read a vbyte number from cmem (which is incremented over the number)
+ * into n.  Note that cmem must be a uchar * */
+#define GETVBYTE(cmem, n)                                                     \
+    if (1) {                                                                  \
+        unsigned int GETVBYTE_count = 0;                                      \
+                                                                              \
+        *(n) = 0;                                                             \
+        while ((STR_FROM_CHAR(*(cmem)) >= 128)) {                             \
+            *(n) |= (*(cmem) & 0x7f) << GETVBYTE_count;                       \
+            GETVBYTE_count += 7;                                              \
+            (cmem)++;                                                         \
+        }                                                                     \
+        *(n) |= STR_FROM_CHAR(*(cmem)) << GETVBYTE_count;                     \
+        (cmem)++;                                                             \
+    } else 
+
+/* macro to put a vbyte number to cmem (which is incremented over the number)
+ * from n (which is destroyed by the operation).  Note that cmem must be 
+ * a uchar * */
+#define PUTVBYTE(cmem, n)                                                  \
+    if (1) {                                                                  \
+    while ((n) >= 128) {                                                      \
+            *(cmem) = ((n) & 0x7f) | 0x80;                                    \
+            (n) >>= 7;                                                        \
+            (cmem)++;                                                         \
+        }                                                                     \
+        *(cmem) = ((unsigned char) n);                                        \
+        (cmem)++;                                                             \
+    } else
+
+int bucket_new(void *mem, unsigned int bucketsize, int strategy) {
+    if (bucketsize >= UINT16_MAX) {
+        return 0;
+    }
+
+    /* this isn't strictly necessary, but means that everything is guaranteed
+     * to be initialised (even the space we don't use) */
+    memset(mem, 0, bucketsize);
+
+    switch (strategy) {
+    case 1:
+    case 2:
+        return 1;
+
+    default:
+        return 0;
+    };
+}
+
+int bucket_sorted(int strategy) {
+    switch (strategy) {
+    case 1:
+    case 2:
+        return 1;
+
+    default:
+        return 0;
+    }
+}
+
+unsigned int bucket_entries(void *mem, unsigned int bucketsize, int strategy) {
+    uint16_t entries;
+
+    switch (strategy) {
+    case 1:
+    case 2:
+        /* read number of entries */
+        MEM_NTOH(&entries, mem, sizeof(entries));
+        return entries;
+        break;
+
+    default:
+        assert(0);
+        return 0;
+        break;
+    }
+}
+
+unsigned int bucket_utilised(void *mem, unsigned int bucketsize, int strategy) {
+    unsigned int i;
+    uint16_t entries,
+             length,
+             utilised = 0;
+
+    switch (strategy) {
+    case 1:
+        /* read number of entries */
+        MEM_NTOH(&entries, mem, sizeof(entries));
+
+        /* read each entry */
+        for (i = 0; i < entries; i++) {
+            MEM_NTOH(&length, B1_SIZE_ADDR(mem, i), sizeof(length));
+            utilised += length;
+        }
+        return utilised;
+        break;
+
+    case 2:
+        /* read number of entries */
+        MEM_NTOH(&entries, mem, sizeof(entries));
+
+        /* read each entry */
+        for (i = 0; i < entries; i++) {
+            MEM_NTOH(&length, B2_SIZE_ADDR(mem, i), sizeof(length));
+            utilised += length;
+        }
+        return utilised;
+        break;
+
+    default:
+        assert(0);
+        return 0;
+        break;
+    }
+}
+
+unsigned int bucket_string(void *mem, unsigned int bucketsize, int strategy) {
+    unsigned int i;
+    uint16_t entries,
+             prevptr = bucketsize,
+             ptr,
+             length,
+             string = 0;
+    switch (strategy) {
+    case 1:
+        /* read number of entries */
+        MEM_NTOH(&entries, mem, sizeof(entries));
+
+        /* read each entry */
+        for (i = 0; i < entries; i++) {
+            MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i), sizeof(ptr));
+            MEM_NTOH(&length, B1_SIZE_ADDR(mem, i), sizeof(length));
+
+            string += (prevptr - ptr) - length;
+
+            prevptr = ptr;
+        }
+        return string;
+        break;
+
+    case 2:
+        /* read number of entries */
+        MEM_NTOH(&entries, mem, sizeof(entries));
+
+        /* read each entry */
+        for (i = 0; i < entries; i++) {
+            MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i), sizeof(ptr));
+            MEM_NTOH(&length, B2_SIZE_ADDR(mem, i), sizeof(length));
+
+            string += (prevptr - ptr) - length;
+
+            prevptr = ptr;
+        }
+        return string;
+        break;
+
+    default:
+        assert(0);
+        return 0;
+        break;
+    }
+}
+
+unsigned int bucket_overhead(void *mem, unsigned int bucketsize, int strategy) {
+    uint16_t entries;
+
+    switch (strategy) {
+    case 1:
+    case 2:
+        /* read number of entries */
+        MEM_NTOH(&entries, mem, sizeof(entries));
+
+        return entries * 2 * sizeof(uint16_t) + sizeof(entries);
+        break;
+
+    default:
+        assert(0);
+        return 0;
+        break;
+    }
+}
+
+unsigned int bucket_unused(void *mem, unsigned int bucketsize, int strategy) {
+    uint16_t entries,
+             lastptr;
+    switch (strategy) {
+    case 1:
+        /* read number of entries */
+        MEM_NTOH(&entries, mem, sizeof(entries));
+
+        /* read last entry */
+        if (entries) {
+            MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, entries - 1), sizeof(lastptr));
+
+            return lastptr - B1_PTR(entries);
+        } else {
+            return bucketsize - sizeof(entries);
+        }
+        break;
+
+    case 2:
+        /* read number of entries */
+        MEM_NTOH(&entries, mem, sizeof(entries));
+
+        /* read last entry */
+        if (entries) {
+            MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, entries - 1), sizeof(lastptr));
+
+            return lastptr - B2_PTR(entries);
+        } else {
+            return bucketsize - sizeof(entries);
+        }
+        break;
+
+    default:
+        assert(0);
+        return 0;
+        break;
+    }
+}
+
+/* functions for strategy 1 */
+
+/* binary searches a bucket for a term, returning the largest thing that is less
+ * than or equal to the given term (this property, which the usual binary search
+ * must be modified to provide, is important because we can then use it for
+ * insertion sorting as well as searching) */
+static unsigned int bucket1_binsearch(void *mem, unsigned int bucketsize, 
+  unsigned int entries, const char *term, unsigned int termlen) {
+    unsigned int l,
+                 r,
+                 m,
+                 i,
+                 len,
+                 tlen;
+    uint16_t ptr,
+             prevptr,
+             size;
+
+    assert(entries);
+
+    l = 0;
+    r = entries - 1;
+
+    while (l < r) {
+        m = BIT_DIV2((r + l + 1), 1);
+
+        /* decode m ptr */
+        MEM_NTOH(&ptr, B1_PTR_ADDR(mem, m), sizeof(ptr));
+        MEM_NTOH(&size, B1_SIZE_ADDR(mem, m), sizeof(ptr));
+
+        /* decode next pointer, so we know where this one ends */
+        if (m) {
+            MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, m - 1), sizeof(prevptr));
+
+            tlen = prevptr - ptr - size;
+            len = (tlen > termlen) ? termlen : tlen;
+
+            for (i = 0; i < len; i++) {
+                if (term[i] < ((char *) mem)[i + ptr + size]) {
+                    r = m - 1;
+                    break;
+                } else if (term[i] > ((char *) mem)[i + ptr + size]) {
+                    l = m;
+                    break;
+                }
+            }
+
+            /* exact match of prefixes */
+            if (i == len) {
+                if (termlen == tlen) {
+                    return m;
+                } else if (termlen < tlen) {
+                    r = m - 1;
+                } else {
+                    l = m;
+                }
+            }
+        } else {
+            /* m is first entry */
+            prevptr = bucketsize;
+
+            tlen = prevptr - ptr - size;
+            len = (tlen > termlen) ? termlen : tlen;
+
+            for (i = 0; i < len; i++) {
+                if (term[i] < ((char *) mem)[i + ptr + size]) {
+                    /* no exact match, act now to prevent underflow */
+                    return 0;
+                    break;
+                } else if (term[i] > ((char *) mem)[i + ptr + size]) {
+                    l = m;
+                    break;
+                }
+            }
+
+            /* exact match of prefixes */
+            if (i == len) {
+                if (termlen <= tlen) {
+                    /* no match, act now to prevent underflow */
+                    return 0;
+                } else {
+                    l = m;
+                }
+            }
+        }
+    }
+
+    /* no exact match */
+    return l;
+}
+
+void *bucket1_find(void *mem, unsigned int bucketsize, const char *term, 
+  unsigned int termlen, unsigned int *veclen, unsigned int *idx) {
+    unsigned int index,
+                 i;
+    uint16_t entries,
+             size,
+             ptr,
+             prevptr;
+             
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    /* handle 0 entries case */
+    if (!entries) {
+        return NULL;
+    }
+
+    index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+    if (((unsigned int) prevptr - ptr) - size == termlen) {
+        for (i = 0; i < termlen; i++) {
+            if (term[i] != ((char *) mem)[i + ptr + size]) {
+                return NULL;
+            }
+        }
+
+        *veclen = size;
+        if (idx) {
+            *idx = index;
+        }
+        return ((char *) mem) + ptr;
+    }
+
+    return NULL;
+}
+
+void *bucket1_search(void *mem, unsigned int bucketsize, const char *term, 
+  unsigned int termlen, unsigned int *veclen, unsigned int *idx) {
+    unsigned int index;
+    uint16_t entries,
+             size,
+             ptr,
+             prevptr;
+             
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    /* handle 0 entries case */
+    if (!entries) {
+        return NULL;
+    }
+
+    index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    if (idx) {
+        *idx = index;
+    }
+    *veclen = size;
+    return ((char *) mem) + ptr;
+}
+
+void *bucket1_realloc_at(void *mem, unsigned int bucketsize, 
+  unsigned int index, unsigned int newsize, int *toobig) {
+    unsigned int termlen;
+    uint16_t size,
+             lastaddr,
+             entries,
+             new_bucket_size,
+             ptr,
+             prevptr,
+             movesize;
+
+    new_bucket_size = bucketsize - sizeof(uint16_t);
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    /* handle 0 entries case */
+    if (!entries || (index >= entries)) {
+        *toobig = 0;
+        return NULL;
+    }
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+
+    /* read the last entry */
+    MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem, (entries - 1)), 
+      sizeof(lastaddr));
+
+    /* infer term length */
+    termlen = prevptr - ptr - size;
+
+    if (newsize > size) {
+        /* allocation is growing */
+
+        if ((newsize - size) > lastaddr - B1_PTR(entries)) {
+            /* not enough space to grow the entry */
+            if (termlen + newsize + sizeof(uint16_t) * 2 
+              > new_bucket_size) {
+                /* ... even if the bucket was empty */
+                *toobig = 1;
+            }
+            return NULL;
+        }
+
+        /* only need to move the bytes from the old entry */
+        movesize = size;
+    } else {
+        /* shrinking realloc, move only the bytes that will be preserved */
+        movesize = newsize;
+    }
+
+    /* move strings and vectors (careful, this line is tricky) */
+    memmove(((char *) mem) + lastaddr - (newsize - size), 
+      ((char *) mem) + lastaddr, ptr + movesize - lastaddr);
+
+    /* adjust pointers */
+    assert(((newsize > size) && ptr > (newsize - size)) 
+      || ((newsize < size) && ptr > (size - newsize))
+      || (newsize == size));
+    ptr -= (newsize - size);
+    MEM_HTON(B1_PTR_ADDR(mem, index), &ptr, sizeof(ptr));
+    MEM_HTON(B1_SIZE_ADDR(mem, index), &newsize, sizeof(ptr));
+    prevptr = ptr;
+
+    for (index++; index < entries; index++) {
+        MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), 
+          sizeof(ptr));
+        ptr -= (newsize - size);
+        MEM_HTON(B1_PTR_ADDR(mem, index), &ptr, 
+          sizeof(ptr));
+    }
+
+    /* done */
+    return ((char *) mem) + prevptr;
+}
+
+void *bucket1_realloc(void *mem, unsigned int bucketsize, const char *term,
+  unsigned int termlen, unsigned int newsize, int *toobig) {
+    unsigned int i,
+                 index;
+    uint16_t entries,
+             size,
+             ptr,
+             prevptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    /* handle 0 entries case */
+    if (!entries) {
+        *toobig = 0;
+        return NULL;
+    }
+
+    index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
+
+    /* verify that index points to requested term */
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+    if (((unsigned int) prevptr - ptr - size) == termlen) {
+        for (i = 0; i < termlen; i++) {
+            if (term[i] != ((char *) mem)[ptr + size + i]) {
+                return NULL;
+            }
+        }
+
+        return bucket1_realloc_at(mem, bucketsize, index, newsize, toobig);
+    } else {
+        return NULL;
+    }
+}
+
+void *bucket1_alloc(void *mem, unsigned int bucketsize, const char *term, 
+  unsigned int termlen, unsigned int newsize, int *toobig, 
+  unsigned int *idx) {
+    unsigned int index,
+                 i,
+                 len;
+    uint16_t size,
+             lastaddr,
+             entries,
+             ptr,
+             prevptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+    size = newsize;
+
+    if (entries) {
+        /* read the last entry */
+        MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem, (entries - 1)), 
+          sizeof(lastaddr));
+
+        /* check that we have enough space to allocate entry */
+        if ((size + termlen + 2 * (sizeof(uint16_t))) 
+          > (lastaddr - B1_PTR(entries))) {
+            /* test whether theres enough space to allocate the entry if the
+             * bucket was empty */
+            *toobig = (termlen + newsize + sizeof(uint16_t) * 2 
+              > bucketsize - sizeof(entries));
+            return NULL;
+        }
+
+        index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
+
+        /* need to do a last comparison to figure out whether we want to insert
+         * here or in the next position */
+        MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+        MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+
+        /* decode next pointer, so we know where this one ends */
+        if (index) {
+            MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), 
+              sizeof(prevptr));
+        } else {
+            prevptr = bucketsize;
+        }
+
+        /* the way we do our binary search, the item may need to be inserted 
+         * at the *next* location (assuming that there is no exact match) */
+
+        assert(prevptr >= ptr);
+        len = (unsigned int) (((unsigned int) prevptr - ptr - size) > termlen) 
+            ? termlen : prevptr - ptr - size;
+
+        for (i = 0; i < len; i++) {
+            if (term[i] < ((char *) mem)[i + ptr + size]) {
+                break;
+            } else if (term[i] > ((char *) mem)[i + ptr + size]) {
+                index++;
+                prevptr = ptr;
+                MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+                MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+                break;
+            }
+        }
+
+        /* exact match of prefixes */
+        /* XXX: should check for exact match */
+        if (i == len) {
+            if (termlen > len) {
+                index++;
+                prevptr = ptr;
+                MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+                MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+            }
+        }
+
+        /* new allocation needs to be inserted at index */
+        if (index < entries) {
+            MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+            MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+
+            /* decode next pointer, so we know where this one ends */
+            if (index) {
+                MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), 
+                  sizeof(prevptr));
+            } else {
+                prevptr = bucketsize;
+            }
+            /* move strings and data down */
+            memmove(((char *) mem) + lastaddr - termlen - newsize,
+              ((char *) mem) + lastaddr,
+              ptr - lastaddr + (prevptr - ptr));
+
+            /* shift pointers up */
+            for (i = entries; (i > index); i--) {
+                MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i - 1), sizeof(ptr));
+                ptr -= termlen + newsize;
+                MEM_HTON(B1_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
+                memcpy(B1_SIZE_ADDR(mem, i), B1_SIZE_ADDR(mem, i - 1), 
+                  sizeof(size));
+            }
+            ptr = prevptr - termlen - newsize;
+        } else {
+            ptr = lastaddr - termlen - newsize;
+        }
+    } else {
+        /* check that we have enough space to allocate entry */
+        if (termlen + newsize + sizeof(uint16_t) * 2 
+          > bucketsize - sizeof(entries)) {
+            *toobig = 1;
+            return NULL;
+        }
+
+        ptr = bucketsize - termlen - newsize;
+        index = 0;
+    }
+
+    /* encode new pointer */
+    size = newsize;
+    MEM_HTON(B1_PTR_ADDR(mem, index), &ptr, sizeof(ptr));
+    MEM_HTON(B1_SIZE_ADDR(mem, index), &size, sizeof(size));
+
+    /* copy new string in */
+    memcpy(((char *) mem) + ptr + size, term, termlen);
+
+    /* encode new entries record */
+    entries++;
+    MEM_HTON(B1_ENTRIES_ADDR(mem), &entries, sizeof(entries));
+
+    if (idx) {
+        *idx = index;
+    }
+    return ((char *) mem) + ptr;
+}
+
+int bucket1_remove_at(void *mem, unsigned int bucketsize, unsigned int index) {
+    unsigned int i;
+    uint16_t lastaddr, 
+             entries,
+             size,
+             ptr,
+             prevptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (!entries || (index >= entries)) {
+        return 0;
+    }
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+
+    /* read the last entry */
+    MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem, (entries - 1)), 
+      sizeof(lastaddr));
+
+    /* move strings/data up */
+    memmove(((char *) mem) + lastaddr + (prevptr - ptr),
+      ((char *) mem) + lastaddr, ptr - lastaddr);
+
+    size = prevptr - ptr;
+
+    /* update pointers */
+    for (i = index; i + 1 < entries; i++) {
+        MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i + 1), sizeof(ptr));
+        ptr += size;
+        MEM_HTON(B1_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
+        memcpy(B1_SIZE_ADDR(mem, i), 
+          B1_SIZE_ADDR(mem, i + 1), sizeof(size));
+    }
+
+    /* encode new entries record */
+    entries--;
+    MEM_HTON(B1_ENTRIES_ADDR(mem), &entries, sizeof(entries));
+
+    return 1;
+}
+
+int bucket1_remove(void *mem, unsigned int bucketsize, const char *term, 
+  unsigned int termlen) {
+    unsigned int i,
+                 index;
+    uint16_t entries,
+             ptr,
+             size,
+             prevptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (!entries) {
+        return 0;
+    }
+
+    index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
+
+    /* verify that index points to requested term */
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+    if (((unsigned int) prevptr - ptr - size) == termlen) {
+        for (i = 0; i < termlen; i++) {
+            if (term[i] != ((char *) mem)[ptr + size + i]) {
+                return 0;
+            }
+        }
+
+        return bucket1_remove_at(mem, bucketsize, index);
+    } else {
+        return 0;
+    }
+}
+
+const char *bucket1_term_at(void *mem, unsigned int bucketsize, 
+  unsigned int index, unsigned int *len, void **data, unsigned int *veclen) {
+    uint16_t addr,
+             prevaddr,  /* logically previous (physically next) address */
+             size,
+             entries;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, mem, sizeof(entries));
+
+    if (index < entries) {
+        /* read the entry */
+        MEM_NTOH(&addr, B1_PTR_ADDR(mem, index), sizeof(addr));
+        MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(size));
+        assert(((sizeof(addr) * entries) <= addr) 
+          && (bucketsize > addr));
+
+        if (index) {
+            /* its not the first entry, read the previous entry's address */
+            MEM_NTOH(&prevaddr, B1_PTR_ADDR(mem, index - 1), 
+              sizeof(prevaddr));
+        } else {
+            /* its the first entry, boundary is the end of the bucket */
+            prevaddr = bucketsize;
+        }
+
+        *len = prevaddr - addr - size;
+        *veclen = size;
+        *data = ((char *) mem) + addr;
+        return ((char *) mem) + addr + size;
+    } else {
+        /* its past the last entry */
+        return NULL;
+    }
+}
+
+int bucket1_split(void *mem1, unsigned int bucketsize1, void *mem2, 
+  unsigned int bucketsize2, unsigned int terms) {
+    unsigned int i,
+                 j;
+    uint16_t lastaddr, 
+             entries,
+             size,
+             ptr,
+             prevptr;
+
+    memset(mem2, 0, bucketsize2);
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem1), sizeof(entries));
+
+    if (terms >= entries) {
+        return (terms == entries);
+    }
+
+    if (terms) {
+        /* read split entry */
+        MEM_NTOH(&ptr, B1_PTR_ADDR(mem1, terms - 1), sizeof(ptr));
+    } else {
+        ptr = bucketsize1;
+    }
+
+    /* read last entry */
+    MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem1, entries - 1), sizeof(lastaddr));
+
+    /* copy strings and data from bucket 1 to bucket 2 */
+    memcpy((char *) mem2 + bucketsize2 - (ptr - lastaddr), 
+      (char *) mem1 + lastaddr, ptr - lastaddr);
+
+    /* copy pointers to new bucket */
+    prevptr = ptr;
+    for (j = 0, i = terms; i < entries; i++, j++) {
+        MEM_NTOH(&ptr, B1_PTR_ADDR(mem1, i), sizeof(ptr));
+        ptr += bucketsize1 - prevptr;
+        MEM_HTON(B1_PTR_ADDR(mem2, j), &ptr, sizeof(size));
+        memcpy(B1_SIZE_ADDR(mem2, j), B1_SIZE_ADDR(mem1, i), sizeof(size));
+    }
+
+    /* adjust entries record in both buckets */
+    size = terms;
+    mem_hton(B1_ENTRIES_ADDR(mem1), &size, sizeof(size));
+    entries -= size;
+    mem_hton(B1_ENTRIES_ADDR(mem2), &entries, sizeof(entries));
+
+    return 1;
+}
+
+int bucket1_set_term(void *mem, unsigned int bucketsize, unsigned int termno, 
+  const char *newterm, unsigned int newtermlen, int *toobig) {
+    unsigned int i,
+                 termlen;
+    uint16_t size,
+             ptr, 
+             prevptr,
+             lastptr,
+             entries;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (termno >= entries) {
+        return 0;
+    }
+
+    /* read entry, previous and last pointers */
+    MEM_NTOH(&ptr, B1_PTR_ADDR(mem, termno), sizeof(ptr));
+    if (termno + 1 < entries) {
+        MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, termno + 1), sizeof(prevptr));
+
+        /* read the last entry */
+        MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, (entries - 1)), sizeof(lastptr));
+    } else {
+        prevptr = bucketsize;
+        lastptr = ptr;
+    }
+    MEM_NTOH(&size, B1_SIZE_ADDR(mem, size), sizeof(size));
+
+    termlen = prevptr - ptr - size;
+
+    if (newtermlen > termlen) {
+        /* string is growing */
+
+        /* check that we have enough space to allocate entry */
+        if (((newtermlen - termlen) > (lastptr - B1_PTR(entries)))) {
+
+            /* not enough space to allocate the entry */
+            if ((newtermlen + 2 * sizeof(uint16_t) + size)
+              > bucketsize - sizeof(entries)) {
+                /* ... even if the bucket was empty */
+                *toobig = 1;
+            }
+            return 0;
+        }
+
+        /* move strings and data prior to the entry */
+        memmove(((char *) mem) + lastptr - (newtermlen - termlen), 
+          ((char *) mem) + lastptr, ptr - lastptr + size);
+
+        /* update pointers prior to the entry */
+        for (i = termno; i < entries; i++) {
+            MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, i), sizeof(lastptr));
+            lastptr -= (newtermlen - termlen);
+            MEM_HTON(B1_PTR_ADDR(mem, i), &lastptr, sizeof(lastptr));
+        }
+    } else if (newtermlen < termlen) {
+        /* string is shrinking */
+
+        /* move strings and data prior to the entry */
+        memmove(((char *) mem) + lastptr + (termlen - newtermlen), 
+          ((char *) mem) + lastptr, ptr - lastptr + size);
+
+        /* update pointers prior to the entry */
+        for (i = termno; i < entries; i++) {
+            MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, i), sizeof(lastptr));
+            lastptr += (termlen - newtermlen);
+            MEM_HTON(B1_PTR_ADDR(mem, i), &lastptr, sizeof(lastptr));
+        }
+    }
+
+    /* copy new string in */
+    memcpy(((char *) mem) + ptr + size, newterm, newtermlen);
+
+    return 1;
+}
+
+int bucket1_resize(void *mem, unsigned int oldsize, unsigned int newsize) {
+    unsigned int i;
+    uint16_t ptr,
+             lastptr,
+             entries;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (!entries) {
+        return 1;
+    }
+
+    /* read last entry */
+    MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, (entries - 1)), sizeof(lastptr));
+
+    if (newsize < oldsize) {
+        /* shrinking */
+        if ((oldsize - newsize) > (lastptr - B1_PTR(entries))) {
+            return 0;
+        }
+
+        /* move data and strings */
+        memmove(((char *) mem) + lastptr - (oldsize - newsize), 
+          ((char *) mem) + lastptr, oldsize - lastptr);
+
+        /* update pointer entries */
+        for (i = 0; i < entries; i++) {
+            MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i), sizeof(ptr));
+            ptr -= (oldsize - newsize);
+            MEM_HTON(B1_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
+        }
+    } else if (newsize > oldsize) {
+        /* growing */
+
+        /* move data and strings */
+        memmove(((char *) mem) + lastptr + (newsize - oldsize), 
+          ((char *) mem) + lastptr, oldsize - lastptr);
+
+        /* update pointer entries */
+        for (i = 0; i < entries; i++) {
+            MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i), sizeof(ptr));
+            ptr += (newsize - oldsize);
+            MEM_HTON(B1_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
+        }
+    }
+
+    return 1;
+}
+
+void *bucket1_append(void *mem, unsigned int bucketsize, const char *term,
+  unsigned int termlen, unsigned int size, int *toobig) {
+    uint16_t entries,
+             lastaddr,
+             ptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (entries) {
+        /* read the last entry */
+        MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem, (entries - 1)), 
+          sizeof(lastaddr));
+    } else {
+        lastaddr = bucketsize;
+    }
+
+    /* check that we have enough free space */
+    if ((size + termlen + 2 * (sizeof(uint16_t))) 
+      > (lastaddr - B1_PTR(entries))) {
+        /* test whether theres enough space to allocate the entry if the
+         * bucket was empty */
+        *toobig = (termlen + size + sizeof(uint16_t) * 2 
+          > bucketsize - sizeof(entries));
+        return NULL;
+    }
+
+    /* copy term in */
+    memcpy(((char *) mem) + lastaddr - termlen, term, termlen);
+
+    /* update entries record and pointer */
+    ptr = lastaddr - termlen - size;
+    mem_hton(B1_PTR_ADDR(mem, entries), &ptr, sizeof(ptr));
+    ptr = size;
+    mem_hton(B1_SIZE_ADDR(mem, entries), &ptr, sizeof(ptr));
+    entries++;
+    mem_hton(B1_ENTRIES_ADDR(mem), &entries, sizeof(entries));
+
+    return ((char *) mem) + lastaddr - termlen - size;
+}
+
+/* functions for strategy 2 */
+
+/* binary searches a bucket for a term, returning the largest thing that is less
+ * than or equal to the given term (this property, which the usual binary search
+ * must be modified to provide, is important because we can then use it for
+ * insertion sorting as well as searching) */
+static unsigned int bucket2_binsearch(void *mem, unsigned int bucketsize, 
+  unsigned int entries, const char *term, unsigned int termlen) {
+    unsigned int l,
+                 r,
+                 m,
+                 i,
+                 len,
+                 tlen;
+    uint16_t ptr,
+             prevptr,
+             size;
+
+    assert(entries);
+
+    l = 0;
+    r = entries - 1;
+
+    while (l < r) {
+        m = BIT_DIV2((r + l + 1), 1);
+
+        /* decode m ptr */
+        MEM_NTOH(&ptr, B2_PTR_ADDR(mem, m), sizeof(ptr));
+        MEM_NTOH(&size, B2_SIZE_ADDR(mem, m), sizeof(ptr));
+
+        /* decode next pointer, so we know where this one ends */
+        if (m) {
+            MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, m - 1), sizeof(prevptr));
+
+            tlen = prevptr - ptr - size;
+            len = (tlen > termlen) ? termlen : tlen;
+
+            for (i = 0; i < len; i++) {
+                if (term[i] < ((char *) mem)[i + ptr + size]) {
+                    r = m - 1;
+                    break;
+                } else if (term[i] > ((char *) mem)[i + ptr + size]) {
+                    l = m;
+                    break;
+                }
+            }
+
+            /* exact match of prefixes */
+            if (i == len) {
+                if (termlen == tlen) {
+                    return m;
+                } else if (termlen < tlen) {
+                    r = m - 1;
+                } else {
+                    l = m;
+                }
+            }
+        } else {
+            /* m is first entry */
+            prevptr = bucketsize;
+
+            tlen = prevptr - ptr - size;
+            len = (tlen > termlen) ? termlen : tlen;
+
+            for (i = 0; i < len; i++) {
+                if (term[i] < ((char *) mem)[i + ptr + size]) {
+                    /* no exact match, act now to prevent underflow */
+                    return 0;
+                    break;
+                } else if (term[i] > ((char *) mem)[i + ptr + size]) {
+                    l = m;
+                    break;
+                }
+            }
+
+            /* exact match of prefixes */
+            if (i == len) {
+                if (termlen <= tlen) {
+                    /* no match, act now to prevent underflow */
+                    return 0;
+                } else {
+                    l = m;
+                }
+            }
+        }
+    }
+
+    /* no exact match */
+    return l;
+}
+
+void *bucket2_find(void *mem, unsigned int bucketsize, const char *term, 
+  unsigned int termlen, unsigned int *veclen, unsigned int *idx) {
+    unsigned int index,
+                 i;
+    uint16_t entries,
+             size,
+             ptr,
+             prevptr;
+             
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    /* handle 0 entries case */
+    if (!entries) {
+        return NULL;
+    }
+
+    index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+    if (((unsigned int) prevptr - ptr) - size == termlen) {
+        for (i = 0; i < termlen; i++) {
+            if (term[i] != ((char *) mem)[i + ptr + size]) {
+                return NULL;
+            }
+        }
+
+        *veclen = size;
+        if (idx) {
+            *idx = index;
+        }
+        return ((char *) mem) + ptr;
+    }
+
+    return NULL;
+}
+
+void *bucket2_search(void *mem, unsigned int bucketsize, const char *term, 
+  unsigned int termlen, unsigned int *veclen, unsigned int *idx) {
+    unsigned int index;
+    uint16_t entries,
+             size,
+             ptr,
+             prevptr;
+             
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    /* handle 0 entries case */
+    if (!entries) {
+        return NULL;
+    }
+
+    index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    if (idx) {
+        *idx = index;
+    }
+    *veclen = size;
+    return ((char *) mem) + ptr;
+}
+
+void *bucket2_realloc_at(void *mem, unsigned int bucketsize, 
+  unsigned int index, unsigned int newsize, int *toobig) {
+    uint16_t size,
+             entries,
+             new_bucket_size,
+             ptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    /* handle 0 entries case */
+    if (!entries || (index >= entries)) {
+        *toobig = 0;
+        return NULL;
+    }
+
+    new_bucket_size = bucketsize - sizeof(uint16_t);
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    if (size == newsize) {
+        return ((char *) mem) + ptr;
+    } else {
+        return NULL;
+    }
+}
+
+void *bucket2_realloc(void *mem, unsigned int bucketsize, const char *term,
+  unsigned int termlen, unsigned int newsize, int *toobig) {
+    unsigned int i,
+                 index;
+    uint16_t entries,
+             size,
+             ptr,
+             prevptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    /* handle 0 entries case */
+    if (!entries) {
+        *toobig = 0;
+        return NULL;
+    }
+
+    index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
+
+    /* verify that index points to requested term */
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    if (size != newsize) {
+        return NULL;
+    }
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+    if (((unsigned int) prevptr - ptr - size) == termlen) {
+        for (i = 0; i < termlen; i++) {
+            if (term[i] != ((char *) mem)[ptr + size + i]) {
+                return NULL;
+            }
+        }
+
+        return bucket2_realloc_at(mem, bucketsize, index, newsize, toobig);
+    } else {
+        return NULL;
+    }
+}
+
+void *bucket2_alloc(void *mem, unsigned int bucketsize, const char *term, 
+  unsigned int termlen, unsigned int newsize, int *toobig, 
+  unsigned int *idx) {
+    unsigned int index,
+                 i,
+                 len;
+    uint16_t size,
+             lastaddr,
+             entries,
+             ptr,
+             prevptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+    MEM_NTOH(&size, B2_SIZE_ADDR(mem, 0), sizeof(size));
+
+    if (entries && (size != newsize)) {
+        return NULL;
+    }
+
+    if (entries) {
+        /* read the last entry */
+        MEM_NTOH(&lastaddr, B2_PTR_ADDR(mem, (entries - 1)), 
+          sizeof(lastaddr));
+
+        /* check that we have enough space to allocate entry */
+        if ((size + termlen + 2 * (sizeof(uint16_t))) 
+          > (lastaddr - B2_PTR(entries))) {
+            /* test whether theres enough space to allocate the entry if the
+             * bucket was empty */
+            *toobig = (termlen + newsize + sizeof(uint16_t) * 2 
+              > bucketsize - sizeof(entries));
+            return NULL;
+        }
+
+        index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
+
+        /* need to do a last comparison to figure out whether we want to insert
+         * here or in the next position */
+        MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+        MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+
+        /* decode next pointer, so we know where this one ends */
+        if (index) {
+            MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), 
+              sizeof(prevptr));
+        } else {
+            prevptr = bucketsize;
+        }
+
+        /* the way we do our binary search, the item may need to be inserted 
+         * at the *next* location (assuming that there is no exact match) */
+
+        assert(prevptr >= ptr);
+        len = (unsigned int) (((unsigned int) prevptr - ptr - size) > termlen) 
+            ? termlen : prevptr - ptr - size;
+
+        for (i = 0; i < len; i++) {
+            if (term[i] < ((char *) mem)[i + ptr + size]) {
+                break;
+            } else if (term[i] > ((char *) mem)[i + ptr + size]) {
+                index++;
+                prevptr = ptr;
+                MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+                MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+                break;
+            }
+        }
+
+        /* exact match of prefixes */
+        /* XXX: should check for exact match */
+        if (i == len) {
+            if (termlen > len) {
+                index++;
+                prevptr = ptr;
+                MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+                MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+            }
+        }
+
+        /* new allocation needs to be inserted at index */
+        if (index < entries) {
+            MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+            MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+
+            /* decode next pointer, so we know where this one ends */
+            if (index) {
+                MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), 
+                  sizeof(prevptr));
+            } else {
+                prevptr = bucketsize;
+            }
+            /* move strings and data down */
+            memmove(((char *) mem) + lastaddr - termlen - newsize,
+              ((char *) mem) + lastaddr,
+              ptr - lastaddr + (prevptr - ptr));
+
+            /* shift pointers up */
+            for (i = entries; (i > index); i--) {
+                MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i - 1), sizeof(ptr));
+                ptr -= termlen + newsize;
+                MEM_HTON(B2_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
+                memcpy(B2_SIZE_ADDR(mem, i), B2_SIZE_ADDR(mem, i - 1), 
+                  sizeof(size));
+            }
+            ptr = prevptr - termlen - newsize;
+        } else {
+            ptr = lastaddr - termlen - newsize;
+        }
+    } else {
+        /* check that we have enough space to allocate entry */
+        if (termlen + newsize + sizeof(uint16_t) * 2 
+          > bucketsize - sizeof(entries)) {
+            *toobig = 1;
+            return NULL;
+        }
+
+        ptr = bucketsize - termlen - newsize;
+        index = 0;
+    }
+
+    /* encode new pointer */
+    size = newsize;
+    MEM_HTON(B2_PTR_ADDR(mem, index), &ptr, sizeof(ptr));
+    MEM_HTON(B2_SIZE_ADDR(mem, index), &size, sizeof(size));
+
+    /* copy new string in */
+    memcpy(((char *) mem) + ptr + size, term, termlen);
+
+    /* encode new entries record */
+    entries++;
+    MEM_HTON(B2_ENTRIES_ADDR(mem), &entries, sizeof(entries));
+
+    if (idx) {
+        *idx = index;
+    }
+    return ((char *) mem) + ptr;
+}
+
+int bucket2_remove_at(void *mem, unsigned int bucketsize, unsigned int index) {
+    unsigned int i;
+    uint16_t lastaddr, 
+             entries,
+             size,
+             ptr,
+             prevptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (!entries || (index >= entries)) {
+        return 0;
+    }
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+
+    /* read the last entry */
+    MEM_NTOH(&lastaddr, B2_PTR_ADDR(mem, (entries - 1)), 
+      sizeof(lastaddr));
+
+    /* move strings/data up */
+    memmove(((char *) mem) + lastaddr + (prevptr - ptr),
+      ((char *) mem) + lastaddr, ptr - lastaddr);
+
+    size = prevptr - ptr;
+
+    /* update pointers */
+    for (i = index; i + 1 < entries; i++) {
+        MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i + 1), sizeof(ptr));
+        ptr += size;
+        MEM_HTON(B2_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
+    }
+
+    /* encode new entries record */
+    entries--;
+    MEM_HTON(B2_ENTRIES_ADDR(mem), &entries, sizeof(entries));
+
+    return 1;
+}
+
+int bucket2_remove(void *mem, unsigned int bucketsize, const char *term, 
+  unsigned int termlen) {
+    unsigned int i,
+                 index;
+    uint16_t entries,
+             ptr,
+             size,
+             prevptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (!entries) {
+        return 0;
+    }
+
+    index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
+
+    /* verify that index points to requested term */
+
+    /* decode ptr */
+    MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
+    MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
+
+    /* decode next pointer, so we know where this one ends */
+    if (index) {
+        MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
+    } else {
+        prevptr = bucketsize;
+    }
+
+    assert(prevptr >= ptr);
+    if (((unsigned int) prevptr - ptr - size) == termlen) {
+        for (i = 0; i < termlen; i++) {
+            if (term[i] != ((char *) mem)[ptr + size + i]) {
+                return 0;
+            }
+        }
+
+        return bucket2_remove_at(mem, bucketsize, index);
+    } else {
+        return 0;
+    }
+}
+
+const char *bucket2_term_at(void *mem, unsigned int bucketsize, 
+  unsigned int index, unsigned int *len, void **data, unsigned int *veclen) {
+    uint16_t addr,
+             prevaddr,  /* logically previous (physically next) address */
+             size,
+             entries;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, mem, sizeof(entries));
+
+    if (index < entries) {
+        /* read the entry */
+        MEM_NTOH(&addr, B2_PTR_ADDR(mem, index), sizeof(addr));
+        MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(size));
+        assert(((sizeof(addr) * entries) <= addr) 
+          && (bucketsize > addr));
+
+        if (index) {
+            /* its not the first entry, read the previous entry's address */
+            MEM_NTOH(&prevaddr, B2_PTR_ADDR(mem, index - 1), 
+              sizeof(prevaddr));
+        } else {
+            /* its the first entry, boundary is the end of the bucket */
+            prevaddr = bucketsize;
+        }
+
+        *len = prevaddr - addr - size;
+        *veclen = size;
+        *data = ((char *) mem) + addr;
+        return ((char *) mem) + addr + size;
+    } else {
+        /* its past the last entry */
+        return NULL;
+    }
+}
+
+int bucket2_split(void *mem1, unsigned int bucketsize1, void *mem2, 
+  unsigned int bucketsize2, unsigned int terms) {
+    unsigned int i,
+                 j;
+    uint16_t lastaddr, 
+             entries,
+             size,
+             ptr,
+             prevptr;
+
+    memset(mem2, 0, bucketsize2);
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem1), sizeof(entries));
+
+    if (terms >= entries) {
+        return (terms == entries);
+    }
+
+    if (terms) {
+        /* read split entry */
+        MEM_NTOH(&ptr, B2_PTR_ADDR(mem1, terms - 1), sizeof(ptr));
+    } else {
+        ptr = bucketsize1;
+    }
+
+    /* read last entry */
+    MEM_NTOH(&lastaddr, B2_PTR_ADDR(mem1, entries - 1), sizeof(lastaddr));
+
+    /* copy strings and data from bucket 1 to bucket 2 */
+    memcpy((char *) mem2 + bucketsize2 - (ptr - lastaddr), 
+      (char *) mem1 + lastaddr, ptr - lastaddr);
+
+    /* copy pointers to new bucket */
+    prevptr = ptr;
+    for (j = 0, i = terms; i < entries; i++, j++) {
+        MEM_NTOH(&ptr, B2_PTR_ADDR(mem1, i), sizeof(ptr));
+        ptr += bucketsize1 - prevptr;
+        MEM_HTON(B2_PTR_ADDR(mem2, j), &ptr, sizeof(size));
+    }
+    memcpy(B2_SIZE_ADDR(mem2, j), B2_SIZE_ADDR(mem1, i), sizeof(size));
+
+    /* adjust entries record in both buckets */
+    size = terms;
+    mem_hton(B2_ENTRIES_ADDR(mem1), &size, sizeof(size));
+    entries -= size;
+    mem_hton(B2_ENTRIES_ADDR(mem2), &entries, sizeof(entries));
+
+    return 1;
+}
+
+int bucket2_set_term(void *mem, unsigned int bucketsize, unsigned int termno, 
+  const char *newterm, unsigned int newtermlen, int *toobig) {
+    unsigned int i,
+                 termlen;
+    uint16_t size,
+             ptr, 
+             prevptr,
+             lastptr,
+             entries;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (termno >= entries) {
+        return 0;
+    }
+
+    /* read entry, previous and last pointers */
+    MEM_NTOH(&ptr, B2_PTR_ADDR(mem, termno), sizeof(ptr));
+    if (termno + 1 < entries) {
+        MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, termno + 1), sizeof(prevptr));
+
+        /* read the last entry */
+        MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, (entries - 1)), sizeof(lastptr));
+    } else {
+        prevptr = bucketsize;
+        lastptr = ptr;
+    }
+    MEM_NTOH(&size, B2_SIZE_ADDR(mem, size), sizeof(size));
+
+    termlen = prevptr - ptr - size;
+
+    if (newtermlen > termlen) {
+        /* string is growing */
+
+        /* check that we have enough space to allocate entry */
+        if (((newtermlen - termlen) > (lastptr - B2_PTR(entries)))) {
+
+            /* not enough space to allocate the entry */
+            if ((newtermlen + 2 * sizeof(uint16_t) + size)
+              > bucketsize - sizeof(entries)) {
+                /* ... even if the bucket was empty */
+                *toobig = 1;
+            }
+            return 0;
+        }
+
+        /* move strings and data prior to the entry */
+        memmove(((char *) mem) + lastptr - (newtermlen - termlen), 
+          ((char *) mem) + lastptr, ptr - lastptr + size);
+
+        /* update pointers prior to the entry */
+        for (i = termno; i < entries; i++) {
+            MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, i), sizeof(lastptr));
+            lastptr -= (newtermlen - termlen);
+            MEM_HTON(B2_PTR_ADDR(mem, i), &lastptr, sizeof(lastptr));
+        }
+    } else if (newtermlen < termlen) {
+        /* string is shrinking */
+
+        /* move strings and data prior to the entry */
+        memmove(((char *) mem) + lastptr + (termlen - newtermlen), 
+          ((char *) mem) + lastptr, ptr - lastptr + size);
+
+        /* update pointers prior to the entry */
+        for (i = termno; i < entries; i++) {
+            MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, i), sizeof(lastptr));
+            lastptr += (termlen - newtermlen);
+            MEM_HTON(B2_PTR_ADDR(mem, i), &lastptr, sizeof(lastptr));
+        }
+    }
+
+    /* copy new string in */
+    memcpy(((char *) mem) + ptr + size, newterm, newtermlen);
+
+    return 1;
+}
+
+int bucket2_resize(void *mem, unsigned int oldsize, unsigned int newsize) {
+    unsigned int i;
+    uint16_t ptr,
+             lastptr,
+             entries;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (!entries) {
+        return 1;
+    }
+
+    /* read last entry */
+    MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, (entries - 1)), sizeof(lastptr));
+
+    if (newsize < oldsize) {
+        /* shrinking */
+        if ((oldsize - newsize) > (lastptr - B2_PTR(entries))) {
+            return 0;
+        }
+
+        /* move data and strings */
+        memmove(((char *) mem) + lastptr - (oldsize - newsize), 
+          ((char *) mem) + lastptr, oldsize - lastptr);
+
+        /* update pointer entries */
+        for (i = 0; i < entries; i++) {
+            MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i), sizeof(ptr));
+            ptr -= (oldsize - newsize);
+            MEM_HTON(B2_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
+        }
+    } else if (newsize > oldsize) {
+        /* growing */
+
+        /* move data and strings */
+        memmove(((char *) mem) + lastptr + (newsize - oldsize), 
+          ((char *) mem) + lastptr, oldsize - lastptr);
+
+        /* update pointer entries */
+        for (i = 0; i < entries; i++) {
+            MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i), sizeof(ptr));
+            ptr += (newsize - oldsize);
+            MEM_HTON(B2_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
+        }
+    }
+
+    return 1;
+}
+
+void *bucket2_append(void *mem, unsigned int bucketsize, const char *term,
+  unsigned int termlen, unsigned int size, int *toobig) {
+    uint16_t entries,
+             lastaddr,
+             ptr;
+
+    /* read number of entries */
+    MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
+
+    if (entries) {
+        /* read the last entry */
+        MEM_NTOH(&lastaddr, B2_PTR_ADDR(mem, (entries - 1)), 
+          sizeof(lastaddr));
+    } else {
+        lastaddr = bucketsize;
+    }
+
+    /* check that we have enough free space */
+    if ((size + termlen + 2 * (sizeof(uint16_t))) 
+      > (lastaddr - B2_PTR(entries))) {
+        /* test whether theres enough space to allocate the entry if the
+         * bucket was empty */
+        *toobig = (termlen + size + sizeof(uint16_t) * 2 
+          > bucketsize - sizeof(entries));
+        return NULL;
+    }
+
+    /* copy term in */
+    memcpy(((char *) mem) + lastaddr - termlen, term, termlen);
+
+    /* update entries record and pointer */
+    ptr = lastaddr - termlen - size;
+    mem_hton(B2_PTR_ADDR(mem, entries), &ptr, sizeof(ptr));
+    ptr = size;
+    mem_hton(B2_SIZE_ADDR(mem, entries), &ptr, sizeof(ptr));
+    entries++;
+    mem_hton(B2_ENTRIES_ADDR(mem), &entries, sizeof(entries));
+
+    return ((char *) mem) + lastaddr - termlen - size;
+}
+
+#include <stdio.h>
+
+int bucket_print(void *mem, unsigned int bucketsize, int strategy) {
+    void *data;
+    const char *term;
+    unsigned int i,
+                 tlen,
+                 vlen;
+    unsigned int state = 0;
+
+    printf("%u entries\n", bucket_entries(mem, bucketsize, strategy));
+
+    while ((term = bucket_next_term(mem, bucketsize, strategy, &state, &tlen, 
+        &data, &vlen))) {
+
+        putc('\'', stdout);
+        for (i = 0; i < tlen; i++) {
+            putc(term[i], stdout);
+        }
+        putc('\'', stdout);
+        putc(' ', stdout);
+        printf("%u %u (off %u)\n", tlen, vlen, 
+          (unsigned int) (((char *) data) - (char *) mem));
+    }
+    putc('\n', stdout);
+    return 1;
+}
+
+/* switching functions */
+
+void *bucket_alloc(void *bucketmem, unsigned int bucketsize, int strategy,
+  const char *term, unsigned int termlen, unsigned int newsize, 
+  int *toobig, unsigned int *idx) {
+    switch (strategy) {
+    case 1:
+        return bucket1_alloc(bucketmem, bucketsize, term, termlen, newsize, 
+          toobig, idx);
+
+    case 2:
+        return bucket2_alloc(bucketmem, bucketsize, term, termlen, newsize, 
+          toobig, idx);
+
+    default:
+        *toobig = 0;
+        return NULL;
+    };
+}
+
+void *bucket_find(void *bucketmem, unsigned int bucketsize,
+  int strategy, const char *term, unsigned int termlen, 
+  unsigned int *veclen, unsigned int *idx) {
+    switch (strategy) {
+    case 1:
+        return bucket1_find(bucketmem, bucketsize, term, termlen, veclen, 
+            idx);
+    case 2:
+        return bucket2_find(bucketmem, bucketsize, term, termlen, veclen, 
+            idx);
+
+    default:
+        return NULL;
+    };
+}
+
+void *bucket_search(void *bucketmem, unsigned int bucketsize, int strategy, 
+  const char *term, unsigned int termlen, unsigned int *veclen, 
+  unsigned int *idx) {
+    switch (strategy) {
+    case 1:
+        return bucket1_search(bucketmem, bucketsize, term, termlen, veclen, 
+            idx);
+
+    case 2:
+        return bucket2_search(bucketmem, bucketsize, term, termlen, veclen, 
+            idx);
+
+    default:
+        return NULL;
+    };
+}
+
+int bucket_remove(void *bucketmem, unsigned int bucketsize, int strategy,
+  const char *term, unsigned int termlen) {
+    switch (strategy) {
+    case 1:
+        return bucket1_remove(bucketmem, bucketsize, term, termlen);
+        
+    case 2:
+        return bucket2_remove(bucketmem, bucketsize, term, termlen);
+
+    default:
+        return 0;
+    };
+}
+
+int bucket_remove_at(void *bucketmem, unsigned int bucketsize, int strategy,
+  unsigned int index) {
+    switch (strategy) {
+    case 1:
+        return bucket1_remove_at(bucketmem, bucketsize, index);
+
+    case 2:
+        return bucket2_remove_at(bucketmem, bucketsize, index);
+
+    default:
+        return 0;
+    };
+}
+
+void *bucket_realloc(void *bucketmem, unsigned int bucketsize, 
+  int strategy, const char *term, unsigned int termlen, 
+  unsigned int newlen, int *toobig) {
+    switch (strategy) {
+    case 1:
+        return bucket1_realloc(bucketmem, bucketsize, term, termlen, 
+          newlen, toobig);
+
+    case 2:
+        return bucket2_realloc(bucketmem, bucketsize, term, termlen, 
+          newlen, toobig);
+
+    default:
+        *toobig = 0;
+        return NULL;
+    };
+}
+
+void *bucket_realloc_at(void *bucketmem, unsigned int bucketsize, 
+  int strategy, unsigned int index, unsigned int newlen, int *toobig) {
+    switch (strategy) {
+    case 1:
+        return bucket1_realloc_at(bucketmem, bucketsize, index, newlen, 
+            toobig);
+
+    case 2:
+        return bucket2_realloc_at(bucketmem, bucketsize, index, newlen, 
+            toobig);
+
+    default:
+        *toobig = 0;
+        return NULL;
+    };
+}
+
+const char *bucket_next_term(void *bucketmem, unsigned int bucketsize, 
+  int strategy, unsigned int *state, unsigned int *len, void **data, 
+  unsigned int *veclen) {
+    assert(bucketsize);
+
+    switch (strategy) {
+    case 1:
+        return bucket1_term_at(bucketmem, bucketsize, (*state)++, len, data, 
+            veclen);
+
+    case 2:
+        return bucket2_term_at(bucketmem, bucketsize, (*state)++, len, data, 
+            veclen);
+
+    default:
+        return NULL;
+    };
+}
+
+const char *bucket_term_at(void *bucketmem, unsigned int bucketsize, 
+  int strategy, unsigned int index, unsigned int *len, void **data, 
+  unsigned int *veclen) {
+    assert(bucketsize);
+
+    switch (strategy) {
+    case 1:
+        return bucket1_term_at(bucketmem, bucketsize, index, len, data, 
+            veclen);
+
+    case 2:
+        return bucket2_term_at(bucketmem, bucketsize, index, len, data, 
+            veclen);
+
+    default:
+        return NULL;
+    };
+}
+
+int bucket_split(void *bucketmem1, unsigned int bucketsize1, 
+  void *bucketmem2, unsigned int bucketsize2, int strategy, 
+  unsigned int split_terms) {
+    switch (strategy) {
+    case 1:
+        return bucket1_split(bucketmem1, bucketsize1, bucketmem2, bucketsize2, 
+          split_terms);
+
+    case 2:
+        return bucket2_split(bucketmem1, bucketsize1, bucketmem2, bucketsize2, 
+          split_terms);
+
+    default:
+        return 0;
+    }
+}
+
+int bucket_resize(void *bucketmem, unsigned int old_bucketsize, int strategy, 
+  unsigned int new_bucketsize) {
+    switch (strategy) {
+    case 1:
+        return bucket1_resize(bucketmem, old_bucketsize, new_bucketsize);
+
+    case 2:
+        return bucket2_resize(bucketmem, old_bucketsize, new_bucketsize);
+
+    default:
+        return 0;
+    };
+}
+
+void *bucket_append(void *bucketmem, unsigned int bucketsize, int strategy,
+  const char *term, unsigned int termlen, unsigned int size, 
+  int *toobig) {
+    switch (strategy) {
+    case 1:
+        return bucket1_append(bucketmem, bucketsize, term, termlen, size, 
+          toobig);
+
+    case 2:
+        return bucket2_append(bucketmem, bucketsize, term, termlen, size, 
+          toobig);
+
+    default:
+        *toobig = 0;
+        return NULL;
+    };
+}
+
+void bucket_print_split(void *bucketmem, unsigned int bucketsize, 
+  int strategy, unsigned int terms, const char *term, unsigned int termlen, 
+  unsigned int additional, int smaller) {
+    const char *currterm;
+    unsigned int state = 0;
+    void *vec;
+    unsigned int i,
+                 j,
+                 len,
+                 veclen,
+                 sum = 0;
+
+    for (i = 0; i < terms; i++) {
+        currterm = bucket_next_term(bucketmem, bucketsize, strategy, &state, 
+            &len, &vec, &veclen);
+        assert(currterm);
+        for (j = 0; j < len; j++) {
+            putc(currterm[j], stdout);
+        }
+        printf(" (%u) ", veclen + len);
+        sum += len + veclen;
+    }
+
+    if (smaller) {
+        printf("(additional) ");
+        for (j = 0; j < termlen; j++) {
+            putc(term[j], stdout);
+        }
+        printf(" (%u) ", additional);
+        sum += additional;
+    }
+
+    printf("[%u] | ", sum);
+    sum = 0;
+
+    if (!smaller) {
+        printf("(additional) ");
+        for (j = 0; j < termlen; j++) {
+            putc(term[j], stdout);
+        }
+        printf(" (%u) ", additional);
+        sum += additional;
+    }
+
+    while ((currterm = bucket_next_term(bucketmem, bucketsize, strategy, &state,
+        &len, &vec, &veclen))) {
+
+        for (j = 0; j < len; j++) {
+            putc(currterm[j], stdout);
+        }
+        printf(" (%u) ", veclen + len);
+        sum += len + veclen;
+    }
+
+    printf(" [%u]\n", sum);
+}
+
+unsigned int bucket_find_split_entry(void *bucketmem, unsigned int bucketsize,
+  int strategy, unsigned int range, const char *term, 
+  unsigned int termlen, unsigned int additional, int *smaller) {
+    const void *ret;                /* return value from bucket functions */
+    void *dataptr;                  /* data location of vector in bucket */
+    int tmpsmaller = 0,             /* value to be copied into smaller */
+        consumed = 0,               /* whether the additional term has been 
+                                     * consumed */ 
+        cmp;                        /* result of string comparison */
+    unsigned int shortest,          /* size of the shortest entry we've seen */
+                 index,             /* split bucket term index */
+                 disp,              /* displacement of shortest entry from a 
+                                     * perfectly balanced split */
+                 terms = 0,         /* number of terms seen thus far */
+                 sum = 0,           /* sum of data thus far */
+                 len,               /* length of string entry */
+                 veclen,            /* length of data in entry */
+                 data,              /* amount of data in bucket */
+                 iter_state = 0;    /* state of iteration */
+
+    /* determine where to split the leaf node 
+     *
+     * prefix b-tree magic is performed here, by selecting shortest string to 
+     * push up within given range.  If two strings are equally short, the 
+     * distribution of data between the buckets is considered, with more even
+     * distribution favoured. */
+
+    assert(bucket_sorted(strategy));  /* XXX: should handle unsorted buckets 
+                                       * (by sorting) */
+
+    data = bucket_utilised(bucketmem, bucketsize, strategy) 
+      + bucket_string(bucketmem, bucketsize, strategy) + additional;
+    data /= 2;
+    /* our interval of interest is now data +/- range */
+
+    ret = bucket_next_term(bucketmem, bucketsize, strategy, &iter_state, &len, 
+        &dataptr, &veclen);
+    assert(ret);
+
+    /* iterate until we come up to term that enters range */
+    while (ret 
+
+      /* need to do comparison to additional term now so that we can stop on
+       * term that crosses boundary into acceptable range */
+      && ((cmp = str_nncmp(term, termlen, ret, len)), 1)
+
+      /* if additional term is less than bucket term ... */
+      && (((!consumed && (cmp < 0))
+          /* ... check that its not going to cross into range ... */
+          && (sum + additional < data - range) 
+          /* ... and consume it */
+          && ((sum += additional), (consumed = 1)))
+
+        /* else if additional term is greater than bucket term or already
+         * consumed ... */
+        || ((consumed || (cmp > 0))
+          /* ... check that bucket term isn't going to cross into range ... */
+          && (sum + len + veclen < data - range) 
+          && ((sum += len + veclen), ++terms)
+          && (ret = bucket_next_term(bucketmem, bucketsize, strategy, 
+              &iter_state, &len, &dataptr, &veclen)))
+
+        /* else if they're equal ... */
+        || ((!consumed && !cmp) 
+          /* ... check that the sum isn't going to cross into range ... */
+          && (sum + len + veclen + additional < data - range) 
+          /* ... and consume them */
+          && ((sum += len + veclen + additional), ++terms, (consumed = 1))
+          && (ret = bucket_next_term(bucketmem, bucketsize, strategy, 
+              &iter_state, &len, &dataptr, &veclen))))) {
+
+        /* do nothing */
+    }
+
+    /* we're now up to term that may enter range, its the answer if it crosses
+     * the entire range.  Either way we have to consume the next term here. */
+
+    /* if additional term hasn't been consumed, and is less than bucket 
+     * term ... */
+    if (ret && ((cmp = str_nncmp(term, termlen, ret, len)) < 0) && !consumed) {
+        /* ... and its going to cross entire range ... */
+        if (sum + additional >= data + range) {
+            /* its the splitting point, determine whether it balances better on 
+             * left or right of split and return */
+            *smaller = (sum + additional - data < data - sum);
+            return terms;
+        } else {
+            /* its not the splitting point, or even a candidate, just consume 
+             * it */
+            sum += additional;
+            consumed = 1;
+            tmpsmaller = 1;
+        }
+
+    /* else if additional term is greater than bucket term or already 
+     * consumed ... */
+    } else if (ret && (consumed || (cmp > 0))) {
+        /* ... and bucket term is going to cross entire range */
+        if (sum + len + veclen >= data + range) {
+            /* its the splitting point, determine whether it balances better on
+             * left or right of split and return */
+            *smaller = consumed;
+            return terms + (sum + len + veclen - data < data - sum);
+        } else {
+            /* its not the splitting point, or even a candidate, consume it */
+            sum += len + veclen;
+            tmpsmaller = consumed;
+            terms++;
+            ret = bucket_next_term(bucketmem, bucketsize, strategy, &iter_state,
+                &len, &dataptr, &veclen);
+        }
+
+    /* else if they're equal ... */
+    } else if (ret && !consumed && !cmp) {
+      /* ... check if they will cross entire range ... */
+        if (sum + len + veclen + additional >= data + range) {
+            /* combination is the splitting point, determine whether it 
+             * balances better on left or right of split and return */
+            *smaller = (sum + len + veclen + additional - data < data - sum);
+            return terms + *smaller;
+        } else {
+            /* they aren't the splitting point, or even a candidate, consume
+             * them */
+            sum += len + veclen + additional;
+            consumed = 1;
+            tmpsmaller = 1;
+            terms++;
+            ret = bucket_next_term(bucketmem, bucketsize, strategy, &iter_state,
+                &len, &dataptr, &veclen);
+        }
+    } 
+
+    /* haven't found a splitting point thus far, but everything until we exit
+     * the range is now a candidate */
+    index = -1;
+    disp = shortest = UINT_MAX;
+
+    /* XXX: note that code below here hasn't really been debugged, since 
+     * ranges haven't been enabled yet */
+
+    /* iterate until we exit range */
+    assert(sum >= data - range);
+    while (ret && (sum < data + range)) {
+        cmp = str_nncmp(term, termlen, ret, len);
+
+        if (!consumed && (cmp < 0)) {
+            /* consume additional term */
+
+            /* if its the shortest entry, or equal shortest with smaller
+             * displacement from a perfectly balanced bucket, then its our
+             * current best candidate for splitting point */
+            if ((len < shortest) 
+              || ((len == shortest) 
+                && (((sum < data) && (data - sum < disp) 
+                  && (((sum + additional < data) 
+                      && (data - sum - additional < disp))
+                    || ((sum + additional > data)
+                      && (sum + additional - data < disp))))
+                  || ((sum > data) 
+                    && (sum + additional - data < disp))))) {
+
+                /* calculate maximum displacement of term from midpoint */
+                if (sum < data) {
+                    disp = data - sum;
+                    if (sum + additional > data) {
+                        if (sum + additional - data > disp) {
+                            disp = sum + additional - data;
+                        }
+                    }
+                } else {
+                    disp = sum + additional - data;
+                }
+                index = terms;
+                shortest = len;
+                tmpsmaller = 0;
+            }
+
+            sum += additional;
+            consumed = 1;
+        } else {
+            if (!consumed && !cmp) {
+                /* consume both terms */
+                if ((len < shortest) 
+                  || ((len == shortest) 
+                    && (((sum < data) && (data - sum < disp) 
+                      && (((sum + len + veclen + additional < data) 
+                          && (data - sum - len - veclen - additional < disp))
+                        || ((sum + len + veclen + additional > data)
+                          && (sum + len + veclen + additional - data < disp))))
+                      || ((sum > data) 
+                        && (sum + len + veclen + additional - data 
+                          < disp))))) {
+
+                    /* calculate maximum displacement of term from midpoint */
+                    if (sum < data) {
+                        disp = data - sum;
+                        if (sum + len + veclen + additional > data) {
+                            if (sum + len + veclen + additional - data > disp) {
+                                disp = sum + len + veclen + additional - data;
+                            }
+                        }
+                    } else {
+                        disp = sum + len + veclen + additional - data;
+                    }
+
+                    index = terms + 1;
+                    shortest = len;
+                    tmpsmaller = 0;
+                }
+
+                sum += additional + len + veclen;
+                consumed = 1;
+            } else {
+                /* consume term from bucket */
+                if ((len < shortest) 
+                  || ((len == shortest) 
+                    && (((sum < data) && (data - sum < disp) 
+                      && (((sum + len + veclen < data) 
+                          && (data - sum - len - veclen < disp))
+                        || ((sum + len + veclen > data)
+                          && (sum + len + veclen - data < disp))))
+                      || ((sum > data) 
+                        && (sum + len + veclen - data < disp))))) {
+
+                    /* calculate maximum displacement of term from midpoint */
+                    if (sum < data) {
+                        disp = data - sum;
+                        if (sum + len + veclen > data) {
+                            if (sum + len + veclen - data > disp) {
+                                disp = sum + len + veclen - data;
+                            }
+                        }
+                    } else {
+                        disp = sum + len + veclen - data;
+                    }
+                    index = terms + 1;
+                    shortest = len;
+                    tmpsmaller = consumed;
+                }
+
+                sum += len + veclen;
+            }
+            /* get next term from bucket */
+            terms++;
+            ret = bucket_next_term(bucketmem, bucketsize, strategy, &iter_state,
+                &len, &dataptr, &veclen);
+        }
+    }
+
+    assert((index != -1) && (disp != UINT_MAX) && (shortest != UINT_MAX));
+    *smaller = tmpsmaller;
+    return index;
+}
+
diff --git a/src/chash.c b/src/chash.c
new file mode 100644 (file)
index 0000000..db34133
--- /dev/null
@@ -0,0 +1,1465 @@
+/* chash.c implements the interface declared in chash.h.  The implementation
+ * caters for different types by using a primitive sort of templating using
+ * macros.  Nasty, but it gets the job done.  One performance improvement that 
+ * i've made is to specialise the macro's for strings.  A prefix consisting of
+ * the first word full of characters is formed, which allows fast comparison.
+ * Since we only need inequality, not relative positional (< or >) information
+ * for a hashtable, the characters are stored in the native endianness of the
+ * platform.  This allows us to return pointers directly to the prefix as a
+ * string and it will work for the first four characters.  We also allocate
+ * another word for either a suffix or pointer into a strings array 
+ * immediately following, so the combination can be used to store strings 
+ * of size <= 2 words directly in each node.  Longer strings we store (entirely,
+ * even though the prefix contains some of it, so we can return pointers to the
+ * whole string) in a special strings area.  The strings area is simply an 
+ * array which we keep a tail pointer into, and an indication whether it is 
+ * packed.  We allocate strings off the end of the area, and remove them by 
+ * deleting the reference and indicating that the area is no longer packed.  
+ * If further space is needed we repack the area, by iterating over the 
+ * hashtable, copying strings into packed format again, before expanding.
+ *
+ * written nml 2003-05-29
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "chash.h"
+#include "_chash.h"
+
+#include "def.h"
+#include "bit.h"
+#include "str.h"
+#include "objalloc.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <limits.h>
+
+/* amount requested from malloc for links */
+#define BULK_ALLOC 1024
+
+/* minimum number of bytes that we'll normally (we make exceptions if we run
+ * out of memory) repack to reclaim */
+#define PACK_HYSTERESIS (BULK_ALLOC / 3)
+
+struct chash_iter {
+    struct chash *hash;            /* hashtable we're iterating over */
+    struct chash_link *curr;       /* current link */
+    struct chash_link first;       /* (dummy) first link, for convenience */
+    unsigned int currpos;          /* current position in hashtable */
+};
+
+/* internal function to grow and rehash the hashtable */
+static int chash_expand(struct chash *hash) {
+    unsigned int size,
+                 newsize,
+                 i;
+    void *ptr;
+    struct chash_link *link,
+                      *list,
+                      **linkptr;
+
+    if (hash->bits < (BIT_FROM_BYTE(sizeof(unsigned int)))) {
+        size = BIT_POW2(hash->bits);
+        newsize = BIT_POW2(hash->bits + 1);
+        if ((ptr 
+          = realloc(hash->table, sizeof(struct chash_link*) * newsize))) {
+            hash->table = ptr;
+            BIT_ARRAY_NULL(&hash->table[size], size);
+
+            /* now we need to rehash all of the items in the hashtable */
+            for (i = 0; i < size; i++) {
+                linkptr = &hash->table[i];
+                while ((link = *linkptr)) {
+                    /* note: we need to move it if the bit we just
+                     * started considering is on */
+                    if (BIT_GET(link->hash, hash->bits)) {
+                        /* it belongs in the new slot, move it */
+                        *linkptr = link->next;
+                        link->next = hash->table[size + i];
+                        hash->table[size + i] = link;
+                    } else {
+                        /* it belongs in the old slot, leave it */
+                        linkptr = &link->next;
+                    }
+                }
+            }
+
+            /* reverse all of the new lists, since they're in exactly
+             * the wrong order (ordered by move-to-front) */
+            for (/* note: i == size */; i < newsize; i++) {
+                if ((list = hash->table[i]) && (list->next)) {
+                    /* reverse the list */
+                    hash->table[i] = NULL;
+                    do {
+                        link = list->next;
+                        list->next = hash->table[i];
+                        hash->table[i] = list;
+                        list = link;
+                    } while (list);
+                }
+            }
+
+            hash->bits++;
+            hash->resize_point 
+              = (unsigned int) (BIT_POW2(hash->bits) * hash->resize_load);
+
+            /* watch for overflow */
+            if ((hash->resize_load > 1.0) 
+              && (hash->resize_point < BIT_POW2(hash->bits))) {
+                hash->resize_point = UINT_MAX;
+            }
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+/* internal function to repack the strings area when it becomes fragmented */
+static enum chash_ret chash_strings_repack(struct chash *hash) {
+    char *copy = malloc(hash->strings.used);
+    unsigned int i,
+                 size = BIT_POW2(hash->bits);
+    struct chash_link *link;
+
+    assert(hash->strings.unpacked);
+
+    if (copy) {
+        memcpy(copy, hash->strings.strings, hash->strings.used);
+        hash->strings.used = 0;
+
+        /* iterate through the hash table, copying strings into strings area in
+         * packed, ordered fashion */
+
+        for (i = 0; i < size; i++) {
+            link = hash->table[i];
+            while (link) {
+                memcpy(&hash->strings.strings[hash->strings.used],
+                  &copy[link->key.k_str.ptr], link->key.k_str.len);
+                link->key.k_str.ptr = hash->strings.used;
+                hash->strings.used += link->key.k_str.len;
+                link = link->next;
+            }
+        }
+
+        free(copy);
+        hash->strings.unpacked = 0;
+        return CHASH_OK;
+    } else {
+        return CHASH_ENOMEM;
+    }
+}
+
+/* internal function to expand the strings area when necessary */
+static enum chash_ret chash_strings_expand(struct chash *hash) {
+    void *ptr = realloc(hash->strings.strings, 2 * hash->strings.size);
+
+    if (ptr) {
+        hash->strings.strings = ptr;
+        hash->strings.size *= 2;
+        return CHASH_OK;
+    } else {
+        return CHASH_ENOMEM;
+    }
+}
+
+/* macro to perform all common initialisation of the hashtable */
+#define CHASH_INIT(startbits, resize_load, hash, space, keytype, cmp, str)    \
+    do {                                                                      \
+        if ((space = malloc(sizeof(*space)))                                  \
+          && (space->table = NULL, space->strings.strings = NULL,             \
+              space->strings.size = space->strings.used = 0,                  \
+              space->strings.unpacked = 0, 1)                                 \
+          && (space->table                                                    \
+            = malloc(sizeof(struct chash_link*) * BIT_POW2(startbits)))       \
+          && (space->alloc = objalloc_new(sizeof(struct chash_link), 0,       \
+              DEAR_DEBUG, BULK_ALLOC, NULL))                                  \
+          /* initialise strings area */                                       \
+          && (!str || ((space->strings.size = BULK_ALLOC),                    \
+              (space->strings.strings = malloc(BULK_ALLOC))))) {              \
+            space->bits = startbits;                                          \
+            space->resize_load = resize_load;                                 \
+            space->cmpfn = cmp;                                               \
+            space->data_type = CHASH_TYPE_UNKNOWN;                            \
+            space->hashfn.h_##keytype = hash;                                 \
+            space->elements = 0;                                              \
+            space->resize_point                                               \
+              = (unsigned int) (BIT_POW2(startbits) * resize_load);           \
+            BIT_ARRAY_NULL(space->table, BIT_POW2(startbits));                \
+        } else {                                                              \
+            if (space) {                                                      \
+                if (space->table) {                                           \
+                    free(space->table);                                       \
+                }                                                             \
+                free(space);                                                  \
+            }                                                                 \
+            return NULL;                                                      \
+        }                                                                     \
+    } while (0);
+
+struct chash *chash_ptr_new(unsigned int startbits, float resize_load, 
+  unsigned int (*hash)(const void *key), 
+  int (*cmp)(const void *key1, const void *key2)) {
+    struct chash *table;
+
+    CHASH_INIT(startbits, resize_load, hash, table, ptr, cmp, 0);
+    table->key_type = CHASH_TYPE_PTR;
+    return table;
+}
+
+struct chash *chash_luint_new(unsigned int startbits, float resize_load) {
+    struct chash *table;
+    CHASH_INIT(startbits, resize_load, NULL, table, luint, NULL, 0);
+    table->key_type = CHASH_TYPE_LUINT;
+    return table;
+}
+
+struct chash *chash_str_new(unsigned int startbits, float resize_load, 
+  unsigned int (*hash)(const char *key, unsigned int len)) {
+    struct chash *table;
+    CHASH_INIT(startbits, resize_load, hash, table, str, NULL, 1);
+    table->key_type = CHASH_TYPE_STR;
+    return table;
+}
+
+void chash_delete(struct chash *hash) {
+    objalloc_clear(hash->alloc);
+    objalloc_delete(hash->alloc);
+    if (hash->strings.strings) {
+        free(hash->strings.strings);
+    }
+    free(hash->table);
+    hash->table = NULL;     /* makes use after deletion easy to catch */
+    free(hash);
+    return;
+}
+
+unsigned int chash_size(const struct chash *hash) {
+    return CHASH_SIZE(hash);
+}
+
+unsigned int chash_reserve(struct chash *hash, unsigned int reserve) {
+    return objalloc_reserve(hash->alloc, reserve);
+}
+
+struct chash_iter *chash_iter_new(struct chash *hash) {
+    struct chash_iter *iter;
+
+    if (sizeof(*iter) <= sizeof(struct chash_link)) {
+        if (!(iter = objalloc_malloc(hash->alloc, sizeof(*iter)))) {
+            return NULL;
+        }
+    } else if (!(iter = malloc(sizeof(*iter)))) {
+        return NULL;
+    }
+
+    iter->hash = hash;
+    iter->curr = &iter->first;
+    iter->first.next = NULL;
+    iter->currpos = 0;
+
+    return iter;
+}
+
+void chash_iter_delete(struct chash_iter *iter) {
+    if (sizeof(*iter) <= sizeof(struct chash_link)) {
+        objalloc_free(iter->hash->alloc, iter);
+    } else {
+        free(iter);
+    }
+}
+
+void chash_clear(struct chash *hash) {
+    objalloc_clear(hash->alloc);
+    BIT_ARRAY_NULL(hash->table, BIT_POW2(hash->bits));
+    hash->elements = 0;
+
+    return;
+}
+
+/* insert functions (which are almost exactly the same) */
+
+#define CHASH_INSERT(hash, ky, keytype, dt, datatype, dtptr)                  \
+    do {                                                                      \
+        struct chash_link *newlink;                                           \
+                                                                              \
+        /* note: no search for duplicates */                                  \
+                                                                              \
+        /* obtain a new link, and insert it at the front of the chain */      \
+        if ((newlink = objalloc_malloc(hash->alloc, sizeof(*newlink)))) {     \
+            /* insert new link */                                             \
+            newlink->hash = hashval;                                          \
+            newlink->key.k_##keytype = ky;                                    \
+            newlink->data.d_##datatype = dt;                                  \
+            *dtptr = &newlink->data.d_##datatype;                             \
+            newlink->next = hash->table[modhash];                             \
+            hash->table[modhash] = newlink;                                   \
+            hash->elements++;                                                 \
+                                                                              \
+            /* check if we need to expand the table */                        \
+            if (hash->elements > hash->resize_point) {                        \
+                if (!chash_expand(hash)) {                                    \
+                    /* failed: up the resize point so we don't expand soon */ \
+                    hash->resize_point <<= 1;                                 \
+                }                                                             \
+            }                                                                 \
+                                                                              \
+            return CHASH_OK;                                                  \
+        } else {                                                              \
+            return CHASH_ENOMEM;                                              \
+        }                                                                     \
+    } while (0)
+
+enum chash_ret chash_ptr_ptr_insert(struct chash *hash, const void *ckey, 
+  void *data) {
+    void *key = (void *) ckey;   /* get around const issue */
+    void **dummy;
+    unsigned int hashval = hash->hashfn.h_ptr(key),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_INSERT(hash, key, ptr, data, ptr, &dummy);
+}
+
+enum chash_ret chash_ptr_luint_insert(struct chash *hash, const void *ckey, 
+  unsigned long int data) {
+    void *key = (void *) ckey;   /* get around const issue */
+    unsigned long int *dummy;
+    unsigned int hashval = hash->hashfn.h_ptr(key),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_INSERT(hash, key, ptr, data, luint, &dummy);
+}
+
+enum chash_ret chash_luint_ptr_insert(struct chash *hash, 
+  unsigned long int key, void *data) {
+    void **dummy;
+    unsigned int hashval = key,   /* integral types are their own keys */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_INSERT(hash, key, luint, data, ptr, &dummy);
+}
+
+enum chash_ret chash_luint_luint_insert(struct chash *hash, 
+  unsigned long int key, unsigned long int data) {
+    unsigned long int *dummy;
+    unsigned int hashval = key,   /* integral types are their own keys */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_INSERT(hash, key, luint, data, luint, &dummy);
+}
+
+enum chash_ret chash_luint_dbl_insert(struct chash *hash, 
+  unsigned long int key, double data) {
+    double *dummy;
+    unsigned int hashval = key,   /* integral types are their own keys */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_DBL) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_DBL;
+
+    CHASH_INSERT(hash, key, luint, data, dbl, &dummy);
+}
+
+enum chash_ret chash_luint_flt_insert(struct chash *hash, 
+  unsigned long int key, float data) {
+    float *dummy;
+    unsigned int hashval = key,   /* integral types are their own keys */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_FLT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_FLT;
+
+    CHASH_INSERT(hash, key, luint, data, flt, &dummy);
+}
+
+/* specialisation for string type */
+
+#define CHASH_STR_INSERT(hash, ky, kylen, dt, datatype, dtptr)                \
+    do {                                                                      \
+        struct chash_link *newlink;                                           \
+                                                                              \
+        /* note: no search for duplicates */                                  \
+                                                                              \
+        /* obtain a new link, and insert it at the front of the chain */      \
+        if ((newlink = objalloc_malloc(hash->alloc, sizeof(*newlink)))) {     \
+            /* insert new link */                                             \
+            newlink->hash = hashval;                                          \
+            newlink->key.k_str.len = kylen;                                   \
+                                                                              \
+            /* ensure that there's enough space in the strings area */        \
+            while (hash->strings.size - hash->strings.used < kylen) {         \
+                if ((hash->strings.unpacked >= PACK_HYSTERESIS)               \
+                  && (hash->strings.unpacked >= kylen)) {                     \
+                    if (chash_strings_repack(hash) != CHASH_OK) {             \
+                        /* failed to repack */                                \
+                        objalloc_free(hash->alloc, newlink);                  \
+                        return CHASH_ENOMEM;                                  \
+                    }                                                         \
+                } else {                                                      \
+                    if (chash_strings_expand(hash) != CHASH_OK) {             \
+                        /* failed to expand, see if repacking will let us     \
+                         * fit this string in */                              \
+                        if ((hash->strings.unpacked < kylen)                  \
+                          || (chash_strings_repack(hash) != CHASH_OK)) {      \
+                            /* failed to repack, or repacking wouldn't        \
+                             * free enough space anyway */                    \
+                            objalloc_free(hash->alloc, newlink);              \
+                            return CHASH_ENOMEM;                              \
+                        }                                                     \
+                    }                                                         \
+                }                                                             \
+            }                                                                 \
+                                                                              \
+            /* we have enough space to code the string */                     \
+            newlink->key.k_str.ptr = hash->strings.used;                      \
+            memcpy(&hash->strings.strings[hash->strings.used], ky,            \
+              kylen);                                                         \
+            hash->strings.used += kylen;                                      \
+                                                                              \
+            newlink->data.d_##datatype = dt;                                  \
+            *dtptr = &newlink->data.d_##datatype;                             \
+            newlink->next = hash->table[modhash];                             \
+            hash->table[modhash] = newlink;                                   \
+            hash->elements++;                                                 \
+                                                                              \
+            /* check if we need to expand the table */                        \
+            if (hash->elements > hash->resize_point) {                        \
+                if (!chash_expand(hash)) {                                    \
+                    /* failed: up the resize point so we don't expand soon */ \
+                    hash->resize_point <<= 1;                                 \
+                }                                                             \
+            }                                                                 \
+                                                                              \
+            return CHASH_OK;                                                  \
+        } else {                                                              \
+            return CHASH_ENOMEM;                                              \
+        }                                                                     \
+    } while (0)
+
+enum chash_ret chash_nstr_ptr_insert(struct chash *hash, 
+  const char *key, unsigned int keylen, void *data) {
+    void *dummy;
+    unsigned int hashval = hash->hashfn.h_str(key, keylen),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_STR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_STR_INSERT(hash, key, keylen, data, ptr, &dummy);
+}
+
+/* remove functions (which are almost exactly the same) */
+
+#define CHASH_REMOVE(hash, ky, keytype, keyisptr, dt, datatype)               \
+    do {                                                                      \
+        struct chash_link **linkptr = &hash->table[modhash],                  \
+                          *link = *linkptr;                                   \
+                                                                              \
+        while (link) {                                                        \
+            if ((keyisptr && ((hashval == link->hash)                         \
+                && (!hash->cmpfn((void*) ky, link->key.k_ptr))))              \
+              /* compare direct if key isn't a pointer type */                \
+              || (!keyisptr && (link->key.k_##keytype == ky))) {              \
+                /* found it, remove */                                        \
+                *linkptr = link->next;                                        \
+                *dt = link->data.d_##datatype;                                \
+                objalloc_free(hash->alloc, link);                             \
+                hash->elements--;                                             \
+                return CHASH_OK;                                              \
+            }                                                                 \
+            linkptr = &link->next;                                            \
+            link = *linkptr;                                                  \
+        }                                                                     \
+    } while (0)
+
+enum chash_ret chash_ptr_ptr_remove(struct chash *hash, const void *key, 
+  void **data) {
+    unsigned int hashval = hash->hashfn.h_ptr(key),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_REMOVE(hash, key, ptr, 1, data, ptr);
+    /* failed to remove */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_ptr_luint_remove(struct chash *hash, const void *key, 
+  unsigned long int *data) {
+    unsigned int hashval = hash->hashfn.h_ptr(key),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_REMOVE(hash, key, ptr, 1, data, luint);
+    /* failed to remove */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_luint_ptr_remove(struct chash *hash, 
+  unsigned long int key, void **data) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_REMOVE(hash, key, luint, 0, data, ptr); 
+    /* failed to remove */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_luint_luint_remove(struct chash *hash, 
+  unsigned long int key, unsigned long int *data) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_REMOVE(hash, key, luint, 0, data, luint); 
+    /* failed to remove */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_luint_dbl_remove(struct chash *hash, 
+  unsigned long int key, double *data) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_DBL) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_DBL;
+
+    CHASH_REMOVE(hash, key, luint, 0, data, dbl); 
+    /* failed to remove */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_luint_flt_remove(struct chash *hash, 
+  unsigned long int key, float *data) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_FLT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_FLT;
+
+    CHASH_REMOVE(hash, key, luint, 0, data, flt); 
+    /* failed to remove */
+    return CHASH_ENOENT;
+}
+
+/* specialisation of remove for string type */
+
+#define CHASH_STR_REMOVE(hash, ky, kylen, dt, datatype)                       \
+    do {                                                                      \
+        struct chash_link **linkptr = &hash->table[modhash],                  \
+                          *link = *linkptr;                                   \
+                                                                              \
+        while (link) {                                                        \
+            if ((kylen == link->key.k_str.len)                                \
+              && (hashval == link->hash)                                      \
+              && (!str_ncmp(ky, &hash->strings.strings[link->key.k_str.ptr],  \
+                  kylen))) {                                                  \
+                /* found it, remove */                                        \
+                                                                              \
+                assert(hash->strings.used >= kylen);                          \
+                /* string is in strings area */                               \
+                if (link->key.k_str.ptr == hash->strings.used - kylen) {      \
+                    /* its the last string in the area, don't need to         \
+                     * fragment */                                            \
+                    hash->strings.used -= kylen;                              \
+                } else {                                                      \
+                    hash->strings.unpacked += kylen;                          \
+                }                                                             \
+                *dt = link->data.d_##datatype;                                \
+                *linkptr = link->next;                                        \
+                objalloc_free(hash->alloc, link);                             \
+                hash->elements--;                                             \
+                return CHASH_OK;                                              \
+            }                                                                 \
+            linkptr = &link->next;                                            \
+            link = *linkptr;                                                  \
+        }                                                                     \
+    } while (0)
+
+enum chash_ret chash_nstr_ptr_remove(struct chash *hash, 
+  const char *key, unsigned int keylen, void **data) {
+    unsigned int hashval = hash->hashfn.h_str(key, keylen),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_STR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_STR_REMOVE(hash, key, keylen, data, ptr); 
+    /* failed to remove */
+    return CHASH_ENOENT;
+}
+
+/* find functions (which are almost exactly the same) */
+
+#define CHASH_FIND(hash, ky, keytype, keyisptr, dt, datatype)                 \
+    do {                                                                      \
+        struct chash_link **linkptr = &hash->table[modhash],                  \
+                          *link = *linkptr;                                   \
+                                                                              \
+        while (link) {                                                        \
+            if ((keyisptr && ((hashval == link->hash)                         \
+                && (!hash->cmpfn((void*) ky, link->key.k_ptr))))              \
+              /* compare direct if key isn't a pointer type */                \
+              || (!keyisptr && (link->key.k_##keytype == ky))) {              \
+                /* found it, move to front */                                 \
+                if (link != hash->table[modhash]) {                           \
+                    *linkptr = link->next;                                    \
+                    link->next = hash->table[modhash];                        \
+                    hash->table[modhash] = link;                              \
+                }                                                             \
+                *dt = &link->data.d_##datatype;                               \
+                return CHASH_OK;                                              \
+            }                                                                 \
+            linkptr = &link->next;                                            \
+            link = *linkptr;                                                  \
+        }                                                                     \
+    } while (0)
+
+enum chash_ret chash_ptr_ptr_find(struct chash *hash, const void *key, 
+  void ***data) {
+    unsigned int hashval = hash->hashfn.h_ptr(key),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_FIND(hash, key, ptr, 1, data, ptr);
+    /* failed to find it */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_ptr_luint_find(struct chash *hash, const void *key, 
+  unsigned long int **data) {
+    unsigned int hashval = hash->hashfn.h_ptr(key),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_FIND(hash, key, ptr, 1, data, luint);
+    /* failed to find it */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_luint_ptr_find(struct chash *hash, unsigned long int key, 
+  void ***data) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_FIND(hash, key, luint, 0, data, ptr);
+    /* failed to find it */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_luint_luint_find(struct chash *hash, unsigned long int key,
+  unsigned long int **data) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_FIND(hash, key, luint, 0, data, luint);
+    /* failed to find it */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_luint_dbl_find(struct chash *hash, unsigned long int key, 
+  double **data) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_DBL) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_DBL;
+
+    CHASH_FIND(hash, key, luint, 0, data, dbl);
+    /* failed to find it */
+    return CHASH_ENOENT;
+}
+
+enum chash_ret chash_luint_flt_find(struct chash *hash, unsigned long int key, 
+  float **data) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_FLT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_FLT;
+
+    CHASH_FIND(hash, key, luint, 0, data, flt);
+    /* failed to find it */
+    return CHASH_ENOENT;
+}
+
+/* specialisation for str type */
+
+#define CHASH_STR_FIND(hash, ky, kylen, dt, datatype)                         \
+    do {                                                                      \
+        struct chash_link **linkptr = &hash->table[modhash],                  \
+                          *link = *linkptr;                                   \
+                                                                              \
+        while (link) {                                                        \
+            if ((kylen == link->key.k_str.len)                                \
+              && (hashval == link->hash)                                      \
+              && (!str_ncmp(ky, &hash->strings.strings[link->key.k_str.ptr],  \
+                  kylen))) {                                                  \
+                /* found it, move to front */                                 \
+                if (link != hash->table[modhash]) {                           \
+                    *linkptr = link->next;                                    \
+                    link->next = hash->table[modhash];                        \
+                    hash->table[modhash] = link;                              \
+                }                                                             \
+                *dt = &link->data.d_##datatype;                               \
+                return CHASH_OK;                                              \
+            }                                                                 \
+            linkptr = &link->next;                                            \
+            link = *linkptr;                                                  \
+        }                                                                     \
+    } while (0)
+
+enum chash_ret chash_nstr_ptr_find(struct chash *hash, const char *key, 
+  unsigned int keylen, void ***data) {
+    unsigned int hashval = hash->hashfn.h_str(key, keylen),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_STR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_STR_FIND(hash, key, keylen, data, ptr);
+    /* failed to find it */
+    return CHASH_ENOENT;
+}
+
+/* find_insert function (which are almost exactly the same) */
+
+enum chash_ret chash_ptr_ptr_find_insert(struct chash *hash, const void *key, 
+  void ***fnd_data, void *ins_data, int *find) {
+    unsigned int hashval = hash->hashfn.h_ptr(key),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    *find = 1;
+    CHASH_FIND(hash, key, ptr, 1, fnd_data, ptr);
+    *find = 0;
+    CHASH_INSERT(hash, (void *) key, ptr, ins_data, ptr, fnd_data);
+}
+
+enum chash_ret chash_luint_dbl_find_insert(struct chash *hash, 
+  unsigned long int key, double **fnd_data, double ins_data, int *find) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_DBL) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_DBL;
+
+    *find = 1;
+    CHASH_FIND(hash, key, luint, 0, fnd_data, dbl);
+    *find = 0;
+    CHASH_INSERT(hash, key, luint, ins_data, dbl, fnd_data);
+}
+
+enum chash_ret chash_luint_flt_find_insert(struct chash *hash, 
+  unsigned long int key, float **fnd_data, float ins_data, int *find) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_FLT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_FLT;
+
+    *find = 1;
+    CHASH_FIND(hash, key, luint, 0, fnd_data, flt);
+    *find = 0;
+    CHASH_INSERT(hash, key, luint, ins_data, flt, fnd_data);
+}
+
+enum chash_ret chash_ptr_luint_find_insert(struct chash *hash, 
+  const void *key, unsigned long int **fnd_data, unsigned long int ins_data, 
+  int *find) {
+    unsigned int hashval = hash->hashfn.h_ptr(key),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    *find = 1;
+    CHASH_FIND(hash, key, ptr, 1, fnd_data, luint);
+    *find = 0;
+    CHASH_INSERT(hash, (void *) key, ptr, ins_data, luint, fnd_data);
+}
+
+enum chash_ret chash_luint_ptr_find_insert(struct chash *hash, 
+  unsigned long int key, void ***fnd_data, void *ins_data, int *find) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    *find = 1;
+    CHASH_FIND(hash, key, luint, 0, fnd_data, ptr);
+    *find = 0;
+    CHASH_INSERT(hash, key, luint, ins_data, ptr, fnd_data);
+}
+
+enum chash_ret chash_luint_luint_find_insert(struct chash *hash, 
+  unsigned long int key, unsigned long int **fnd_data, 
+  unsigned long int ins_data, int *find) {
+    unsigned int hashval = key,  /* integral types are their own hash values */
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    *find = 1;
+    CHASH_FIND(hash, key, luint, 0, fnd_data, luint);
+    *find = 0;
+    CHASH_INSERT(hash, key, luint, ins_data, luint, fnd_data);
+}
+
+enum chash_ret chash_nstr_ptr_find_insert(struct chash *hash, 
+  const char *key, unsigned int keylen, void ***fnd_data, void *ins_data, 
+  int *find) {
+    unsigned int hashval = hash->hashfn.h_str(key, keylen),
+                 modhash = BIT_MOD2(hashval, hash->bits);
+
+    assert(hash->key_type == CHASH_TYPE_STR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    *find = 1;
+    CHASH_STR_FIND(hash, key, keylen, fnd_data, ptr);
+    *find = 0;
+    CHASH_STR_INSERT(hash, key, keylen, ins_data, ptr, fnd_data);
+}
+
+/* foreach function (which are almost exactly the same) */
+
+#define CHASH_FOREACH(hash, fn, keytype, datatype, userd)                     \
+    do {                                                                      \
+        unsigned int i,                                                       \
+                     size = BIT_POW2(hash->bits);                             \
+        struct chash_link *link;                                              \
+                                                                              \
+        for (i = 0; i < size; i++) {                                          \
+            link = hash->table[i];                                            \
+            while (link) {                                                    \
+                fn(userd, link->key.k_##keytype, &link->data.d_##datatype);   \
+                link = link->next;                                            \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        return CHASH_OK;                                                      \
+    } while (0)
+
+enum chash_ret chash_ptr_ptr_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, const void *key, void **data)) {
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_FOREACH(hash, fn, ptr, ptr, userdata);
+}
+
+enum chash_ret chash_ptr_luint_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, const void *key, unsigned long int *data)) {
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_FOREACH(hash, fn, ptr, luint, userdata);
+}
+
+enum chash_ret chash_luint_ptr_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, unsigned long int key, void **data)) {
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_FOREACH(hash, fn, luint, ptr, userdata);
+}
+
+enum chash_ret chash_luint_luint_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, unsigned long int key, unsigned long int *data)) {
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_FOREACH(hash, fn, luint, luint, userdata);
+}
+
+enum chash_ret chash_luint_dbl_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, unsigned long int key, double *data)) {
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_DBL) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_DBL;
+
+    CHASH_FOREACH(hash, fn, luint, dbl, userdata);
+}
+
+enum chash_ret chash_luint_flt_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, unsigned long int key, float *data)) {
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_FLT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_FLT;
+
+    CHASH_FOREACH(hash, fn, luint, flt, userdata);
+}
+
+/* specialisation for str type */
+
+#define CHASH_STR_FOREACH(hash, fn, datatype, userd)                          \
+    do {                                                                      \
+        unsigned int i,                                                       \
+                     size = BIT_POW2(hash->bits);                             \
+        struct chash_link *link;                                              \
+                                                                              \
+        for (i = 0; i < size; i++) {                                          \
+            link = hash->table[i];                                            \
+                                                                              \
+            while (link) {                                                    \
+                fn(userd, &hash->strings.strings[link->key.k_str.ptr],        \
+                  link->key.k_str.len, &link->data.d_##datatype);             \
+                link = link->next;                                            \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        return CHASH_OK;                                                      \
+    } while (0)
+
+enum chash_ret chash_nstr_ptr_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, const char *key, unsigned int len, void **data)) {
+    assert(hash->key_type == CHASH_TYPE_STR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_STR_FOREACH(hash, fn, ptr, userdata);
+}
+
+/* iteration functions */
+
+#define CHASH_ITER_NEXT(iter, key, keytype, data, datatype)                   \
+    do {                                                                      \
+        unsigned int tablesize = BIT_POW2((iter)->hash->bits);                \
+        struct chash_link *curr = (iter)->curr->next;                         \
+                                                                              \
+        while (!curr) {                                                       \
+            if ((iter)->currpos < tablesize) {                                \
+                curr = (iter)->hash->table[(iter)->currpos++];                \
+            } else {                                                          \
+                return CHASH_ITER_FINISH;                                     \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        (iter)->curr = curr;                                                  \
+        *(key) = curr->key.k_##keytype;                                       \
+        *(data) = &curr->data.d_##datatype;                                   \
+        return CHASH_OK;                                                      \
+    } while (0)
+
+enum chash_ret chash_iter_ptr_ptr_next(struct chash_iter *iter, 
+  const void **key, void ***data) {
+    struct chash *hash = iter->hash;
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_ITER_NEXT(iter, key, ptr, data, ptr);
+}
+
+enum chash_ret chash_iter_ptr_luint_next(struct chash_iter *iter, 
+  const void **key, unsigned long int **data) {
+    struct chash *hash = iter->hash;
+    assert(hash->key_type == CHASH_TYPE_PTR);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_ITER_NEXT(iter, key, ptr, data, luint);
+}
+
+enum chash_ret chash_iter_luint_ptr_next(struct chash_iter *iter, 
+  unsigned long int *key, void ***data) {
+    struct chash *hash = iter->hash;
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_ITER_NEXT(iter, key, luint, data, ptr);
+}
+
+enum chash_ret chash_iter_luint_luint_next(struct chash_iter *iter, 
+  unsigned long int *key, unsigned long int **data) {
+    struct chash *hash = iter->hash;
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_LUINT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_LUINT;
+
+    CHASH_ITER_NEXT(iter, key, luint, data, luint);
+}
+
+enum chash_ret chash_iter_luint_dbl_next(struct chash_iter *iter, 
+  unsigned long int *key, double **data) {
+    struct chash *hash = iter->hash;
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_DBL) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_DBL;
+
+    CHASH_ITER_NEXT(iter, key, luint, data, dbl); 
+}
+
+enum chash_ret chash_iter_luint_flt_next(struct chash_iter *iter, 
+  unsigned long int *key, float **data) {
+    struct chash *hash = iter->hash;
+    assert(hash->key_type == CHASH_TYPE_LUINT);
+    assert((hash->data_type == CHASH_TYPE_FLT) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_FLT;
+
+    CHASH_ITER_NEXT(iter, key, luint, data, flt); 
+}
+
+/* specialisation for str type */
+
+#define CHASH_STR_ITER_NEXT(iter, key, keylen, data, datatype)                \
+    do {                                                                      \
+        unsigned int tablesize = BIT_POW2((iter)->hash->bits);                \
+        struct chash_link *curr = (iter)->curr->next;                         \
+                                                                              \
+        while (!curr) {                                                       \
+            if ((iter)->currpos < tablesize) {                                \
+                curr = (iter)->hash->table[(iter)->currpos++];                \
+            } else {                                                          \
+                return CHASH_ITER_FINISH;                                     \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        (iter)->curr = curr;                                                  \
+        *(data) = &curr->data.d_ptr;                                          \
+        *keylen = curr->key.k_str.len;                                        \
+        *(key) = &iter->hash->strings.strings[curr->key.k_str.ptr];           \
+        return CHASH_OK;                                                      \
+    } while (0)
+
+enum chash_ret chash_iter_nstr_ptr_next(struct chash_iter *iter, 
+  const char **key, unsigned int *keylen, void ***data) {
+    struct chash *hash = iter->hash;
+    assert(hash->key_type == CHASH_TYPE_STR);
+    assert((hash->data_type == CHASH_TYPE_PTR) 
+      || (hash->data_type == CHASH_TYPE_UNKNOWN));
+    hash->data_type = CHASH_TYPE_PTR;
+
+    CHASH_STR_ITER_NEXT(iter, key, keylen, data, ptr);
+}
+
+/* str to nstr converters */
+
+enum chash_ret chash_str_ptr_insert(struct chash *hash, 
+  const char *key, void *data) {
+    return chash_nstr_ptr_insert(hash, key, str_len(key), data);
+}
+
+enum chash_ret chash_str_ptr_remove(struct chash *hash, 
+  const char *key, void **data) {
+    return chash_nstr_ptr_remove(hash, key, str_len(key), data);
+}
+
+enum chash_ret chash_str_ptr_find(struct chash *hash, const char *key, 
+  void ***data) {
+    return chash_nstr_ptr_find(hash, key, str_len(key), data);
+}
+
+enum chash_ret chash_str_ptr_find_insert(struct chash *hash, 
+  const char *key, void ***fnd_data, void *ins_data, int *find) {
+    return chash_nstr_ptr_find_insert(hash, key, str_len(key), 
+        fnd_data, ins_data, find);
+}
+
+#ifdef CHASH_TEST
+#include <stdio.h>
+
+unsigned int inthash(unsigned int key) {
+    return key;
+}
+
+void luint_ptr_free(void *opaque, unsigned long int key, void **data) {
+    free(*data);
+}
+
+int test_str() {
+    struct chash *hash;
+    const char *and = "and";
+    const char *or = "or";
+    const char *the = "the";
+    const char *not = "not";
+    const char *a = "a";
+    const char *medium = "medium";
+    const char *longstr = "blasdfjas;dljb;alsjkdf;lasjfdbasl;djfoeww;mlkvasdo"
+      "fwe;lawjrf;lsjl;fjasl;dfja;slkdjf;laejri;oajj;lbvjasdo;fijeo;fjal;sn;o"
+      "gvaeoirfal;skenfl;aksjoijre;ajflkans;ldgjaoiejr;lasjfdlknas;ovijasoier"
+      ";laskenf;lkasnfvoiajdsf;ojawe;lrkn;wlerkjwpoieur9p2u349823958y2o;3lkjn"
+      "52;o5iu29-8y52h52;n35;2lkn5o2pi35p92875928h5o2n5235h-928735-92835po2n3"
+      "5k2hj35p9278359072p5oiuh2;o5n23o5iu2-98375-2983h5o25n3p[209u5-928735-9"
+      "2h5[3o2kn5o2i3j5-092723-87295ioh23;k5jn2309572035972o3i5hn2;35p2o";
+    const char *longstr2 = "xxxsdfjas;dljb;alsjkdf;lasjfdbasl;djfoeww;mlkvasdo"
+      "fwe;lawjrf;lsjl;fjasl;dfja;slkdjf;laejri;oajj;lbvjasdo;fijeo;fjal;sn;o"
+      "gvaeoirfal;skenfl;aksjoijre;ajflkans;ldgjaoiejr;lasjfdlknas;ovijasoier"
+      ";laskenf;lkasnfvoiajdsf;ojawe;lrkn;wlerkjwpoieur9p2u349823958y2o;3lkjn"
+      "52;o5iu29-8y52h52;n35;2lkn5o2pi35p92875928h5o2n5235h-928735-92835po2n3"
+      "5k2hj35p9278359072p5oiuh2;o5n23o5iu2-98375-2983h5o25n3p[209u5-928735-9"
+      "2h5[3o2kn5o2i3j5-092723-87295ioh23;k5jn2309572035972o3i5hn2;35p2olsdk8";
+    enum chash_ret ret;
+    void *found;
+    void **ifound;
+
+    if ((hash = chash_str_new(0, 2.0, str_nhash))) {
+        /* insert some elements */
+        ret = chash_str_ptr_insert(hash, and, (char *) and);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, the, (char *) the);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, or, (char *) or);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, not, (char *) not);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, a, (char *) a);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, medium, (char *) medium);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, longstr, (char *) longstr);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, longstr2, (char *) longstr2);
+        assert(ret == CHASH_OK);
+        assert(chash_size(hash) == 8);
+
+        /* find the elements */
+        ret = chash_str_ptr_find(hash, and, &ifound);
+        assert(ret == CHASH_OK && *ifound == (void *) and);
+        ret = chash_str_ptr_find(hash, or, &ifound);
+        assert(ret == CHASH_OK && *ifound == (void *) or);
+        ret = chash_str_ptr_find(hash, not, &ifound);
+        assert(ret == CHASH_OK && *ifound == (void *) not);
+        ret = chash_str_ptr_find(hash, the, &ifound);
+        assert(ret == CHASH_OK && *ifound == (void *) the);
+        ret = chash_str_ptr_find(hash, a, &ifound);
+        assert(ret == CHASH_OK && *ifound == (void *) a);
+        ret = chash_str_ptr_find(hash, medium, &ifound);
+        assert(ret == CHASH_OK && *ifound == (void *) medium);
+        ret = chash_str_ptr_find(hash, longstr, &ifound);
+        assert(ret == CHASH_OK && *ifound == (void *) longstr);
+        ret = chash_str_ptr_find(hash, longstr2, &ifound);
+        assert(ret == CHASH_OK && *ifound == (void *) longstr2);
+
+        /* remove the elements */
+        ret = chash_str_ptr_remove(hash, and, &found);
+        assert(ret == CHASH_OK && found == (void *) and);
+        ret = chash_str_ptr_remove(hash, or, &found);
+        assert(ret == CHASH_OK && found == (void *) or);
+        ret = chash_str_ptr_remove(hash, not, &found);
+        assert(ret == CHASH_OK && found == (void *) not);
+        ret = chash_str_ptr_remove(hash, the, &found);
+        assert(ret == CHASH_OK && found == (void *) the);
+        ret = chash_str_ptr_remove(hash, a, &found);
+        assert(ret == CHASH_OK && found == (void *) a);
+        ret = chash_str_ptr_remove(hash, medium, &found);
+        assert(ret == CHASH_OK && found == (void *) medium);
+        ret = chash_str_ptr_remove(hash, longstr, &found);
+        assert(ret == CHASH_OK && found == (void *) longstr);
+        ret = chash_str_ptr_remove(hash, longstr2, &found);
+        assert(ret == CHASH_OK && found == (void *) longstr2);
+        assert(chash_size(hash) == 0);
+
+        /* insert them back */
+        ret = chash_str_ptr_insert(hash, and, (char *) and);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, the, (char *) the);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, or, (char *) or);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, not, (char *) not);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, a, (char *) a);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, medium, (char *) medium);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, longstr, (char *) longstr);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, longstr2, (char *) longstr2);
+        assert(ret == CHASH_OK);
+
+        /* remove the elements */
+        ret = chash_str_ptr_remove(hash, and, &found);
+        assert(ret == CHASH_OK && found == (void *) and);
+        ret = chash_str_ptr_remove(hash, or, &found);
+        assert(ret == CHASH_OK && found == (void *) or);
+        ret = chash_str_ptr_remove(hash, not, &found);
+        assert(ret == CHASH_OK && found == (void *) not);
+        ret = chash_str_ptr_remove(hash, the, &found);
+        assert(ret == CHASH_OK && found == (void *) the);
+        ret = chash_str_ptr_remove(hash, a, &found);
+        assert(ret == CHASH_OK && found == (void *) a);
+        ret = chash_str_ptr_remove(hash, medium, &found);
+        assert(ret == CHASH_OK && found == (void *) medium);
+        ret = chash_str_ptr_remove(hash, longstr, &found);
+        assert(ret == CHASH_OK && found == (void *) longstr);
+        ret = chash_str_ptr_remove(hash, longstr2, &found);
+        assert(ret == CHASH_OK && found == (void *) longstr2);
+        assert(chash_size(hash) == 0);
+
+        /* fail finding elements */
+        ret = chash_str_ptr_find(hash, and, &ifound);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_find(hash, or, &ifound);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_find(hash, not, &ifound);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_find(hash, the, &ifound);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_find(hash, a, &ifound);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_find(hash, medium, &ifound);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_find(hash, longstr, &ifound);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_find(hash, longstr2, &ifound);
+        assert(ret == CHASH_ENOENT);
+
+        /* fail removing elements */
+        ret = chash_str_ptr_remove(hash, and, &found);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_remove(hash, or, &found);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_remove(hash, not, &found);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_remove(hash, the, &found);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_remove(hash, a, &found);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_remove(hash, medium, &found);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_remove(hash, longstr, &found);
+        assert(ret == CHASH_ENOENT);
+        ret = chash_str_ptr_remove(hash, longstr2, &found);
+        assert(ret == CHASH_ENOENT);
+
+        /* insert them back */
+        ret = chash_str_ptr_insert(hash, and, (char *) and);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, the, (char *) the);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, or, (char *) or);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, not, (char *) not);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, a, (char *) a);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, medium, (char *) medium);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, longstr, (char *) longstr);
+        assert(ret == CHASH_OK);
+        ret = chash_str_ptr_insert(hash, longstr2, (char *) longstr2);
+        assert(ret == CHASH_OK);
+
+        /* clear elements */
+        chash_clear(hash);
+        assert(CHASH_SIZE(hash) == 0);
+
+        chash_delete(hash);
+        return 1;
+    } else {
+        fprintf(stderr, "hashtable failed init\n");
+        return 0;
+    }
+}
+
+int main() {
+    struct chash *hash;
+    unsigned int i,
+                 size = 10000;
+    int ret;
+    void *vptr,
+         **vptrptr;
+    unsigned int *ptr;
+
+    if (!test_str()) {
+        fprintf(stderr, "string hashtable failed\n");
+        return EXIT_FAILURE;
+    }
+
+    if ((hash = chash_luint_new(0, 2.0))) {
+        /* insert some elements */
+        for (i = 0; i < size; i++) {
+            assert(CHASH_SIZE(hash) == i);
+            ptr = malloc(sizeof(*ptr));
+            assert(ptr);
+            *ptr = i;
+            ret = chash_luint_ptr_insert(hash, i, ptr);
+            assert(ret == CHASH_OK);
+            assert(CHASH_SIZE(hash) == i + 1);
+        }
+
+        /* find the elements */
+        for (i = 0; i < size; i++) {
+            ret = chash_luint_ptr_find(hash, i, &vptrptr);
+            assert(ret == CHASH_OK);
+            assert((ptr = *vptrptr) && *ptr == i);
+        }
+
+        /* remove the elements */
+        for (i = 0; i < size / 2; i++) {
+            ret = chash_luint_ptr_remove(hash, i, &vptr);
+            assert(ret == CHASH_OK);
+            assert((ptr = vptr) && *ptr == i);
+            free(ptr);
+        }
+
+        /* insert them back */
+        for (i = 0; i < size / 2; i++) {
+            assert(CHASH_SIZE(hash) == size / 2 + i);
+            ptr = malloc(sizeof(*ptr));
+            assert(ptr);
+            *ptr = i;
+            ret = chash_luint_ptr_insert(hash, i, ptr);
+            assert(ret == CHASH_OK);
+            assert(CHASH_SIZE(hash) == size / 2 + i + 1);
+        }
+
+        /* remove the elements */
+        for (i = 0; i < size / 2; i++) {
+            ret = chash_luint_ptr_remove(hash, i, &vptr);
+            assert(ret == CHASH_OK);
+            assert((ptr = vptr) && *ptr == i);
+            free(ptr);
+        }
+
+        /* fail finding elements */
+        for (i = 0; i < size / 2; i++) {
+            ret = chash_luint_ptr_find(hash, i, &vptrptr);
+            assert(ret == CHASH_ENOENT);
+        }
+
+        /* find remaining */
+        for (; i < size; i++) {
+            ret = chash_luint_ptr_find(hash, i, &vptrptr);
+            assert(ret == CHASH_OK);
+            assert((ptr = *vptrptr) && *ptr == i);
+        }
+
+        /* fail removing elements */
+        for (i = 0; i < size / 2; i++) {
+            ret = chash_luint_ptr_remove(hash, i, &vptr);
+            assert(ret == CHASH_ENOENT);
+        }
+
+        /* clear elements */
+        chash_luint_ptr_foreach(hash, NULL, luint_ptr_free);
+        chash_clear(hash);
+        assert(CHASH_SIZE(hash) == 0);
+
+        /* fail to find the elements */
+        for (i = 0; i < size; i++) {
+            ret = chash_luint_ptr_find(hash, i, &vptrptr);
+            assert(ret == CHASH_ENOENT);
+        }
+
+        chash_delete(hash);
+    } else {
+        fprintf(stderr, "hashtable failed init\n");
+        return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}
+#endif
+
diff --git a/src/commandline.c b/src/commandline.c
new file mode 100644 (file)
index 0000000..bb5cfec
--- /dev/null
@@ -0,0 +1,1634 @@
+/* commandline.c is the new command-line interface for the search engine
+ *
+ * written nml 2003-07-21
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "config.h"
+#include "def.h"
+#include "docmap.h"         /* needed to set cache values on index load */
+#include "getlongopt.h"
+#include "index.h"
+#include "str.h"
+#include "queryparse.h"
+#include "timings.h"
+#include "index_querybuild.h"
+#include "summarise.h"
+#include "error.h"
+#include "signals.h"
+#include "svnversion.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+void print_usage(const char *progname, FILE *output, int verbose) {
+    const char *name = str_rchr(progname, '/');
+
+    if (name) {
+        name++;
+    } else {
+        name = progname;
+    }
+    fprintf(output, "usage to query: '%s'\n", name);
+    fprintf(output, "  query options:\n");
+    fprintf(output, "    -f,--filename: specify index to load (default "
+      "'index')\n");
+    fprintf(output, "    -n,--number-results: provide this many results per "
+      "query (default: 20)\n");
+    fprintf(output, "    -b,--begin-results: provide results after this "
+      "offset (default 0)\n");
+    fprintf(output, "    --summary=[value]: create textual summary of this "
+      "type\n"
+      "                       (where value is capitalise, plain, or tag)\n");
+    fprintf(output, "    --query-list=[file]: read queries from this file\n");
+    fprintf(output, "    --query-stop=[file]: stop queries according to the "
+      "contents of this file\n");
+    fprintf(output, 
+      "                         (or use default if no file give)\n");
+    fprintf(output, "    --big-and-fast: use more memory\n");
+    fprintf(output, "    -s,--stats: get index statistics\n");
+    fprintf(output, "    -v,--version: print version number\n");
+    fprintf(output, "    -h,--help: print this message\n");
+
+    fprintf(output, "\n");
+    fprintf(output, "  query metric options:\n");
+    fprintf(output, "    --anh-impact: evaluate using impact-ordered lists\n"
+      "                  (must have specified --anh-impact while indexing)\n");
+    fprintf(output, "    --okapi: use Okapi BM25 metric\n");
+    fprintf(output, "    --k1=[float]: set Okapi BM25 k1 value\n");
+    fprintf(output, "    --k3=[float]: set Okapi BM25 k3 value\n");
+    fprintf(output, "    --b=[float]: set Okapi BM25 b value\n");
+    fprintf(output, "    --pivoted-cosine=[float]: use pivoted cosine "
+      "metric, with given pivot\n");
+    fprintf(output, "    --cosine: use cosine metric\n");
+    fprintf(output, "    --hawkapi=[float]: use Dave Hawking's metric, "
+      "with alpha given\n");
+    fprintf(output, "    --dirichlet=[uint]: use Dirichlet-smoothed LM "
+      "metric, with mu given\n");
+
+    fprintf(output, "\n");
+    fprintf(output, "usage to index: '%s -i file1 ... fileN'\n", 
+      name);
+    fprintf(output, "  indexing options:\n");
+    fprintf(output, "    -f,--filename: name the created index "
+      "(default 'index')\n");
+    fprintf(output, "    --big-and-fast: use more memory\n");
+    fprintf(output, "    --file-list=[file]: read files to index from this "
+      "file\n");
+    fprintf(output, "    --stem=[value]: change stemming algorithm\n"
+      "                    (value is one of none, eds, light, porters)\n"
+      "                    (default is light)\n");
+    fprintf(output, "    --add: add indexed files to an existing index\n");
+    fprintf(output, "    --anh-impact: generate impact-ordered lists\n");
+
+    return;
+}
+
+/* struct to hold arguments */
+struct args {
+    int stat;
+    int index;
+    int index_add;
+    int index_add_stats;
+    char *prefix;
+    char **list;
+    FILE *qlist;
+
+    const char *type;
+    char *config_file;
+    unsigned int memory;
+    unsigned int results;
+    unsigned int first_result;
+    char * stop_file;
+    char * qstop_file;
+
+    int sopts;
+    struct index_search_opt sopt;
+    int aopts;
+    struct index_add_opt aopt;
+    int copts;
+    struct index_commit_opt copt;
+    int nopts;
+    struct index_new_opt nopt;
+    int lopts;
+    struct index_load_opt lopt;
+};
+
+static void free_args(struct args *args) {
+    unsigned int i = 0;
+
+    if (args->prefix) {
+        free(args->prefix);
+    }
+    if (args->list) {
+        for (i = 0; args->list[i]; i++) {
+            free(args->list[i]);
+        }
+        free(args->list);
+    }
+    if (args->config_file) {
+        free(args->config_file);
+    }
+    if (args->stop_file) {
+        free(args->stop_file);
+    }
+    if (args->qstop_file) {
+        free(args->qstop_file);
+    }
+    if (args->type) {
+        free((char *) args->type);
+    }
+    if (args->qlist && args->qlist != stdin) {
+        fclose(args->qlist);
+    }
+    return;
+}
+
+/* internal function to qualify a given filename with the current working
+ * directly if necessary */
+static char *path_dup(const char *file, const char *path) {
+    unsigned int len;
+    char *tmp;
+
+    /* FIXME: avoid unix-centric checking of file-name absolutism */
+#ifdef WIN32
+    if ((*file && (file[1] == ':') && (file[2] == '\\')) || !path) {
+        return str_dup(file);
+    }
+#else
+    if ((*file == '/') || !path) {
+        return str_dup(file);
+    }
+#endif
+    if ((len = str_len(file) + 1 + str_len(path) + 1) 
+      && (tmp = malloc(len))) {
+        unsigned int tmplen;
+
+        str_lcpy(tmp, path, len);
+
+        tmplen = str_len(tmp);
+        tmp[tmplen] = OS_SEPARATOR;
+        tmp[tmplen + 1] = '\0';
+
+        str_lcat(tmp, file, len);
+        return tmp;
+    } else {
+        return NULL;
+    }
+}
+
+/* internal function to fill the args list from the given stream */
+static int fill_args_list(struct args *args, FILE *input, const char *path) {
+    unsigned int listcount;
+    char buf[FILENAME_MAX + 1];
+
+    if (!args->list) {
+        if (!(args->list = malloc(sizeof(*args->list)))) {
+            return 0;
+        }
+        args->list[0] = NULL;
+    }
+
+    /* count initial items */
+    for (listcount = 0; args->list[listcount]; listcount++) ;
+
+    /* add items */
+    while (fgets(buf, FILENAME_MAX + 1, input)
+      && !ferror(input)) {
+        void *ptr;
+
+        str_rtrim(buf);
+
+        if (!(ptr 
+          = realloc(args->list, sizeof(*args->list) * (listcount + 2)))) {
+            return 0;
+        }
+        args->list = ptr;
+        if (!(args->list[listcount] = path_dup(buf, path))) {
+            return 0;
+        }
+        listcount++;
+    }
+    args->list[listcount] = NULL;
+
+    return feof(input) && !ferror(input);
+}
+
+/* enumeration of option ids */
+enum {
+    OPT_INDEX, OPT_FILENAME, OPT_CONFIG, OPT_TYPE, OPT_NUMBER_RESULTS,
+    OPT_BEGIN_RESULTS, OPT_VERSION, OPT_HELP, OPT_STATS, OPT_SUMMARY,
+    OPT_MEMORY, OPT_ACCUMULATION_MEMORY, OPT_ACCUMULATION_DOCS, OPT_DUMP_MEMORY,
+    OPT_DUMP_VECS, OPT_REBUILD, OPT_REMERGE, OPT_INPLACE, OPT_MAXFILESIZE, 
+    OPT_FILELIST, OPT_ADD, OPT_ADD_STATS, OPT_OKAPI, OPT_K1, OPT_K3, OPT_B,
+    OPT_PIVOTED_COSINE, OPT_COSINE, OPT_WORD_LIMIT, OPT_HAWKAPI, 
+    OPT_SORT_ACCESSES, OPT_VOCAB_LISTSIZE, 
+    OPT_FRAPPEND, OPT_MAXFLIST,
+    OPT_STEM, OPT_BUILD_STOP, OPT_QUERY_STOP, OPT_ACCUMULATOR_LIMIT, 
+    OPT_IGNORE_VERSION,
+    OPT_DIRICHLET, OPT_ANH_IMPACT, 
+    OPT_TABLESIZE, OPT_PARSEBUF, OPT_BIG_AND_FAST, OPT_QUERYLIST
+};
+
+static struct args *parse_args(unsigned int argc, char **argv, 
+  struct args *args, FILE *output, const char *path) {
+    int quiet = 0,               /* an internal error occurred */
+        err = 0,                 /* whether an error has occurred */
+        must_index = 0,          /* whether arguments have to be for build */
+        must_search = 0,         /* whether arguments have to be for search */
+        must_stat = 0,           /* whether arguments have to be for stat */
+        verbose = 0,             /* whether to print a bunch of stuff out */
+        metric = 0,              /* whether a metric has been set */
+        stem = 0;                /* whether stemming has been specified */
+    unsigned int listitems = 0;  /* number of items in the list */
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    long int num;                /* temporary space for numeric conversion */
+    char *tmp;                   /* temporary space */
+    unsigned int ind;            /* current index in argv array */
+    enum getlongopt_ret ret;     /* return value from option parser */
+    FILE *fp;                    /* file pointer to open file list with */
+    double dnum;
+
+    struct getlongopt_opt opts[] = {
+        {"index", 'i', GETLONGOPT_ARG_NONE, OPT_INDEX},
+        {"add", 'a', GETLONGOPT_ARG_NONE, OPT_ADD},
+        {"build-stats", '\0', GETLONGOPT_ARG_NONE, OPT_ADD_STATS},
+        {"filename", 'f', GETLONGOPT_ARG_REQUIRED, OPT_FILENAME},
+        {"config", 'c', GETLONGOPT_ARG_REQUIRED, OPT_CONFIG},
+        {"type", 't', GETLONGOPT_ARG_REQUIRED, OPT_TYPE},
+        {"number-results", 'n', GETLONGOPT_ARG_REQUIRED, OPT_NUMBER_RESULTS},
+        {"begin-results", 'b', GETLONGOPT_ARG_REQUIRED, OPT_BEGIN_RESULTS},
+        {"version", 'v', GETLONGOPT_ARG_NONE, OPT_VERSION},
+        {NULL, 'V', GETLONGOPT_ARG_NONE, OPT_VERSION},
+        {"help", 'h', GETLONGOPT_ARG_NONE, OPT_HELP},
+        {NULL, 'H', GETLONGOPT_ARG_NONE, OPT_HELP},
+        {"stats", 's', GETLONGOPT_ARG_NONE, OPT_STATS},
+        {"summary", '\0', GETLONGOPT_ARG_REQUIRED, OPT_SUMMARY},    
+        {"big-and-fast", '\0', GETLONGOPT_ARG_NONE, OPT_BIG_AND_FAST},
+        {"memory", 'm', GETLONGOPT_ARG_REQUIRED, OPT_MEMORY},
+        {"tablesize", '\0', GETLONGOPT_ARG_REQUIRED, OPT_TABLESIZE},
+        {"parse-buffer", '\0', GETLONGOPT_ARG_REQUIRED, OPT_PARSEBUF},
+        {"file-list", 'L', GETLONGOPT_ARG_REQUIRED, OPT_FILELIST},    
+        {"query-list", '\0', GETLONGOPT_ARG_REQUIRED, OPT_QUERYLIST},    
+        {"word-limit", '\0', GETLONGOPT_ARG_REQUIRED, OPT_WORD_LIMIT},    
+        {"stem", '\0', GETLONGOPT_ARG_REQUIRED, OPT_STEM},    
+        {"build-stop", '\0', GETLONGOPT_ARG_REQUIRED, OPT_BUILD_STOP},
+        {"query-stop", '\0', GETLONGOPT_ARG_OPTIONAL, OPT_QUERY_STOP},
+        {"accumulator-limit", 'A', GETLONGOPT_ARG_REQUIRED,
+            OPT_ACCUMULATOR_LIMIT},
+        {"ignore-version", '\0', GETLONGOPT_ARG_NONE, OPT_IGNORE_VERSION},
+
+        /* metrics */
+        {"okapi", '\0', GETLONGOPT_ARG_NONE, OPT_OKAPI},
+        {"k1", '1', GETLONGOPT_ARG_REQUIRED, OPT_K1},
+        {"k3", '3', GETLONGOPT_ARG_REQUIRED, OPT_K3},
+        {"b", 'b', GETLONGOPT_ARG_REQUIRED, OPT_B},
+        {"pivoted-cosine", '\0', GETLONGOPT_ARG_REQUIRED, OPT_PIVOTED_COSINE},
+        {"cosine", '\0', GETLONGOPT_ARG_NONE, OPT_COSINE},
+        {"hawkapi", '\0', GETLONGOPT_ARG_REQUIRED, OPT_HAWKAPI},
+        {"anh-impact", '\0', GETLONGOPT_ARG_NONE, OPT_ANH_IMPACT},
+        {"dirichlet", '\0', GETLONGOPT_ARG_REQUIRED, OPT_DIRICHLET},
+
+        {"accumulation-memory", '\0', GETLONGOPT_ARG_REQUIRED, 
+          OPT_ACCUMULATION_MEMORY},
+        {"accumulation-docs", '\0', GETLONGOPT_ARG_REQUIRED, 
+          OPT_ACCUMULATION_DOCS},
+        {"dump-memory", '\0', GETLONGOPT_ARG_REQUIRED, OPT_DUMP_MEMORY},
+        {"dump-vecs", '\0', GETLONGOPT_ARG_REQUIRED, OPT_DUMP_VECS},
+        {"max-file-size", '\0', GETLONGOPT_ARG_REQUIRED, OPT_MAXFILESIZE},
+        {"file-listsize", '\0', GETLONGOPT_ARG_REQUIRED, OPT_MAXFLIST},
+    };
+
+    /* set defaults */
+    args->index = 0;             /* search by default */
+    args->index_add = 0;         /* search by default */
+    args->index_add_stats = 0;
+    args->stat = 0;              /* search by default */
+    args->first_result = 0;
+
+    /* null out the others */
+    args->results = 0;
+    args->type = NULL;
+    args->prefix = NULL;
+    args->config_file = NULL;
+    args->stop_file = NULL;
+    args->qstop_file = NULL;
+    args->memory = 0;
+    args->list = NULL;
+    args->qlist = stdin;
+
+    args->aopts = INDEX_ADD_NOOPT;
+    args->sopts = INDEX_SEARCH_NOOPT;
+    args->copts = INDEX_COMMIT_NOOPT;
+    args->nopts = INDEX_NEW_NOOPT;
+    args->lopts = INDEX_LOAD_NOOPT;
+
+    /* provide okapi defaults */
+    args->sopt.u.okapi_k3.k1 = 1.2F;
+    args->sopt.u.okapi_k3.k3 = 1e10; /* inf */
+    args->sopt.u.okapi_k3.b = 0.75;
+
+    args->sopt.summary_type = INDEX_SUMMARISE_NONE;
+
+    args->nopt.stop_file = NULL;
+
+    args->lopt.docmap_cache = DOCMAP_CACHE_TRECNO;
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(output, "failed to initialise options parser\n");
+        return NULL;
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case OPT_INDEX:
+            /* indexing is on */
+            if (!must_search && !must_stat) {
+                must_index = 1;
+                args->index = 1;
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "i option cannot be used with search options\n");
+            }
+            break;
+
+        case OPT_QUERYLIST:
+            if (args->qlist == stdin) {
+                if (!(args->qlist = fopen(arg, "rb"))) {
+                    fprintf(output, "unable to open query list '%s': %s\n",
+                      arg, strerror(errno));
+                    err = 1;
+                }
+            } else {
+                err = 1;
+                fprintf(output, "query list already specified\n");
+            }
+            break;
+
+        case OPT_ADD:
+            /* updating is on */
+            if (!must_search && !must_stat) {
+                must_index = 1;
+                args->index_add = 1;
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "a option cannot be used with search options\n");
+            }
+            break;
+
+        case OPT_ADD_STATS:
+            args->index_add_stats = 1;
+            break;
+
+        case OPT_STATS:
+            /* stat printing on */
+            if (!must_search && !must_index) {
+                must_stat = 1;
+                args->stat = 1;
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "s option cannot be used with search options\n");
+            }
+            break;
+
+        case OPT_FILENAME:
+            /* they want to set the prefix */
+            if (!args->prefix) {
+                if (!(args->prefix = str_dup(arg))) {
+                    err = quiet = 1;
+                    fprintf(output, "can't form index name: %s\n", 
+                      strerror(errno));
+                }
+            } else {
+                err = 1;
+                fprintf(output, "prefix already set to %s\n", args->prefix);
+            }
+            break;
+
+        case OPT_WORD_LIMIT:
+            /* they want to set the word limit */
+            if (!(args->sopts & INDEX_SEARCH_WORD_LIMIT)) {
+                args->sopts |= INDEX_SEARCH_WORD_LIMIT;
+                errno = 0;
+                num = strtol(arg, &tmp, 10);
+                if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                    args->sopt.word_limit = num;
+                } else {
+                    fprintf(output, 
+                      "error converting word limit value '%s'\n", arg);
+                    err = 1;
+                    verbose = 0;
+                }
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, "word limit already set to %u\n", 
+                  args->sopt.word_limit);
+            }
+            break;
+
+
+        case OPT_MAXFILESIZE:
+            /* they want to set the maximum filesize */
+            if (!(args->nopts & INDEX_NEW_MAXFILESIZE)) {
+                args->nopts |= INDEX_NEW_MAXFILESIZE;
+                errno = 0;
+                num = strtol(arg, &tmp, 10);
+                if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                    args->nopt.maxfilesize = num;
+                } else {
+                    fprintf(output, 
+                      "error converting maximum file size value '%s'\n", arg);
+                    err = 1;
+                    verbose = 0;
+                }
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, "maximum file size already set to %lu\n", 
+                  args->nopt.maxfilesize);
+            }
+            break;
+
+        case OPT_DUMP_MEMORY:
+            /* they want to set the amount of memory used for dumping */
+            if (!(args->copts & INDEX_COMMIT_DUMPBUF)) {
+                args->copts |= INDEX_COMMIT_DUMPBUF;
+                errno = 0;
+                num = strtol(arg, &tmp, 10);
+                if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                    args->copt.dumpbuf = num;
+                } else {
+                    fprintf(output, "error converting dump memory value '%s'\n",
+                      arg);
+                    err = 1;
+                    verbose = 0;
+                }
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, "dump memory already set to %u\n", 
+                  args->copt.dumpbuf);
+            }
+            break;
+
+        case OPT_ACCUMULATION_DOCS:
+            /* they want to set the amount of documents accumulated */
+            if (!(args->aopts & INDEX_ADD_ACCDOC)) {
+                args->aopts |= INDEX_ADD_ACCDOC;
+                errno = 0;
+                num = strtol(arg, &tmp, 10);
+                if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                    args->aopt.accdoc = num;
+                } else {
+                    fprintf(output, "error converting acc docs value '%s'\n",
+                      arg);
+                    err = 1;
+                    verbose = 0;
+                }
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, "acc docs already set to %u\n", 
+                  args->aopt.accdoc);
+            }
+            break;
+
+        case OPT_ACCUMULATION_MEMORY:
+            /* they want to set the amount of memory used */
+            if (!(args->aopts & INDEX_ADD_ACCBUF)) {
+                args->aopts |= INDEX_ADD_ACCBUF;
+                errno = 0;
+                num = strtol(arg, &tmp, 10);
+                if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                    args->aopt.accbuf = num;
+                } else {
+                    fprintf(output, "error converting memory value '%s'\n", 
+                      arg);
+                    err = 1;
+                    verbose = 0;
+                }
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, "memory already set to %u\n", 
+                  args->aopt.accbuf);
+            }
+            break;
+
+        case OPT_BIG_AND_FAST:
+            /* use big memory options */
+            if (!args->memory) {
+                args->memory = BIG_MEMORY_DEFAULT;
+            }
+            if (!(args->nopts & INDEX_NEW_PARSEBUF)) {
+                args->nopts |= INDEX_NEW_PARSEBUF;
+                args->lopts |= INDEX_LOAD_PARSEBUF;
+                args->nopt.parsebuf = args->lopt.parsebuf = BIG_PARSE_BUFFER;
+            }
+            if (!(args->nopts & INDEX_NEW_TABLESIZE)) {
+                args->nopts |= INDEX_NEW_TABLESIZE;
+                args->lopts |= INDEX_LOAD_TABLESIZE;
+                args->nopt.tablesize = args->lopt.tablesize = BIG_TABLESIZE;
+            }
+            break;
+
+        case OPT_MEMORY:
+            /* they want to set the amount of memory used */
+            if (!args->memory) {
+                errno = 0;
+                num = strtol(arg, &tmp, 10);
+                if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                    args->memory = num;
+                } else {
+                    fprintf(output, "error converting memory value '%s'\n", 
+                      arg);
+                    err = 1;
+                    verbose = 0;
+                }
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, "memory already set to %u\n", args->memory);
+            }
+            break;
+
+        case OPT_PARSEBUF:
+            errno = 0;
+            num = strtol(arg, &tmp, 10);
+            if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                args->nopts |= INDEX_NEW_PARSEBUF;
+                args->lopts |= INDEX_LOAD_PARSEBUF;
+                args->nopt.parsebuf = args->lopt.parsebuf = num;
+            } else {
+                fprintf(output, "error converting parsebuf value '%s'\n", 
+                  arg);
+                err = 1;
+                verbose = 0;
+            }
+            break;
+
+        case OPT_TABLESIZE:
+            errno = 0;
+            num = strtol(arg, &tmp, 10);
+            if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                args->nopts |= INDEX_NEW_TABLESIZE;
+                args->lopts |= INDEX_LOAD_TABLESIZE;
+                args->nopt.tablesize = args->lopt.tablesize = num;
+            } else {
+                fprintf(output, "error converting tablesize value '%s'\n", 
+                  arg);
+                err = 1;
+                verbose = 0;
+            }
+            break;
+
+        case OPT_STEM:
+            args->nopts |= INDEX_NEW_STEM;
+            stem = 1;
+            if (!str_casecmp(arg, "eds")) {
+                args->nopt.stemmer = INDEX_STEM_EDS;
+            } else if (!str_casecmp(arg, "light")) {
+                args->nopt.stemmer = INDEX_STEM_LIGHT;
+            } else if (!str_casecmp(arg, "none")) {
+                /* in fact, don't stem */
+                args->nopts ^= INDEX_NEW_STEM;
+            } else if (!str_casecmp(arg, "porters")
+              || (!str_casecmp(arg, "porter"))) {
+                args->nopt.stemmer = INDEX_STEM_PORTERS;
+            } else {
+                fprintf(output, "unrecognised stemming algorithm '%s'\n", arg);
+                err = 1;
+            }
+            break;
+
+        case OPT_QUERY_STOP:
+            if (args->qstop_file) {
+                err = 1;
+                fprintf(output, "query stoplist specified multiple times\n");
+            } else if (!arg || (args->qstop_file = str_dup(arg))) {
+                args->nopts |= INDEX_NEW_QSTOP;
+                args->nopt.qstop_file = args->qstop_file;
+                args->lopts |= INDEX_LOAD_QSTOP;
+                args->lopt.qstop_file = args->qstop_file;
+            } else {
+                err = quiet = 1;
+                fprintf(output, "can't copy query stoplist name\n");
+            } 
+            break;
+
+        case OPT_BUILD_STOP:
+            if (!(args->nopts & INDEX_NEW_STOP)) {
+                if (!(args->stop_file = str_dup(arg))) {
+                    err = quiet = 1;
+                    fprintf(output, "can't form index name: %s\n", 
+                      strerror(errno));
+                } else {
+                    args->nopts |= INDEX_NEW_STOP;
+                    args->nopt.stop_file = args->stop_file;
+                }
+            } else {
+                err = 1;
+                fprintf(output, "stop file already set to %s\n", 
+                  args->stop_file);
+            }
+            break;
+
+        case OPT_CONFIG:
+            /* they want to use a different config file than the default */
+            if (!must_search && !must_stat && !args->config_file) {
+                must_index = 1;
+                if (!(args->config_file = str_dup(arg))) {
+                    verbose = 0;
+                    err = quiet = 1;
+                    fprintf(output, "can't copy config\n");
+                }
+            } else if (args->config_file) {
+                fprintf(output, "config already set to '%s'\n", 
+                  args->config_file);
+                verbose = 0;
+                err = 1;
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, 
+                  "c option cannot be used with search options\n");
+            }
+            break;
+
+        case OPT_TYPE:
+            /* type specification */
+            if (!must_search && !must_stat && (!args->type)) {
+                /* be backward compatible with previous versions, recognise
+                 * 'trec', 'html' and 'inex' */
+                if (!str_casecmp(arg, "trec")) {
+                    if (!(args->type = str_dup("application/x-trec"))) {
+                        fprintf(output, "no memory to copy type trec\n");
+                        verbose = 0;
+                        err = 1;
+                    }
+                } else if (!str_casecmp(arg, "html")) {
+                    if (!(args->type = str_dup("text/html"))) {
+                        fprintf(output, "no memory to copy type html\n");
+                        verbose = 0;
+                        err = 1;
+                    }
+                } else if (!str_casecmp(arg, "inex")) {
+                    if (!(args->type = str_dup("application/x-inex"))) {
+                        fprintf(output, "no memory to copy type inex\n");
+                        verbose = 0;
+                        err = 1;
+                    }
+                } else if (!(args->type = str_dup(arg))) {
+                    fprintf(output, "no memory, couldn't copy type '%s'\n", 
+                      arg);
+                    verbose = 0;
+                    err = 1;
+                }
+            } else if (args->type) {
+                fprintf(output, "type specified multiple times\n");
+                verbose = 0;
+                err = 1;
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, 
+                  "t option cannot be used with search options\n");
+            }
+            break;
+
+        case OPT_NUMBER_RESULTS:
+            if (!must_index && !must_stat && (args->results == 0)) {
+                must_search = 1;
+                errno = 0;
+                num = strtol(arg, &tmp, 10);
+                if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                    args->results = num;
+                } else {
+                    fprintf(output, "error converting results value '%s'\n", 
+                      arg);
+                    err = 1;
+                }
+            } else if (args->results) {
+                fprintf(output, 
+                  "results already specified (%d)\n", args->results);
+                verbose = 0;
+                err = 1;
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, 
+                  "n option cannot be used with indexing options\n");
+            }
+            break;
+
+        case OPT_BEGIN_RESULTS:
+            if (!must_index && !must_stat && (args->first_result == 0)) {
+                must_search = 1;
+                errno = 0;
+                num = strtol(arg, &tmp, 10);
+                if (!errno && (num >= 0) && (num <= UINT_MAX) && !*tmp) {
+                    args->first_result = num;
+                } else {
+                    fprintf(output, 
+                      "error converting start result value '%s'\n", arg);
+                    verbose = 0;
+                    err = 1;
+                }
+            } else if (args->first_result) {
+                fprintf(output, 
+                  "start result already specified (%u)\n", args->first_result);
+                verbose = 0;
+                err = 1;
+            } else {
+                verbose = 0;
+                err = 1;
+                fprintf(output, 
+                  "b option cannot be used with indexing options\n");
+            }
+            break;
+
+        case OPT_SUMMARY:
+            /* they want to set the query-biased summary type */
+            if (!must_index && !str_casecmp(arg, "plain")) {
+                must_search = 1;
+                args->sopt.summary_type = INDEX_SUMMARISE_PLAIN;
+                args->sopts |= INDEX_SEARCH_SUMMARY_TYPE;
+            } else if ((!must_index && !str_casecmp(arg, "capitalise"))
+              || (!must_index && !str_casecmp(arg, "capitalize"))) {
+                must_search = 1;
+                args->sopt.summary_type = INDEX_SUMMARISE_CAPITALISE;
+                args->sopts |= INDEX_SEARCH_SUMMARY_TYPE;
+            } else if (!must_index && !str_casecmp(arg, "tag")) {
+                must_search = 1;
+                args->sopt.summary_type = INDEX_SUMMARISE_TAG;
+                args->sopts |= INDEX_SEARCH_SUMMARY_TYPE;
+            } else if (!must_index && !str_casecmp(arg, "none")) {
+                must_search = 1;
+                args->sopt.summary_type = INDEX_SUMMARISE_NONE;
+                args->sopts |= INDEX_SEARCH_SUMMARY_TYPE;
+            } else if (!must_index) {
+                fprintf(output, "unrecognised summary type '%s'\n", arg);
+                err = 1;
+            } else {
+                fprintf(output, "no summary available during indexing\n");
+                err = 1;
+            }
+            break;
+
+        case OPT_VERSION: 
+            printf("version %s\n", PACKAGE_VERSION);
+            err = 1;
+            if (argc == 2) {
+                quiet = 1;
+                output = stdout; /* direct to stdout since they requested it */
+                verbose = 0;
+            }
+            break;
+
+        case OPT_HELP:
+            err = 1;
+            verbose = 1;
+            output = stdout;  /* direct to stdout since they requested it */
+            break;
+
+        case OPT_FILELIST:
+            if ((fp = fopen(arg, "rb"))) {
+                if (!fill_args_list(args, fp, path)) {
+                    fprintf(output, "unable to parse list of files from '%s'\n",
+                      arg);
+                    err = 1;
+                }
+                fclose(fp);
+            } else {
+                fprintf(output, "unable to read '%s' for list of files\n", 
+                  arg);
+            }
+            break;
+
+        case OPT_OKAPI: 
+            if (!must_index && !must_stat) {
+                must_search = 1;
+                if (metric) {
+                    err = 1;
+                    fprintf(output, "metric set multiple times\n");
+                } else {
+                    metric = 1;
+                    args->sopts |= INDEX_SEARCH_OKAPI_RANK;
+                }
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "okapi option must be used with search options\n");
+            }
+            break;
+
+        case OPT_K1: 
+            if (!must_index && !must_stat) {
+                must_search = 1;
+                errno = 0;
+                dnum = strtod(arg, &tmp);
+                if (!errno && !*tmp) {
+                    args->sopt.u.okapi_k3.k1 = (float) dnum;
+                } else {
+                    fprintf(output, 
+                      "error converting start result value '%s'\n", arg);
+                    verbose = 0;
+                    err = 1;
+                }
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "k1 option must be used with search options\n");
+            }
+            break;
+
+        case OPT_K3: 
+            if (!must_index && !must_stat) {
+                must_search = 1;
+                errno = 0;
+                dnum = strtod(arg, &tmp);
+                if (!errno && !*tmp) {
+                    args->sopt.u.okapi_k3.k3 = (float) dnum;
+                } else {
+                    fprintf(output, 
+                      "error converting start result value '%s'\n", arg);
+                    verbose = 0;
+                    err = 1;
+                }
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "k3 option must be used with search options\n");
+            }
+            break;
+
+        case OPT_B:
+            if (!must_index && !must_stat) {
+                must_search = 1;
+                errno = 0;
+                dnum = strtod(arg, &tmp);
+                if (!errno && !*tmp) {
+                    args->sopt.u.okapi_k3.b = (float) dnum;
+                } else {
+                    fprintf(output, 
+                      "error converting start result value '%s'\n", arg);
+                    verbose = 0;
+                    err = 1;
+                }
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "okapi b option must be used with search options\n");
+            }
+            break;
+
+        case OPT_ANH_IMPACT:
+            args->sopts |= INDEX_SEARCH_ANH_IMPACT_RANK;
+            args->copts |= INDEX_COMMIT_ANH_IMPACTS;
+            break;
+
+        case OPT_DIRICHLET:
+            if (!must_index && !must_stat) {
+                must_search = 1;
+                if (metric) {
+                    err = 1;
+                    fprintf(output, "metric set multiple times\n");
+                } else {
+                    metric = 1;
+                    args->sopts |= INDEX_SEARCH_DIRICHLET_RANK;
+
+                    errno = 0;
+                    dnum = strtod(arg, &tmp);
+                    if (!errno && !*tmp) {
+                        args->sopt.u.dirichlet.mu = (float) dnum;
+                    } else {
+                        fprintf(output, 
+                          "error converting mu value '%s'\n", arg);
+                        verbose = 0;
+                        err = 1;
+                    }
+                }
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "dirichlet option must be used with search options\n");
+            }
+            break;
+
+        case OPT_HAWKAPI:
+            if (!must_index && !must_stat) {
+                must_search = 1;
+                if (metric) {
+                    err = 1;
+                    fprintf(output, "metric set multiple times\n");
+                } else {
+                    metric = 1;
+                    args->sopts |= INDEX_SEARCH_HAWKAPI_RANK;
+
+                    errno = 0;
+                    dnum = strtod(arg, &tmp);
+                    if (!errno && !*tmp) {
+                        args->sopt.u.hawkapi.alpha = (float) dnum;
+                        args->sopt.u.hawkapi.k3 = 1e10; /* ~= inf */
+                    } else {
+                        fprintf(output, 
+                          "error converting start result value '%s'\n", arg);
+                        verbose = 0;
+                        err = 1;
+                    }
+                }
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "hawkapi option must be used with search options\n");
+            }
+            break;
+
+        case OPT_PIVOTED_COSINE: 
+            if (!must_index && !must_stat) {
+                must_search = 1;
+                if (metric) {
+                    err = 1;
+                    fprintf(output, "metric set multiple times\n");
+                } else {
+                    metric = 1;
+                    args->sopts |= INDEX_SEARCH_PCOSINE_RANK;
+
+                    /* arrange for weights to be loaded into memory */
+                    args->lopts |= INDEX_LOAD_DOCMAP_CACHE;
+                    args->lopt.docmap_cache |= DOCMAP_CACHE_WEIGHT;
+
+                    errno = 0;
+                    dnum = strtod(arg, &tmp);
+                    if (!errno && !*tmp) {
+                        args->sopt.u.pcosine.pivot = (float) dnum;
+                    } else {
+                        fprintf(output, 
+                          "error converting start result value '%s'\n", arg);
+                        verbose = 0;
+                        err = 1;
+                    }
+                }
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "pivoted cosine option must be used with search options\n");
+            }
+            break;
+
+        case OPT_COSINE:
+            if (!must_index && !must_stat) {
+                must_search = 1;
+                if (metric) {
+                    err = 1;
+                    fprintf(output, "metric set multiple times\n");
+                } else {
+                    metric = 1;
+                    args->sopts |= INDEX_SEARCH_COSINE_RANK;
+
+                    /* arrange for weights to be loaded into memory */
+                    args->lopts |= INDEX_LOAD_DOCMAP_CACHE;
+                    args->lopt.docmap_cache |= DOCMAP_CACHE_WEIGHT;
+                }
+            } else {
+                err = 1;
+                fprintf(output, 
+                  "cosine option must be used with search options\n");
+            }
+            break;
+
+        case OPT_VOCAB_LISTSIZE: 
+            errno = 0;
+            num = strtol(arg, &tmp, 10);
+            if (!errno && !*tmp) {
+                args->lopt.vocab_size = args->nopt.vocab_size = num;
+                args->lopts |= INDEX_LOAD_VOCAB;
+                args->nopts |= INDEX_NEW_VOCAB;
+            } else {
+                fprintf(output, 
+                  "error converting vocab list-size value '%s'\n", arg);
+                verbose = 0;
+                err = 1;
+            }
+            break;
+
+        case OPT_IGNORE_VERSION:
+            args->lopts |= INDEX_LOAD_IGNORE_VERSION;
+            break;
+
+        case OPT_ACCUMULATOR_LIMIT:
+            /* set number of accumulators to use. */
+            errno = 0;
+            num = strtol(arg, &tmp, 10);
+            if (!errno && !*tmp) {
+                args->sopt.accumulator_limit = num;
+                args->sopts |= INDEX_SEARCH_ACCUMULATOR_LIMIT;
+            } else {
+                fprintf(output, 
+                  "error converting accumulator limit value '%s'\n", arg);
+                verbose = 0;
+                err = 1;
+            }
+            break;
+
+        case OPT_MAXFLIST: 
+            errno = 0;
+            num = strtol(arg, &tmp, 10);
+            if (!errno && !*tmp) {
+                args->lopt.maxflist_size = num;
+                args->lopts |= INDEX_LOAD_MAXFLIST;
+            } else {
+                fprintf(output, 
+                  "error converting vocab list-size value '%s'\n", arg);
+                verbose = 0;
+                err = 1;
+            }
+            break;
+
+        default:
+            /* shouldn't happen */
+            assert(0);
+        };
+    }
+
+    /* finish up with the option parser */
+    ind = getlongopt_optind(parser) + 1;
+    getlongopt_delete(parser);
+
+    if (ret == GETLONGOPT_END) {
+        /* succeeded, do nothing */
+    } else {
+        if (ret == GETLONGOPT_UNKNOWN) {
+            fprintf(output, "unknown option '%s'\n", argv[ind]);
+        } else if (ret == GETLONGOPT_MISSING_ARG) {
+            fprintf(output, "missing argument to option '%s'\n", argv[ind]);
+        } else if (ret == GETLONGOPT_ERR) {
+            fprintf(output, "unexpected error parsing options (around '%s')\n",
+              argv[ind]);
+        } else {
+            /* shouldn't happen */
+            assert(0);
+        }
+        return NULL;
+    }
+
+    if (!err && !args->prefix) {
+        if (!(args->prefix = str_dup("index"))) {
+            fprintf(output, "couldn't copy prefix 'index'\n");
+            err = quiet = 1;
+        }
+    }
+
+    if (!err && !args->memory) {
+        args->memory = MEMORY_DEFAULT;
+    }
+
+    if (!err && !args->results) {
+        args->results = 20;
+    }
+
+    /* use light stemming by default */
+    if (!err && !stem) {
+        args->nopts |= INDEX_NEW_STEM;
+        args->nopt.stemmer = INDEX_STEM_LIGHT;
+    }
+    /* remaining arguments should be sources */
+    if (!args->list) {
+        if ((args->list = malloc(sizeof(*args->list)))) {
+            args->list[0] = NULL;
+        } else {
+            fprintf(output, "couldn't allocate list memory\n");
+            err = quiet = 1;
+        }
+    }
+
+    /* count initial items */
+    for (listitems = 0; args->list[listitems]; listitems++) ;
+
+    while (!err && (ind < argc)) {
+        void *ptr;
+
+        if ((ptr
+          = realloc(args->list, (listitems + 2) * sizeof(*args->list)))) {
+            args->list = ptr;
+        } else {
+            fprintf(output, "couldn't allocate list memory\n");
+            err = quiet = 1;
+        }
+        if (!err) {
+            if (!args->stat && !args->index && !args->index_add) {
+                /* querying (don't prepend path) */
+                if ((args->list[listitems] = str_dup(argv[ind]))) {
+                    listitems++;
+                } else {
+                    fprintf(output, "couldn't allocate list memory\n");
+                    err = quiet = 1;
+                }
+            } else {
+                /* not querying */
+                if ((args->list[listitems] = path_dup(argv[ind], path))) {
+                    listitems++;
+                } else {
+                    fprintf(output, "couldn't allocate list memory\n");
+                    err = quiet = 1;
+                }
+            }
+        }
+        ind++;
+    }
+    args->list[listitems] = NULL;
+
+    if (err) {
+        if (!quiet) {
+            fprintf(output, "\n");
+            print_usage(*argv, output, verbose);
+        }
+        free_args(args);
+        return NULL;
+    } else {
+        return args;
+    }
+}
+
+/* internal function that indicates whether the given query is a request to
+ * return a document from the cache.  Returns true if it is, else false on error
+ * or if it isn't.  If true, then docno will contain requested document 
+ * number */
+static int is_cache_request(const char *querystr, unsigned int maxwordlen, 
+  unsigned long int *docno) {
+    struct queryparse *qp;           /* structure to parse the query */
+    char word[TERMLEN_MAX + 1];      /* buffer to hold words */
+    unsigned int wordlen;            /* length of word */
+    int parse_ret;                   /* parsing result */
+    char *end;
+    
+    if (!(qp 
+      = queryparse_new(maxwordlen, querystr, str_len(querystr)))) {
+
+        return 0;
+    }
+
+    /* first element must be a cache: modifier */
+    parse_ret = queryparse_parse(qp, word, &wordlen);
+    if ((parse_ret != QUERYPARSE_START_MODIFIER) 
+      || (wordlen != str_len("cache")) || str_ncmp(word, "cache", wordlen)) {
+        /* didn't match */
+        queryparse_delete(qp);
+        return 0;
+    }
+
+    /* second element must the docno (XXX: or URL) of document */
+    parse_ret = queryparse_parse(qp, word, &wordlen);
+    word[wordlen] = '\0';
+    if ((parse_ret != QUERYPARSE_WORD) 
+      || ((*docno = strtol(word, &end, 10)) < 0) 
+      || (*end != '\0')) {
+        /* didn't match */
+        queryparse_delete(qp);
+        return 0;
+    }
+
+    /* third element must be an end modifier */
+    parse_ret = queryparse_parse(qp, word, &wordlen);
+    if (parse_ret != QUERYPARSE_END_MODIFIER) {
+        /* didn't match */
+        queryparse_delete(qp);
+        return 0;
+    }
+
+    /* that must be the last element */
+    parse_ret = queryparse_parse(qp, word, &wordlen);
+    if (parse_ret != QUERYPARSE_EOF) {
+        /* didn't match */
+        queryparse_delete(qp);
+        return 0;
+    }
+
+    queryparse_delete(qp);
+    return 1;
+}
+
+int search(struct index *idx, const char *query, struct index_result *result, 
+  unsigned int requested, unsigned int start, unsigned int maxwordlen,
+  int opts, struct index_search_opt *opt) {
+    unsigned int results,                /* number of results */
+                 i;
+    double total_results;
+    struct timeval then,
+                   now;
+    double seconds;
+    unsigned long int docno;
+    int est;
+
+    /* check to see whether they have requested a document from the cache */
+    if (!is_cache_request(query, maxwordlen, &docno)) {
+
+        gettimeofday(&then, NULL);
+
+        if (index_search(idx, query, start, requested,
+              result, &results, &total_results, &est, opts, opt)) {
+
+            gettimeofday(&now, NULL);
+
+            seconds = (double) ((now.tv_sec - then.tv_sec) 
+              + (now.tv_usec - (double) then.tv_usec) / 1000000.0);
+
+            for (i = 0; i < results; i++) {
+                fprintf(stdout, "%u. %s (score %f, docid %lu)\n",
+                      start + i + 1, result[i].auxilliary, result[i].score,
+                      result[i].docno);
+                
+                if (opt->summary_type != INDEX_SUMMARISE_NONE) {
+                    /* print out document summary and title */ 
+                    if (result[i].title[0] != '\0') {
+                        fprintf(stdout, "title: %s\n", 
+                          result[i].title);
+                    }
+                    if (result[i].summary[0] != '\0') {
+                        fprintf(stdout, "%s\n", result[i].summary);
+                    }
+                }              
+            }
+          
+            if (seconds == 0.0) {
+                fprintf(stdout, "\n%u results of %s%.0f shown\n", 
+                  i, est ? "about " : "", total_results);
+            } else {
+                fprintf(stdout, "\n%u results of %s%.0f shown "
+                  "(took %f seconds)\n",
+                  i, est ? "about " : "", total_results, seconds);
+            }
+        }
+    } else {
+        int readlen;
+        unsigned int total = 0;
+        char buf[BUFSIZ];
+
+        while ((readlen = index_retrieve(idx, docno, total, buf, BUFSIZ)) > 0) {
+            fwrite(buf, 1, readlen, stdout);
+            total += readlen;
+        } 
+
+        if (readlen < 0) {
+            /* error occurred */
+            fprintf(stderr, "failed to retrieve document %lu\n", docno);
+            return 0;
+        }
+
+        return 1;
+    }
+
+    return 1;
+}
+
+int build(struct args *args, FILE *output) {
+    struct index *idx = NULL;                /* index we're constructing */
+    unsigned int i,                          /* counter */
+                 docs;
+    int ret;
+    unsigned long int docno;
+    struct index_stats stats;
+    struct index_expensive_stats estats;
+    struct timeval now,
+                   then;
+    double seconds;
+
+    TIMINGS_DECL();
+
+    TIMINGS_START();
+
+    fprintf(output, "%s version %s", PACKAGE, PACKAGE_VERSION);
+
+    if (1) {
+        /* print a little more info */
+        int ndebug = 0;
+
+#ifdef NDEBUG
+        ndebug = 1;
+#endif
+
+        fprintf(output, ", %s%s", 
+          ndebug ? "" : "no NDEBUG, ", 
+          DEAR_DEBUG ? "DEAR_DEBUG! (may run EXTREMELY slowly)" : "");
+    }
+    fprintf(output, "\n");
+
+    if (signal(SIGINT, signals_cleanup_handler) == SIG_ERR) {
+        fprintf(stderr, "Warning: unable to catch SIGINT\n");
+    }
+    if (signal(SIGTERM, signals_cleanup_handler) == SIG_ERR) {
+        fprintf(stderr, "Warning: unable to catch SIGTERM\n");
+    }
+
+    if (args->index_add) {
+        if ((idx 
+          = index_load(args->prefix, args->memory, args->lopts, &args->lopt))
+            == NULL) {
+
+            fprintf(stderr, "Failed to load index with prefix '%s': "
+              "%s\n", args->prefix, error_last_msg());
+            return 0;
+        }
+        fprintf(output, "loaded index '%s'\n", args->prefix);
+    } else {
+        assert(args->index);
+        if ((idx = index_new(args->prefix, args->config_file, args->memory, 
+          args->nopts, &args->nopt)) == NULL) {
+            fprintf(stderr, "Failed to create new index with prefix '%s': "
+              "%s\n", args->prefix, error_last_msg());
+            return 0;
+        }
+        fprintf(output, "created new index '%s'\n", args->prefix);
+    }
+    signals_set_index_under_construction(idx);
+
+    fprintf(output, "sources (type %s): ", args->type ? args->type : "auto");
+    for (i = 0; args->list[i]; i++) {
+        fprintf(output, "%s ", args->list[i]);
+    }
+    fprintf(output, "\n");
+
+    /* add repositories from args */
+    for (i = 0; args->list[i]; i++) {
+        fprintf(output, "parsing %s... ", args->list[i]);
+        fflush(output);
+
+        gettimeofday(&then, NULL);
+
+        if (index_add(idx, args->list[i], args->type, &docno, &docs, 
+            args->aopts, &args->aopt, args->copts, &args->copt)) {
+
+            gettimeofday(&now, NULL);
+
+            seconds = (double) ((now.tv_sec - then.tv_sec) 
+              + (now.tv_usec - (double) then.tv_usec) / 1000000.0);
+
+            /* succeded */
+            fprintf(output, "found %u doc%s, %s%s%s%f seconds\n", docs, 
+              docs == 1 ? "": "s", 
+              !args->type ? "type " : "",
+              !args->type 
+                ? (args->aopt.detected_type
+                  ? args->aopt.detected_type
+                  : "unknown")
+                : "",
+              !args->type ? ", " : "", seconds);
+        } else {
+            fprintf(stderr, "error while adding file %s: %s\n", 
+              args->list[i], error_last_msg());
+            index_rm(idx);
+            index_delete(idx);
+            return 0;
+        }
+    }
+
+    if (args->index && !args->index_add) {
+        fprintf(output, "merging...\n");
+    } else {
+        assert(args->index_add);
+        fprintf(output, "updating...\n");
+    }
+
+    if (index_commit(idx, args->copts, &args->copt, args->aopts, &args->aopt)) {
+        /* successful, do nothing */
+    } else {
+        fprintf(stderr, "error committing...\n");
+        index_rm(idx);
+        index_delete(idx);
+        return 0;
+    }
+
+    /* timings */
+    TIMINGS_END("build");
+
+    /* get stats from index */
+    ret = index_stats(idx, &stats);
+    if (args->index_add_stats) {
+        index_expensive_stats(idx, &estats);
+    }
+    signals_clear_index_under_construction();
+    index_delete(idx);
+
+    if (ret) {
+        /* print out end stuff */
+        if (stats.terms_high) {
+            fprintf(output, 
+              "\nsummary: %lu documents, %lu distinct index terms, "
+              "%u %u terms\n", stats.docs, stats.dterms, 
+              stats.terms_high, stats.terms_low);
+        } else {
+            /* terms.high unused, don't print it */
+            fprintf(output, 
+              "\nsummary: %lu documents, %lu distinct index terms, "
+              "%u terms\n", stats.docs, stats.dterms, 
+              stats.terms_low);
+        }
+
+        if (args->index_add_stats) {
+            /* print out extended summary */
+            printf("dterms: %lu\n", stats.dterms);
+            printf("terms_high: %u\n", stats.terms_high);
+            printf("terms_low: %u\n", stats.terms_low);
+            printf("docs: %lu\n", stats.docs);
+            printf("avg_weight: %f\n", estats.avg_weight);
+            printf("avg_words: %f\n", estats.avg_words);
+            printf("avg_length: %f\n", estats.avg_length);
+            printf("maxtermlen: %u\n", stats.maxtermlen);
+            printf("vocab_listsize: %u\n", stats.vocab_listsize);
+            printf("updates: %u\n", stats.updates);
+            printf("tablesize: %u\n", stats.tablesize);
+            printf("parsebuf: %u\n", stats.parsebuf); 
+            printf("vocab_leaves: %u\n", estats.vocab_leaves); 
+            printf("vocab_pages: %u\n", estats.vocab_pages); 
+            printf("pagesize: %u\n", estats.pagesize); 
+            printf("vectors: %f\n", estats.vectors); 
+            printf("vectors_files: %f\n", estats.vectors_files); 
+            printf("vectors_vocab: %f\n", estats.vectors_vocab); 
+            printf("allocated_files: %f\n", estats.allocated_files); 
+            printf("vocab_info: %f\n", estats.vocab_info); 
+            printf("vocab_structure: %f\n", estats.vocab_structure); 
+            printf("sorted: %d\n", stats.sorted); 
+        }
+
+        return 1;
+    } else {
+        fprintf(stderr, "failed to get stats from index: %s\n", 
+          strerror(errno));
+        return 0;
+    }
+}
+
+int main(int argc, char **argv) {
+    struct args argspace,
+               *args;
+    FILE *output;
+    struct index *idx;
+    struct index_result *results;
+    unsigned int i;
+    struct index_stats stats;
+    char path[FILENAME_MAX + 1];
+    struct timeval now, 
+                   then;
+
+    if (isatty(STDOUT_FILENO)) {
+        output = stdout;
+    } else {
+        output = stderr;
+    }
+
+    if (!getcwd(path, FILENAME_MAX)) {
+        fprintf(stderr, "failed to get current working directory\n");
+        return EXIT_FAILURE;
+    }
+
+    if ((args = parse_args(argc, argv, &argspace, output, path))) {
+        if (!args->index && !args->index_add && !args->stat) {
+            /* load the index */
+            if ((idx = index_load(args->prefix, args->memory, 
+                  args->lopts, &args->lopt)) 
+              && (results = malloc(sizeof(*results) * args->results))) {
+
+                gettimeofday(&then, NULL);
+
+                /* get word length for this index */
+                if (!index_stats(idx, &stats)) {
+                    index_delete(idx);
+                    free_args(args);
+                    return EXIT_FAILURE;
+                }
+
+                /* non-interactive mode */
+                for (i = 0; args->list && args->list[i]; i++) {
+                    if (!(search(idx, args->list[i], results, args->results,
+                      args->first_result, stats.maxtermlen, args->sopts,
+                      &args->sopt))) {
+                        index_delete(idx);
+                        free_args(args);
+                        return EXIT_FAILURE;
+                    }
+                }
+
+                if (args->qlist != stdin || !args->list || !args->list[0]) {
+                    /* stream-sourced mode */
+                    char querybuf[QUERYBUF + 1];
+
+                    while (((args->qlist != stdin) 
+                        || (printf("> ") && (fflush(stdout) == 0)))
+                      && fgets(querybuf, QUERYBUF, args->qlist)) {
+                        querybuf[QUERYBUF] = '\0';
+
+                        if (!(search(idx, querybuf, results, args->results, 
+                          args->first_result, stats.maxtermlen, args->sopts, 
+                          &args->sopt))) {
+                            index_delete(idx);
+                            free_args(args);
+                            return EXIT_FAILURE;
+                        }
+                    }
+                }
+
+                gettimeofday(&now, NULL);
+
+                printf("%lu microseconds querying "
+                  "(excluding loading/unloading)\n", 
+                  (unsigned long int) (now.tv_usec - then.tv_usec 
+                    + (now.tv_sec - then.tv_sec) * 1000000));
+
+                index_delete(idx);
+                free(results);
+            } else {
+                /* failed to load index or allocate memory */
+                if (idx) {
+                    index_delete(idx);
+                    fprintf(output, "failed to allocate memory for results\n");
+                } else {
+                    if (error_has_msg())
+                        fprintf(stderr, "%s\n", error_last_msg());
+                    if (argc == 1) {
+                        fprintf(output, "failed to load index '%s'\n\n", 
+                          args->prefix);
+                        print_usage(*argv, output, 0);
+                    } else {
+                        fprintf(output, "failed to load index '%s'\n", 
+                          args->prefix);
+                    }
+                }
+                free_args(args);
+                return EXIT_FAILURE;
+            }
+        } else if (args->stat) {
+            /* load the index */
+            if ((idx = index_load(args->prefix, args->memory, 
+                INDEX_LOAD_NOOPT, NULL))) {
+
+                struct index_stats stats;
+                struct index_expensive_stats estats;
+
+                if (index_stats(idx, &stats) 
+                  && index_expensive_stats(idx, &estats)) {
+                    printf("distinct terms: %lu\n", stats.dterms);
+                    printf("terms: %u %u\n", stats.terms_high, stats.terms_low);
+                    printf("documents: %lu\n", stats.docs);
+                    printf("average document length: %f\n", estats.avg_length);
+                    printf("average document weight: %f\n", estats.avg_weight);
+                    printf("average document terms: %f\n", estats.avg_words);
+                    printf("sorted: %d\n", stats.sorted);
+                    index_delete(idx);
+                } else {
+                    fprintf(stderr, "failed to get statistics\n");
+                    index_delete(idx);
+                    return EXIT_FAILURE;
+                }
+            } else {
+                /* failed to load index or allocate memory */
+                if (error_has_msg())
+                    fprintf(stderr, "%s\n", error_last_msg());
+                fprintf(output, "failed to load index '%s'\n\n", 
+                  args->prefix);
+                print_usage(*argv, output, 0);
+                return EXIT_FAILURE;
+            }
+        } else {
+            if (!args->list || !args->list[0]) {
+                /* read from stdin */
+                if (!fill_args_list(args, stdin, path)) {
+                    fprintf(output, "unable to read files from stdin\n");
+                    free_args(args);
+                    return EXIT_FAILURE;
+                } else if (!args->list || !args->list[0]) {
+                    fprintf(output, "no input files specified\n");
+                    free_args(args);
+                    return EXIT_FAILURE;
+                }
+            }
+
+            /* build or add to a index */
+            if (!build(args, output)) {
+                free_args(args);
+                return EXIT_FAILURE;
+            }
+        }
+        free_args(args);
+    }
+
+    return EXIT_SUCCESS;
+}
+
diff --git a/src/compat/win32_stubs.c b/src/compat/win32_stubs.c
new file mode 100755 (executable)
index 0000000..b20653c
--- /dev/null
@@ -0,0 +1,34 @@
+/* win32_stubs.c creates trivial versions of some functions that we need for
+ * portability
+ *
+ * written nml 2004-07-16
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "def.h"
+#include "config.h"
+
+#include <time.h>
+
+/* on windows we can use up to 4GB
+ * (see http://support.microsoft.com/default.aspx?scid=kb;en-us;93496).  We
+ * have to ifdef out the other stuff because windows doesn't have ftruncate. */
+int getmaxfsize(int fd, unsigned int knownlimit, unsigned int *limit) {
+    if (knownlimit > 4294967295U) {
+        *limit = 4294967295U;
+    } else {
+        *limit = knownlimit;
+    }
+    return 1;
+}
+
+int gettimeofday(struct timeval *tp, void *vp) {
+    tp->tv_sec = time(NULL);
+    tp->tv_usec = 0;
+    return 0;
+}
+
+
+
diff --git a/src/compat/zglob.c b/src/compat/zglob.c
new file mode 100644 (file)
index 0000000..fc69979
--- /dev/null
@@ -0,0 +1,206 @@
+/* zglob.c implements something approximating POSIX glob calls using
+ * win32 system calls.
+ *
+ * written nml 2004-11-23
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "glob.h"
+
+#include "str.h"
+
+#include <assert.h>
+#include <windows.h>
+
+int glob(const char *pattern, int flags, 
+  int(*errfunc)(const char *epath, int eerrno), glob_t *pglob) {
+    WIN32_FIND_DATA fdata;
+    HANDLE findh = INVALID_HANDLE_VALUE;
+    int err;
+    unsigned int startmatches = 0;
+    char *copy;
+
+    if ((flags & GLOB_APPEND)) {
+        startmatches = pglob->gl_pathc;
+    } else {
+        unsigned int alloc,
+                     i;
+
+        if (!(flags & GLOB_DOOFFS)) {
+            pglob->gl_offs = 0;
+        }
+
+        pglob->gl_pathsize = 1;
+        pglob->gl_pathc = 0;
+        alloc = pglob->gl_offs + pglob->gl_pathsize;
+
+        if ((pglob->gl_pathv = malloc(alloc * sizeof(char *)))) {
+            for (i = 0; i < pglob->gl_offs; i++) {
+                pglob->gl_pathv[i] = NULL;
+            }
+        } else {
+            return GLOB_NOSPACE;
+        }
+    }
+
+    if ((findh = FindFirstFile(pattern, &fdata)) != INVALID_HANDLE_VALUE) {
+        do {
+            /* copy matching filename */
+            if ((fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+              && (flags & GLOB_MARK)) {
+                unsigned int len = str_nlen(fdata.cFileName, MAX_PATH);
+
+                /* copy and mark directory */
+                if ((copy = malloc(len + 2))) {
+                    memcpy(copy, fdata.cFileName, len);
+                    copy[len] = '\\';
+                    copy[len + 1] = '\0';
+                } else {
+                    pglob->gl_pathc = startmatches;
+                    return GLOB_NOSPACE;
+                }
+            } else {
+                /* copy and mark directory */
+                if ((copy = str_ndup(fdata.cFileName, MAX_PATH))) {
+                    /* copy succeded, do nothing */
+                } else {
+                    pglob->gl_pathc = startmatches;
+                    return GLOB_NOSPACE;
+                }
+            }
+
+            /* expand array if necessary */
+            if (pglob->gl_pathc + pglob->gl_offs >= pglob->gl_pathsize) {
+                void *ptr;
+                unsigned int newsize 
+                  = pglob->gl_offs + (pglob->gl_pathsize * 2);
+
+                if ((ptr = realloc(pglob->gl_pathv, 
+                    sizeof(char *) * newsize))) {
+
+                    pglob->gl_pathv = ptr;
+                    pglob->gl_pathsize = newsize;
+
+                } else {
+                    pglob->gl_pathc = startmatches;
+                    free(copy);
+                    return GLOB_NOSPACE;
+                }
+            }
+
+            assert(copy);
+            assert(pglob->gl_pathc + pglob->gl_offs < pglob->gl_pathsize);
+
+            /* insert match */
+            pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
+
+        } while (FindNextFile(findh, &fdata) != 0);
+
+        err = GetLastError();
+        FindClose(findh);
+
+        if (err == ERROR_NO_MORE_FILES) {
+            return GLOB_OK;
+        } else {
+            pglob->gl_pathc = startmatches;
+            printf("glob abort unexpected\n");
+            return GLOB_ABORTED;
+        }
+    } else {
+        if (GetLastError() == ERROR_FILE_NOT_FOUND) {
+            /* nothing matched */
+            if (flags & GLOB_NOCHECK) {
+                if ((copy = str_dup(pattern))) {
+                    /* expand array if necessary */
+                    if (pglob->gl_pathc + pglob->gl_offs 
+                      >= pglob->gl_pathsize) {
+                        void *ptr;
+                        unsigned int newsize 
+                          = pglob->gl_offs + (pglob->gl_pathsize * 2);
+
+                        if ((ptr = realloc(pglob->gl_pathv, 
+                            sizeof(char *) * newsize))) {
+
+                            pglob->gl_pathv = ptr;
+                            pglob->gl_pathsize = newsize;
+
+                        } else {
+                            pglob->gl_pathc = startmatches;
+                            free(copy);
+                            return GLOB_NOSPACE;
+                        }
+                    }
+
+                    /* insert pattern */
+                    pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
+                    return GLOB_OK;
+                } else {
+                    return GLOB_NOSPACE;
+                }
+            } else {
+                return GLOB_NOMATCH;
+            }
+        } else {
+            return GLOB_ABORTED;
+        }
+    }
+}
+
+void globfree(glob_t *pglob) {
+    unsigned int i;
+
+    if (pglob->gl_pathv) {
+        for (i = pglob->gl_offs; i < pglob->gl_offs + pglob->gl_pathc; i++) {
+            if (pglob->gl_pathv[i]) {
+                free(pglob->gl_pathv[i]);
+            }
+        }
+        free(pglob->gl_pathv);
+    }
+}
+
+#ifdef GLOB_TEST
+/* small application to test globbing */
+int main(int argc, char **argv) {
+    glob_t g;
+    unsigned int i;
+    enum glob_error gret;
+
+    for (i = 1; i < argc; i++) {
+        gret 
+          = glob(argv[i], GLOB_MARK | ((i == 1) ? 0 : GLOB_APPEND), NULL, &g);
+
+        switch (gret) {
+        case GLOB_OK:
+            break;
+
+        case GLOB_ABORTED:
+            fprintf(stderr, "error globbing '%s'\n", argv[i]);
+            return EXIT_FAILURE;
+
+        case GLOB_NOMATCH:
+            printf("no match for '%s'\n", argv[i]);
+            break;
+
+        case GLOB_NOSPACE:
+            fprintf(stderr, "failed to allocated space for glob\n");
+            globfree(&g);
+            return EXIT_FAILURE;
+        };
+    }
+
+    if (argc > 1) {
+        for (i = 0; i < g.gl_pathc; i++) {
+            printf("%s\n", g.gl_pathv[i]);
+        }
+        printf("\n");
+        globfree(&g);
+    }
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
diff --git a/src/cosine.c b/src/cosine.c
new file mode 100644 (file)
index 0000000..5719823
--- /dev/null
@@ -0,0 +1,591 @@
+/* cosine.c implements the cosine metric for the zettair query
+ * subsystem.  This file was automatically generated from
+ * src/cosine.metric and src/metric.c
+ * by scripts/metric.py on Thu, 29 Jun 2006 04:12:41 GMT.  
+ *
+ * DO NOT MODIFY THIS FILE, as changes will be lost upon 
+ * subsequent regeneration (and this code is repetitive enough 
+ * that you probably don't want to anyway).  
+ * Go modify src/cosine.metric or src/metric.c instead.  
+ * 
+ * Comments from cosine.metric:
+ *
+ * cosine.metric is a functional description in our funny zettair metric
+ * language (see metric.py) of how the cosine metric should operate.
+ * 
+ * This cosine metric is the most basic metric available, in order to
+ * provide symmetry and to ensure that the weights are meaningful.
+ * Thus, we simply calculate the cosine of the angle between a document
+ * and query, where each term is a dimension, and the number of
+ * occurrances of that term, slightly mangled with a log, is the distance in
+ * that dimension.
+ * 
+ * This metric should probably only be used when the query really is a
+ * document.
+ * 
+ * written nml 2005-07-18
+ *
+ */
+
+
+#include "firstinclude.h"
+
+#include "metric.h"
+
+#include "_index.h"
+#include "_docmap.h"
+#include "index_querybuild.h"
+
+#include "def.h"
+#include "objalloc.h"
+#include "docmap.h"
+#include "search.h"
+#include "vec.h"
+
+#include <assert.h>
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+
+static enum search_ret pre(struct index *idx, struct query *query, 
+  int opts, struct index_search_opt *opt) {
+    /* METRIC_PRE */
+    if (docmap_cache(idx->map, docmap_get_cache(idx->map) | DOCMAP_CACHE_WEIGHT) != DOCMAP_OK) return SEARCH_EINVAL;
+
+    return SEARCH_OK;
+}
+
+static enum search_ret post(struct index *idx, struct query *query, 
+  struct search_acc_cons *acc, int opts, struct index_search_opt *opt) {
+    /* METRIC_POST */
+
+    const float Q_weight = search_qweight(query);
+
+
+    while (acc) {
+        assert(acc->acc.docno < docmap_entries(idx->map));
+        /* METRIC_POST_PER_DOC */
+        (acc->acc.weight) /= (float) ((DOCMAP_GET_WEIGHT(idx->map, acc->acc.docno)) * Q_weight);
+
+        acc = acc->next;
+    }
+
+    return SEARCH_OK;
+}
+
+/* macro to atomically read the next docno and f_dt from a vector 
+ * (note: i also tried a more complicated version that tested for a long vec 
+ * and used unchecked reads, but measurements showed no improvement) */
+#define NEXT_DOC(v, docno, f_dt)                                              \
+    (vec_vbyte_read(v, &docno_d)                                              \
+      && (((vec_vbyte_read(v, &f_dt) && ((docno += docno_d + 1), 1))          \
+        /* second read failed, reposition vec back to start of docno_d */     \
+        || (((v)->pos -= vec_vbyte_len(docno_d)), 0))))
+
+/* macro to scan over f_dt offsets from a vector/source */
+#define SCAN_OFFSETS(src, v, f_dt)                                            \
+    do {                                                                      \
+        unsigned int toscan = f_dt,                                           \
+                     scanned;                                                 \
+        enum search_ret sret;                                                 \
+                                                                              \
+        do {                                                                  \
+            if ((scanned = vec_vbyte_scan(v, toscan, &scanned)) == toscan) {  \
+                toscan = 0;                                                   \
+                break;                                                        \
+            } else if (scanned < toscan) {                                    \
+                toscan -= scanned;                                            \
+                /* need to read more */                                       \
+                if ((sret = src->readlist(src, VEC_LEN(v),                    \
+                    (void **) &(v)->pos, &bytes)) == SEARCH_OK) {             \
+                                                                              \
+                    (v)->end = (v)->pos + bytes;                              \
+                } else if (sret == SEARCH_FINISH) {                           \
+                    /* shouldn't end while scanning offsets */                \
+                    return SEARCH_EINVAL;                                     \
+                } else {                                                      \
+                    return sret;                                              \
+                }                                                             \
+            } else {                                                          \
+                assert("can't get here" && 0);                                \
+                return SEARCH_EINVAL;                                         \
+            }                                                                 \
+        } while (toscan);                                                     \
+    } while (0)
+static enum search_ret or_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc;
+    unsigned int accs_added = 0;   /* number of accumulators added */
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    unsigned int bytes;
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    /* METRIC_DECL */
+
+
+    /* METRIC_PER_CALL */
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                prevptr = &acc->next;
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += (1 + (float) logf((query->term[qterm].f_qt))) * (1 + (float) logf(f_dt));
+
+            } else {
+                struct search_acc_cons *newacc;
+                assert(!acc || docno < acc->acc.docno); 
+
+                /* allocate a new accumulator (we have reserved allocators
+                 * earlier, so this should never fail) */
+                newacc = objalloc_malloc(results->alloc, sizeof(*newacc));
+                assert(newacc);
+                newacc->next = acc;
+                acc = newacc;
+                acc->acc.docno = docno;
+                acc->acc.weight = 0.0;
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += (1 + (float) logf((query->term[qterm].f_qt))) * (1 + (float) logf(f_dt));
+
+                *prevptr = newacc;
+                accs_added++;
+            }
+            assert(acc);
+
+            /* go to next accumulator */
+            prevptr = &acc->next;
+            acc = acc->next;
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, update number of accumulators */
+            results->accs += accs_added;
+            results->total_results += accs_added;
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+static enum search_ret and_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src,
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc;
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    struct vec v = {NULL, NULL};
+    unsigned int bytes,
+                 missed = 0,       /* number of list entries that didn't match 
+                                    * an accumulator */
+                 hit = 0,          /* number of entries in both accs and list*/
+                 decoded = 0;      /* number of list entries seen */
+    enum search_ret ret;
+    float cooc_rate;               /* co-occurrance rate for list entries and 
+                                    * accumulators */
+    /* METRIC_DECL */
+
+
+    /* METRIC_PER_CALL */
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += (1 + (float) logf((query->term[qterm].f_qt))) * (1 + (float) logf(f_dt));
+
+
+                /* go to next accumulator */
+                acc = acc->next;
+                hit++;
+            } else {
+                missed++;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate number of results */
+
+            /* list entries now divide up into two portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            assert(missed + hit == decoded);
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            if (missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* tolerance value for thresholding estimates.  Should be >= 1.0.  Make higher
+ * for stabler, but higher memory usage, processing. */
+#define TOLERANCE 1.2
+
+/* low-ish approximation of infinity, to make counting up to it acceptable */
+#define INF 2000
+
+static enum search_ret thresh_decode(struct index *idx, struct query *query,
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, 
+  struct search_list_src *src, unsigned int postings, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc,
+                           dummy;
+    unsigned long int f_dt,           /* number of offsets for this document */
+                      docno_d;        /* d-gap */
+
+    /* initial number of accumulators */
+    unsigned int initial_accs = results->accs,
+
+                 decoded = 0,         /* number of postings decoded */
+                 thresh,              /* current discrete threshold */
+                 rethresh,            /* distance to recalculation of the 
+                                       * threshold */
+                 rethresh_dist,
+                 bytes,
+                 step,
+                 missed = 0,        /* number of list entries that didn't match 
+                                     * an accumulator */
+                 hit = 0;           /* number of entries in both accs and list*/
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    int infinite = 0;                 /* whether threshold is infinite */
+    float cooc_rate;
+    /* METRIC_DECL */
+
+
+    /* METRIC_PER_CALL */
+
+
+    rethresh_dist = rethresh = (postings + results->acc_limit - 1) 
+      / results->acc_limit;
+
+    if (results->v_t == FLT_MIN) {
+        unsigned long int docno_copy = docno;
+
+        /* this should be the first thresholded list, need to estimate 
+         * threshold */
+        assert(rethresh && rethresh < postings);
+        thresh = 0;
+
+        assert(rethresh < postings);
+        while (rethresh) {
+            while (rethresh && NEXT_DOC(&v, docno, f_dt)) {
+                rethresh--;
+                SCAN_OFFSETS(src, &v, f_dt);
+                if (f_dt > thresh) {
+                    thresh = f_dt;
+                }
+            }
+
+            /* need to read more data, preserving bytes that we already have */
+            if (rethresh && (ret = src->readlist(src, VEC_LEN(&v),
+                (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+                v.end = v.pos + bytes;
+            } else if (rethresh) {
+                assert(ret != SEARCH_FINISH);
+                return ret;
+            }
+        }
+        thresh--;
+
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        acc->acc.weight = 0.0;
+        f_dt = thresh;
+        /* METRIC_CONTRIB */
+        (acc->acc.weight) += (1 + (float) logf((query->term[qterm].f_qt))) * (1 + (float) logf(f_dt));
+
+        results->v_t = acc->acc.weight;
+
+        /* reset source/vector to start */
+        v.pos = v.end = NULL;
+        if ((ret = src->reset(src)) != SEARCH_OK) {
+            return ret;
+        }
+
+        acc = *prevptr;
+        docno = docno_copy;
+        rethresh = rethresh_dist;
+    } else {
+        /* translate the existing v_t threshold to an f_dt */
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        f_dt = 0;
+        do {
+            acc->acc.weight = 0.0;
+            f_dt++;
+            /* METRIC_CONTRIB */
+            (acc->acc.weight) += (1 + (float) logf((query->term[qterm].f_qt))) * (1 + (float) logf(f_dt));
+
+        } while (acc->acc.weight < results->v_t && f_dt < INF);
+        thresh = f_dt; 
+        acc = *prevptr;
+
+        if (thresh == INF) {
+            /* this is not a sensible term */
+            infinite = 1;
+            rethresh = postings + 1;
+        }
+    }
+
+    /* set step to 1/2 of the threshold */
+    step = (thresh + 1) / 2;
+    step += !step; /* but don't let it become 0 */
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                /* perform threshold test */
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = (*prevptr);
+                    results->accs--;
+                } else {
+                    /* retain this accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += (1 + (float) logf((query->term[qterm].f_qt))) * (1 + (float) logf(f_dt));
+
+
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = *prevptr;
+                    results->accs--;
+                } else {
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+                hit++;
+            } else {
+                if (f_dt > thresh) {
+                    struct search_acc_cons *newacc;
+                    assert(!acc || docno < acc->acc.docno); 
+
+                    if ((newacc = objalloc_malloc(results->alloc, 
+                      sizeof(*newacc)))) {
+                        newacc->acc.docno = docno;
+                        newacc->acc.weight = 0.0;
+                        newacc->next = acc;
+                        acc = newacc;
+                        /* note that we have to be careful around here to 
+                         * assign newacc to acc before using PER_DOC, 
+                         * otherwise we end up with nonsense in some 
+                         * accumulators */
+                        /* METRIC_PER_DOC */
+                        (acc->acc.weight) += (1 + (float) logf((query->term[qterm].f_qt))) * (1 + (float) logf(f_dt));
+
+                        *prevptr = newacc;
+                        results->accs++;
+                    } else {
+                        return SEARCH_ENOMEM;
+                    }
+
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                } else {
+                    missed++;
+                }
+            }
+
+            if (!--rethresh) {
+                int estimate;
+                unsigned int prev_thresh = thresh;
+
+                estimate = (int) (results->accs 
+                  + ((postings - decoded) 
+                    * ((float) results->accs - initial_accs)) / decoded);
+
+                if (estimate > TOLERANCE * results->acc_limit) {
+                    thresh += step;
+                } else if ((estimate < results->acc_limit / TOLERANCE) 
+                  && thresh) {
+                    if (thresh >= step) {
+                        thresh -= step;
+                    } else {
+                        thresh = 0;
+                    }
+                }
+
+                step = (step + 1) / 2;
+                assert(step);
+
+                /* note that we don't want to recalculate the threshold if it
+                 * doesn't change because this involves re-discretising it */
+                if (prev_thresh != thresh) {
+                    /* recalculate contribution that corresponds to the new 
+                     * threshold */
+                    f_dt = thresh;
+                    if (f_dt) {
+                        acc = &dummy;
+                        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+                        acc->acc.weight = 0.0;
+                        /* METRIC_CONTRIB */
+                        (acc->acc.weight) += (1 + (float) logf((query->term[qterm].f_qt))) * (1 + (float) logf(f_dt));
+
+                        results->v_t = acc->acc.weight;
+                        acc = *prevptr;
+                    } else {
+                        results->v_t = FLT_MIN;
+                    }
+                }
+
+                rethresh_dist *= 2;
+                rethresh = rethresh_dist;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate total results count */
+            assert(postings == decoded);
+
+            results->total_results += (int) (results->accs - initial_accs);
+
+            /* list entries now divide up into three portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *   - added
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            /* note that the total results are not an estimate if either there
+             * were no accumulators in the list when we started (in which case
+             * missed records exactly the number, uh, missing from the
+             * accumulators) or there were none missed, in which case the
+             * accumulators have fully accounted for everything in this list.
+             * In either case, the (1 - cooc_rate) * missed maths above handles
+             * it exactly (modulo floating point errors of course). */
+            if (initial_accs && missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                if (!infinite) {
+                    /* continue threshold evaluation */
+                    return SEARCH_OK;
+                } else {
+                    /* switch to AND processing */
+                    return SEARCH_FINISH;
+                }
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* Declare a function named the same as the metric that returns a structure 
+ * containing function pointers */
+const struct search_metric * /* METRIC_NAME */ cosine () {
+    const static struct search_metric sm 
+      = {pre, /* METRIC_DEPENDS_POST */ 1 ? post : NULL, 
+         or_decode, and_decode, thresh_decode};
+    return &sm;
+}
+
diff --git a/src/cosine.metric b/src/cosine.metric
new file mode 100644 (file)
index 0000000..f1319fa
--- /dev/null
@@ -0,0 +1,23 @@
+# cosine.metric is a functional description in our funny zettair metric
+# language (see metric.py) of how the cosine metric should operate.  
+#
+# This cosine metric is the most basic metric available, in order to
+# provide symmetry and to ensure that the weights are meaningful.
+# Thus, we simply calculate the cosine of the angle between a document
+# and query, where each term is a dimension, and the number of
+# occurrances of that term, slightly mangled with a log, is the distance in 
+# that dimension.  
+#
+# This metric should probably only be used when the query really is a
+# document.
+#
+# written nml 2005-07-18
+
+decode() {
+       accumulator += (1 + (float) logf(f_qt)) * (1 + (float) logf(f_dt));
+}
+
+post() {
+    accumulator /= (float) (D_weight * Q_weight);
+}
+
diff --git a/src/dirichlet.c b/src/dirichlet.c
new file mode 100644 (file)
index 0000000..c92a11b
--- /dev/null
@@ -0,0 +1,615 @@
+/* dirichlet.c implements the dirichlet metric for the zettair query
+ * subsystem.  This file was automatically generated from
+ * src/dirichlet.metric and src/metric.c
+ * by scripts/metric.py on Thu, 31 Aug 2006 23:54:32 GMT.  
+ *
+ * DO NOT MODIFY THIS FILE, as changes will be lost upon 
+ * subsequent regeneration (and this code is repetitive enough 
+ * that you probably don't want to anyway).  
+ * Go modify src/dirichlet.metric or src/metric.c instead.  
+ * 
+ * Comments from dirichlet.metric:
+ *
+ * dirichlet.metric is a functional description in our funny zettair metric
+ * language (see metric.py) of how the dirichlet-smoothed
+ * query-likelihood language modelling metric should operate
+ * (henceforth just dirichlet).
+ * 
+ * See Zhai and Lafferty, 'A study of smoothing methods for language models
+ * applied to information retrieval' for details.
+ * 
+ * Dirichlet smoothing gives
+ * p(t|d) = |d| * f_dt / |d| (mu + |d|) + mu * Ft / |C| (mu + |d|)
+ * 
+ * where:
+ * |d| is the length of the document (in terms)
+ * f_dt is the frequency of a term in a given document
+ * Ft is the number of occurrances of a term in the collection
+ * |C| is the length of the collection (in terms)
+ * mu is a parameter
+ * 
+ * Fiddling with this formula, we can show that:
+ * log(p(q | d)) = |q|.log(mu / (mu + |d|))
+ * + sum[ log(1 + |C| * f_dt / (mu * Ft)) ]
+ * 
+ * where the sum is taken over all terms in the query AND document.  Note that
+ * this form is much simpler to evaluate.
+ * 
+ * written nml 2005-06-8
+ *
+ */
+
+
+#include "firstinclude.h"
+
+#include "metric.h"
+
+#include "_index.h"
+#include "_docmap.h"
+#include "index_querybuild.h"
+
+#include "def.h"
+#include "objalloc.h"
+#include "docmap.h"
+#include "search.h"
+#include "vec.h"
+
+#include <assert.h>
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+
+static enum search_ret pre(struct index *idx, struct query *query, 
+  int opts, struct index_search_opt *opt) {
+    /* METRIC_PRE */
+    if (docmap_cache(idx->map, docmap_get_cache(idx->map) | DOCMAP_CACHE_WORDS) != DOCMAP_OK) return SEARCH_EINVAL;
+
+    return SEARCH_OK;
+}
+
+static enum search_ret post(struct index *idx, struct query *query, 
+  struct search_acc_cons *acc, int opts, struct index_search_opt *opt) {
+    /* METRIC_POST */
+
+    const unsigned int Q_terms = search_qterms(query);
+
+
+    while (acc) {
+        assert(acc->acc.docno < docmap_entries(idx->map));
+        /* METRIC_POST_PER_DOC */
+        (acc->acc.weight) += Q_terms * (float) logf((opt->u.dirichlet.mu) / ((opt->u.dirichlet.mu) + (DOCMAP_GET_WORDS(idx->map, acc->acc.docno))));
+
+        acc = acc->next;
+    }
+
+    return SEARCH_OK;
+}
+
+/* macro to atomically read the next docno and f_dt from a vector 
+ * (note: i also tried a more complicated version that tested for a long vec 
+ * and used unchecked reads, but measurements showed no improvement) */
+#define NEXT_DOC(v, docno, f_dt)                                              \
+    (vec_vbyte_read(v, &docno_d)                                              \
+      && (((vec_vbyte_read(v, &f_dt) && ((docno += docno_d + 1), 1))          \
+        /* second read failed, reposition vec back to start of docno_d */     \
+        || (((v)->pos -= vec_vbyte_len(docno_d)), 0))))
+
+/* macro to scan over f_dt offsets from a vector/source */
+#define SCAN_OFFSETS(src, v, f_dt)                                            \
+    do {                                                                      \
+        unsigned int toscan = f_dt,                                           \
+                     scanned;                                                 \
+        enum search_ret sret;                                                 \
+                                                                              \
+        do {                                                                  \
+            if ((scanned = vec_vbyte_scan(v, toscan, &scanned)) == toscan) {  \
+                toscan = 0;                                                   \
+                break;                                                        \
+            } else if (scanned < toscan) {                                    \
+                toscan -= scanned;                                            \
+                /* need to read more */                                       \
+                if ((sret = src->readlist(src, VEC_LEN(v),                    \
+                    (void **) &(v)->pos, &bytes)) == SEARCH_OK) {             \
+                                                                              \
+                    (v)->end = (v)->pos + bytes;                              \
+                } else if (sret == SEARCH_FINISH) {                           \
+                    /* shouldn't end while scanning offsets */                \
+                    return SEARCH_EINVAL;                                     \
+                } else {                                                      \
+                    return sret;                                              \
+                }                                                             \
+            } else {                                                          \
+                assert("can't get here" && 0);                                \
+                return SEARCH_EINVAL;                                         \
+            }                                                                 \
+        } while (toscan);                                                     \
+    } while (0)
+static enum search_ret or_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc;
+    unsigned int accs_added = 0;   /* number of accumulators added */
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    unsigned int bytes;
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    /* METRIC_DECL */
+
+    const double terms = ((double) UINT_MAX) * idx->stats.terms_high + idx->stats.terms_low;
+
+    float w_t = (float) (terms / ((opt->u.dirichlet.mu) * (query->term[qterm].F_t)));
+
+
+    /* METRIC_PER_CALL */
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                prevptr = &acc->next;
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += (float) logf(1 + f_dt * w_t);
+
+            } else {
+                struct search_acc_cons *newacc;
+                assert(!acc || docno < acc->acc.docno); 
+
+                /* allocate a new accumulator (we have reserved allocators
+                 * earlier, so this should never fail) */
+                newacc = objalloc_malloc(results->alloc, sizeof(*newacc));
+                assert(newacc);
+                newacc->next = acc;
+                acc = newacc;
+                acc->acc.docno = docno;
+                acc->acc.weight = 0.0;
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += (float) logf(1 + f_dt * w_t);
+
+                *prevptr = newacc;
+                accs_added++;
+            }
+            assert(acc);
+
+            /* go to next accumulator */
+            prevptr = &acc->next;
+            acc = acc->next;
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, update number of accumulators */
+            results->accs += accs_added;
+            results->total_results += accs_added;
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+static enum search_ret and_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src,
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc;
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    struct vec v = {NULL, NULL};
+    unsigned int bytes,
+                 missed = 0,       /* number of list entries that didn't match 
+                                    * an accumulator */
+                 hit = 0,          /* number of entries in both accs and list*/
+                 decoded = 0;      /* number of list entries seen */
+    enum search_ret ret;
+    float cooc_rate;               /* co-occurrance rate for list entries and 
+                                    * accumulators */
+    /* METRIC_DECL */
+
+    const double terms = ((double) UINT_MAX) * idx->stats.terms_high + idx->stats.terms_low;
+
+    float w_t = (float) (terms / ((opt->u.dirichlet.mu) * (query->term[qterm].F_t)));
+
+
+    /* METRIC_PER_CALL */
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += (float) logf(1 + f_dt * w_t);
+
+
+                /* go to next accumulator */
+                acc = acc->next;
+                hit++;
+            } else {
+                missed++;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate number of results */
+
+            /* list entries now divide up into two portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            assert(missed + hit == decoded);
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            if (missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* tolerance value for thresholding estimates.  Should be >= 1.0.  Make higher
+ * for stabler, but higher memory usage, processing. */
+#define TOLERANCE 1.2
+
+/* low-ish approximation of infinity, to make counting up to it acceptable */
+#define INF 2000
+
+static enum search_ret thresh_decode(struct index *idx, struct query *query,
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, 
+  struct search_list_src *src, unsigned int postings, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc,
+                           dummy;
+    unsigned long int f_dt,           /* number of offsets for this document */
+                      docno_d;        /* d-gap */
+
+    /* initial number of accumulators */
+    unsigned int initial_accs = results->accs,
+
+                 decoded = 0,         /* number of postings decoded */
+                 thresh,              /* current discrete threshold */
+                 rethresh,            /* distance to recalculation of the 
+                                       * threshold */
+                 rethresh_dist,
+                 bytes,
+                 step,
+                 missed = 0,        /* number of list entries that didn't match 
+                                     * an accumulator */
+                 hit = 0;           /* number of entries in both accs and list*/
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    int infinite = 0;                 /* whether threshold is infinite */
+    float cooc_rate;
+    /* METRIC_DECL */
+
+    const double terms = ((double) UINT_MAX) * idx->stats.terms_high + idx->stats.terms_low;
+
+    float w_t = (float) (terms / ((opt->u.dirichlet.mu) * (query->term[qterm].F_t)));
+
+
+    /* METRIC_PER_CALL */
+
+
+    rethresh_dist = rethresh = (postings + results->acc_limit - 1) 
+      / results->acc_limit;
+
+    if (results->v_t == FLT_MIN) {
+        unsigned long int docno_copy = docno;
+
+        /* this should be the first thresholded list, need to estimate 
+         * threshold */
+        assert(rethresh && rethresh < postings);
+        thresh = 0;
+
+        assert(rethresh < postings);
+        while (rethresh) {
+            while (rethresh && NEXT_DOC(&v, docno, f_dt)) {
+                rethresh--;
+                SCAN_OFFSETS(src, &v, f_dt);
+                if (f_dt > thresh) {
+                    thresh = f_dt;
+                }
+            }
+
+            /* need to read more data, preserving bytes that we already have */
+            if (rethresh && (ret = src->readlist(src, VEC_LEN(&v),
+                (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+                v.end = v.pos + bytes;
+            } else if (rethresh) {
+                assert(ret != SEARCH_FINISH);
+                return ret;
+            }
+        }
+        thresh--;
+
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        acc->acc.weight = 0.0;
+        f_dt = thresh;
+        /* METRIC_CONTRIB */
+        (acc->acc.weight) += (float) logf(1 + f_dt * w_t);
+
+        results->v_t = acc->acc.weight;
+
+        /* reset source/vector to start */
+        v.pos = v.end = NULL;
+        if ((ret = src->reset(src)) != SEARCH_OK) {
+            return ret;
+        }
+
+        acc = *prevptr;
+        docno = docno_copy;
+        rethresh = rethresh_dist;
+    } else {
+        /* translate the existing v_t threshold to an f_dt */
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        f_dt = 0;
+        do {
+            acc->acc.weight = 0.0;
+            f_dt++;
+            /* METRIC_CONTRIB */
+            (acc->acc.weight) += (float) logf(1 + f_dt * w_t);
+
+        } while (acc->acc.weight < results->v_t && f_dt < INF);
+        thresh = f_dt; 
+        acc = *prevptr;
+
+        if (thresh == INF) {
+            /* this is not a sensible term */
+            infinite = 1;
+            rethresh = postings + 1;
+        }
+    }
+
+    /* set step to 1/2 of the threshold */
+    step = (thresh + 1) / 2;
+    step += !step; /* but don't let it become 0 */
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                /* perform threshold test */
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = (*prevptr);
+                    results->accs--;
+                } else {
+                    /* retain this accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += (float) logf(1 + f_dt * w_t);
+
+
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = *prevptr;
+                    results->accs--;
+                } else {
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+                hit++;
+            } else {
+                if (f_dt > thresh) {
+                    struct search_acc_cons *newacc;
+                    assert(!acc || docno < acc->acc.docno); 
+
+                    if ((newacc = objalloc_malloc(results->alloc, 
+                      sizeof(*newacc)))) {
+                        newacc->acc.docno = docno;
+                        newacc->acc.weight = 0.0;
+                        newacc->next = acc;
+                        acc = newacc;
+                        /* note that we have to be careful around here to 
+                         * assign newacc to acc before using PER_DOC, 
+                         * otherwise we end up with nonsense in some 
+                         * accumulators */
+                        /* METRIC_PER_DOC */
+                        (acc->acc.weight) += (float) logf(1 + f_dt * w_t);
+
+                        *prevptr = newacc;
+                        results->accs++;
+                    } else {
+                        return SEARCH_ENOMEM;
+                    }
+
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                } else {
+                    missed++;
+                }
+            }
+
+            if (!--rethresh) {
+                int estimate;
+                unsigned int prev_thresh = thresh;
+
+                estimate = (int) (results->accs 
+                  + ((postings - decoded) 
+                    * ((float) results->accs - initial_accs)) / decoded);
+
+                if (estimate > TOLERANCE * results->acc_limit) {
+                    thresh += step;
+                } else if ((estimate < results->acc_limit / TOLERANCE) 
+                  && thresh) {
+                    if (thresh >= step) {
+                        thresh -= step;
+                    } else {
+                        thresh = 0;
+                    }
+                }
+
+                step = (step + 1) / 2;
+                assert(step);
+
+                /* note that we don't want to recalculate the threshold if it
+                 * doesn't change because this involves re-discretising it */
+                if (prev_thresh != thresh) {
+                    /* recalculate contribution that corresponds to the new 
+                     * threshold */
+                    f_dt = thresh;
+                    if (f_dt) {
+                        acc = &dummy;
+                        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+                        acc->acc.weight = 0.0;
+                        /* METRIC_CONTRIB */
+                        (acc->acc.weight) += (float) logf(1 + f_dt * w_t);
+
+                        results->v_t = acc->acc.weight;
+                        acc = *prevptr;
+                    } else {
+                        results->v_t = FLT_MIN;
+                    }
+                }
+
+                rethresh_dist *= 2;
+                rethresh = rethresh_dist;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate total results count */
+            assert(postings == decoded);
+
+            results->total_results += (int) (results->accs - initial_accs);
+
+            /* list entries now divide up into three portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *   - added
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            /* note that the total results are not an estimate if either there
+             * were no accumulators in the list when we started (in which case
+             * missed records exactly the number, uh, missing from the
+             * accumulators) or there were none missed, in which case the
+             * accumulators have fully accounted for everything in this list.
+             * In either case, the (1 - cooc_rate) * missed maths above handles
+             * it exactly (modulo floating point errors of course). */
+            if (initial_accs && missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                if (!infinite) {
+                    /* continue threshold evaluation */
+                    return SEARCH_OK;
+                } else {
+                    /* switch to AND processing */
+                    return SEARCH_FINISH;
+                }
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* Declare a function named the same as the metric that returns a structure 
+ * containing function pointers */
+const struct search_metric * /* METRIC_NAME */ dirichlet () {
+    const static struct search_metric sm 
+      = {pre, /* METRIC_DEPENDS_POST */ 1 ? post : NULL, 
+         or_decode, and_decode, thresh_decode};
+    return &sm;
+}
+
diff --git a/src/dirichlet.metric b/src/dirichlet.metric
new file mode 100644 (file)
index 0000000..6ddb49a
--- /dev/null
@@ -0,0 +1,38 @@
+# dirichlet.metric is a functional description in our funny zettair metric
+# language (see metric.py) of how the dirichlet-smoothed
+# query-likelihood language modelling metric should operate
+# (henceforth just dirichlet).  
+#
+# See Zhai and Lafferty, 'A study of smoothing methods for language models
+# applied to information retrieval' for details.
+# 
+# Dirichlet smoothing gives 
+#   p(t|d) = |d| * f_dt / |d| (mu + |d|) + mu * Ft / |C| (mu + |d|)
+#
+#   where:
+#     |d| is the length of the document (in terms)
+#     f_dt is the frequency of a term in a given document
+#     Ft is the number of occurrances of a term in the collection
+#     |C| is the length of the collection (in terms)
+#     mu is a parameter
+#
+# Fiddling with this formula, we can show that:
+#   log(p(q | d)) = |q|.log(mu / (mu + |d|)) 
+#     + sum[ log(1 + |C| * f_dt / (mu * Ft)) ]
+#
+# where the sum is taken over all terms in the query AND document.  Note that
+# this form is much simpler to evaluate.
+#
+# written nml 2005-06-8
+
+parameter float mu;
+
+decode() {
+    float w_t = (float) (terms / (mu * F_t));
+    accumulator += (float) logf(1 + f_dt * w_t);
+}
+
+post() {
+    accumulator += Q_terms * (float) logf(mu / (mu + D_terms));
+}
+
diff --git a/src/docmap.c b/src/docmap.c
new file mode 100755 (executable)
index 0000000..0f1bde4
--- /dev/null
@@ -0,0 +1,2484 @@
+/* docmap.c implements the interface declared in docmap.h.  The docmap holds
+ * all per-document information in the search engine.  As of the below date, 
+ * the design has been changed and a new implementation written (also renamed
+ * ndocmap back to docmap).
+ *
+ * The new design is essentially a paged array.  The docmap is split into pages
+ * of a given size, with each page consisting of a small header, and then some
+ * data.  Pages may be either data or cache pages, where data pages hold the
+ * 'true' docmap record, and cache pages are used to load data into memory
+ * quickly between invocations.
+ * Each entry is serially encoded into a data page
+ * utilising simple inter- and intra-entry compression (so that 
+ * they must be read as a stream).  Specifically, all integer entries are
+ * vbyte-encoded, and all text entries associated with each entry are
+ * front-coded with respect to the previous entry.
+ * Unlike the previous design, this docmap holds all elements of an entry
+ * contiguously on disk.
+ *
+ * The docmap then has an append buffer, which holds new documents in main
+ * memory prior to them migrating to disk, and a read buffer.  
+ * Both are an integral number of pages.  
+ * In addition to these buffers, the user can request that certain quantities 
+ * be cached in main memory, where that quantity is individually held as 
+ * an array.  Cache pages are read/written at the load/save of the docmap to 
+ * move cached items in/out of memory quickly.
+ *
+ * The data pages are indexed by an in-memory sorted array, mapping the first
+ * docno contained within each page to its location.  This information and 
+ * other aggregate information is written to the end of the docmap on shutdown,
+ * in cache pages.
+ *
+ * The format of each data page is: 
+ *   - the constant byte '0xda', or '0xdf' for the final data page
+ *   - number of entries in this page (4 byte big-endian integer)
+ *   - for each entry:
+ *     - fileno gap + 1 or 0 (vbyte).  0 indicates that this document 
+ *       immediately follows the previous, and no offset field is present
+ *     - (optional, see above) offset field (vbyte)
+ *     - docno gap (since docnos strictly ascend - vbyte)
+ *     - flags (shifted onto docno gap vbyte)
+ *     - distinct words in document (vbyte)
+ *     - words - distinct_words (since words >= distinct_words, vbyte)
+ *     - bytes - (2 * words - 1) (since each word must occupy at least two 
+ *       bytes, except the first. vbyte)
+ *     - mime type of document
+ *     - TREC docno (front-coded):
+ *       - number of prefix bytes from previous TREC docno (vbyte)
+ *       - length of suffix bytes (vbyte)
+ *       - suffix bytes
+ *     - weight (float)
+ *
+ * this implementation doesn't currently handle deletion, but has been designed
+ * so that adding it shouldn't be too much hassle.  The in-memory arrays can be
+ * limited by knowing the smallest active entry.  The map can be made a true
+ * search structure (such as rbtree) instead of just a sorted array.  Adjacent
+ * pages can be combined when they become sufficiently sparse, and freed pages
+ * reused for new content.
+ *
+ * The format of each cache page is:
+ *   - the constant byte '0xca', or constant byte '0xcf' for the final cache 
+ *     page
+ *   - the last document number in the docmap (acts as a timestamp - vbyte)
+ *   - the page number of the first cache page (vbyte)
+ *   - a series of self-delimiting entries containing cache information:
+ *     - byte 0x00 meaning end-of-page
+ *     - byte 0x02, followed by the aggregate quantities (sum_bytes, sum_words,
+ *       sum_dwords and sum_weight) written as a vbyte normalised fraction
+ *       (multiplied by UINT32_MAX) and a vbyte exponent
+ *     - byte 0x03, followed by a map cache entry:
+ *       - vbyte number of entries in the map 
+ *       - vbyte offset of following entries in the map
+ *       - uint32_t number of following entries from the map
+ *       - a series of vbyte map entries
+ *       - note that no entry shall exceed a page, and that the offsets
+ *         encountered should form a sequence across pages
+ *     - byte 0x4, followed by word array entry, same format as map array
+ *     - byte 0x5, followed by dword array entry, same format as word array
+ *     - byte 0x6, followed by bytes array entry, same format as word array
+ *     - byte 0x7, followed by weight array entry, same format as word array,
+ *       except that weights are stored like aggregate doubles
+ *     - byte 0x8, followed by trecno offset array entry, same format as word
+ *       array
+ *     - byte 0x9, followed by trecno font-coded entry:
+ *       - vbyte number of characters in array
+ *       - vbyte offset of following entry in array 
+ *       - vbyte number of characters in following entry
+ *       - a character array of front-coded trecno entries
+ *
+ * There are a few in-memory tricks which i've used to reduce the amount of
+ * space required to cache elements.  The first is to use 3-in-4
+ * front-coding of TREC docno entries.  This means that only every fourth entry
+ * is wholly represented, with three subsequent entries front-coded against it.
+ * All entries are stored in a character array, with an array of pointers into
+ * the char array for reasonably fast random access.  Last time i checked, this
+ * saved 50% of the space required for sensibly ordered TREC docnos.
+ *
+ * A process similar to 3-in-4 front-coding is used for the location array.  
+ * The array records vbyte'd byte counts for each document.  Every 8 entries, 
+ * an offset into the array is recorded for faster random access.  In addition,
+ * if that record has a non-zero offset (which we can tell through the reposset
+ * structure) then the offset is recorded before the vbyte bytes entry.
+ * This provides access to the byte counts, but additionally allows the offset
+ * to be reconstructed for any record by decoding at most 8 bytes records.
+ * 
+ * To complete the in-memory caching of location information, document types 
+ * are recorded in a sorted in-memory array if they are not of type
+ * MIME_TYPE_APPLICATION_X_TREC (yes, this is a bit hacky).
+ *
+ * There are still some flaws in the current implementation (XXX).  Firstly, 
+ * the empty docmap has no valid representation.  
+ * Also, the number of entries on a page can change during reading, which won't
+ * be picked up.  Also, there's some confusion about whether buffers point to a
+ * series of pages or to a single page.  
+ * 
+ * written nml 2006-04-06 
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "_docmap.h"
+#include "docmap.h"
+
+#include "def.h"
+#include "binsearch.h"
+#include "fdset.h"
+#include "mem.h"
+#include "reposset.h"
+#include "_reposset.h"
+#include "str.h"
+#include "timings.h"
+#include "vec.h"
+#include "zstdint.h"
+#include "zvalgrind.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* frequency of front-coding of trecno's.  For example, a value of 4 sets a
+ * policy of 3-in-4 front coding, where only every fourth entry is not
+ * front-encoded */
+#define TRECNO_FRONT_FREQ 4
+
+/* frequency of relative coding of locations. */
+#define LOC_REL_FREQ 8
+
+/* initial memory allocated to various arrays */
+#define INIT_LEN 8
+
+/* character constants for identifying pages */
+#define FINAL_DATA_BYTE ((char) 0xdf)
+#define DATA_BYTE ((char) 0xda)
+#define CACHE_BYTE ((char) 0xca)
+#define FINAL_CACHE_BYTE ((char) 0xcf)
+
+#define DOCMAP_WEIGHT_PRECISION 7
+
+enum cache_id {
+    CACHE_ID_END = 0,
+    CACHE_ID_AGG = 0x01,
+    CACHE_ID_MAP = 0x02,
+    CACHE_ID_WORDS = 0x03,
+    CACHE_ID_DWORDS = 0x04,
+    CACHE_ID_WEIGHT = 0x07,
+    CACHE_ID_TRECNO = 0x08,
+    CACHE_ID_TRECNO_CODE = 0x09,
+    CACHE_ID_REPOS_REC = 0x0a,
+    CACHE_ID_REPOS_CHECK = 0x0b,
+    CACHE_ID_LOC = 0x0c,
+    CACHE_ID_LOC_CODE = 0x0d,
+    CACHE_ID_TYPEEX = 0x0e
+};
+
+/* internal function to make a cursor point to nothing */
+static void invalidate_cursor(struct docmap_cursor *cur) {
+    cur->buf = NULL;
+    cur->page = -1;
+    cur->entry.docno = -1;
+    cur->entry.fileno = -1;
+    cur->entry.offset = -1;
+    cur->entry.bytes = 0;
+    cur->first_docno = cur->last_docno = -1;
+    cur->pos.pos = cur->pos.end = NULL;
+}
+
+/* internal function to invalidate a buffer entry and the cursors that point to
+ * it */
+static void invalidate_buffer(struct docmap *dm, struct docmap_buffer *buf) {
+    if (dm->read.buf == buf) {
+        invalidate_cursor(&dm->read);
+    }
+    if (dm->write.buf == buf) {
+        invalidate_cursor(&dm->write);
+    }
+    buf->page = -1;
+    buf->buflen = 0;
+    buf->dirty = 0;
+}
+
+/* internal function to initialise a docmap structure, used for both docmap_new
+ * and docmap_load */
+static struct docmap *docmap_init(struct fdset *fdset, 
+  int fd_type, unsigned int pagesize, unsigned int pages, 
+  unsigned long int max_filesize, enum docmap_cache cache) {
+    struct docmap *dm = malloc(sizeof(*dm));
+
+    if (pages < 2) {
+        pages = 2;
+    }
+
+    if (dm && (dm->buf = malloc(pagesize * pages)) 
+      && (dm->map = malloc(sizeof(*dm->map) * INIT_LEN))
+      && (dm->rset = reposset_new())) {
+        dm->map_size = INIT_LEN;
+        dm->map_len = 0;
+        dm->map[dm->map_len] = ULONG_MAX;
+
+        dm->file_pages = max_filesize / pagesize;
+        dm->fdset = fdset;
+        dm->fd_type = fd_type;
+        dm->pagesize = pagesize;
+        dm->entries = 0;
+
+        /* assign all pages to reading, append buffering will steal them later
+         * if necessary */
+        invalidate_cursor(&dm->read);
+        invalidate_cursor(&dm->write);
+        invalidate_buffer(dm, &dm->readbuf);
+        invalidate_buffer(dm, &dm->appendbuf);
+        dm->read.entry.trecno = dm->write.entry.trecno = NULL;
+        dm->read.entry.trecno_len = dm->read.entry.trecno_size = 0;
+        dm->write.entry.trecno_len = dm->write.entry.trecno_size = 0;
+        dm->readbuf.buf = dm->buf;
+        dm->readbuf.bufsize = pages;
+
+        dm->appendbuf.page = 0;      /* append gets page 0 because it has no 
+                                      * buflen */
+        dm->appendbuf.buf = dm->buf;
+        dm->appendbuf.bufsize = 0;
+
+        dm->dirty = 0;           
+
+        dm->cache.cache = cache;
+        dm->cache.len = dm->cache.size = 0;
+        dm->cache.words = NULL;
+        dm->cache.dwords = NULL;
+        dm->cache.weight = NULL;
+        dm->cache.loc_off = NULL;
+        dm->cache.loc.buf = NULL;
+        dm->cache.loc.len = dm->cache.loc.size = 0;
+        dm->cache.trecno_off = NULL;
+        dm->cache.trecno.buf = NULL;
+        dm->cache.trecno.len = dm->cache.trecno.size = 0;
+        dm->cache.typeex = NULL;
+        dm->cache.typeex_len = dm->cache.typeex_size = 0;
+
+        dm->agg.avg_bytes = dm->agg.sum_bytes 
+          = dm->agg.avg_weight = dm->agg.sum_weight 
+          = dm->agg.avg_words = dm->agg.sum_words 
+          = dm->agg.avg_dwords = dm->agg.sum_dwords
+          = dm->agg.sum_trecno = 0;
+    } else {
+        if (dm) {
+            if (dm->buf) {
+                free(dm->buf);
+                dm->buf = NULL;
+            }
+            free(dm);
+            dm = NULL;
+        }
+    }
+
+    return dm;
+}
+
+/* internal function to encode an entry relative to a previous entry into 
+ * some space. */
+static enum docmap_ret encode(struct vec *v, struct docmap_entry *prev, 
+  struct docmap_entry *curr) {
+    uintmax_t tmp[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
+    unsigned int arrlen = sizeof(tmp) / sizeof(*tmp),
+                 prefix,
+                 len,
+                 bytes,
+                 i = 0;
+    char *pos = v->pos;
+
+    /* figure out the length of the front-coding prefix between trecnos */
+    if (curr->trecno_len < prev->trecno_len) {
+        len = curr->trecno_len;
+    } else {
+        len = prev->trecno_len;
+    }
+    for (prefix = 0; 
+      prefix < len 
+        && curr->trecno[prefix] == prev->trecno[prefix]; prefix++) ;
+    assert(prefix <= len && prefix <= curr->trecno_len);
+
+    if (curr->fileno == prev->fileno 
+      && curr->offset == prev->offset + (off_t) prev->bytes) {
+        /* document immediately follows the previous */
+        tmp[i++] = 0;
+        arrlen--;
+    } else {
+        assert(curr->fileno >= prev->fileno || prev->fileno == -1);
+        tmp[i++] = 1 + curr->fileno - prev->fileno;
+        assert(tmp[i - 1] > 0);  /* CANNOT be zero */
+        tmp[i++] = curr->offset;
+    }
+
+    /* encode docno gap and flags into one integer */
+    tmp[i] = curr->docno - prev->docno;
+    tmp[i] <<= 1;
+    tmp[i++] |= curr->flags;
+
+    tmp[i++] = curr->dwords;
+    tmp[i++] = curr->words - curr->dwords;
+    tmp[i++] = curr->bytes + 1 - 2 * curr->words;
+    tmp[i++] = curr->mtype;
+    tmp[i++] = prefix;
+    tmp[i++] = curr->trecno_len - prefix;
+
+    if ((vec_maxint_arr_write(v, tmp, arrlen, &bytes) == arrlen)
+      && vec_byte_write(v, curr->trecno + prefix, 
+        (unsigned int) tmp[arrlen - 1]) == tmp[arrlen - 1]
+      && vec_flt_write(v, curr->weight, DOCMAP_WEIGHT_PRECISION)) {
+
+        /* Relations that we use to compress entries.  These assertions go 
+         * after encoding so that we don't assert things if encoding fails) */
+        assert(curr->words >= curr->dwords);
+        assert(curr->bytes + 1 >= 2 * curr->words);
+        return DOCMAP_OK;
+    } else {
+        v->pos = pos;
+        return DOCMAP_BUFSIZE_ERROR;
+    }
+}
+
+/* internal function to decode an entry from some space.  Note that target must
+ * contain the previous entry for the next entry to be correctly decoded. */
+static enum docmap_ret decode(struct docmap_cursor *cur) {
+    struct vec *v = &cur->pos; 
+    struct docmap_entry *target = &cur->entry;
+    uintmax_t tmp[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
+    unsigned int i,
+                 bytes,
+                 readlen,
+                 arrlen = sizeof(tmp) / sizeof(*tmp);
+    char *pos = v->pos;
+
+    if (cur->past < cur->entries 
+      && vec_maxint_arr_read(v, tmp, 1, &readlen)) {
+        /* have to examine fileno before we can tell how many more numbers to
+         * read */
+        if (!tmp[0]) {
+            /* fileno indicates that this doc starts immediately after prev */
+            i = 2;
+            tmp[0] = target->fileno;
+            tmp[1] = target->offset + target->bytes;
+        } else {
+            tmp[0] += target->fileno - 1;
+            i = 1;
+            /* offset will be read below */
+        }
+
+        if (vec_maxint_arr_read(v, &tmp[i], arrlen - i, &bytes)) {
+            /* ensure that we've got enough space for the trecno */
+            if (target->trecno_size < tmp[arrlen - 2] + tmp[arrlen - 1] + 1) {
+                void *ptr = realloc(target->trecno, (unsigned int)
+                    (tmp[arrlen - 2] + tmp[arrlen - 1] + 1));
+
+                if (ptr) {
+                    target->trecno = ptr;
+                    target->trecno_size = (unsigned int) 
+                      (tmp[arrlen - 2] + tmp[arrlen - 1] + 1);
+                } else {
+                    assert(!CRASH);
+                    v->pos = pos;
+                    return DOCMAP_MEM_ERROR;
+                }
+            }
+
+            i = 0;
+            assert(tmp[0] != target->fileno || tmp[1] >= target->offset);
+            target->fileno = (unsigned int) tmp[i++];
+            target->offset = (unsigned long int) tmp[i++];
+            target->flags = (int) (tmp[i] & 1);
+            target->docno += (((unsigned int) tmp[i++]) >> 1);
+            target->dwords = (unsigned int) tmp[i++];
+            target->words = target->dwords + (unsigned int) tmp[i++];
+            target->bytes = (unsigned int) tmp[i++] + 2 * target->words - 1;
+            target->mtype = (unsigned int) tmp[i++];
+
+            if (vec_byte_read(v, target->trecno + tmp[i], 
+                (unsigned int) tmp[i + 1]) == tmp[i + 1]
+              && vec_flt_read(v, &target->weight, DOCMAP_WEIGHT_PRECISION)) {
+                target->trecno_len = (unsigned int) tmp[i] 
+                  + (unsigned int) tmp[i + 1];
+                target->trecno[target->trecno_len] = '\0';
+                cur->past++;
+                return DOCMAP_OK;
+            } else {
+                /* bugger, we've destroyed the previous entry */
+                assert("can't get here" && 0);
+                return DOCMAP_BUFSIZE_ERROR;
+            }
+        }
+        return DOCMAP_OK;
+    }
+
+    v->pos = pos;
+    return DOCMAP_BUFSIZE_ERROR;
+}
+
+/* internal method to transfer a buffer from the read buffer to the append
+ * buffer */
+static enum docmap_ret take_read_buffer(struct docmap *dm) {
+    assert(!dm->readbuf.dirty);
+    assert(dm->readbuf.bufsize > 1);
+    if (!dm->readbuf.bufsize) {
+        return DOCMAP_ARG_ERROR;
+    }
+
+    dm->readbuf.buf += dm->pagesize;
+    dm->readbuf.page++;
+    dm->readbuf.bufsize--;
+    if (dm->readbuf.buflen >= dm->readbuf.bufsize) {
+        dm->readbuf.buflen = dm->readbuf.bufsize;
+    }
+    if (dm->read.pos.pos >= dm->readbuf.buf && dm->read.pos.pos 
+      < dm->readbuf.buf + dm->pagesize * dm->readbuf.buflen) {
+        /* do nothing */
+    } else {
+        invalidate_cursor(&dm->read);
+    }
+
+    dm->appendbuf.bufsize++;
+
+    return DOCMAP_OK;
+}
+
+static void zero_entry(struct docmap_entry *e) {
+    e->docno = 0;
+    e->fileno = 0;
+    e->offset = 0;
+    e->bytes = 0;
+    e->trecno_len = 0;
+}
+
+/* internal function to initialise the next page in the append buffer */
+static enum docmap_ret init_append_buffer(struct docmap *dm, 
+  unsigned long int docno) {
+
+    while (dm->map_len + 1 >= dm->map_size) {
+        void *ptr = realloc(dm->map, 
+            sizeof(*dm->map) * (dm->map_size * 2 + 1));
+
+        if (ptr) {
+            dm->map = ptr;
+            dm->map_size *= 2;
+            dm->map_size++;
+        } else {
+            assert(!CRASH);
+            return DOCMAP_MEM_ERROR;
+        }
+    }
+
+    assert(dm->appendbuf.buflen < dm->appendbuf.bufsize);
+    dm->appendbuf.dirty = 1;
+    dm->write.pos.pos 
+      = dm->appendbuf.buf + dm->appendbuf.buflen * dm->pagesize;
+    dm->write.pos.end = dm->write.pos.pos + dm->pagesize;
+    dm->write.entries = 0;
+    zero_entry(&dm->write.entry);
+    dm->appendbuf.buflen++;
+
+    dm->map[dm->map_len++] = docno;
+    dm->map[dm->map_len] = ULONG_MAX;
+
+    *dm->write.pos.pos++ = DATA_BYTE;
+    dm->write.pos.pos += sizeof(uint32_t);       /* skip space for entries */
+    assert(vec_len(&dm->write.pos));
+    if (DEAR_DEBUG) {
+        memset(dm->write.pos.pos, 0, vec_len(&dm->write.pos));
+    }
+    return DOCMAP_OK;
+}
+
+/* internal function to commit a dirty buffer to disk */
+static enum docmap_ret commit(struct docmap *dm, struct docmap_buffer *buf) {
+    unsigned int page = buf->page,
+                 pages = buf->buflen,
+                 pagesize = dm->pagesize,
+                 fileno,
+                 target,
+                 bytes;
+    char *pos = buf->buf;
+    unsigned long int offset;
+    int fd;
+
+    assert(buf->dirty);
+
+    /* note that buffers may span multiple files */
+    do {
+        fileno = page / dm->file_pages;
+        offset = page % dm->file_pages;
+        target = pages;
+        if (offset + target > dm->file_pages) {
+            target = dm->file_pages - offset;
+            assert(target);
+        }
+
+        VALGRIND_CHECK_READABLE(pos, target * pagesize);
+        if (((fd = fdset_pin(dm->fdset, dm->fd_type, fileno, offset * pagesize,
+            SEEK_SET)) >= 0) 
+          && (bytes = write(fd, pos, target * pagesize)) == target * pagesize
+          && fdset_unpin(dm->fdset, dm->fd_type, fileno, fd) == FDSET_OK) {
+            pages -= target;
+            pos += bytes;
+        } else {
+            if (fd >= 0) {
+                fdset_unpin(dm->fdset, dm->fd_type, fileno, fd);
+            }
+            return DOCMAP_IO_ERROR;
+        }
+    } while (pages);
+
+    buf->dirty = 0;
+    return DOCMAP_OK;
+}
+
+/* internal function to recalculate aggregate values */
+static void aggregate(struct docmap *dm) {
+    if (dm->entries) {
+        dm->agg.avg_words = dm->agg.sum_words / dm->entries;
+        dm->agg.avg_dwords = dm->agg.sum_dwords / dm->entries;
+        dm->agg.avg_bytes = dm->agg.sum_bytes / dm->entries;
+        dm->agg.avg_weight = dm->agg.sum_weight / dm->entries;
+    } else {
+        dm->agg.avg_words = dm->agg.avg_dwords = dm->agg.avg_bytes 
+          = dm->agg.avg_weight = 0;
+    }
+}
+
+static enum docmap_ret cbuf_realloc(struct docmap_cbuf *buf) {
+    void *ptr = realloc(buf->buf, buf->size * 2 + 1);
+
+    if (ptr) {
+        buf->buf = ptr;
+        buf->size *= 2;
+        buf->size++;
+        return DOCMAP_OK;
+    } else {
+        assert(!CRASH);
+        return DOCMAP_MEM_ERROR;
+    }
+}
+
+static enum docmap_ret cache(struct docmap *dm, struct docmap_entry *entry) {
+    enum docmap_ret dmret;
+
+    assert(dm->cache.len == entry->docno);
+    if (dm->cache.cache & DOCMAP_CACHE_WORDS) {
+        dm->cache.words[entry->docno] = entry->words;
+    }
+    if (dm->cache.cache & DOCMAP_CACHE_DISTINCT_WORDS) {
+        dm->cache.dwords[entry->docno] = entry->dwords;
+    }
+    if (dm->cache.cache & DOCMAP_CACHE_WEIGHT) {
+        dm->cache.weight[entry->docno] = entry->weight;
+    }
+
+    if (dm->cache.cache & DOCMAP_CACHE_LOCATION) {
+        /* look up fileno of this entry */
+        struct vec v;
+        struct reposset_record *rec = reposset_record(dm->rset, entry->docno);
+        enum docmap_ret dmret;
+        unsigned int bytes;
+        assert(rec);
+
+        v.pos = dm->cache.loc.buf + dm->cache.loc.len;
+        v.end = dm->cache.loc.buf + dm->cache.loc.size;
+
+        if (!(entry->docno % LOC_REL_FREQ)) {
+            /* need to add random access for this entry */
+            dm->cache.loc_off[entry->docno / LOC_REL_FREQ] = dm->cache.loc.len;
+
+            if (rec->rectype == REPOSSET_SINGLE_FILE 
+              && rec->docno != entry->docno) {
+                /* need to record offset for this entry, since it's in a
+                 * many-docs file and it is not the first entry. */
+                uintmax_t arr = entry->offset;
+
+                while (!(vec_maxint_arr_write(&v, &arr, 1, &bytes))) {
+                    if ((dmret = cbuf_realloc(&dm->cache.loc)) == DOCMAP_OK) {
+                        v.pos = dm->cache.loc.buf + dm->cache.loc.len;
+                        v.end = dm->cache.loc.buf + dm->cache.loc.size;
+                    } else {
+                        return dmret;
+                    }
+                }
+                dm->cache.loc.len += bytes;
+            }
+        }
+
+        /* write the number of bytes for this doc into the loc buffer */
+        while (!(bytes = vec_vbyte_write(&v, entry->bytes))) {
+            if ((dmret = cbuf_realloc(&dm->cache.loc)) == DOCMAP_OK) {
+                v.pos = dm->cache.loc.buf + dm->cache.loc.len;
+                v.end = dm->cache.loc.buf + dm->cache.loc.size;
+            } else {
+                return dmret;
+            }
+        }
+        dm->cache.loc.len += bytes;
+
+        /* record type if it's not X_TREC */
+        if (entry->mtype != MIME_TYPE_APPLICATION_X_TREC) {
+            /* ensure that we have enough memory */
+            if (dm->cache.typeex_len >= dm->cache.typeex_size) {
+                void *ptr = realloc(dm->cache.typeex, 
+                  sizeof(*dm->cache.typeex) * (dm->cache.typeex_size * 2 + 1));
+                
+                if (ptr) {
+                    dm->cache.typeex = ptr;
+                    dm->cache.typeex_size *= 2;
+                    dm->cache.typeex_size++;
+                } else {
+                    assert(!CRASH);
+                    return DOCMAP_MEM_ERROR;
+                }
+            }
+
+            dm->cache.typeex[dm->cache.typeex_len].docno = entry->docno;
+            dm->cache.typeex[dm->cache.typeex_len++].mtype = entry->mtype;
+        }
+    }
+
+    if (dm->cache.cache & DOCMAP_CACHE_TRECNO) {
+        struct vec v;
+        struct vec readv;
+        unsigned int index = entry->docno / TRECNO_FRONT_FREQ;
+        unsigned int offset = entry->docno % TRECNO_FRONT_FREQ;
+        int encoded;
+        unsigned int front = 0;
+
+        v.pos = dm->cache.trecno.buf + dm->cache.trecno.len;
+        v.end = dm->cache.trecno.buf + dm->cache.trecno.size;
+
+        if (offset) {
+            unsigned int i,
+                         ret;
+            unsigned long int len,
+                              prefix;
+
+            encoded = 1;
+
+            /* front-code against unencoded entry */
+            readv.pos = dm->cache.trecno.buf + dm->cache.trecno_off[index];
+            readv.end = dm->cache.trecno.buf + dm->cache.trecno.len;
+            ret = vec_vbyte_read(&readv, &len);
+            assert(ret);
+            for (front = 0; 
+              front < len && readv.pos[front] == entry->trecno[front]; 
+                front++) ;
+            readv.pos += len;
+
+            /* propagate front-code through similarly coded entries */
+            for (i = 0; i + 1 < offset; i++) {
+                ret = vec_vbyte_read(&readv, &prefix);
+                assert(ret);
+                ret = vec_vbyte_read(&readv, &len);
+                assert(ret);
+
+                assert(vec_len(&readv) >= len);
+                if (front >= prefix) {
+                    /* front may only match the length of the prefix, but can 
+                     * be extended to match the rest of the string */
+                    for (front = prefix; 
+                      front < len + prefix && readv.pos[front - prefix] 
+                          == entry->trecno[front]; front++) ;
+                }
+                readv.pos += len;
+            }
+        } else {
+            /* don't front-encode this entry, just write it in */
+            encoded = 0;
+            dm->cache.trecno_off[index] = dm->cache.trecno.len;
+        }
+
+        /* write either unencoded or front-coded entry */
+        while ((encoded && !vec_vbyte_write(&v, front)) 
+          || !vec_vbyte_write(&v, entry->trecno_len - front)
+          || vec_byte_write(&v, entry->trecno + front, 
+              entry->trecno_len - front) != entry->trecno_len - front) {
+
+            if ((dmret = cbuf_realloc(&dm->cache.trecno)) == DOCMAP_OK) {
+                v.pos = dm->cache.trecno.buf + dm->cache.trecno.len;
+                v.end = dm->cache.trecno.buf + dm->cache.trecno.size;
+            } else {
+                return dmret;
+            }
+        }
+        dm->cache.trecno.len = v.pos - dm->cache.trecno.buf;
+    }
+
+    dm->cache.len++;
+    return DOCMAP_OK;
+}
+
+static enum docmap_ret cache_realloc(struct docmap *dm) {
+    void *ptr;
+
+    if (dm->cache.cache & DOCMAP_CACHE_WORDS) {
+        if ((ptr = realloc(dm->cache.words, 
+            sizeof(*dm->cache.words) * dm->cache.size))) {
+
+            dm->cache.words = ptr;
+        } else {
+            assert(!CRASH);
+            return DOCMAP_MEM_ERROR;
+        }
+    }
+    if (dm->cache.cache & DOCMAP_CACHE_DISTINCT_WORDS) {
+        if ((ptr = realloc(dm->cache.dwords, 
+            sizeof(*dm->cache.dwords) * dm->cache.size))) {
+
+            dm->cache.dwords = ptr;
+        } else {
+            assert(!CRASH);
+            return DOCMAP_MEM_ERROR;
+        }
+    }
+    if (dm->cache.cache & DOCMAP_CACHE_WEIGHT) {
+        if ((ptr = realloc(dm->cache.weight, 
+            sizeof(*dm->cache.weight) * dm->cache.size))) {
+
+            dm->cache.weight = ptr;
+        } else {
+            assert(!CRASH);
+            return DOCMAP_MEM_ERROR;
+        }
+    }
+    if (dm->cache.cache & DOCMAP_CACHE_TRECNO) {
+        if ((ptr = realloc(dm->cache.trecno_off, sizeof(*dm->cache.trecno_off) 
+          * (dm->cache.size / TRECNO_FRONT_FREQ + 1)))) {
+
+            dm->cache.trecno_off = ptr;
+        } else {
+            assert(!CRASH);
+            return DOCMAP_MEM_ERROR;
+        }
+    }
+    if (dm->cache.cache & DOCMAP_CACHE_LOCATION) {
+        if ((ptr = realloc(dm->cache.loc_off, sizeof(*dm->cache.loc_off) 
+          * (dm->cache.size / LOC_REL_FREQ + 1)))) {
+
+            dm->cache.loc_off = ptr;
+        } else {
+            assert(!CRASH);
+            return DOCMAP_MEM_ERROR;
+        }
+    }
+
+    return DOCMAP_OK;
+}
+
+void update_append_entries(struct docmap *dm) {
+    /* first update entries in current append page */
+    mem_hton(dm->appendbuf.buf 
+      + (dm->appendbuf.buflen - 1) * dm->pagesize + 1, 
+      &dm->write.entries, sizeof(dm->write.entries));
+}
+
+enum docmap_ret docmap_add(struct docmap *dm, 
+  unsigned int fileno, off_t offset, 
+  unsigned int bytes, enum docmap_flag flags, 
+  unsigned int words, unsigned int distinct_words,
+  float weight, const char *trecno, unsigned trecno_len, enum mime_types mtype,
+  unsigned long int *docno) {
+    enum docmap_ret dmret;
+    struct docmap_entry entry;
+    char *tmp;
+    unsigned int tmplen,
+                 reposno;
+    enum reposset_ret rret;
+
+    assert(offset >= 0);
+
+    /* copy parameters into entry */
+    entry.docno = dm->entries;
+    entry.fileno = fileno;
+    entry.offset = offset;
+    entry.bytes = bytes;
+    entry.words = words;
+    entry.dwords = distinct_words;
+    entry.flags = flags;
+    entry.mtype = mtype;
+    entry.weight = weight;
+    entry.trecno = (char *) trecno;
+    entry.trecno_size = entry.trecno_len = trecno_len;
+
+    /* fiddle reposset in response to new docno */
+    assert(!entry.docno 
+      || reposset_reposno(dm->rset, entry.docno - 1, &reposno) == REPOSSET_OK);
+    if (!offset) {
+        unsigned int reposno;
+
+        if ((rret = reposset_append(dm->rset, entry.docno, &reposno)) 
+          == REPOSSET_OK) {
+            assert(reposno == entry.fileno);
+        } else {
+            assert(!CRASH);
+            return DOCMAP_MEM_ERROR;
+        }
+
+        /* add a checkpoint at the start of compressed repositories */
+        if (entry.flags & DOCMAP_COMPRESSED) {
+            rret = reposset_add_checkpoint(dm->rset, entry.fileno, 
+                MIME_TYPE_APPLICATION_X_GZIP, 0);
+            if (rret != REPOSSET_OK) {
+                assert(!CRASH);
+                return DOCMAP_MEM_ERROR;
+            }
+        }
+    } else if ((rret = reposset_append_docno(dm->rset, entry.docno, 1)) 
+      != REPOSSET_OK) {
+        assert(!CRASH);
+        return DOCMAP_MEM_ERROR;
+    }
+    /* check that previous reposno hasn't changed */
+    assert(!entry.docno 
+      || (reposset_reposno(dm->rset, entry.docno - 1, &tmplen) == REPOSSET_OK
+        && tmplen == reposno));
+    /* check that this reposno is as expected */
+    assert(reposset_reposno(dm->rset, entry.docno, &tmplen) == REPOSSET_OK
+      && tmplen == entry.fileno);
+
+    /* ensure we've got enough space to store docno *before* we encode */
+    while (dm->write.entry.trecno_size <= entry.trecno_len) {
+        void *ptr = realloc(dm->write.entry.trecno, 
+            dm->write.entry.trecno_size * 2 + 1);
+
+        if (ptr) {
+            dm->write.entry.trecno = ptr;
+            dm->write.entry.trecno_size *= 2;
+            dm->write.entry.trecno_size++;
+        } else {
+            assert(!CRASH);
+            return DOCMAP_MEM_ERROR;
+        }
+    }
+
+    /* ensure we've got enough space for cache */
+    if (dm->cache.cache && dm->cache.len >= dm->cache.size) {
+        dm->cache.size = dm->cache.size * 2 + 1;
+        if ((dmret = cache_realloc(dm)) != DOCMAP_OK) {
+            dm->cache.size = (dm->cache.size - 1) / 2;
+            return dmret;
+        }
+    }
+
+    while ((dmret = encode(&dm->write.pos, &dm->write.entry, &entry)) 
+      != DOCMAP_OK) {
+        switch (dmret) {
+        case DOCMAP_OK: assert("can't get here" && 0); break;
+        default: return dmret;
+
+        case DOCMAP_BUFSIZE_ERROR:
+            /* need to move to the next page */
+
+            if (dm->appendbuf.buflen) {
+                update_append_entries(dm);
+            }
+
+            assert(dm->readbuf.bufsize >= 1);
+            if (dm->readbuf.bufsize == 1) {
+                /* no more buffer space.  commit current contents and then 
+                 * give all buffer back to read */
+                if ((!dm->readbuf.dirty 
+                    || (dmret = commit(dm, &dm->readbuf)) == DOCMAP_OK)
+                  && (!dm->appendbuf.dirty 
+                    || ((dmret = commit(dm, &dm->appendbuf)) == DOCMAP_OK))) {
+
+                    /* remove the append buffer, giving it all back to the read
+                     * buffer */
+                    assert(dm->appendbuf.buflen == dm->appendbuf.bufsize);
+                    invalidate_buffer(dm, &dm->readbuf);
+                    dm->appendbuf.page += dm->appendbuf.buflen;
+                    dm->appendbuf.buflen = 0;
+                    dm->readbuf.bufsize += dm->appendbuf.bufsize;
+                    dm->readbuf.buf = dm->buf;
+                    dm->appendbuf.bufsize = 0;
+
+                    /* invalidate write cursor */
+                    invalidate_cursor(&dm->write);
+                } else {
+                    return dmret;
+                }
+            }
+
+            /* see if we need to create a new file for the append page we're
+             * about to create */
+            if (!((dm->appendbuf.page + dm->appendbuf.buflen) 
+              % dm->file_pages) && dm->appendbuf.page) {
+                /* create new file (not for first file though - docmap_new 
+                 * handles that) */
+                unsigned int dmfileno = (dm->appendbuf.page 
+                  + dm->appendbuf.buflen) / dm->file_pages;
+                /* need to initialise a new file for this page */
+                int fd = fdset_create(dm->fdset, dm->fd_type, dmfileno);
+                if (fd >= 0) {
+                    fdset_unpin(dm->fdset, dm->fd_type, dmfileno, fd);
+                } else {
+                    return DOCMAP_IO_ERROR;
+                }
+            }
+
+            /* steal a page from the read buffer */
+            if ((dmret = take_read_buffer(dm)) != DOCMAP_OK) {
+                return dmret;
+            }
+
+            /* initialise buffer */
+            if ((dmret = init_append_buffer(dm, dm->entries)) != DOCMAP_OK) {
+
+                return dmret;
+            }
+
+            aggregate(dm); /* recalculate aggregates */
+            break;
+        }
+    }
+
+    dm->dirty = 1;
+    dm->appendbuf.dirty = 1;
+    dm->write.entries++;
+
+    /* update stored entry in write cursor */
+    tmp = dm->write.entry.trecno;
+    tmplen = dm->write.entry.trecno_size;
+    dm->write.entry = entry;
+    dm->write.entry.trecno = tmp;
+    dm->write.entry.trecno_size = tmplen;
+    assert(dm->write.entry.trecno_size > entry.trecno_len);
+    memcpy(dm->write.entry.trecno, entry.trecno, entry.trecno_len);
+    dm->write.entry.trecno[entry.trecno_len] = '\0';
+
+    if (dm->cache.cache) {
+        assert(dm->cache.len < dm->cache.size);
+        if ((dmret = cache(dm, &dm->write.entry)) != DOCMAP_OK) {
+            return dmret;
+        }
+    }
+    /* update aggregate entries */
+    dm->agg.sum_bytes += bytes;
+    dm->agg.sum_words += words;
+    dm->agg.sum_dwords += distinct_words;
+    dm->agg.sum_weight += weight;
+    dm->agg.sum_trecno += trecno_len;
+
+    *docno = dm->entries++;
+    return DOCMAP_OK;
+}
+
+static int map_cmp(const void *vone, const void *vtwo) {
+    const unsigned long int *one = vone,
+                            *two = vtwo;
+
+    if (*one < *two) {
+        return -1;
+    } else if (*one > *two) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+/* internal function to reset a cursor to the first entry of a new buffer */
+static void reset_cursor(struct docmap *dm, struct docmap_cursor *cur, 
+  struct docmap_buffer *buf, unsigned int page, unsigned long int last_docno) {
+    int ret;
+
+    assert(page >= buf->page && page < buf->page + buf->buflen);
+    cur->pos.pos = buf->buf + dm->pagesize * (page - buf->page);
+    cur->pos.end = cur->pos.pos + dm->pagesize;
+    cur->page = page;
+    cur->buf = buf;
+    cur->last_docno = last_docno;
+    cur->past = 0;
+
+    /* read header */
+    ret = *cur->pos.pos++;
+    assert(ret == DATA_BYTE || ret == FINAL_DATA_BYTE);
+    assert(vec_len(&cur->pos) > sizeof(cur->entries));
+    mem_ntoh(&cur->entries, cur->pos.pos, sizeof(cur->entries));
+    cur->pos.pos += sizeof(cur->entries);
+    zero_entry(&cur->entry);
+    ret = decode(cur);
+    assert(ret == DOCMAP_OK);
+    cur->first_docno = cur->entry.docno;
+    assert(cur->first_docno <= cur->last_docno);
+    return;
+}
+
+/* internal function to turn a docno into a page number */
+static unsigned int find_page(struct docmap *dm, unsigned long int docno) {
+    unsigned long int *find;
+    unsigned int page;
+
+    assert(docno < dm->entries);
+
+    /* find the correct page in the map */
+    find = binsearch(&docno, dm->map, dm->map_len, sizeof(docno), map_cmp);
+
+    if (find < dm->map + dm->map_len && *find == docno) {
+        page = find - dm->map;
+    } else {
+        page = find - dm->map - 1;
+    }
+
+    return page;
+}
+
+/* arrange for the read buffer to find the page that contains docno */
+static enum docmap_ret page_in(struct docmap *dm, unsigned int page) {
+    enum docmap_ret dmret;
+    int fd;
+
+    /* check that the page we want isn't already in the read buffer */
+    if (page >= dm->readbuf.page 
+      && page < dm->readbuf.page + dm->readbuf.buflen) {
+        return DOCMAP_OK;
+    } else if (page >= dm->appendbuf.page 
+      && page < dm->appendbuf.page + dm->appendbuf.buflen) {
+        /* page we're after is in the append buffer */
+        return DOCMAP_OK;
+    } else {
+        /* we'll have to read the page we're after from disk */
+
+        if (!dm->readbuf.dirty 
+          || (dmret = commit(dm, &dm->readbuf)) == DOCMAP_OK) {
+            dm->readbuf.dirty = 0;
+        } else {
+            /* commit failed */
+            assert(!CRASH);
+            return dmret;
+        }
+
+        if (((fd = fdset_pin(dm->fdset, dm->fd_type, page / dm->file_pages, 
+            (page % dm->file_pages) * dm->pagesize, SEEK_SET)) >= 0)
+          && (dm->readbuf.buflen 
+            = read(fd, dm->readbuf.buf, dm->readbuf.bufsize * dm->pagesize)) 
+              != -1
+          && (fdset_unpin(dm->fdset, dm->fd_type, page / dm->file_pages, fd) 
+              == FDSET_OK)
+          && (dm->readbuf.buflen > 0)) {
+            assert((dm->readbuf.buflen / dm->pagesize) * dm->pagesize 
+              == dm->readbuf.buflen);
+            dm->readbuf.buflen /= dm->pagesize;
+            dm->readbuf.page = page;
+            return DOCMAP_OK;
+        } else {
+            assert(!CRASH);
+            invalidate_cursor(&dm->read);
+            dm->readbuf.buflen = 0;
+            dm->readbuf.page = -1;
+            return DOCMAP_IO_ERROR;
+        }
+    }
+}
+
+/* internal function to iterate a cursor to the correct location in the 
+ * docmap */
+static enum docmap_ret traverse(struct docmap *dm, 
+  struct docmap_cursor *cur, unsigned long int docno) {
+    unsigned int page;
+    enum docmap_ret dmret;
+
+    assert(dm->map[dm->map_len] == ULONG_MAX);
+    if (docno < cur->first_docno || docno >= cur->last_docno) {
+        /* need to find the correct page */
+        page = find_page(dm, docno);
+        if ((dmret = page_in(dm, page)) == DOCMAP_OK) {
+            assert(page < dm->map_len);
+            if (page >= dm->readbuf.page 
+              && page < dm->readbuf.page + dm->readbuf.buflen) {
+                reset_cursor(dm, cur, &dm->readbuf, page, dm->map[page + 1]);
+            } else if (page >= dm->appendbuf.page 
+              && page < dm->appendbuf.page + dm->appendbuf.buflen) {
+                update_append_entries(dm);
+                reset_cursor(dm, cur, &dm->appendbuf, page, dm->map[page + 1]);
+            } else {
+                assert("can't get here" && 0);
+                return DOCMAP_FMT_ERROR;
+            }
+        } else {
+            return dmret;
+        }
+    } else if (docno < cur->entry.docno) {
+        /* need to re-traverse current page */
+        reset_cursor(dm, cur, cur->buf, cur->page, cur->last_docno);
+    }
+    assert(docno >= cur->first_docno && docno < cur->last_docno 
+      && docno >= cur->entry.docno);
+
+    /* iterate to the correct position */
+    while ((docno > cur->entry.docno) 
+      && (dmret = decode(cur)) == DOCMAP_OK) ;
+
+    if (docno == cur->entry.docno) {
+        return DOCMAP_OK;
+    } else {
+        return DOCMAP_ARG_ERROR;
+    }
+}
+
+enum docmap_ret docmap_get_trecno(struct docmap *dm, unsigned long int
+  docno, char *aux_buf, unsigned aux_buf_len, unsigned *aux_len) {
+    enum docmap_ret dmret;
+    unsigned int len;
+
+    if (docno >= dm->entries) {
+        return DOCMAP_ARG_ERROR;
+    }
+
+    if (dm->cache.cache & DOCMAP_CACHE_TRECNO) {
+        /* retrieve front-coded aux from buffer */
+        struct vec v;
+        unsigned long int len,
+                          prefix = 0;
+        unsigned int i,
+                     index = docno / TRECNO_FRONT_FREQ,
+                     offset = docno % TRECNO_FRONT_FREQ;
+
+        /* read first entry into buffer */
+        v.pos = dm->cache.trecno.buf + dm->cache.trecno_off[index];
+        v.end = dm->cache.trecno.buf + dm->cache.trecno.len;
+        vec_vbyte_read(&v, &len);
+        if (len <= aux_buf_len) {
+            vec_byte_read(&v, aux_buf, len);
+        } else {
+            vec_byte_read(&v, aux_buf, aux_buf_len);
+        }
+
+        for (i = 0; i < offset; i++) {
+            vec_vbyte_read(&v, &prefix);
+            vec_vbyte_read(&v, &len);
+
+            if (prefix + len < aux_buf_len) {
+                vec_byte_read(&v, aux_buf + prefix, len);
+            } else if (prefix < aux_buf_len) {
+                char *pos = v.pos + len;
+                vec_byte_read(&v, aux_buf + prefix, aux_buf_len - prefix);
+                v.pos = pos;  /* skip the remaining entry */
+            } else {
+                /* just skip this entry, it can't affect the given buffer */
+                v.pos += len;
+            }
+        }
+
+        *aux_len = prefix + len;
+        return DOCMAP_OK;
+    } else if ((dmret = traverse(dm, &dm->read, docno)) == DOCMAP_OK) {
+        len = (aux_buf_len < dm->read.entry.trecno_len) 
+          ? aux_buf_len
+          : dm->read.entry.trecno_len;
+        memcpy(aux_buf, dm->read.entry.trecno, len);
+        *aux_len = dm->read.entry.trecno_len;
+        return DOCMAP_OK;
+    } else {
+        return dmret;
+    }
+}
+
+static int typeex_cmp(const void *vone, const void *vtwo) {
+    const struct docmap_type_ex *one = vone,
+                                *two = vtwo;
+
+    if (one->docno < two->docno) {
+        return -1;
+    } else if (one->docno > two->docno) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+enum docmap_ret docmap_get_location(struct docmap *dm,
+  unsigned long int docno, unsigned int *fileno, 
+  off_t *disk_offset_ptr, unsigned int *bytes, 
+  enum mime_types *mtype, enum docmap_flag *flags) {
+    enum docmap_ret dmret;
+    uintmax_t disk_offset = 0;
+    unsigned long int arr[LOC_REL_FREQ];
+    unsigned int index,
+                 offset,
+                 readbytes;
+    struct reposset_record *rec;
+    struct vec v;
+    struct docmap_type_ex *find,
+                          target;
+
+    if (docno >= dm->entries) {
+        return DOCMAP_ARG_ERROR;
+    }
+
+    if (dm->cache.cache & DOCMAP_CACHE_LOCATION) {
+        index = docno / LOC_REL_FREQ;
+        offset = docno % LOC_REL_FREQ;
+
+        rec = reposset_record(dm->rset, index * LOC_REL_FREQ);
+        assert(rec);
+
+        v.pos = dm->cache.loc.buf + dm->cache.loc_off[index];
+        v.end = dm->cache.loc.buf + dm->cache.loc.len;
+
+        if (rec->rectype == REPOSSET_SINGLE_FILE 
+          && rec->docno != index * LOC_REL_FREQ) {
+            /* need to retrieve offset as well */
+            readbytes = vec_maxint_arr_read(&v, &disk_offset, 1, bytes);
+            assert(readbytes);
+        }
+
+        /* retrieve bytes entries up until entry we're after */
+        assert(offset < LOC_REL_FREQ);
+        readbytes = vec_vbyte_arr_read(&v, arr, offset + 1, bytes);
+        assert(readbytes == offset + 1);
+
+        /* retrieve reposset record for docno we're after */
+        rec = reposset_record(dm->rset, docno);
+        *fileno = reposset_reposno_rec(rec, docno);
+        *bytes = arr[offset];
+
+        if (rec->rectype != REPOSSET_SINGLE_FILE
+          || rec->docno > index * LOC_REL_FREQ) {
+            /* this record doesn't extend back to the encoded offset */
+            disk_offset = 0;
+        }
+
+        /* calculate offset by summing the bytes entries for relevant previous
+         * entries */
+        while (rec->rectype == REPOSSET_SINGLE_FILE
+          && offset
+          && rec->docno < index * LOC_REL_FREQ + offset) {
+            disk_offset += arr[--offset];
+        }
+        *disk_offset_ptr = (off_t) disk_offset;
+
+        /* read checkpoints to figure out whether that repository is 
+         * compressed */
+        assert(!reposset_check(dm->rset, *fileno)
+          || reposset_check(dm->rset, *fileno)->reposno == *fileno);
+        if (reposset_check(dm->rset, *fileno)) {
+            *flags = DOCMAP_COMPRESSED;
+        } else {
+            *flags = 0;
+        }
+
+        /* figure out what the mtype is */
+        target.docno = docno;
+
+        /* find the correct page in the map */
+        find = binsearch(&docno, dm->cache.typeex, dm->cache.typeex_len, 
+          sizeof(*dm->cache.typeex), typeex_cmp);
+
+        if (find < dm->cache.typeex + dm->cache.typeex_len 
+          && find->docno == docno) {
+            *mtype = find->mtype;
+        } else {
+            *mtype = MIME_TYPE_APPLICATION_X_TREC;
+        }
+
+        return DOCMAP_OK;
+    } else if ((dmret = traverse(dm, &dm->read, docno)) == DOCMAP_OK) {
+        *fileno = dm->read.entry.fileno;
+        *disk_offset_ptr = dm->read.entry.offset;
+        *flags = dm->read.entry.flags;
+        *bytes = dm->read.entry.bytes;
+        *mtype = dm->read.entry.mtype;
+        return DOCMAP_OK;
+    } else {
+        return dmret;
+    }
+}
+
+unsigned int docmap_get_bytes_cached(struct docmap *dm,
+  unsigned int docno) {
+    struct vec v;
+    unsigned int index = docno / LOC_REL_FREQ,
+                 offset = docno % LOC_REL_FREQ;
+    struct reposset_record *rec;
+    uintmax_t disk_offset = 0;
+    unsigned long int arr[LOC_REL_FREQ];
+    unsigned int bytes,
+                 readbytes;
+
+    assert(dm->cache.cache & DOCMAP_CACHE_LOCATION);
+    assert(docno < dm->entries);
+
+    rec = reposset_record(dm->rset, index * LOC_REL_FREQ);
+    assert(rec);
+
+    v.pos = dm->cache.loc.buf + dm->cache.loc_off[index];
+    v.end = dm->cache.loc.buf + dm->cache.loc.len;
+
+    if (rec->rectype == REPOSSET_SINGLE_FILE 
+      && rec->docno != index * LOC_REL_FREQ) {
+        /* need to retrieve offset as well */
+        readbytes = vec_maxint_arr_read(&v, &disk_offset, 1, &bytes);
+        assert(readbytes);
+    }
+
+    /* retrieve bytes entries up until entry we're after */
+    assert(offset < LOC_REL_FREQ);
+    readbytes = vec_vbyte_arr_read(&v, arr, offset + 1, &bytes);
+    assert(readbytes == offset + 1);
+    return arr[offset];
+}
+
+enum docmap_ret docmap_get_bytes(struct docmap *dm,
+  unsigned long int docno, unsigned int *bytes) {
+    enum docmap_ret dmret;
+
+    if (docno < dm->entries && dm->cache.cache & DOCMAP_CACHE_LOCATION) {
+        *bytes = docmap_get_bytes_cached(dm, docno);
+        return DOCMAP_OK;
+    } else if ((dmret = traverse(dm, &dm->read, docno)) == DOCMAP_OK) {
+        *bytes = dm->read.entry.bytes;
+        return DOCMAP_OK;
+    } else {
+        return dmret;
+    }
+}
+
+enum docmap_ret docmap_get_words(struct docmap *dm,
+  unsigned long int docno, unsigned int *words) {
+    enum docmap_ret dmret;
+
+    if (docno < dm->entries && dm->cache.cache & DOCMAP_CACHE_WORDS) {
+        *words = dm->cache.words[docno];
+        return DOCMAP_OK;
+    } else if ((dmret = traverse(dm, &dm->read, docno)) == DOCMAP_OK) {
+        *words = dm->read.entry.words;
+        return DOCMAP_OK;
+    } else {
+        return dmret;
+    }
+}
+
+enum docmap_ret docmap_get_distinct_words(struct docmap *dm,
+  unsigned long int docno, unsigned int *distinct_words) {
+    enum docmap_ret dmret;
+
+    if (docno < dm->entries && dm->cache.cache & DOCMAP_CACHE_DISTINCT_WORDS) {
+        *distinct_words = dm->cache.dwords[docno];
+        return DOCMAP_OK;
+    } else if ((dmret = traverse(dm, &dm->read, docno)) == DOCMAP_OK) {
+        *distinct_words = dm->read.entry.dwords;
+        return DOCMAP_OK;
+    } else {
+        return dmret;
+    }
+}
+
+enum docmap_ret docmap_get_weight(struct docmap *dm,
+  unsigned long int docno, double *weight) {
+    enum docmap_ret dmret;
+
+    if (docno < dm->entries && dm->cache.cache & DOCMAP_CACHE_WEIGHT) {
+        *weight = dm->cache.weight[docno];
+        return DOCMAP_OK;
+    }
+    if ((dmret = traverse(dm, &dm->read, docno)) == DOCMAP_OK) {
+        *weight = dm->read.entry.weight;
+        return DOCMAP_OK;
+    } else {
+        return dmret;
+    }
+}
+
+enum docmap_cache docmap_get_cache(struct docmap *dm) {
+    return dm->cache.cache;
+}
+
+static void cache_cleanup(struct docmap *dm) {
+    if (!(dm->cache.cache & DOCMAP_CACHE_WORDS)) {
+        if (dm->cache.words) {
+            free(dm->cache.words);
+            dm->cache.words = NULL;
+        }
+    } 
+    if (!(dm->cache.cache & DOCMAP_CACHE_DISTINCT_WORDS)) {
+        if (dm->cache.dwords) {
+            free(dm->cache.dwords);
+            dm->cache.dwords = NULL;
+        }
+    } 
+    if (!(dm->cache.cache & DOCMAP_CACHE_WEIGHT)) {
+        if (dm->cache.weight) {
+            free(dm->cache.weight);
+            dm->cache.weight = NULL;
+        }
+    }
+    if (!(dm->cache.cache & DOCMAP_CACHE_TRECNO)) {
+        if (dm->cache.trecno.buf) {
+            free(dm->cache.trecno.buf);
+            dm->cache.trecno.buf = NULL;
+        }
+        if (dm->cache.trecno_off) {
+            free(dm->cache.trecno_off);
+            dm->cache.trecno_off = NULL;
+        }
+        dm->cache.trecno.size = dm->cache.trecno.len = 0;
+    }
+    if (!(dm->cache.cache & DOCMAP_CACHE_LOCATION)) {
+        if (dm->cache.loc.buf) {
+            free(dm->cache.loc.buf);
+            dm->cache.loc.buf = NULL;
+            dm->cache.loc.len = dm->cache.loc.size = 0;
+        }
+        if (dm->cache.loc_off) {
+            free(dm->cache.loc_off);
+            dm->cache.loc_off = NULL;
+        }
+        if (dm->cache.typeex) {
+            free(dm->cache.typeex);
+            dm->cache.typeex = NULL;
+            dm->cache.typeex_len = dm->cache.typeex_size = 0;
+        }
+    }
+}
+
+static enum docmap_ret map_realloc(struct docmap *dm) {
+    void *ptr = realloc(dm->map, sizeof(*dm->map) * dm->map_size * 2);
+
+    if (ptr) {
+        dm->map = ptr;
+        dm->map_size *= 2;
+        return DOCMAP_OK;
+    } else {
+        assert(!CRASH);
+        return DOCMAP_MEM_ERROR;
+    }
+}
+
+static enum docmap_ret docmap_cache_int(struct docmap *dm, 
+  enum docmap_cache tocache, int reread) {
+    enum docmap_cache prev = dm->cache.cache;
+    enum docmap_ret dmret;
+    unsigned int page,
+                 pages = dm->map_len,
+                 prev_entries = dm->entries,
+                 prev_size = dm->cache.size,
+                 prev_fileno = -1;
+
+    assert(pages);
+
+    if (!reread && prev == tocache) {
+        /* nothing to do */
+        return DOCMAP_OK;
+
+    } else if (!reread && (tocache - (dm->cache.cache & tocache)) == 0) {
+        /* all required entries are cached, just turn some off */
+        dm->cache.cache = tocache;
+
+        /* now use tocache to figure out what to remove */
+        tocache = (dm->cache.cache & tocache) - tocache;
+
+        if (tocache & DOCMAP_CACHE_WORDS) {
+            assert(dm->cache.words);
+            free(dm->cache.words);
+            dm->cache.words = NULL;
+        }
+        if (tocache & DOCMAP_CACHE_DISTINCT_WORDS) {
+            assert(dm->cache.dwords);
+            free(dm->cache.dwords);
+            dm->cache.dwords = NULL;
+        }
+        if (tocache & DOCMAP_CACHE_WEIGHT) {
+            assert(dm->cache.weight);
+            free(dm->cache.weight);
+            dm->cache.weight = NULL;
+        }
+        if (tocache & DOCMAP_CACHE_TRECNO) {
+            assert(dm->cache.trecno.buf && dm->cache.trecno_off);
+            free(dm->cache.trecno.buf);
+            free(dm->cache.trecno_off);
+            dm->cache.trecno.buf = NULL;
+            dm->cache.trecno_off = NULL;
+            dm->cache.trecno.len = dm->cache.trecno.size = 0;
+        }
+        if (tocache & DOCMAP_CACHE_LOCATION) {
+            assert(dm->cache.loc.buf && dm->cache.loc_off);
+            free(dm->cache.loc.buf);
+            free(dm->cache.loc_off);
+            dm->cache.loc.buf = NULL;
+            dm->cache.loc_off = NULL;
+            dm->cache.loc.len = dm->cache.loc.size = 0;
+            if (dm->cache.typeex) {
+                free(dm->cache.typeex);
+                dm->cache.typeex = NULL;
+            }
+        }
+        return DOCMAP_OK;
+    }
+
+    dm->dirty = 1;
+    dm->agg.sum_weight = dm->agg.sum_bytes 
+      = dm->agg.sum_words = dm->agg.sum_dwords = 0;
+
+    /* ensure that we've got initial memory for cached items */
+    dm->cache.cache = tocache;
+    if (!(dmret = cache_realloc(dm)) == DOCMAP_OK) {
+        assert(!CRASH);
+        dm->cache.cache = prev;
+        cache_cleanup(dm);
+        return DOCMAP_MEM_ERROR;
+    }
+
+    /* make sure we've got enough room on the map */
+    while (dm->map_len + 1 >= dm->map_size) {
+        dm->map_size = dm->map_len + 1;
+        if ((dmret = map_realloc(dm)) != DOCMAP_OK) {
+            dm->cache.cache = prev;
+            cache_cleanup(dm);
+            return dmret;
+        }
+    }
+
+    /* need to read all entries in the docmap (rebuilding map and reposset 
+     * and entries along the way) */
+    prev_entries = dm->entries;
+    dm->entries = 0;
+    dm->cache.len = 0;
+    dm->cache.typeex_len = 0;
+    dm->cache.trecno.len = 0;
+    dm->cache.loc.len = 0;
+    reposset_clear(dm->rset);
+    for (page = 0; page < pages; page++) {
+        if ((dmret = page_in(dm, page)) == DOCMAP_OK) {
+            unsigned int entry = 0;
+
+            if (page >= dm->readbuf.page 
+              && page < dm->readbuf.page + dm->readbuf.buflen) {
+                reset_cursor(dm, &dm->read, &dm->readbuf, page, ULONG_MAX);
+            } else if (page >= dm->appendbuf.page 
+              && page < dm->appendbuf.page + dm->appendbuf.buflen) {
+                reset_cursor(dm, &dm->read, &dm->appendbuf, page, ULONG_MAX);
+            } else {
+                assert("can't get here" && 0);
+                return DOCMAP_FMT_ERROR;
+            }
+
+            /* update map entry for this page */
+            dm->map[page] = dm->read.entry.docno;
+
+            /* iterate through page entries */
+            do {
+                /* recreate reposset */
+                while (prev_fileno != dm->read.entry.fileno) {
+                    unsigned int reposno;
+                    enum reposset_ret rret;
+                    assert(prev_fileno == -1 
+                      || prev_fileno < dm->read.entry.fileno);
+                    rret = reposset_append(dm->rset, 
+                        dm->read.entry.docno, &reposno);
+                    assert(rret == REPOSSET_OK 
+                      && reposno == dm->read.entry.fileno);
+
+                    prev_fileno++;
+                }
+                reposset_append_docno(dm->rset, dm->read.entry.docno, 1);
+                if (dm->read.entry.flags == DOCMAP_COMPRESSED 
+                  && dm->read.entry.offset == 0) {
+                    enum reposset_ret rret;
+                    /* XXX: add in a checkpoint at the start of each compressed
+                     * file, because that's what the indexing code does */
+                    rret = reposset_add_checkpoint(dm->rset, 
+                      dm->read.entry.fileno, MIME_TYPE_APPLICATION_X_GZIP, 0);
+                    assert(rret == REPOSSET_OK);
+                }
+
+                /* ensure we have space for cache stuff */
+                if (dm->cache.len >= dm->cache.size) {
+                    dm->cache.size = dm->cache.size * 2 + 1;
+                    if ((dmret = cache_realloc(dm)) != DOCMAP_OK) {
+                        dm->cache.size = prev_size;
+                        dm->entries = prev_entries;
+                        dm->cache.cache = prev;
+                        cache_cleanup(dm);
+                        return dmret;
+                    }
+                }
+
+                /* update aggregates */
+                entry++;
+                dm->agg.sum_words += dm->read.entry.words;
+                dm->agg.sum_dwords += dm->read.entry.dwords;
+                dm->agg.sum_bytes += dm->read.entry.bytes;
+                dm->agg.sum_weight += dm->read.entry.weight;
+                dm->agg.sum_trecno += dm->read.entry.trecno_len;
+
+                /* update cache */
+                if ((dmret = cache(dm, &dm->read.entry)) != DOCMAP_OK) {
+                    dm->entries = prev_entries;
+                    dm->cache.cache = prev;
+                    cache_cleanup(dm);
+                    return dmret;
+                }
+            } while ((dmret = decode(&dm->read)) 
+              == DOCMAP_OK);
+
+            assert(dmret == DOCMAP_BUFSIZE_ERROR 
+              && entry == dm->read.entries);
+            dm->entries += entry;
+        } else {
+            assert(!CRASH);
+            dm->cache.cache = prev;
+            cache_cleanup(dm);
+            return DOCMAP_IO_ERROR;
+        }
+    }
+
+    /* update last map entry */
+    dm->map[dm->map_len] = ULONG_MAX;
+
+    aggregate(dm);   /* recalculate aggregates */
+
+    /* clean up after all non-required entries */
+    cache_cleanup(dm);
+    return DOCMAP_OK;
+}
+
+enum docmap_ret docmap_cache(struct docmap *dm, enum docmap_cache tocache) {
+    /* need to have a separate function so that we can force reread of the
+     * docmap when necessary */
+    return docmap_cache_int(dm, tocache, 0);
+}
+
+enum docmap_ret docmap_avg_bytes(struct docmap *dm, double *avg_bytes) {
+    *avg_bytes = dm->agg.avg_bytes;
+    return DOCMAP_OK;
+}
+
+enum docmap_ret docmap_total_bytes(struct docmap *dm, double *total_bytes) {
+    *total_bytes = dm->agg.sum_bytes;
+    return DOCMAP_OK;
+}
+
+enum docmap_ret docmap_avg_words(struct docmap *dm, double *avg_words) {
+    *avg_words = dm->agg.avg_words;
+    return DOCMAP_OK;
+}
+
+enum docmap_ret docmap_avg_distinct_words(struct docmap *dm,
+  double *avg_dwords) {
+    *avg_dwords = dm->agg.avg_dwords;
+    return DOCMAP_OK;
+}
+
+enum docmap_ret docmap_avg_weight(struct docmap *dm, double *avg_weight) {
+    *avg_weight = dm->agg.avg_weight;
+    return DOCMAP_OK;
+}
+
+unsigned long int docmap_entries(struct docmap *dm) {
+    return dm->entries;
+}
+
+const char *docmap_strerror(enum docmap_ret dmret) {
+    switch (dmret) {
+    case DOCMAP_OK:
+        return "success";
+    case DOCMAP_MEM_ERROR:
+        return "memory error";
+    case DOCMAP_IO_ERROR:
+        return "I/O error";
+    case DOCMAP_BUFSIZE_ERROR:
+        return "buffer too small";
+    case DOCMAP_FMT_ERROR:
+        return "format error";
+    case DOCMAP_ARG_ERROR:
+        return "argument (programmer) error";
+    default:
+        return "unknown error";
+    }
+}
+
+enum docmap_ret docmap_save(struct docmap *dm) {
+    enum docmap_ret dmret;
+    unsigned int fileno,
+                 docno;
+    unsigned long int offset;
+    int fd;
+    TIMINGS_DECL();
+    TIMINGS_START();
+
+    if ((!dm->readbuf.dirty 
+        || (dmret = commit(dm, &dm->readbuf)) == DOCMAP_OK)
+      && (!dm->appendbuf.dirty
+        /* mark current last page in append buffer as final */
+        || ((dm->appendbuf.buf[(dm->appendbuf.buflen - 1) * dm->pagesize] 
+            = FINAL_DATA_BYTE) 
+          /* update the entries record in the append page */
+          && (update_append_entries(dm), 1)
+          /* write it to disk */
+          && ((dmret = commit(dm, &dm->appendbuf)) == DOCMAP_OK)
+          /* unmark current last page in append buffer as final */
+          && (dm->appendbuf.buf[(dm->appendbuf.buflen - 1) * dm->pagesize] 
+            = DATA_BYTE)))) {
+
+        fileno = dm->map_len / dm->file_pages;
+        offset = dm->map_len % dm->file_pages;
+        offset *= dm->pagesize;
+
+/* macro to prepare a new page for writing */
+#define NEW_PAGE()                                                            \
+        if (1) {                                                              \
+            if (page >= dm->readbuf.bufsize) {                                \
+                /* need to clear buffer */                                    \
+                unsigned int target = dm->readbuf.bufsize * dm->pagesize;     \
+                unsigned int bytes = write(fd, dm->readbuf.buf, target);      \
+                                                                              \
+                if (bytes == target) {                                        \
+                    page = 0;                                                 \
+                } else {                                                      \
+                    /* writing error */                                       \
+                    fdset_unpin(dm->fdset, dm->fd_type, fileno, fd);          \
+                    return DOCMAP_IO_ERROR;                                   \
+                }                                                             \
+            }                                                                 \
+            v.pos = dm->readbuf.buf + dm->pagesize * page;                    \
+            v.end = v.pos + dm->pagesize;                                     \
+            *v.pos++ = CACHE_BYTE;                                            \
+            vec_vbyte_write(&v, dm->entries);                                 \
+            vec_vbyte_write(&v, dm->map_len);                                 \
+            page++;                                                           \
+        } else
+
+        /* now write out cache pages */
+        if (dm->dirty 
+          && (fd = fdset_pin(dm->fdset, dm->fd_type, fileno, offset, SEEK_SET)) 
+            >= 0) {
+            struct vec v;
+            unsigned int i,
+                         page = 0,
+                         bytes,
+                         written;
+            char *entry_pos,
+                 *end_pos,
+                 byte;
+            struct reposset_check* check;
+
+            /* dump out the contents of the read buffer to give us 
+             * working space */
+            invalidate_buffer(dm, &dm->readbuf);
+
+            NEW_PAGE();
+
+            /* write aggregate quantities */
+            *v.pos++ = CACHE_ID_AGG;
+            vec_flt_write(&v, (float) dm->agg.sum_bytes, 
+              VEC_FLT_FULL_PRECISION);
+            vec_flt_write(&v, (float) dm->agg.sum_words, 
+              VEC_FLT_FULL_PRECISION);
+            vec_flt_write(&v, (float) dm->agg.sum_dwords, 
+              VEC_FLT_FULL_PRECISION);
+            vec_flt_write(&v, (float) dm->agg.sum_weight, 
+              VEC_FLT_FULL_PRECISION);
+            vec_flt_write(&v, (float) dm->agg.sum_trecno, 
+              VEC_FLT_FULL_PRECISION);
+
+/* macro to perform repetitive paging out of arrays */
+#define PAGE_OUT_INT 1
+#define PAGE_OUT_FLT 2
+#define PAGE_OUT_CHR 3
+#define PAGE_OUT_LONG 4
+#define PAGE_OUT_CACHE(id, elem, num, masked, mask, type)                     \
+            for (written = 0; (!masked || dm->cache.cache & mask)             \
+              && written < num; ) {                                           \
+                uint32_t entries = 0;                                         \
+                                                                              \
+                end_pos = v.pos;                                              \
+                byte = id; vec_byte_write(&v, (void *) &byte, 1);             \
+                vec_vbyte_write(&v, num);                                     \
+                vec_vbyte_write(&v, written);                                 \
+                entry_pos = v.pos;                                            \
+                vec_byte_write(&v, (void *) &entries, sizeof(entries));       \
+                if ((type == PAGE_OUT_LONG                                    \
+                  && (entries = vec_vbyte_arr_write(&v,                       \
+                      (void *) ((elem) + written), num - written, &bytes)))   \
+                  || (type == PAGE_OUT_INT                                    \
+                    && (entries = vec_int_arr_write(&v,                       \
+                      (void *) ((elem) + written), num - written, &bytes)))   \
+                  || (type == PAGE_OUT_FLT                                    \
+                    && (entries = vec_flt_arr_write(&v,                       \
+                      (void *) ((elem) + written), num - written,             \
+                      DOCMAP_WEIGHT_PRECISION, &bytes)))                      \
+                  || (type == PAGE_OUT_CHR                                    \
+                    && (entries = vec_byte_write(&v,                          \
+                      (void *) ((elem) + written), num - written)))) {        \
+                                                                              \
+                    mem_hton(entry_pos, &entries, sizeof(entries));           \
+                    written += entries;                                       \
+                } else {                                                      \
+                    /* ran out of space, terminate this page and start anew */\
+                    v.pos = end_pos;                                          \
+                    vec_byte_write(&v, "", 1);                                \
+                    if (DEAR_DEBUG) {                                         \
+                        memset(v.pos, 0, vec_len(&v));                        \
+                    }                                                         \
+                    NEW_PAGE();                                               \
+                }                                                             \
+            }
+
+            PAGE_OUT_CACHE(CACHE_ID_MAP, dm->map, dm->map_len, 0, 0, 
+              PAGE_OUT_LONG);
+            PAGE_OUT_CACHE(CACHE_ID_WORDS, dm->cache.words, dm->cache.len, 
+              1, DOCMAP_CACHE_WORDS, PAGE_OUT_INT);
+            PAGE_OUT_CACHE(CACHE_ID_DWORDS, dm->cache.dwords, dm->cache.len, 
+              1, DOCMAP_CACHE_DISTINCT_WORDS, PAGE_OUT_INT);
+            PAGE_OUT_CACHE(CACHE_ID_WEIGHT, dm->cache.weight, dm->cache.len, 
+              1, DOCMAP_CACHE_WEIGHT, PAGE_OUT_FLT);
+            PAGE_OUT_CACHE(CACHE_ID_TRECNO, dm->cache.trecno_off, 
+              (dm->cache.len + TRECNO_FRONT_FREQ - 1) / TRECNO_FRONT_FREQ, 1, 
+              DOCMAP_CACHE_TRECNO, PAGE_OUT_INT);
+            PAGE_OUT_CACHE(CACHE_ID_TRECNO_CODE, dm->cache.trecno.buf, 
+              dm->cache.trecno.len, 1, DOCMAP_CACHE_TRECNO, PAGE_OUT_CHR);
+            PAGE_OUT_CACHE(CACHE_ID_LOC, dm->cache.loc_off, 
+              (dm->cache.len + LOC_REL_FREQ - 1) / LOC_REL_FREQ, 1, 
+              DOCMAP_CACHE_LOCATION, PAGE_OUT_INT);
+            PAGE_OUT_CACHE(CACHE_ID_LOC_CODE, dm->cache.loc.buf, 
+              dm->cache.loc.len, 1, DOCMAP_CACHE_LOCATION, PAGE_OUT_CHR);
+
+            /* note that we're being dodgy and just processing the type 
+             * exception array as an array of unsigned ints */
+            PAGE_OUT_CACHE(CACHE_ID_TYPEEX, (unsigned int *) dm->cache.typeex,
+              dm->cache.typeex_len * 2, 1, DOCMAP_CACHE_LOCATION, 
+              PAGE_OUT_INT);
+
+            /* write out reposset details */
+            docno = 0;
+            while (docno < dm->entries) {
+                struct reposset_record *rec;
+                char idc = CACHE_ID_REPOS_REC;
+
+                /* retrieve reposset record dealing with this entry */
+                if ((rec = reposset_record(dm->rset, docno))) {
+                    char *pos = v.pos;
+
+                    /* try to write record to output */
+                    if (vec_byte_write(&v, &idc, 1)
+                      && vec_vbyte_write(&v, (rec->reposno << 1) | rec->rectype)
+                      && vec_vbyte_write(&v, rec->docno)
+                      && vec_vbyte_write(&v, rec->quantity)) {
+                        /* succeeded in writing out this record */
+                        docno += rec->quantity;
+                    } else {
+                        v.pos = pos;
+                        vec_byte_write(&v, "", 1);
+                        if (DEAR_DEBUG) {
+                            memset(v.pos, 0, vec_len(&v));
+                        }
+                        NEW_PAGE();
+                    }
+                } else {
+                    assert("can't get here" && 0);
+                    fdset_unpin(dm->fdset, dm->fd_type, fileno, fd);
+                    return DOCMAP_ARG_ERROR;
+                }
+            }
+
+            /* write out checkpoint details */
+            check = reposset_check_first(dm->rset);
+            for (i = 0; i < reposset_checks(dm->rset); i++) {
+                char idc = CACHE_ID_REPOS_CHECK;
+                char *pos = v.pos;
+
+                /* try to write record to output */
+                if (vec_byte_write(&v, &idc, 1)
+                  && vec_vbyte_write(&v, check[i].reposno)
+                  && vec_vbyte_write(&v, check[i].offset)
+                  && vec_vbyte_write(&v, check[i].comp)) {
+                    /* succeeded in writing out this record */
+                } else {
+                    v.pos = pos;
+                    vec_byte_write(&v, "", 1);
+                    if (DEAR_DEBUG) {
+                        memset(v.pos, 0, vec_len(&v));
+                    }
+                    NEW_PAGE();
+                }
+            }
+
+            /* terminate final page, and mark it as final */
+            vec_byte_write(&v, "", 1);
+            if (DEAR_DEBUG) {
+                memset(v.pos, 0, vec_len(&v));
+            }
+            v.pos = dm->readbuf.buf + (page - 1) * dm->pagesize;
+            *v.pos++ = FINAL_CACHE_BYTE;
+
+            /* write it out */
+            bytes = page * dm->pagesize;
+            written = write(fd, dm->readbuf.buf, bytes);
+            dmret = fdset_unpin(dm->fdset, dm->fd_type, fileno, fd);
+            assert(dmret == FDSET_OK);
+
+            if (written != bytes) {
+                return DOCMAP_IO_ERROR;
+            }
+        }
+
+        dm->dirty = 0;
+
+        TIMINGS_END("docmap save");
+        return DOCMAP_OK;
+    } else {
+        return dmret;
+    }
+}
+
+struct docmap *docmap_new(struct fdset *fdset, 
+  int fd_type, unsigned int pagesize, unsigned int pages, 
+  unsigned long int max_filesize, enum docmap_cache cache, 
+  enum docmap_ret *ret) {
+    struct docmap *dm 
+      = docmap_init(fdset, fd_type, pagesize, pages, max_filesize, cache);
+    dm->dirty = 1;
+
+    if (dm) {
+        /* create a new file for the docmap */
+        int fd = fdset_create(dm->fdset, dm->fd_type, 0);
+        if (fd >= 0) {
+            fdset_unpin(dm->fdset, dm->fd_type, 0, fd);
+            *ret = DOCMAP_OK;
+        } else {
+            *ret = DOCMAP_IO_ERROR;
+            docmap_delete(dm);
+            return NULL;
+        }
+    } else {
+        assert(!CRASH);
+        *ret = DOCMAP_MEM_ERROR;
+    }
+
+    return dm;
+}
+
+/* internal function to check that the cache contains the same as the on-disk
+ * docmap */
+static enum docmap_ret docmap_cache_check(struct docmap *dm);
+
+struct docmap *docmap_load(struct fdset *fdset, 
+  int fd_type, unsigned int pagesize, unsigned int bufpages, 
+  unsigned long int max_filesize, enum docmap_cache cache, 
+  enum docmap_ret *ret) {
+    struct docmap *dm = docmap_init(fdset, fd_type, pagesize, bufpages, 
+        max_filesize, 0);
+    int fd = -1,
+        prev_fd,
+        corrupt,
+        map;
+    unsigned long int offset,
+                      tmpl;
+    unsigned int fileno,
+                 page,
+                 pages;
+    struct vec v;
+    enum docmap_ret dmret;
+    TIMINGS_DECL();
+    TIMINGS_START();
+
+    if (!dm) {
+        assert(!CRASH);
+        *ret = DOCMAP_MEM_ERROR;
+        return NULL;
+    }
+    max_filesize = dm->file_pages * dm->pagesize;
+
+#define FAIL(retval)                                                          \
+    if (fd >= 0) {                                                            \
+        fdset_unpin(fdset, fd_type, fileno, fd);                              \
+    }                                                                         \
+    *ret = retval; docmap_delete(dm); assert(!CRASH); return NULL
+
+    /* find out number of pages */
+    for (fileno = 0, pages = 0; (prev_fd = fd), 
+      (fd = fdset_pin(fdset, fd_type, fileno, 0, SEEK_END)) 
+        >= 0;
+      fileno++) {
+        if (prev_fd >= 0) {
+            fdset_unpin(fdset, fd_type, fileno - 1, prev_fd);
+        }
+        if (fileno && offset != max_filesize) {
+            /* corrupt */
+            FAIL(DOCMAP_FMT_ERROR);
+        }
+        offset = lseek(fd, 0, SEEK_CUR);
+        if (offset != -1) {
+            if (((offset / dm->pagesize) * dm->pagesize) != offset) {
+                FAIL(DOCMAP_FMT_ERROR);
+            }
+            pages += offset / dm->pagesize;
+        } else {
+            FAIL(DOCMAP_IO_ERROR);
+        }
+    }
+    fd = prev_fd;
+    assert(fd >= 0);
+    fileno--;
+
+    /* read last page */
+    if (lseek(fd, - (int) dm->pagesize, SEEK_END) != -1 
+      && read(fd, dm->readbuf.buf, dm->pagesize) 
+        == (ssize_t) dm->pagesize) {
+
+        /* determine location of last data page from last page */
+        v.pos = dm->readbuf.buf;
+        v.end = v.pos + dm->pagesize;
+        if (*v.pos++ != FINAL_CACHE_BYTE) {
+            FAIL(DOCMAP_FMT_ERROR);
+        }
+        vec_vbyte_read(&v, &tmpl);
+        dm->entries = dm->cache.size = dm->cache.len = tmpl;
+        vec_vbyte_read(&v, &tmpl);
+        assert(tmpl);
+        dm->map_len = tmpl;
+        dm->map_size = dm->map_len + 1;
+
+        if (!(dm->map = realloc(dm->map, sizeof(*dm->map) * dm->map_size))) {
+            assert(!CRASH);
+            FAIL(DOCMAP_MEM_ERROR);
+        }
+    } else {
+        FAIL(DOCMAP_IO_ERROR);
+    }
+
+    /* pin correct fd, and seek to the correct location */
+    page = dm->map_len - 1; /* address of last data page */
+    offset = (page % dm->file_pages) * dm->pagesize;
+    if (page / dm->file_pages != fileno) {
+        fdset_unpin(fdset, fd_type, fileno, fd);
+        fileno = page / dm->file_pages;
+        if ((fd = fdset_pin(fdset, fd_type, fileno, offset, SEEK_SET)) < 0) {
+            FAIL(DOCMAP_IO_ERROR);
+        }
+    /* seek fd to correct location */
+    } else if (lseek(fd, offset, SEEK_SET) == -1) {
+        FAIL(DOCMAP_IO_ERROR);
+    } 
+
+    /* page last data page into append buffer, read until the end */
+    if ((dmret = take_read_buffer(dm)) == DOCMAP_OK 
+      && (dm->appendbuf.buflen = read(fd, dm->appendbuf.buf, dm->pagesize)) 
+        == dm->pagesize) {
+
+        dm->appendbuf.buflen /= dm->pagesize;
+        dm->appendbuf.page = page;
+        assert(dm->appendbuf.buflen == 1 && dm->appendbuf.bufsize == 1);
+        if (*dm->appendbuf.buf != FINAL_DATA_BYTE) {
+            FAIL(DOCMAP_FMT_ERROR);
+        }
+        reset_cursor(dm, &dm->write, &dm->appendbuf, page, ULONG_MAX);
+
+        /* read until the end of the entries */
+        while (dm->write.past < dm->write.entries) {
+            if ((dmret = decode(&dm->write)) != DOCMAP_OK) {
+                FAIL(DOCMAP_FMT_ERROR);
+            }
+        }
+    } else {
+        FAIL(DOCMAP_IO_ERROR);
+    }
+    fdset_unpin(fdset, fd_type, fileno, fd);
+    fd = -1;
+
+    /* read cache pages */
+    corrupt = 0;
+    map = 0;
+    for (page = dm->map_len; !corrupt && page < pages; page++) {
+        if ((dmret = page_in(dm, page)) == DOCMAP_OK) {
+            assert(page >= dm->readbuf.page && page 
+              && page < dm->readbuf.page + dm->readbuf.buflen);
+            v.pos = dm->readbuf.buf + dm->pagesize * (page - dm->readbuf.page);
+            v.end = v.pos + dm->pagesize;
+
+            if ((((page + 1 < pages) && (*v.pos == CACHE_BYTE))
+              || ((page + 1 == pages) && *v.pos == FINAL_CACHE_BYTE))) {
+                v.pos++;
+            } else {
+                corrupt = 1;
+            }
+
+            vec_vbyte_read(&v, &tmpl);
+            vec_vbyte_read(&v, &offset);
+            if (!corrupt && (tmpl == dm->entries) && (offset == dm->map_len)) {
+                int finished = 0,
+                    type = 0;
+                uint32_t entries,
+                         tmptries;
+                unsigned long int **larrptr = NULL;
+                float **farrptr = NULL;
+                char **carrptr = NULL;
+                unsigned int target = 0,
+                             bytes,
+                             **arrptr = NULL;
+                float tmpf;
+                struct reposset_record tmprec;
+                struct reposset_check tmpcheck;
+
+                while (!corrupt && !finished && vec_len(&v)) {
+                    switch (*v.pos++) {
+                    case CACHE_ID_END: 
+                        finished = 1; 
+                        break;
+
+                    case CACHE_ID_AGG:
+                        vec_flt_read(&v, &tmpf, VEC_FLT_FULL_PRECISION);
+                        dm->agg.sum_bytes = tmpf;
+                        vec_flt_read(&v, &tmpf, VEC_FLT_FULL_PRECISION);
+                        dm->agg.sum_words = tmpf;
+                        vec_flt_read(&v, &tmpf, VEC_FLT_FULL_PRECISION);
+                        dm->agg.sum_dwords = tmpf;
+                        vec_flt_read(&v, &tmpf, VEC_FLT_FULL_PRECISION);
+                        dm->agg.sum_weight = tmpf;
+                        if (!vec_len(&v) 
+                          || !vec_flt_read(&v, &tmpf, VEC_FLT_FULL_PRECISION)) {
+                            corrupt = 1;
+                        }
+                        dm->agg.sum_trecno = tmpf;
+                        break;
+
+                    case CACHE_ID_REPOS_REC:
+                        vec_vbyte_read(&v, &tmpl);
+                        tmprec.reposno = tmpl >> 1;
+                        tmprec.rectype = tmpl & 1;
+                        vec_vbyte_read(&v, &tmpl);
+                        tmprec.docno = tmpl;
+                        if (vec_vbyte_read(&v, &tmpl)) {
+                            tmprec.quantity = tmpl;
+
+                            if (reposset_set_record(dm->rset, &tmprec) 
+                              != REPOSSET_OK) {
+                                assert(!CRASH);
+                                assert(!CRASH);
+                                FAIL(DOCMAP_MEM_ERROR);
+                            }
+                        } else {
+                            assert(!CRASH);
+                            FAIL(DOCMAP_FMT_ERROR);
+                        }
+                        break;
+
+                    case CACHE_ID_REPOS_CHECK:
+                        vec_vbyte_read(&v, &tmpl);
+                        tmpcheck.reposno = tmpl;
+                        vec_vbyte_read(&v, &tmpcheck.offset);
+                        if (vec_vbyte_read(&v, &tmpl) 
+                          && reposset_add_checkpoint(dm->rset, tmpcheck.reposno,
+                              tmpl, tmpcheck.offset) == REPOSSET_OK) {
+
+                            assert(tmpl == MIME_TYPE_APPLICATION_X_GZIP);
+                            tmpcheck.comp = tmpl;
+                        } else {
+                            assert(!CRASH);
+                            FAIL(DOCMAP_FMT_ERROR);
+                        }
+                        break;
+
+                    case CACHE_ID_MAP:
+                    case CACHE_ID_WEIGHT:
+                    case CACHE_ID_TRECNO:
+                    case CACHE_ID_TRECNO_CODE:
+                    case CACHE_ID_DWORDS:
+                    case CACHE_ID_WORDS:
+                    case CACHE_ID_LOC:
+                    case CACHE_ID_LOC_CODE:
+                    case CACHE_ID_TYPEEX:
+                        v.pos--;
+                        bytes = *v.pos++;
+                        vec_vbyte_read(&v, &tmpl);
+                        vec_vbyte_read(&v, &offset);
+                        vec_byte_read(&v, (void *) &tmptries, sizeof(tmptries));
+                        mem_ntoh(&entries, &tmptries, sizeof(entries));
+                        switch (bytes) {
+                        case CACHE_ID_TRECNO_CODE:
+                            dm->cache.cache |= DOCMAP_CACHE_TRECNO;
+                            type = PAGE_OUT_CHR;
+                            target = tmpl;
+                            carrptr = &dm->cache.trecno.buf;
+                            dm->cache.trecno.len = dm->cache.trecno.size = tmpl;
+                            break;
+                        case CACHE_ID_LOC_CODE:
+                            dm->cache.cache |= DOCMAP_CACHE_LOCATION;
+                            type = PAGE_OUT_CHR;
+                            target = tmpl;
+                            carrptr = &dm->cache.loc.buf;
+                            dm->cache.loc.len = dm->cache.loc.size = tmpl;
+                            break;
+                        case CACHE_ID_MAP:
+                            map = 1;
+                            type = PAGE_OUT_LONG;
+                            target = dm->entries;
+                            larrptr = &dm->map;
+                            break;
+                        case CACHE_ID_WEIGHT:
+                            dm->cache.cache |= DOCMAP_CACHE_WEIGHT;
+                            type = PAGE_OUT_FLT;
+                            target = dm->entries;
+                            farrptr = &dm->cache.weight;
+                            break;
+                        case CACHE_ID_TRECNO:
+                            dm->cache.cache |= DOCMAP_CACHE_TRECNO;
+                            type = PAGE_OUT_INT;
+                            target = (dm->entries + TRECNO_FRONT_FREQ - 1) 
+                              / TRECNO_FRONT_FREQ;
+                            arrptr = &dm->cache.trecno_off;
+                            break;
+                        case CACHE_ID_LOC:
+                            dm->cache.cache |= DOCMAP_CACHE_LOCATION;
+                            type = PAGE_OUT_INT;
+                            target = (dm->entries + LOC_REL_FREQ - 1) 
+                              / LOC_REL_FREQ;
+                            arrptr = &dm->cache.loc_off;
+                            break;
+                        case CACHE_ID_DWORDS: 
+                            dm->cache.cache |= DOCMAP_CACHE_DISTINCT_WORDS;
+                            type = PAGE_OUT_INT;
+                            target = dm->entries;
+                            arrptr = &dm->cache.dwords; 
+                            break;
+                        case CACHE_ID_TYPEEX: 
+                            /* note that we're being dodgy and just processing
+                             * the type exception array as an array of 
+                             * unsigned ints */
+                            dm->cache.cache |= DOCMAP_CACHE_LOCATION;
+                            type = PAGE_OUT_INT;
+                            assert(!(tmpl % 2));
+                            target = tmpl;
+                            dm->cache.typeex_len = dm->cache.typeex_size 
+                              = tmpl / 2;
+                            arrptr = (unsigned int **) &dm->cache.typeex; 
+                            break;
+                        case CACHE_ID_WORDS: 
+                            dm->cache.cache |= DOCMAP_CACHE_WORDS;
+                            type = PAGE_OUT_INT;
+                            target = dm->entries;
+                            arrptr = &dm->cache.words; 
+                            break;
+                        default: assert("can't get here" && 0);
+                        }
+
+                        /* arrange memory and read in cache data for each 
+                         * type */
+                        assert(dm->cache.size == dm->entries);
+                        switch (type) {
+                        case PAGE_OUT_LONG:
+                            if (corrupt || !vec_len(&v)) break;
+                            if (!*larrptr 
+                              && !(*larrptr = malloc(sizeof(long) * target))) {
+                                assert(!CRASH);
+                                FAIL(DOCMAP_MEM_ERROR);
+                            }
+
+                            if ((tmpl = vec_vbyte_arr_read(&v, 
+                                *larrptr + offset, entries, &bytes)) 
+                              != entries) {
+                                corrupt = 1;
+                            }
+                            break;
+
+                        case PAGE_OUT_INT:
+                            if (corrupt || !vec_len(&v)) break;
+                            if (!*arrptr 
+                              && !(*arrptr = malloc(sizeof(int) * target))) {
+                                assert(!CRASH);
+                                FAIL(DOCMAP_MEM_ERROR);
+                            }
+
+                            if ((tmpl = vec_int_arr_read(&v, 
+                                *arrptr + offset, entries, &bytes)) 
+                              != entries) {
+                                corrupt = 1;
+                            }
+                            break;
+
+                        case PAGE_OUT_FLT:
+                            if (corrupt || !vec_len(&v)) break;
+                            if (!*farrptr 
+                              && !(*farrptr = malloc(sizeof(float) * target))) {
+                                assert(!CRASH);
+                                FAIL(DOCMAP_MEM_ERROR);
+                            }
+
+                            if ((tmpl = vec_flt_arr_read(&v, 
+                                *farrptr + offset, entries, 
+                                DOCMAP_WEIGHT_PRECISION, &bytes)) 
+                              != entries) {
+                                corrupt = 1;
+                            }
+                            break;
+
+                        case PAGE_OUT_CHR:
+                            if (corrupt || !vec_len(&v)) break;
+                            if (!*carrptr 
+                              && !(*carrptr = malloc(sizeof(float) * target))) {
+                                assert(!CRASH);
+                                FAIL(DOCMAP_MEM_ERROR);
+                            }
+
+                            if ((tmpl = vec_byte_read(&v, 
+                                *carrptr + offset, entries)) != entries) {
+                                corrupt = 1;
+                            }
+                            break;
+                        }
+                        break;
+
+                    default:
+                        corrupt = 1;
+                        break;
+                    }
+                }
+            } else {
+                corrupt = 1;
+            }
+        } else {
+            FAIL(DOCMAP_IO_ERROR);
+        }
+    }
+    dm->map[dm->map_len] = ULONG_MAX;
+    TIMINGS_END("docmap fastload");
+
+    /* if anything goes wrong, docmap_cache_int() at the end */
+    if (corrupt || !map || cache != dm->cache.cache) {
+        /* note that we only force a reread (last argument) if we encountered
+         * corruption or didn't read the mapping entries */
+        if ((dmret = docmap_cache_int(dm, cache, corrupt | !map)) 
+          != DOCMAP_OK) {
+            FAIL(dmret);
+        }
+    }
+
+    if (DEAR_DEBUG) {
+        dmret = docmap_cache_check(dm);
+        assert(dmret == DOCMAP_OK);
+    }
+
+    aggregate(dm);
+    *ret = DOCMAP_OK;
+    return dm;
+}
+
+void docmap_delete(struct docmap *dm) {
+    dm->cache.cache = 0;
+    cache_cleanup(dm);
+    if (dm->write.entry.trecno) {
+        free(dm->write.entry.trecno);
+    }
+    if (dm->read.entry.trecno) {
+        free(dm->read.entry.trecno);
+    }
+    if (dm->map) {
+        free(dm->map);
+    }
+    reposset_delete(dm->rset);
+    free(dm->buf);
+    dm->buf = NULL;
+    free(dm);
+}
+
+static enum docmap_ret docmap_cache_check(struct docmap *dm) {
+    unsigned int page;
+    enum docmap_ret dmret;
+    TIMINGS_DECL();
+    TIMINGS_START();
+
+    if (!dm->cache.cache) {
+        return DOCMAP_OK;
+    }
+
+    /* need to read all entries in the docmap */
+    for (page = 0; page < dm->map_len; page++) {
+        if ((dmret = page_in(dm, page)) == DOCMAP_OK) {
+            unsigned int len;
+
+            if (page >= dm->readbuf.page 
+              && page < dm->readbuf.page + dm->readbuf.buflen) {
+                reset_cursor(dm, &dm->read, &dm->readbuf, page, ULONG_MAX);
+            } else if (page >= dm->appendbuf.page 
+              && page < dm->appendbuf.page + dm->appendbuf.buflen) {
+                reset_cursor(dm, &dm->read, &dm->appendbuf, page, ULONG_MAX);
+            } else {
+                assert("can't get here" && 0);
+                return DOCMAP_FMT_ERROR;
+            }
+
+            /* iterate through page entries */
+            while ((dmret = decode(&dm->read)) 
+              == DOCMAP_OK) {
+                char buf[BUFSIZ + 1];
+
+                if (((dm->cache.cache & DOCMAP_CACHE_WORDS)
+                    && dm->read.entry.words
+                      != dm->cache.words[dm->read.entry.docno])
+                  || ((dm->cache.cache & DOCMAP_CACHE_LOCATION)
+                    && dm->read.entry.bytes
+                      != docmap_get_bytes_cached(dm, dm->read.entry.docno))
+                  || ((dm->cache.cache & DOCMAP_CACHE_DISTINCT_WORDS)
+                    && dm->read.entry.dwords
+                      != dm->cache.dwords[dm->read.entry.docno])) {
+                    assert(!CRASH);
+                    return DOCMAP_FMT_ERROR;
+                }
+
+                if ((dm->cache.cache & DOCMAP_CACHE_WEIGHT)
+                    && (dm->read.entry.weight
+                      < 0.95 * dm->cache.weight[dm->read.entry.docno]
+                      || dm->read.entry.weight
+                      > 1.05 * dm->cache.weight[dm->read.entry.docno])) {
+                    assert(!CRASH);
+                    return DOCMAP_FMT_ERROR;
+                }
+
+                if (dm->cache.cache & DOCMAP_CACHE_TRECNO) {
+                    dmret = docmap_get_trecno(dm, dm->read.entry.docno,
+                        buf, BUFSIZ, &len);
+
+                    if (len < BUFSIZ) {
+                        buf[len] = '\0';
+                        if (str_cmp(buf, dm->read.entry.trecno)) {
+                            assert(!CRASH);
+                            return DOCMAP_FMT_ERROR;
+                        }
+                    } else {
+                        buf[BUFSIZ] = '\0';
+                        if (str_ncmp(buf, dm->read.entry.trecno, BUFSIZ)) {
+                            assert(!CRASH);
+                            return DOCMAP_FMT_ERROR;
+                        }
+                    }
+                }
+
+                if (dm->cache.cache & DOCMAP_CACHE_LOCATION) {
+                    unsigned int fileno,
+                                 bytes;
+                    off_t offset;
+                    enum docmap_flag flags;
+                    enum mime_types mtype;
+                    
+                    if (docmap_get_location(dm, dm->read.entry.docno, &fileno,
+                        &offset, &bytes, &mtype, &flags) != DOCMAP_OK
+                      || (fileno != dm->read.entry.fileno)) {
+                        assert(!CRASH);
+                        return DOCMAP_FMT_ERROR;
+                    } else if (offset != dm->read.entry.offset) {
+                        assert(!CRASH);
+                        return DOCMAP_FMT_ERROR;
+                    } else if (bytes != dm->read.entry.bytes) {
+                        assert(!CRASH);
+                        return DOCMAP_FMT_ERROR;
+                    } else if (flags != dm->read.entry.flags) {
+                        assert(!CRASH);
+                        return DOCMAP_FMT_ERROR;
+                    } else if (mtype != dm->read.entry.mtype) {
+                        assert(!CRASH);
+                        return DOCMAP_FMT_ERROR;
+                    }
+                }
+            }
+            assert(dmret == DOCMAP_BUFSIZE_ERROR);
+        } else {
+            assert(!CRASH);
+            return DOCMAP_IO_ERROR;
+        }
+    }
+
+    TIMINGS_END("docmap scan");
+    return DOCMAP_OK;
+}
+
diff --git a/src/error.c b/src/error.c
new file mode 100644 (file)
index 0000000..40203b6
--- /dev/null
@@ -0,0 +1,72 @@
+#include "firstinclude.h"
+
+#include "error.h"
+
+#include <assert.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#define ERROR_BUF_SIZE 2048
+
+static FILE * error_stream = NULL;
+static int error_stream_inited = 0;
+static char error_buf[ERROR_BUF_SIZE] = "";
+static int error_code = 0;
+
+static void ensure_error_stream_inited() {
+    if (error_stream_inited == 0) {
+#ifdef LOGERRORS
+        error_stream = stderr;
+#else /* LOGERRORS */
+        error_stream = NULL;
+#endif /* LOGERRORS */
+        error_stream_inited = 1;
+    }
+}
+
+int error_loc(int code, const char * func, const char * file, int line,
+  const char * fmt, ...) {
+    va_list ap;
+    char msg_buf[ERROR_BUF_SIZE];
+
+    ensure_error_stream_inited();
+
+    error_code = code;
+
+    va_start(ap, fmt);
+    vsnprintf(msg_buf, ERROR_BUF_SIZE, fmt, ap);
+
+    if (errno) {
+        snprintf(error_buf, ERROR_BUF_SIZE, "ERROR: %s() (%s::%d): %s "
+          "(system error is '%s')", func, file, line, msg_buf, 
+          strerror(errno));
+        errno = 0;
+    } else {
+        snprintf(error_buf, ERROR_BUF_SIZE, "ERROR: %s (%s::%d): %s",
+          func, file, line, msg_buf);
+    }
+    if (error_stream != NULL) {
+        fputs(error_buf, error_stream);
+        fputc('\n', error_stream);
+    }
+    va_end(ap);
+    return code;
+}
+
+int error_has_msg() {
+    return error_buf[0] != '\0';
+}
+
+const char * error_last_msg() {
+    return error_buf;
+}
+
+int error_last_code() {
+    return error_code;
+}
+void error_set_log_stream(FILE * stream) {
+    error_stream = stream;
+    error_stream_inited = 1;
+}
diff --git a/src/fdset.c b/src/fdset.c
new file mode 100644 (file)
index 0000000..1fdf7fd
--- /dev/null
@@ -0,0 +1,1067 @@
+/* fdset.c implements the interface declared in fdset.h.  It will be
+ * implemented by keeping a hashtable full of names for each of the different
+ * types of fds, along with a template name that will be used if no specific
+ * name is provided for a fileno.  The template is the type name specified with
+ * a single ".%u" printf expansion appended to it.
+ *
+ * written nml 2003-02-13
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "fdset.h"
+
+#include "def.h"
+#include "chash.h"
+#include "str.h"
+#include "zstdint.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <stdio.h>
+
+/* Make multi-thread safe.  Note: only the fdset_pin and fdset_unpin
+   functions obey this. */
+#ifdef MT_ZET
+#include <pthread.h>
+#endif /* MT_ZET */
+
+/* struct to represent a specific filename for a given type, fileno pair */
+struct specific {
+    const char *filename;                 /* name of specific file */
+    int write;                            /* whether to enable writing */
+};
+
+/* struct to hold specific and general information about a type */
+struct type {
+    const char *template;                 /* filename template (containing one 
+                                           * %u printf conversion) */
+    int write;                            /* whether to enable writing */
+    struct chash *specific;               /* hashtable of specific entries */
+};
+
+/* struct to represent an open file descriptor */
+struct fd {
+    int fd;                               /* file descriptor */
+    unsigned int lru_count;               /* count to approximate LRU, 
+                                           * UINT_MAX if fd is pinned */
+    unsigned int type;                    /* type of fd */
+    unsigned int fileno;                  /* fd file number */
+    struct fd * next;                     /* to place in a list */
+};
+
+/* internal function to give hash values for fds */
+static unsigned int fd_hash(const void *vfd) {
+    const struct fd *fd = vfd;
+
+    /* basic hash function - give type upper byte only (since its likely to be
+     * small) and xor with fileno */
+    return fd->fileno ^ (fd->type << ((sizeof(unsigned int) - 1) * 8));
+}
+
+/* internal function to compare fds */
+static int fd_cmp(const void *vone, const void *vtwo) {
+    const struct fd *one = vone, 
+                    *two = vtwo;
+
+    if (one->type == two->type) {
+        if (one->fileno == two->fileno) {
+            return 0;
+        } else if (one->fileno < two->fileno) {
+            return -1;
+        } else {
+            return 1;
+        }
+    } else if (one->type < two->type) {
+        return -1;
+    } else {
+        return 1;
+    }
+}
+
+struct fdset {
+    struct chash *typehash;               /* hashtable of type entries */
+    struct fd **fd;                       /* array of open fds */
+    unsigned int fds;                     /* number of open fds */
+    unsigned int fdsize;                  /* size of fd array */
+    struct fd **key;                      /* keys in hash table */
+    unsigned int keys;                    /* number of keys in hash table */
+    unsigned int keysize;                 /* size of key array */
+    struct chash *fdhash;                 /* hashtable for fast lookup of 
+                                           * fds */
+    int umask;                            /* permission mask for opening new 
+                                           * files */
+    unsigned int clock_pos;               /* last position in clock 
+                                           * algorithm */
+    unsigned int lru_default;             /* number of second chances in clock 
+                                           * algorithm */
+    unsigned int limit;                   /* maximum number of fds to open */
+#ifdef MT_ZET
+    pthread_mutex_t mutex;
+#endif /* MT_ZET */
+};
+
+static struct fd * new_fd() {
+    struct fd * fd = NULL;
+
+    if (!(fd = malloc(sizeof(*fd))))
+        return NULL;
+    fd->lru_count = 0;
+    fd->fd = -1;
+    fd->next = NULL;
+    return fd;
+}
+
+static struct fd **make_fd_array(unsigned int size) {
+    struct fd **fd = NULL;
+    unsigned int i;
+    if (!(fd = calloc(size, sizeof(*fd))))
+        return NULL;
+
+    for (i = 0; i < size; i++) {
+        if (!(fd[i] = new_fd())) {
+            for (i--; i >= 0; i--)
+                free(fd[i]);
+            free(fd);
+            return NULL;
+        }
+    }
+    return fd;
+}
+
+static int expand_fd_array(struct fd *** array_p, unsigned int * size_p) {
+    unsigned int new_size = *size_p * 2 + 1;
+    struct fd ** new_array = realloc(*array_p, sizeof(*new_array) * new_size);
+    unsigned int i;
+    
+    if (new_array == NULL) {
+        return -ENOMEM;
+    }
+    for (i = *size_p; i < new_size; i++) {
+        if (!(new_array[i] = new_fd())) {
+            unsigned int j;
+
+            for (j = *size_p; j < i; j++) {
+                free(new_array[j]);
+            }
+            *array_p = new_array;
+            return -ENOMEM;
+        }
+    }
+    *array_p = new_array;
+    *size_p = new_size;
+    return 0;
+}
+
+struct fdset *fdset_new(int umask, unsigned int sizehint) {
+    struct fdset *set;
+
+    if ((set = malloc(sizeof(*set))) 
+      && (set->fdhash = chash_ptr_new(1, 1.0, fd_hash, fd_cmp))
+      && (set->typehash = chash_luint_new(1, 1.0))) {
+        set->umask = umask;
+        set->fds = 0;
+        set->keys = 0;
+        set->lru_default = 3;  /* FIXME: get as param */
+        set->limit = UINT_MAX;   /* no limit */
+        set->clock_pos = 0;
+        if (sizehint) {
+            if (!(set->fd = make_fd_array(sizehint))
+              || !(set->key = make_fd_array(sizehint))) {
+                fdset_delete(set);
+                return NULL;
+            }
+            set->fdsize = sizehint;
+            set->keysize = sizehint;
+        } else {
+            set->fdsize = 0;
+            set->fd = NULL;
+            set->keysize = 0;
+            set->key = NULL;
+        }
+#ifdef MT_ZET
+        pthread_mutex_init(&set->mutex, NULL);
+#endif /* MT_ZET */
+    }
+
+    return set;
+}
+
+static void specific_delete(void *userdata, unsigned long int key, 
+  void **data) {
+    struct specific *sp = *data;
+
+    free((void *) sp->filename);
+    free(sp);
+}
+
+static void type_delete(void *userdata, unsigned long int key, void **data) {
+    struct type *type = *data;
+    chash_luint_ptr_foreach(type->specific, NULL, specific_delete);
+    chash_delete(type->specific);
+    free((void *) type->template);
+    free(type);
+}
+
+void fdset_delete(struct fdset *set) {
+    unsigned int i;
+
+    chash_luint_ptr_foreach(set->typehash, NULL, type_delete);
+    chash_delete(set->typehash);
+    chash_delete(set->fdhash);
+
+    for (i = 0; i < set->fds; i++) {
+        close(set->fd[i]->fd);
+        set->fd[i]->fd = -1;
+        free(set->fd[i]);
+    }
+
+    for (i = 0; i < set->keysize; i++) {
+        if (set->key[i]) {
+            free(set->key[i]);
+        }
+    }
+
+    for (i = set->fds; i < set->fdsize; i++) {
+        if (set->fd[i]) {
+            free(set->fd[i]);
+        }
+    }
+
+#ifdef MT_ZET
+    pthread_mutex_destroy(&set->mutex);
+#endif /* MT_ZET */
+
+    free(set->fd);
+    free(set->key);
+    free(set);
+}
+
+/* convert a string into a printf specifying by escaping potential format
+ * specifiers and adding our own */
+static int maketemplate(char *dst, unsigned int dstlen, const char *src, 
+  unsigned int srclen) {
+    char *dstend = dst + dstlen;
+    const char *srcend = src + srclen;
+
+    while ((dst < dstend) && (src < srcend) && *src) {
+        switch (*src) {
+        case '%':
+            *dst++ = *src++;
+            if (dst < dstend) {
+                *dst++ = '%';
+            } else {
+                return 0;
+            }
+            break;
+
+        default:
+            *dst++ = *src++;
+            break;
+
+        case '\0':
+            return 0;
+            break;
+        };
+    }
+
+    if (dst < dstend) {
+        if (dstend - dst < 4) {
+            return 0;
+        }
+        *dst++ = '.';
+        *dst++ = '%';
+        *dst++ = 'u';
+        *dst = '\0';
+        return 1;
+    }
+
+    return 0;
+}
+
+/* undo maketemplate conversion, returning length of created string */
+static unsigned int untemplate(char *dst, unsigned int dstlen, 
+  const char *src, unsigned int srclen) {
+    char *dstend = dst + dstlen,
+         *dstcpy = dst;
+    const char *srcend = src + srclen;
+
+    while ((dst < dstend) && (src < srcend) && *src) {
+        switch (*src) {
+        case '%':
+            *dst++ = *src++;
+            if (*src == '%') {
+                /* escaped it, skip */
+                src++;
+            } else if (*src == 'u') {
+                /* end of string, end dst on second previous char */
+                dst -= 2;
+                assert(*dst == '.');
+                *dst = '\0';
+                return dst - dstcpy;
+            } else {
+                /* don't know what happened */
+                assert(0);
+            }
+            break;
+
+        default:
+            *dst++ = *src++;
+            break;
+
+        case '\0':
+            /* shouldn't happen */
+            assert(0);
+            break;
+        };
+    }
+
+    /* shouldn't happen */
+    assert(0);
+    return 0;
+}
+
+int fdset_set_type_name(struct fdset *set, unsigned int typeno, 
+  const char *name, unsigned int namelen, int write) {
+    char buf[FILENAME_MAX * 2 + 1];
+    void **find;
+    struct type *type = NULL;
+
+    if (maketemplate(buf, FILENAME_MAX * 2 + 1, name, namelen)) {
+        if ((chash_luint_ptr_find(set->typehash, typeno, &find) == CHASH_OK)
+            /* trying to change the template for an existing type, don't do
+             * this as it may have unintended consequences for files already
+             * open. */
+          || !((type = malloc(sizeof(*type)))
+            && (type->specific = chash_luint_new(1, 1.0))
+            && (chash_luint_ptr_insert(set->typehash, typeno, type) 
+              == CHASH_OK))) {
+            /* couldn't insert new entry */
+
+            if (type) {
+                if (type->specific) {
+                    chash_delete(type->specific);
+                }
+                free(type);
+            }
+            return -EINVAL;
+        }
+
+        if ((type->template = str_dup(buf))) {
+            type->write = !!write;
+            return FDSET_OK;
+        } else {
+            void *remove;
+
+            chash_luint_ptr_remove(set->typehash, typeno, &remove);
+            chash_delete(type->specific);
+            free(type);
+            return -ENOMEM;
+        }
+    }
+
+    return -EINVAL;
+}
+
+int fdset_create_new_type(struct fdset *set, const char *basename,
+  const char *suffix, int write, unsigned int *typeno) {
+    char name_buf[FILENAME_MAX + 1];
+    int ret;
+
+    ret = snprintf((char *) name_buf, FILENAME_MAX, "%s.%s", basename, suffix);
+    if (ret >= FILENAME_MAX)
+        return -EINVAL;
+    else if (ret < 0)
+        return -errno;
+
+    *typeno = fdset_types(set);
+    return fdset_set_type_name(set, *typeno, name_buf, ret, write);
+}
+
+int fdset_set_fd_name(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, const char *name, unsigned int namelen, 
+  int write) {
+    struct type *type;
+    void **find;
+    struct specific *sp = NULL;
+
+    if ((chash_luint_ptr_find(set->typehash, typeno, &find) == CHASH_OK)
+      && (type = *find)) {
+        if (chash_luint_ptr_find(type->specific, fileno, &find) == CHASH_OK) {
+            /* trying to set name thats already been set */
+            sp = *find;
+            if ((namelen == str_len(sp->filename)) 
+              && !str_ncmp(name, sp->filename, namelen)) {
+                /* setting it to the same thing it was, allow it (rebuild
+                 * depends on this behaviour) */
+                return FDSET_OK;
+            } else {
+                /* setting it to something different, return error */
+                return -EEXIST;
+            }
+        }
+
+        if (!((sp = malloc(sizeof(*sp)))
+            && (sp->filename 
+              = str_ndup(name, namelen))
+            && (chash_luint_ptr_insert(type->specific, fileno, sp) 
+              == CHASH_OK))) {
+            /* couldn't insert new entry */
+
+            if (sp) {
+                if (sp->filename) {
+                    free((void *) sp->filename);
+                }
+                free(sp);
+            }
+            return -ENOMEM;
+        }
+
+        sp->write = !!write;
+        return FDSET_OK;
+    }
+
+    return -ENOENT;
+}
+
+static int fdset_ensure_fd_array_space(struct fdset *set) {
+    if (set->fds >= set->fdsize) {
+        int retval = expand_fd_array(&set->fd, &set->fdsize);
+        if (retval < 0)
+            return retval;
+        assert(set->fdsize > set->fds);
+    }
+
+    if (set->keys >= set->keysize) {
+        int retval = expand_fd_array(&set->key, &set->keysize);
+        if (retval < 0)
+            return retval;
+        assert(set->keysize > set->keys);
+    }
+    return 0;
+}
+
+/* Insert a fd into our fdhash. */
+static int fdset_insert_fd(struct fdset *set, unsigned int typeno,
+  unsigned int fileno, int fd) {
+    int found;
+    void **find;
+    int retval;
+    if ( (retval = fdset_ensure_fd_array_space(set)) < 0) {
+        return retval;
+    }
+    set->fd[set->fds]->fd = fd;
+    set->fd[set->fds]->type = typeno;
+    set->fd[set->fds]->fileno = fileno;
+    set->fd[set->fds]->lru_count = UINT_MAX;
+    set->key[set->keys]->type = typeno;
+    set->key[set->keys]->fileno = fileno;
+    set->key[set->keys]->lru_count = UINT_MAX;
+    if (chash_ptr_ptr_find_insert(set->fdhash, set->key[set->keys],
+        &find, set->fd[set->fds], &found) != CHASH_OK) {
+
+        return -errno;
+    }
+    if (found) {
+        struct fd * found = *find;
+        set->fd[set->fds]->next = found;
+        *find = set->fd[set->fds];
+    } else {
+        set->keys++;
+    }
+    set->fds++;
+    return FDSET_OK;
+}
+
+int fdset_create(struct fdset *set, unsigned int typeno, unsigned int fileno) {
+    char filename[FILENAME_MAX + 1];
+    int retval;
+    unsigned int namelen = 0;
+    int write = 0;
+    int fd;
+    int flags;
+
+    if ((retval = fdset_name(set, typeno, fileno, filename, FILENAME_MAX, 
+        &namelen, &write)) != FDSET_OK) {
+
+        return retval;
+    }
+    flags = (write * O_RDWR) | (!write * O_RDONLY) | O_CREAT | O_EXCL 
+      | O_BINARY; 
+
+    /* make sure we're not over the limit */ 
+    if (set->fds >= set->limit) {
+        if ((retval = fdset_close(set)) != FDSET_OK) {
+            return retval;
+        }
+    }
+
+    /* ok, try to open this file non-create. */
+    if ((fd = open((const char *) filename, flags, set->umask)) < 0) {
+        if (errno == EMFILE || errno == ENFILE) {
+            errno = 0;
+            if ((retval = fdset_close(set)) != FDSET_OK) {
+                return retval;
+            }
+            if ((fd = open((const char *) filename, flags, set->umask)) < 0) {
+                return -errno;
+            }
+        } else {
+            return -errno;
+        }
+    }
+    assert(fd >= 0);
+
+    /* we've got our fd; put it into our hashtable.
+       We assume that if the file was just created, it can't be in
+       the hashtable. */
+    if ((retval = fdset_insert_fd(set, typeno, fileno, fd)) != FDSET_OK) {
+        close(fd);
+        return retval;
+    }
+
+    return fd;
+}
+
+int fdset_debug_create(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, const char * src_file, int src_line) {
+    int retval;
+    static int count = 0;
+    retval = fdset_create(set, typeno, fileno);
+    fprintf(stderr, "<create %d: fd %d, type %d, fileno %d (%s: %d)>\n", 
+      count++, retval, typeno, fileno, src_file, src_line);
+    return retval;
+}
+
+int fdset_create_seek(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, off_t offset) {
+    int fd;
+    if ((fd = fdset_create(set, typeno, fileno)) < 0) {
+        return fd;
+    }
+
+    if (lseek(fd, offset, SEEK_SET) == (off_t) -1) {
+        fdset_unpin(set, typeno, fileno, fd);
+        return -errno;
+    }
+    return fd;
+}
+
+int fdset_debug_create_seek(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, off_t offset, const char * src_file,
+  int src_line) {
+    int retval;
+    static int count = 0;
+    retval = fdset_create_seek(set, typeno, fileno, offset);
+    fprintf(stderr, "<create %d: fd %d, type %d, fileno %d, "
+      "truncated offset %lu (%s: %d)>\n", count++, retval, typeno, fileno, 
+      (unsigned long int) offset, src_file, src_line);
+    return retval;
+}
+
+static int fdset_pin_locked(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, off_t offset, int whence) {
+    const char *filename;
+    char buf[FILENAME_MAX + 1];
+    struct fd key,
+              *found;
+    void **find;
+    struct type *type;
+    struct specific *sp;
+    int write;
+    int retval;
+    int fnd;
+
+    /* first, search open fd hashtable for match */
+    key.type = typeno;
+    key.fileno = fileno;
+    if (chash_ptr_ptr_find(set->fdhash, &key, &find) == CHASH_OK) {
+        found = *find;
+        while (found != NULL && found->lru_count == UINT_MAX) {
+            found = found->next;
+        }
+        if (found != NULL) {
+            found->lru_count = UINT_MAX;
+            assert(found->fd > 0);
+
+            if (((whence == SEEK_CUR) && (offset == 0)) 
+              || (lseek(found->fd, offset, whence) != (off_t) -1)) {
+                return found->fd;
+            } else {
+                return -errno;
+            }
+        }
+    }
+
+    /* otherwise, try to open a new fd */
+    if ((retval = fdset_ensure_fd_array_space(set)) < 0) {
+        return retval;
+    }
+
+    /* lookup filename in hash tables */
+    if (chash_luint_ptr_find(set->typehash, typeno, &find) == CHASH_OK) {
+        type = *find;
+        find = NULL;
+        if (((chash_luint_ptr_find(type->specific, fileno, &find) == CHASH_OK)
+            && ((sp = *find), (write = sp->write), (filename = sp->filename)))
+          || ((snprintf((char *) buf, FILENAME_MAX, 
+            (const char *) type->template, fileno) 
+              <= FILENAME_MAX) 
+            && ((write = type->write), (filename = buf)))) {
+            void **find = NULL;
+            int flags = (write * O_RDWR) | (!write * O_RDONLY) | O_BINARY;
+
+            if ((set->fds < set->limit) 
+              && ((set->fd[set->fds]->fd 
+                = open((const char *) filename, flags, set->umask)) != -1)
+              && ((set->fd[set->fds]->type = typeno), 
+                (set->fd[set->fds]->fileno = fileno), 
+                (set->fd[set->fds]->lru_count = UINT_MAX))
+              && ((set->key[set->keys]->type = typeno), 
+                (set->key[set->keys]->fileno = fileno), 
+                (set->key[set->keys]->lru_count = UINT_MAX))
+              /* insert into fds hashtable */
+              && (chash_ptr_ptr_find_insert(set->fdhash, set->key[set->keys], 
+                  &find, set->fd[set->fds], &fnd) == CHASH_OK)) {
+
+                if (fnd) {
+                    struct fd * found = *find;
+                    set->fd[set->fds]->next = found;
+                    *find = set->fd[set->fds];
+                } else {
+                    set->keys++;
+                }
+                /* this is a new file, so SEEK_CUR is equivalent
+                   to SEEK_SET.  We make this distinction to allow
+                   indexing of non-seekable file descriptors, e.g.
+                   <(gunzip foo.txt.gz); this is a bit of a hack. */
+                if (((whence == SEEK_CUR || whence == SEEK_SET) 
+                      && (offset == 0)) 
+                  || (lseek(set->fd[set->fds]->fd, offset, whence) 
+                    != (off_t) -1)) {
+
+                    return set->fd[set->fds++]->fd;
+                } else {
+                    /* failed to seek, leave fd open but mark it as 
+                     * replaceable */
+                    set->fd[set->fds++]->lru_count = 0;
+                    return -errno;
+                }
+            } else if (set->fd[set->fds]->fd >= 0) {
+                close(set->fd[set->fds]->fd);
+                set->fd[set->fds]->fd = -1;
+                return -ENOMEM;
+            } else if (((set->fds >= set->limit) 
+                || (errno == EMFILE) || (errno == ENFILE))
+              && (fdset_close(set) == FDSET_OK)) {
+                /* having closed a file, try again */
+                void **find = NULL;
+
+                errno = 0;
+                if (((set->fd[set->fds]->fd 
+                    = open((const char *) filename, flags, set->umask)) != -1)
+                  && ((set->fd[set->fds]->type = typeno), 
+                    (set->fd[set->fds]->fileno = fileno), 
+                    (set->fd[set->fds]->lru_count = UINT_MAX))
+                  && ((set->key[set->keys]->type = typeno), 
+                      (set->key[set->keys]->fileno = fileno), 
+                      (set->key[set->keys]->lru_count = UINT_MAX))
+                  /* insert into fds hashtable */
+                  && (chash_ptr_ptr_find_insert(set->fdhash, set->fd[set->fds],
+                      &find, set->fd[set->fds], &fnd) == CHASH_OK)) {
+
+                    if (fnd) {
+                        struct fd * found = *find;
+                        set->fd[set->fds]->next = found;
+                        *find = set->fd[set->fds];
+                    } else {
+                        set->keys++;
+                    }
+                    if (((whence == SEEK_CUR) && (offset == 0)) 
+                      || (lseek(set->fd[set->fds]->fd, offset, whence) 
+                          != (off_t) -1)) {
+
+                        return set->fd[set->fds++]->fd;
+                    } else {
+                        /* failed to seek, leave fd open but mark it as 
+                         * replaceable */
+                        set->fd[set->fds++]->lru_count = 0;
+                        return -errno;
+                    }
+                } else {
+                    /* couldn't open file */
+                    return -errno;
+                }
+            } else {
+                /* open failed */
+                assert(set->fd[set->fds]->fd == -1);
+                assert(errno);
+                return -errno;
+            }
+        } else {
+            return -ENOSPC;  /* filename was too long */
+        }
+    }
+
+    return -EINVAL;
+}
+
+int fdset_pin(struct fdset *set, unsigned int typeno, unsigned int fileno,
+  off_t offset, int whence) {
+    int retval = 0;
+#ifdef MT_ZET
+    pthread_mutex_lock(&set->mutex);
+#endif /* MT_ZET */
+    retval = fdset_pin_locked(set, typeno, fileno, offset, whence);
+#ifdef MT_ZET
+    pthread_mutex_unlock(&set->mutex);
+#endif /* MT_ZET */
+    return retval;
+}
+
+int fdset_debug_pin(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, off_t offset, int whence, 
+  const char * src_file, int src_line) {
+    static int count = 0;
+    int retval = 0;
+    retval = fdset_pin(set, typeno, fileno, offset, whence);
+    fprintf(stderr, "<pin %d: fd %d, type %d, fileno %d (%s: %d)>\n", count++,
+      retval, typeno, fileno, src_file, src_line);
+    return retval;
+}
+
+int fdset_name(struct fdset *set, unsigned int typeno, unsigned int fileno, 
+  char *buf, unsigned int buflen, unsigned int *len, int *write) {
+    void **find;
+    struct type *type;
+    struct specific *sp;
+
+    /* lookup name in hash tables */
+    if (chash_luint_ptr_find(set->typehash, typeno, &find) == CHASH_OK) {
+        type = *find;
+        if ((chash_luint_ptr_find(type->specific, fileno, &find) == CHASH_OK)
+            && (sp = *find)) {
+            *len = str_lcpy(buf, sp->filename, buflen);
+            *write = sp->write;
+        } else {
+            *len = snprintf((char *) buf, buflen, 
+                (const char *) type->template, fileno);
+            *write = type->write;
+        }
+        return FDSET_OK;
+    } else {
+        return -ENOENT;
+    }
+}
+
+int fdset_type_name(struct fdset *set, unsigned int typeno, 
+  char *buf, unsigned int buflen, unsigned int *len, int *write) {
+    void **find;
+    struct type *type;
+
+    /* lookup name in hash tables */
+    if (chash_luint_ptr_find(set->typehash, typeno, &find) == CHASH_OK) {
+        type = *find;
+        *write = type->write;
+        *len 
+          = untemplate(buf, buflen, type->template, str_len(type->template));
+        return FDSET_OK;
+    } else {
+        return -ENOENT;
+    }
+}
+
+static int fdset_unpin_locked(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, int fd) {
+    struct fd key,
+              *found;
+    void **find;
+
+    /* search open fd hashtable for match */
+    key.type = typeno;
+    key.fileno = fileno;
+    if (chash_ptr_ptr_find(set->fdhash, &key, &find) == CHASH_OK) {
+        found = *find;
+        while (found != NULL && found->fd != fd)
+            found = found->next;
+        if (found == NULL) {
+            return -ENOENT;
+        }
+        assert(found->lru_count == UINT_MAX);
+        found->lru_count = set->lru_default;
+        return FDSET_OK;
+    } else {
+        return -ENOENT;
+    }
+}
+
+int fdset_unpin(struct fdset *set, unsigned int typeno, unsigned int fileno, 
+  int fd) {
+    int retval = 0;
+#ifdef MT_ZET
+    pthread_mutex_lock(&set->mutex);
+#endif /* MT_ZET */
+    retval = fdset_unpin_locked(set, typeno, fileno, fd);
+#ifdef MT_ZET
+    pthread_mutex_unlock(&set->mutex);
+#endif /* MT_ZET */
+    return retval;
+}
+
+int fdset_debug_unpin(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, int fd, const char * src_file, int src_line) {
+    static int count = 0;
+    fprintf(stderr, "<unpin %d: fd %d, type %d, fileno %d (%s: %d)>\n", 
+      count++, fd, typeno, fileno, src_file, src_line);
+    return fdset_unpin(set, typeno, fileno, fd);
+}
+
+static int fdset_fd_close(struct fdset *set, int index) {
+    void **find;
+    struct fd *found;
+    struct fd *prev = NULL;
+    int ret;
+
+    /* XXX: for some reason (?) this close call can take an looong time (10s or
+     * so) on mac OS X */
+    if (close(set->fd[index]->fd) != 0) {
+        assert(!CRASH);
+        assert(errno);
+        return -errno;
+    }
+    set->fd[index]->fd = -1;
+
+    /* remove from fdhash */
+    ret = chash_ptr_ptr_find(set->fdhash, set->fd[index], &find);
+    assert(ret == CHASH_OK);
+    found = *find;
+    while (found != set->fd[index]) {
+        prev = found;
+        found = found->next;
+        assert(found != NULL);
+    }
+    if (prev == NULL) {
+        if (found->next) {
+            *find = found->next; 
+        } else {
+            void *val;
+
+            /* have removed last from list */
+            ret = chash_ptr_ptr_remove(set->fdhash, set->fd[index], &val);
+            assert(ret == CHASH_OK);
+        }
+    } else {
+        prev->next = found->next;
+    }
+    found->next = NULL;
+
+    /* move it to the end of the array of fds */
+    found = set->fd[index];
+    set->fds--;
+    memmove(&set->fd[index], &set->fd[index + 1], 
+      sizeof(found) * (set->fds - index));
+    set->fd[set->fds] = found;
+    return FDSET_OK;
+}
+
+int fdset_close(struct fdset *set) {
+    int changed;
+    unsigned int i;
+
+    /* ensure that clock pos is valid */
+    while (set->clock_pos > set->fds) {
+        set->clock_pos -= set->fds;
+    }
+
+    /* clock approximation of LRU algorithm */
+    do {
+        changed = 0;
+
+        for (i = set->clock_pos; i < set->fds; i++) {
+            if (!set->fd[i]->lru_count) {
+                set->clock_pos = i;
+                return fdset_fd_close(set, i);
+            } else {
+                /* decrements count by one if count is not set to UINT_MAX
+                 * (UINT_MAX indicates that it is pinned and can't be 
+                 * closed) */
+                if (set->fd[i]->lru_count != UINT_MAX) {
+                    set->fd[i]->lru_count--;
+                    changed = 1;
+                }
+            }
+        }
+
+        for (i = 0; i < set->clock_pos; i++) {
+            if (!set->fd[i]->lru_count) {
+                set->clock_pos = i;
+                return fdset_fd_close(set, i);
+            } else {
+                /* decrements count by one if count is not set to UINT_MAX
+                 * (UINT_MAX indicates that it is pinned and can't be 
+                 * closed) */
+                if (set->fd[i]->lru_count != UINT_MAX) {
+                    set->fd[i]->lru_count--;
+                    changed = 1;
+                }
+            }
+        }
+    } while (changed);
+
+    /* all available fds are pinned */
+    assert(fdset_opened(set) == fdset_pinned(set));
+    return -ENOENT;
+}
+
+unsigned int fdset_opened(struct fdset *set) {
+    return set->fds;
+}
+
+unsigned int fdset_pinned(struct fdset *set) {
+    unsigned int i,
+                 count = 0;
+
+    for (i = 0; i < set->fds; i++) {
+        if (set->fd[i]->lru_count == UINT_MAX) {
+            count++;
+        }
+    }
+
+    return count;
+}
+
+int fdset_isset(struct fdset *set, unsigned int typeno, unsigned int fileno, 
+  int *isset) {
+    void **find;
+    struct type *type;
+    struct specific *sp;
+
+    /* lookup name in hash tables */
+    if (chash_luint_ptr_find(set->typehash, typeno, &find) == CHASH_OK) {
+        type = *find;
+        if ((chash_luint_ptr_find(type->specific, fileno, &find) == CHASH_OK)
+            && (sp = *find)) {
+            *isset = 1;
+        } else {
+            *isset = 0;
+        }
+        return FDSET_OK;
+    }
+
+    return -EINVAL;
+}
+
+unsigned int fdset_types(struct fdset *set) {
+    return chash_size(set->typehash);
+}
+
+int fdset_close_file(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno) {
+    struct fd key,
+              *found;
+    void **find;
+    unsigned int i;
+
+    /* first, search open fd hashtable for match */
+    key.type = typeno;
+    key.fileno = fileno;
+    /* close all of the open fd's for this file */
+    if (chash_ptr_ptr_find(set->fdhash, &key, &find) == CHASH_OK) {
+        found = *find;
+        while (found) {
+            if (found->lru_count != UINT_MAX) {
+                /* XXX: linear search through fd array to determine position */
+                for (i = 0; (i < set->fds) && (set->fd[i] != found); i++) ;
+                assert((i < set->fds) && (set->fd[i] == found));
+
+                found = found->next;
+                fdset_fd_close(set, i);
+            } else {
+                fprintf(stderr, "Still pinned: fd: %d, lru_count: %u, "
+                  "type %u, fileno %u\n", found->fd, found->lru_count,
+                  found->type, found->fileno);
+                /* can't unlink, we still have open references to it */
+                return -EBUSY;
+            }
+        }
+    }
+    return FDSET_OK;
+}
+
+int fdset_unlink(struct fdset *set, unsigned int typeno, unsigned int fileno) {
+    char buf[FILENAME_MAX + 1];
+    void **find;
+    struct specific *sp;
+    struct type *type;
+    unsigned int len;
+    int ret;
+
+    ret = fdset_close_file(set, typeno, fileno);
+    if (ret < 0)
+        return ret;
+
+    /* lookup name in hash tables */
+    if (chash_luint_ptr_find(set->typehash, typeno, &find) == CHASH_OK) {
+        type = *find;
+        if ((chash_luint_ptr_find(type->specific, fileno, &find) == CHASH_OK)
+            && (sp = *find)) {
+
+            if (sp->write) {
+                if (unlink(sp->filename) == 0) {
+                    return FDSET_OK;
+                } else {
+                    return -errno;
+                }
+            } else {
+                return -EBADF;
+            }
+        } else if (type->write) {
+            len = snprintf((char *) buf, FILENAME_MAX, 
+                (const char *) type->template, fileno);
+            assert(len <= FILENAME_MAX);
+
+            if (unlink(buf) == 0) {
+                return FDSET_OK;
+            } else {
+                return -errno;
+            }
+        } else {
+            return -EBADF;
+        }
+    } else {
+        return -ENOENT;
+    }
+}
+
+/* debugging function to return the name of a repository.  DONT USE THIS FOR
+ * ANYTHING SERIOUS (uses static buffer) */
+const char *fdset_debug_name(struct fdset *set, int typeno, 
+  unsigned int fileno) {
+    void **find;
+    struct type *type;
+    struct specific *sp;
+    static char buf[FILENAME_MAX + 1];
+
+    /* lookup name in hash tables */
+    if (chash_luint_ptr_find(set->typehash, typeno, &find) == CHASH_OK) {
+        type = *find;
+        if ((chash_luint_ptr_find(type->specific, fileno, &find) == CHASH_OK)
+            && (sp = *find)) {
+            str_lcpy(buf, sp->filename, FILENAME_MAX);
+        } else {
+            snprintf((char *) buf, FILENAME_MAX, 
+                (const char *) type->template, fileno);
+        }
+        return buf;
+    } else {
+        return NULL;
+    }
+}
+
diff --git a/src/freemap.c b/src/freemap.c
new file mode 100644 (file)
index 0000000..75191f5
--- /dev/null
@@ -0,0 +1,1496 @@
+/* freemap.c implements a reasonable sorted-list freemap to allocate disk space
+ * for vectors.
+ * 
+ * The freemap has undergone a number of redesign phases in order to address
+ * performance issues (it accumulates a large number of entries during
+ * updates). The current design is to have one large linked list with all free
+ * entries on it, with a partial red-black tree index keyed on location to allow
+ * quick reallocation/freeing with merging of contiguous entries.  We also have
+ * a seperate set of linked lists that list free entries in a log range, which
+ * allows us to malloc entries with a size requirement relatively quickly.
+ *
+ * written nml 2003-04-28
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "freemap.h"
+
+#include "bit.h"
+#include "rbtree.h"
+#include "def.h"
+#include "str.h"
+#include "lcrand.h"
+#include "objalloc.h"
+
+#include "zstdint.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+
+enum freerec_flags {
+    FREEREC_INDEXED = (1 << 0)            /* whether this record is in the 
+                                           * red-black index tree */
+};
+
+/* struct to hold a single free record */
+struct freerec {
+    struct freerec *next;                 /* next in linked list */
+    struct freerec *prev;                 /* previous in linked list */
+    struct freerec *next_size;            /* next in size-based linked list */
+    struct freerec *prev_size;            /* previous in size-based list */
+    unsigned int fileno;                  /* what file space occurs in */
+    unsigned long int offset;             /* what offset it occurs at */
+    unsigned int size;                    /* how big it is */
+    enum freerec_flags flags;             /* flags associated with this record 
+                                           * (see enum above) */
+};
+
+/* number of lists we index */
+#define SIZELISTS (sizeof(int) * 8)
+
+struct freemap {
+    struct rbtree *index;                 /* red-black tree storing some of the 
+                                           * entries in the linked list, to 
+                                           * provide fast ordered access to the 
+                                           * linked list entries */
+    struct freerec *sizeindex[SIZELISTS]; /* pointers to linked list of free 
+                                           * entries where each entry is of 
+                                           * size 2^index - 2^(index + 1) */
+    struct freerec *sizetail[SIZELISTS];  /* pointers to tails of size-based 
+                                           * linked lists */
+    struct freerec *first;                /* sorted linked list of free 
+                                           * records */
+    struct freerec *unused;               /* linked list of unused free 
+                                           * records */
+    unsigned int entries;                 /* number of entries in linked list */
+    int err;                              /* last occuring error */
+    double space;                         /* amount of space in map */
+    double waste;                         /* wasted space */
+    unsigned int append;                  /* how much space we're allowed to 
+                                           * append to keep the number of 
+                                           * entries down */
+    unsigned int files;                   /* how many files we have 
+                                           * instanciated */
+    enum freemap_strategies strategy;     /* allocation strategy */
+    unsigned int index_mark;              /* integer between 0 and RAND_MAX that
+                                           * indicates what percentage of items 
+                                           * to index */
+    struct lcrand *rand;                  /* random number sequence */
+    struct objalloc *alloc;               /* node allocator */
+    void *opaque;                         /* opaque pointer for newfile fn */
+    int (*newfile)(void *opaque,          /* what to call to find out size */
+      unsigned int file,                  /* limit on a new file */
+      unsigned int *maxsize);
+};
+
+/* internal function to help qsort a set of freerecs (assuming that they can't
+ * overlap) - sorts into reverse order */
+static int freerec_cmp(const void *one, const void *two) {
+    const struct freerec *node1 = one,
+                         *node2 = two;
+
+    /* have to do it the slow way (not subtraction) because of the danger of
+     * overflow (think *very* hard before you change this - what happens when
+     * you compare UINT_MAX with 0?) */
+    if (node1->fileno == node2->fileno) {
+        if (node1->offset < node2->offset) {
+            return -1;
+        } else if (node1->offset > node2->offset) {
+            return 1;
+        } else {
+            return 0;
+        }
+    } else {
+        if (node1->fileno < node2->fileno) {
+            return -1;
+        } else if (node1->fileno > node2->fileno) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+}
+
+/* internal function to return the size of a given size-indexed list */
+static unsigned int sizelist_size(const struct freerec *rec, 
+  unsigned int *bytes) {
+    unsigned int size = 0,
+                 lbytes = 0;
+
+    while (rec) {
+        size++;
+        lbytes += rec->size;
+        rec = rec->next_size;
+    }
+
+    if (bytes) {
+        *bytes = lbytes;
+    }
+
+    return size;
+}
+
+/* internal function to ensure that the freemap is sane */
+static int freemap_invariant(struct freemap *map) {
+    if (DEAR_DEBUG) {
+        struct freerec *curr,
+                       *prev;
+        unsigned int count = 0,
+                     count2,
+                     count3,
+                     count4,
+                     i;
+        int cmp;
+
+        count = 0;
+        for ((prev = NULL), curr = map->first; curr; 
+          (prev = curr), (curr = curr->next), count++) {
+            /* check that linked lists are linked correctly */
+            if ((curr->prev != prev) || (curr->next == map->first)) {
+                assert(!CRASH);
+                return 0;
+            }
+
+            /* check for overlap and zero-length and incorrect sorting 
+             * in entries */
+            if (prev) {
+                if (!curr->size 
+                  || ((curr->fileno == prev->fileno) 
+                    && ((curr->offset <= prev->offset + prev->size) 
+                      || (curr->offset <= prev->offset)
+                      || (prev->offset + prev->size <= prev->offset)))) {
+
+                    assert(!CRASH);
+                    return 0;
+                }
+            }
+        }
+
+        for ((curr = prev), prev = NULL; curr; 
+          (prev = curr), (curr = curr->prev)) {
+            /* check that linked lists are linked correctly */
+            if (curr->next != prev) {
+                assert(!CRASH);
+                return 0;
+            }
+        }
+      
+        count4 = 0;
+        for (i = 0; i < SIZELISTS; i++) {
+            if (map->sizeindex[i] && map->sizeindex[i]->prev_size) {
+                assert(!CRASH);
+                return 0;
+            }
+
+            for ((prev = NULL), curr = map->sizeindex[i]; curr; 
+              (prev = curr), (curr = curr->next_size), count4++) {
+                /* check that linked lists are linked correctly */
+                if ((curr->prev_size != prev) 
+
+                  /* try to check for loops in lists */
+                  || (curr->next_size == map->sizeindex[i]) 
+                    || (curr->next_size 
+                      && (curr->next_size == curr->prev_size))) {
+
+                    assert(!CRASH);
+                    return 0;
+                }
+
+                /* check that the entry is of the correct size */
+                if (bit_log2(curr->size) != i) {
+                    assert(!CRASH);
+                    return 0;
+                }
+            }
+            assert(map->sizetail[i] == prev);
+
+            for ((curr = prev), prev = NULL; curr; 
+              (prev = curr), (curr = curr->prev_size)) {
+                /* check that linked lists are linked correctly */
+                if (curr->next_size != prev) {
+                    assert(!CRASH);
+                    return 0;
+                }
+            }
+        }
+
+        count3 = 0;
+        for ((prev = NULL), curr = map->unused; curr; 
+          (prev = curr), (curr = curr->next), count3++) {
+            /* check that linked lists are linked correctly */
+            if (curr->prev != prev) {
+                assert(!CRASH);
+                return 0;
+            }
+
+            /* unused entries shouldn't be indexed */
+            if (curr->flags) {
+                assert(!CRASH);
+                return 0;
+            }
+
+            /* unused entries shouldn't be sizeindexed */
+            if (curr->prev_size || curr->next_size) {
+                assert(!CRASH);
+                return 0;
+            }
+
+            /* check for overlap and incorrect sorting in entries */
+            if (prev) {
+                if ((curr->fileno == prev->fileno) 
+                  && ((curr->offset <= prev->offset + prev->size) 
+                    || (curr->offset <= prev->offset))) {
+
+                    assert(!CRASH);
+                    return 0;
+                }
+            }
+        }
+
+        for ((curr = prev), prev = NULL; curr; 
+          (prev = curr), (curr = curr->prev)) {
+            /* check that linked lists are linked correctly */
+            if (curr->next != prev) {
+                assert(!CRASH);
+                return 0;
+            }
+        }
+
+        /* check entries count is consistent */
+        if (map->entries != count + count3) {
+            assert(!CRASH);
+            return 0;
+        }
+
+        /* check that all entries are in sizeindex */
+        if (count4 != count) {
+            assert(!CRASH);
+            return 0;
+        }
+
+        /* check that free and unused lists don't overlap */
+        curr = map->first;
+        prev = map->unused;
+        while (curr && prev) {
+            cmp = freerec_cmp(curr, prev);
+
+            if (!cmp) {
+                assert(!CRASH);
+                return 0;
+            } else if (cmp < 0) {
+                if ((curr->fileno == prev->fileno) 
+                  && (curr->offset + curr->size > prev->offset)) {
+                    assert(!CRASH);
+                    return 0;
+                }
+
+                curr = curr->next;
+            } else if (cmp > 0) {
+                if ((curr->fileno == prev->fileno) 
+                  && (prev->offset + prev->size > curr->offset)) {
+                    freemap_print(map, stdout);
+                    assert(!CRASH);
+                    return 0;
+                }
+
+                prev = prev->next;
+            }
+        }
+
+        /* check that unused list has only one entry per file */
+        for ((prev = NULL), curr = map->unused; curr; 
+          (prev = curr), curr = curr->next) {
+            if (prev && (prev->fileno == curr->fileno)) {
+                assert(!CRASH);
+                return 0;
+            }
+        }
+
+        /* count number of entries without links to size-based list, and ensure
+         * that its the same as the number of singleton entries in sizeindex */
+        count = 0;
+        count2 = 0;
+        for (curr = map->first; curr; curr = curr->next) {
+            if (!curr->next_size && !curr->prev_size) {
+                count++;
+            }
+        }
+        for (i = 0; i < SIZELISTS; i++) {
+            if (map->sizeindex[i] && !map->sizeindex[i]->next_size) {
+                count2++;
+            }
+        }
+        if (count != count2) {
+            assert(!CRASH);
+            return 0;
+        }
+
+        /* count number of entries in sizeindex and ensure that its the
+         * same as number of entries in freelist */
+        count = 0;
+        count2 = 0;
+        for (curr = map->first; curr; curr = curr->next) {
+            count++;
+        }
+        for (i = 0; i < SIZELISTS; i++) {
+            for (curr = map->sizeindex[i]; curr; curr = curr->next_size) {
+                count2++;
+            }
+        }
+        if (count != count2) {
+            assert(!CRASH);
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+struct freemap *freemap_new(enum freemap_strategies strategy,
+  unsigned int append, void *opaque, 
+  int (*addfile)(void *opaque, unsigned int file, unsigned int *maxsize)) {
+    struct freemap *map;
+    unsigned int i;
+
+    if ((strategy != FREEMAP_STRATEGY_FIRST) 
+      && (strategy != FREEMAP_STRATEGY_BEST) 
+      && (strategy != FREEMAP_STRATEGY_WORST)
+      && (strategy != FREEMAP_STRATEGY_CLOSE)) {
+        return NULL;
+    }
+
+    if ((map = malloc(sizeof(*map))) 
+      && (map->index = rbtree_ptr_new(freerec_cmp))
+      && (map->rand = lcrand_new(time(NULL)))
+      && (map->alloc 
+        /* XXX: should allow setting of chunksize and underlying allocator for 
+         * object alloctor from outside interface */
+        = objalloc_new(sizeof(struct freerec), 0, !!DEAR_DEBUG, 1024, NULL))) {
+
+        map->first = map->unused = NULL;
+        map->strategy = strategy;
+        map->entries = 0;
+        map->err = 0;
+        map->space = map->waste = 0.0;
+        map->append = append;
+        map->opaque = opaque;
+        map->newfile = addfile;
+        map->files = 0;
+
+        /* FIXME: set via interface */
+        map->index_mark = ((unsigned int) 0.2 * LCRAND_MAX);  
+
+        for (i = 0; i < SIZELISTS; i++) {
+            map->sizeindex[i] = NULL;
+            map->sizetail[i] = NULL;
+        }
+
+        if (!freemap_invariant(map)) {
+            freemap_delete(map);
+            map = NULL;
+        }
+    } else {
+        if (map) {
+            if (map->index) {
+                if (map->rand) {
+                    lcrand_delete(map->rand);
+                    map->rand = NULL;
+                }
+                rbtree_delete(map->index);
+                map->index = NULL;
+            }
+            free(map);
+            map = NULL;
+        }
+    }
+
+    return map;
+}
+
+void freemap_delete(struct freemap *map) {
+    assert(freemap_invariant(map));
+
+    rbtree_delete(map->index);
+    lcrand_delete(map->rand);
+    objalloc_clear(map->alloc);
+    objalloc_delete(map->alloc);
+    free(map);
+    return;
+}
+
+/* macros to alter the sizeindex for individual records easily */
+
+#define SIZEINDEX(map, rec)                                                   \
+    do {                                                                      \
+        unsigned int sizeindex_index;                                         \
+                                                                              \
+        sizeindex_index = bit_log2(rec->size);                                \
+        assert(!rec->next_size);                                              \
+        assert(!rec->prev_size);                                              \
+        rec->prev_size = map->sizetail[sizeindex_index];                      \
+        rec->next_size = NULL;                                                \
+        if (rec->prev_size) {                                                 \
+            assert(!rec->prev_size->next_size);                               \
+            rec->prev_size->next_size = rec;                                  \
+        } else {                                                              \
+            assert(!map->sizeindex[sizeindex_index]);                         \
+            map->sizeindex[sizeindex_index] = rec;                            \
+        }                                                                     \
+        map->sizetail[sizeindex_index] = rec;                                 \
+    } while (0)
+
+#define SIZEUNINDEX(map, rec, oldsize)                                        \
+    do {                                                                      \
+        unsigned int sizeindex_index = bit_log2(oldsize);                     \
+                                                                              \
+        /* remove from old location */                                        \
+        if (rec->prev_size) {                                                 \
+            rec->prev_size->next_size = rec->next_size;                       \
+        } else {                                                              \
+            assert(rec == map->sizeindex[sizeindex_index]);                   \
+            map->sizeindex[sizeindex_index] = rec->next_size;                 \
+        }                                                                     \
+        if (rec->next_size) {                                                 \
+            rec->next_size->prev_size = rec->prev_size;                       \
+        } else {                                                              \
+            assert(rec == map->sizetail[sizeindex_index]);                    \
+            map->sizetail[sizeindex_index] = rec->prev_size;                  \
+        }                                                                     \
+        rec->prev_size = NULL;                                                \
+        rec->next_size = NULL;                                                \
+    } while (0)
+
+#define SIZEREINDEX(map, rec, oldsize)                                        \
+    SIZEUNINDEX(map, rec, oldsize); SIZEINDEX(map, rec)
+
+/* note that at various times during the next few routines we alter records that
+ * may be inserted in the index.  This would generally be a problem, since we
+ * are altering the key of an item in a sorted data structure, but since this
+ * change will not change the sorting order of the index, we should be ok */
+
+static int freemap_malloc_unused(struct freemap *map, unsigned int fileno, 
+  unsigned int offset, unsigned int *size, int options, 
+  struct freerec *unused) {
+    struct freerec *rec,
+                   *prev;
+    void **find;
+    void *findkey;
+    unsigned int tmp;
+
+    if (unused->offset != offset) {
+        /* we're either going to allocate from the middle or the end, either
+         * way we need to insert the start into the free list */
+        
+        struct freerec key;
+
+        key.offset = offset;
+        key.fileno = fileno;
+
+        /* search the red-black tree for the location nearest 
+         * specified location */
+        if (rbtree_ptr_ptr_find_near(map->index, &key, &findkey, 
+            &find) == RBTREE_OK) {
+
+            rec = *find;
+            prev = rec->prev;
+        } else {
+            rec = map->first;
+            prev = NULL;
+        }
+
+        /* search forward for correct place */
+        while (rec && freerec_cmp(rec, &key) < 0) {
+            prev = rec;
+            rec = rec->next;
+        }
+
+        if (prev && (prev->fileno == unused->fileno) 
+          && (prev->offset + prev->size == unused->offset)) {
+            /* can coalesce first half of unused record into free
+             * record */
+            tmp = prev->size;
+            prev->size += offset - unused->offset;
+            SIZEREINDEX(map, prev, tmp);
+            unused->size -= offset - unused->offset;
+            unused->offset = offset;
+        } else {
+            /* need to create a new rec to split the current record */
+            struct freerec *newrec;
+
+            if ((newrec = objalloc_malloc(map->alloc, sizeof(*newrec)))) {
+                newrec->fileno = unused->fileno;
+                newrec->offset = unused->offset;
+                newrec->size = offset - newrec->offset;
+
+                unused->size -= newrec->size;
+                unused->offset = offset;
+
+                /* insert first half into free records, to ensure
+                 * that our assumption is maintained */
+
+                newrec->next = rec;
+                newrec->prev = prev;
+                newrec->next_size = newrec->prev_size = NULL;
+                if (newrec->prev) {
+                    newrec->prev->next = newrec;
+                } else {
+                    map->first = newrec;
+                }
+                if (newrec->next) {
+                    newrec->next->prev = newrec;
+                }
+                SIZEINDEX(map, newrec);
+
+                if ((lcrand(map->rand) <= map->index_mark)
+                  /* randomly decided to index this record */
+                  && (rbtree_ptr_ptr_insert(map->index, newrec, newrec) 
+                      == RBTREE_OK)) {
+
+                    newrec->flags = FREEREC_INDEXED;
+                } else {
+                    newrec->flags = 0;
+                }
+
+                map->entries++;
+            } else {
+                /* indicate out of memory error */
+                map->err = ENOMEM;
+                assert(freemap_invariant(map));
+                return 0;
+            }
+        }
+    }
+
+    assert(unused->offset == offset);
+
+    if ((unused->size == *size) || (!(options & FREEMAP_OPT_EXACT) 
+      && (unused->size <= *size + map->append))) {
+        /* unused gets consumed by allocation */
+        *size = unused->size;
+
+        if (unused->prev) {
+            unused->prev->next = unused->next;
+        } else {
+            map->unused = unused->next;
+        }
+
+        if (unused->next) {
+            unused->next->prev = unused->prev;
+        }
+        assert(!unused->flags);
+        objalloc_free(map->alloc, unused);
+        map->entries--;
+    } else {
+        /* tail of unused remains, the rest gets allocated */
+        unused->offset += *size;
+        unused->size -= *size;
+    }
+    assert(freemap_invariant(map));
+    return 1;
+}
+
+/* internal function to handle allocation from a specific location */
+static int freemap_malloc_location(struct freemap *map, unsigned int fileno, 
+  unsigned int offset, unsigned int *size, int options) {
+    struct freerec key,
+                   *rec,
+                   *prev,
+                   *unused;
+    void **find;
+    void *findkey;
+    unsigned int tmp;
+
+    assert(freemap_invariant(map));
+
+    if (!*size) {
+        assert(freemap_invariant(map));
+        return 1;
+    }
+
+    /* note that we make the assumption that unused elements can only occur at
+     * the end of the file.  This assumption is localised, because allocating a
+     * specific location is the only way we can break that assumption.  If we
+     * move all unused space that has allocations after it to the previously
+     * used list, then everything works */
+
+    /* search the red-black tree for the location nearest specified location */
+    key.fileno = fileno;
+    key.offset = offset;
+    if (rbtree_ptr_ptr_find_near(map->index, &key, &findkey, &find) 
+          == RBTREE_OK) {
+
+        rec = *find;
+    } else {
+        rec = map->first;
+    }
+
+    /* iterate until we hit the first free block that could be it */
+    while (rec && ((rec->fileno < fileno) || ((rec->fileno == fileno) 
+      && (rec->offset + rec->size) <= offset))) {
+        rec = rec->next;
+    }
+
+    if (rec && (rec->fileno == fileno) && (rec->offset <= offset) 
+      && (rec->offset + rec->size >= offset + *size)) {
+        if (rec->offset != offset) {
+            if ((rec->size - (offset - rec->offset) == *size) 
+              || (!(options & FREEMAP_OPT_EXACT) 
+                && (rec->size - (offset - rec->offset) 
+                  <= *size + map->append))) {
+                
+                /* only the start of the record will remain, just shorten it */
+                tmp = rec->size;
+                rec->size = offset - rec->offset;
+                SIZEREINDEX(map, rec, tmp);
+            } else {
+                /* need to create a new rec to split record */
+                struct freerec *newrec;
+
+                if ((newrec = objalloc_malloc(map->alloc, sizeof(*newrec)))) {
+                    newrec->offset = offset + *size;
+                    newrec->fileno = fileno;
+                    newrec->size = rec->offset + rec->size - newrec->offset;
+
+                    tmp = rec->size;
+                    rec->size = offset - rec->offset;
+                    SIZEREINDEX(map, rec, tmp);
+
+                    newrec->next = rec->next;
+                    newrec->prev = rec;
+                    newrec->next_size = newrec->prev_size = NULL;
+                    rec->next = newrec;
+                    if (newrec->next) {
+                        newrec->next->prev = newrec;
+                    }
+                    SIZEINDEX(map, newrec);
+
+                    if ((lcrand(map->rand) <= map->index_mark)
+                      /* randomly decided to index this record */
+                      && (rbtree_ptr_ptr_insert(map->index, newrec, newrec) 
+                          == RBTREE_OK)) {
+
+                        newrec->flags = FREEREC_INDEXED;
+                    } else {
+                        newrec->flags = 0;
+                    }
+                    map->entries++;
+                } else {
+                    /* indicate out of memory error */
+                    map->err = ENOMEM;
+                    assert(freemap_invariant(map));
+                    return 0;
+                }
+            }
+        } else if ((rec->size == *size) || (!(options & FREEMAP_OPT_EXACT) 
+            && (rec->size <= *size + map->append))) {
+
+            /* rec gets consumed by allocation */
+            *size = rec->size;
+
+            SIZEUNINDEX(map, rec, rec->size);
+            if (rec->prev) {
+                rec->prev->next = rec->next;
+            } else {
+                map->first = rec->next;
+            }
+
+            if (rec->next) {
+                rec->next->prev = rec->prev;
+            }
+
+            if ((rec->flags & FREEREC_INDEXED) 
+              && (rbtree_ptr_ptr_remove(map->index, rec, &findkey) 
+                != RBTREE_OK)) {
+                assert(!CRASH);
+                objalloc_free(map->alloc, rec);
+                /* indicate failure (and just lost memory) */
+                map->err = EINVAL;
+                assert(freemap_invariant(map));
+                return 0;
+            }
+            objalloc_free(map->alloc, rec);
+            map->entries--;
+        } else {
+            tmp = rec->size;
+            rec->offset += *size;
+            rec->size -= *size;
+            SIZEREINDEX(map, rec, tmp);
+        }
+        assert(freemap_invariant(map));
+        return 1;
+    }
+
+    /* couldn't cover whole allocation with one used block.  rec points to the 
+     * only free block that can be involved in the allocation, need to find
+     * unused blocks that are involved */
+    unused = map->unused;
+    prev = NULL;
+    while (unused && ((unused->fileno < fileno) || ((unused->fileno == fileno) 
+      && (unused->offset + unused->size) <= offset))) {
+        prev = unused;
+        unused = unused->next;
+    }
+
+    if (unused && (unused->fileno == fileno) && (unused->offset <= offset) 
+      && (unused->offset + unused->size >= offset + *size)) {
+        /* allocate from unused */
+        return freemap_malloc_unused(map, fileno, offset, size, options, 
+          unused);
+    }
+
+    /* if we have a candidate from both, and they're both in the correct 
+     * file ... */
+    if (unused && rec && (unused->fileno == fileno) 
+      && (unused->fileno == rec->fileno) 
+      /* ... and they're contiguous with rec first (has to be first under our
+       * unused-at-the-end assumption) */
+      && (unused->offset == rec->offset + rec->size)) {
+        unsigned int start = offset - rec->offset;
+        unsigned int end = unused->size + rec->size - start - *size;
+
+        /* start is the offset from the start of rec to the start of the
+         * allocation.  end is the amount of space left in unused after
+         * allocation */
+
+        if (!end || (!(options & FREEMAP_OPT_EXACT) && (end <= map->append))) {
+            /* unused is consumed by the allocation, remove it */
+
+            /* calculate size of allocated block, note that we need to do this
+             * before we fiddle with the rec record using start value below */
+            *size = rec->size + unused->size - start;
+
+            if (unused->prev) {
+                unused->prev->next = unused->next;
+            } else {
+                map->unused = unused->next;
+            }
+
+            if (unused->next) {
+                unused->next->prev = unused->prev;
+            }
+            assert(!unused->flags);
+            objalloc_free(map->alloc, unused);
+            map->entries--;
+        } else {
+            unused->offset = unused->offset + unused->size - end;
+            unused->size = end;
+        }
+
+        if (!start) {
+            /* rec is consumed by the allocation, remove it */
+            assert(rec->offset + rec->size < offset + *size);
+
+            SIZEUNINDEX(map, rec, rec->size);
+            if (rec->prev) {
+                rec->prev->next = rec->next;
+            } else {
+                map->first = rec->next;
+            }
+
+            if (rec->next) {
+                rec->next->prev = rec->prev;
+            }
+
+            if ((rec->flags & FREEREC_INDEXED) 
+              && (rbtree_ptr_ptr_remove(map->index, rec, &findkey) 
+                != RBTREE_OK)) {
+
+                assert(!CRASH);
+                objalloc_free(map->alloc, rec);
+                /* indicate failure (and just lost memory) */
+                map->err = EINVAL;
+                assert(freemap_invariant(map));
+                return 0;
+            }
+            objalloc_free(map->alloc, rec);
+            map->entries--;
+        } else {
+            assert(rec->offset < offset);
+            tmp = rec->size;
+            rec->size = start;
+            SIZEREINDEX(map, rec, tmp);
+        }
+
+        assert(freemap_invariant(map));
+        return 1;
+    }
+
+    /* get allocations from allocating function if necessary */
+    while ((!unused || (fileno > unused->fileno)) && (fileno >= map->files)) {
+        if ((unused = objalloc_malloc(map->alloc, sizeof(*unused))) 
+          /* get a new allocation from the providing function */
+          && (map->newfile(map->opaque, map->files, &unused->size))) {
+            map->space += unused->size;
+            unused->fileno = map->files++;
+            unused->offset = 0;
+           
+            unused->prev_size = unused->next_size = NULL;
+            unused->prev = prev;
+            unused->next = NULL;
+            if (prev) {
+                assert(prev->next == NULL);
+                prev->next = unused;
+            } else {
+                map->unused = unused;
+            }
+            unused->flags = 0;
+            prev = unused;
+            map->entries++;
+        } else {
+            /* indicate failure */
+            map->err = ENOMEM;
+            if (unused) {
+                objalloc_free(map->alloc, unused);
+            }
+            assert(freemap_invariant(map));
+            return 0;
+        }
+    }
+
+    if (unused && (unused->fileno == fileno) && (unused->offset <= offset) 
+      && (unused->offset + unused->size >= offset + *size)) {
+        /* allocate from unused */
+        return freemap_malloc_unused(map, fileno, offset, size, options, 
+          unused);
+    }
+
+    return 0;
+}
+
+int freemap_malloc(struct freemap *map, unsigned int *fileno, 
+  unsigned long int *offset, unsigned int *size, int options, ...) {
+    va_list varargs;
+    struct freerec *rec = NULL;
+    unsigned int space,
+                 tmp;
+    unsigned int lsize = *size,         /* local copy of size */
+                 index,
+                 i;
+    void *findkey;
+
+    assert(freemap_invariant(map));
+
+    va_start(varargs, options);
+    if (options & FREEMAP_OPT_LOCATION) {
+        /* deal with LOCATION in a different function, too hard otherwise */
+        unsigned int fileno = (unsigned int) va_arg(varargs, unsigned int);
+        unsigned long int offset 
+          = (unsigned int) va_arg(varargs, unsigned long int);
+
+        va_end(varargs);
+        return freemap_malloc_location(map, fileno, offset, size, options);
+    }
+    va_end(varargs);
+
+    if (!lsize) {
+        *fileno = 0;
+        *offset = 0;
+        return 1;
+    }
+
+    index = bit_log2(lsize);
+    switch (map->strategy) {
+    case FREEMAP_STRATEGY_FIRST:
+        /* first-fit along location-based list */
+        for (rec = map->first; rec && (rec->size < lsize); rec = rec->next) ;
+        break;
+
+    case FREEMAP_STRATEGY_CLOSE:
+        /* search, ascending up to larger sizeindex lists, for an entry to fit
+         * this size */
+        rec = NULL;
+        i = index;
+        do {
+            for (rec = map->sizeindex[i]; rec && (rec->size < lsize); 
+              rec = rec->next_size) ;
+        } while (!rec && (++i < SIZELISTS));
+        break;
+
+    case FREEMAP_STRATEGY_BEST:
+        /* search, ascending up to larger sizeindex lists, for the best entry in
+         * this list (which will be the best fit overall) to fit this size */
+        i = index;
+        do {
+            struct freerec *best;
+
+            /* find first acceptable chunk */
+            for (best = map->sizeindex[i]; best && (best->size < lsize); 
+              best = best->next_size) ;
+
+            /* have found first fit, now process the rest to find best fit */
+            if (best) {
+                for (rec = best->next_size; rec; rec = rec->next_size) {
+                    if ((rec->size >= lsize) && (rec->size < best->size)) {
+                        best = rec;
+                    }
+                }
+            }
+
+            rec = best;
+        } while (!rec && (++i < SIZELISTS));
+        break;
+
+    case FREEMAP_STRATEGY_WORST:
+        /* search, descending down from larger sizeindex lists, for the worst 
+         * entry in this list (which will be the worst fit overall) to fit 
+         * this size */
+        i = SIZELISTS - 1;
+        do {
+            struct freerec *worst;
+
+            /* find first acceptable chunk */
+            for (worst = map->sizeindex[i]; worst && (worst->size < lsize); 
+              worst = worst->next_size) ;
+
+            /* have found first fit, now process the rest to find worst fit */
+            if (worst) {
+                for (rec = worst->next_size; rec; rec = rec->next_size) {
+                    if ((rec->size >= lsize) && (rec->size > worst->size)) {
+                        worst = rec;
+                    }
+                }
+            }
+
+            rec = worst;
+        } while (!rec && (i-- + 1 > index));
+        break;
+
+    default: 
+        assert("can't get here" && 0);
+        break;
+    }
+
+    /* if we've selected a record it should be suitable... */
+    assert(!rec || (rec->size >= lsize));
+
+    /* ...but we'll check anyway */
+    if (rec && (rec->size >= lsize)) {
+        /* allocate from rec and return it */
+        *fileno = rec->fileno;
+        *offset = rec->offset;
+
+        if ((rec->size == lsize) 
+          || (!(options & FREEMAP_OPT_EXACT) 
+          && (rec->size <= lsize + map->append))) {
+            /* its a close fit, just allocate all of it */
+            *size = rec->size;
+
+            SIZEUNINDEX(map, rec, rec->size);
+            if (rec->prev) {
+                rec->prev->next = rec->next;
+            } else {
+                map->first = rec->next;
+            }
+
+            if (rec->next) {
+                rec->next->prev = rec->prev;
+            }
+
+            if ((rec->flags & FREEREC_INDEXED) 
+              && (rbtree_ptr_ptr_remove(map->index, rec, &findkey) 
+                != RBTREE_OK)) {
+
+                assert(!CRASH);
+                objalloc_free(map->alloc, rec);
+                /* indicate failure (and just lost memory) */
+                map->err = EINVAL;
+                return 0;
+            }
+            objalloc_free(map->alloc, rec);
+            map->entries--;
+        } else {
+            /* need to fragment space */
+            tmp = rec->size;
+            rec->size -= lsize;
+            rec->offset += lsize;
+            SIZEREINDEX(map, rec, tmp);
+        }
+        assert(freemap_invariant(map));
+        return 1;
+    } else {
+        /* check for unused portions that we can use on a first-fit basis */
+        struct freerec *prev = NULL;
+
+        rec = map->unused;
+
+        while (rec) {
+            prev = rec;
+            if (rec->size >= lsize) {
+                *fileno = rec->fileno;
+                *offset = rec->offset;
+
+                if ((rec->size == lsize) || (!(options & FREEMAP_OPT_EXACT) 
+                    && (rec->size <= lsize + map->append))) {
+
+                    /* its a close fit, just allocate all of it */
+                    *size = rec->size;
+
+                    if (rec->prev) {
+                        rec->prev->next = rec->next;
+                    } else {
+                        map->unused = rec->next;
+                    }
+
+                    if (rec->next) {
+                        rec->next->prev = rec->prev;
+                    }
+
+                    assert(!rec->flags);
+                    objalloc_free(map->alloc, rec);
+
+                    map->entries--;
+                } else {
+                    /* need to fragment space */
+                    rec->size -= lsize;
+                    rec->offset += lsize;
+                }
+
+                assert(freemap_invariant(map));
+                return 1;
+            }
+            rec = rec->next;
+        }
+
+        /* get a new allocation from the providing function */
+        if (map->newfile(map->opaque, map->files, &space)) {
+            map->space += space;
+            map->files++;
+
+            if ((space == lsize)
+              || (!(options & FREEMAP_OPT_EXACT) 
+                && (space <= lsize + map->append)
+                && (space >= lsize))) {
+
+                /* whole file goes to new allocation */
+                *fileno = map->files - 1;
+                *offset = 0;
+                *size = space;
+                assert(freemap_invariant(map));
+                return 1;
+            } else {
+                /* need to allocate an unused link.  Note that we put new unused
+                 * links at the back of the unused link list so that space in
+                 * earlier files gets used in preference to space in later
+                 * files. */
+                if ((rec = objalloc_malloc(map->alloc, sizeof(*rec)))) {
+                    if (space < lsize) {
+                        /* not enough space returned, save it and indicate
+                         * failure */
+                        rec->fileno = map->files - 1;
+                        rec->offset = 0;
+                        rec->size = space;
+                    } else {
+                        /* more than enough space returned, save extra and
+                         * return success */
+                        rec->fileno = *fileno = map->files - 1;
+                        *offset = 0;
+                        rec->offset = lsize;
+                        rec->size = space - lsize;
+                    }
+
+                    rec->flags = 0;
+                    rec->next = NULL;
+                    rec->prev = prev;
+                    rec->prev_size = rec->next_size = NULL;
+                    if (prev) {
+                        prev->next = rec;
+                    } else {
+                        map->unused = rec;
+                    }
+                    map->entries++;
+                       
+                    assert(freemap_invariant(map));
+                    if (space < lsize) {
+                        return 0;
+                    } else {
+                        return 1;
+                    }
+                } else {
+                    /* need to indicate out of memory error */
+                    map->err = ENOMEM;
+                    return 0;
+                }
+            }
+        }
+    }
+
+    return 0;
+}
+
+int freemap_free(struct freemap *map, unsigned int fileno, 
+  unsigned long int offset, unsigned int size) {
+    struct freerec key,
+                   *rec,
+                   *prev;
+    void **find;
+    void *findkey;
+    unsigned int tmp;
+
+    assert(freemap_invariant(map));
+
+    if (!size) {
+        return 1;
+    }
+
+    /* find position in freelist */
+    key.fileno = fileno;
+    key.offset = offset;
+    key.size = 0;
+
+    /* search the red-black tree for the location nearest specified 
+     * location */
+    if (rbtree_ptr_ptr_find_near(map->index, &key, &findkey, &find) 
+        == RBTREE_OK) {
+
+        rec = *find;
+        prev = NULL;
+    } else {
+        rec = map->first;
+        prev = NULL;
+    }
+
+    /* search forward for correct place */
+    while (rec && (freerec_cmp(rec, &key) < 0)) {
+        assert(rec->fileno != fileno 
+          || (rec->offset + rec->size <= offset));
+        prev = rec;
+        rec = rec->next;
+    }
+
+    /* shouldn't have actually found a match */
+    assert(!rec || freerec_cmp(rec, &key));
+
+    /* try to coalesce it with the previous entry */
+    if (prev && (prev->fileno == fileno) 
+      && (prev->offset + prev->size == offset)) {
+        tmp = prev->size;
+        prev->size += size;
+        SIZEREINDEX(map, prev, tmp);
+
+        /* try to coalesce with next as well */
+        if (rec && (rec->fileno == fileno) 
+          && (offset + size == rec->offset)) {
+            tmp = prev->size;
+            prev->size += rec->size;
+            SIZEREINDEX(map, prev, tmp);
+
+            /* don't need rec any more, remove it */
+            SIZEUNINDEX(map, rec, rec->size);
+            prev->next = rec->next;
+            if (rec->next) {
+                rec->next->prev = prev;
+            }
+
+            if ((rec->flags & FREEREC_INDEXED) 
+              && (rbtree_ptr_ptr_remove(map->index, rec, &findkey) 
+                != RBTREE_OK)) {
+
+                assert(!CRASH);
+                objalloc_free(map->alloc, rec);
+                /* indicate failure (and just lost memory) */
+                map->err = EINVAL;
+                return 0;
+            }
+
+            objalloc_free(map->alloc, rec);
+            map->entries--;
+        }
+    /* try to coalesce it with next entry */
+    } else if (rec && (rec->fileno == fileno)
+      && (offset + size == rec->offset)) {
+        tmp = rec->size;
+        rec->size += size;
+        rec->offset -= size;
+        SIZEREINDEX(map, rec, tmp);
+    /* need to insert new record for this entry */
+    } else {
+        struct freerec *newrec;
+
+        if ((newrec = objalloc_malloc(map->alloc, sizeof(*newrec)))) {
+            newrec->fileno = fileno;
+            newrec->offset = offset;
+            newrec->size = size;
+
+            newrec->prev = prev;
+            newrec->next = rec;
+            newrec->next_size = newrec->prev_size = NULL;
+            if (prev) {
+                prev->next = newrec;
+            } else {
+                map->first = newrec;
+            }
+            if (rec) {
+                rec->prev = newrec;
+            }
+            SIZEINDEX(map, newrec);
+            map->entries++;
+
+            if ((lcrand(map->rand) <= map->index_mark)
+              /* randomly decided to index this record */
+              && (rbtree_ptr_ptr_insert(map->index, newrec, newrec) 
+                == RBTREE_OK)) {
+
+                newrec->flags = FREEREC_INDEXED;
+            } else {
+                newrec->flags = 0;
+            }
+        } else {
+            /* indicate out of memory error */
+            map->err = ENOMEM;
+            return 0;
+        }
+    }
+
+    assert(freemap_invariant(map));
+    return 1;
+}
+
+int freemap_waste(struct freemap *map, unsigned int fileno, 
+  unsigned long int offset, unsigned int size) {
+    map->waste += size;
+    return 1;
+}
+
+unsigned int freemap_realloc(struct freemap *map, unsigned int fileno, 
+  unsigned long int offset, unsigned int size, unsigned int additional, 
+  int options, ...) {
+    struct freerec key,
+                   *rec,
+                   *prev;
+    void **find;
+    void *findkey;
+    unsigned int tmp;
+
+    assert(freemap_invariant(map));
+
+    /* find position in freelist */
+    key.fileno = fileno;
+    key.offset = offset + size;
+
+    /* search the red-black tree for the location nearest specified 
+     * location */
+    if (rbtree_ptr_ptr_find_near(map->index, &key, &findkey, &find) 
+        == RBTREE_OK) {
+
+        rec = *find;
+        prev = rec->prev;
+    } else {
+        rec = map->first;
+        prev = NULL;
+    }
+
+    /* search forward for correct place */
+    while (rec && freerec_cmp(rec, &key) < 0) {
+        prev = rec;
+        rec = rec->next;
+    }
+
+    if (rec && (rec->fileno == fileno) && (rec->offset == offset + size) 
+      && (rec->size >= additional)) {
+
+        if (rec->size == additional || (!(options & FREEMAP_OPT_EXACT) 
+          && (rec->size <= additional + map->append))) {
+            /* rec is consumed by allocation */
+            tmp = rec->size;
+
+            SIZEUNINDEX(map, rec, rec->size);
+            assert(rec->prev == prev);
+            if (prev) {
+                prev->next = rec->next;
+            } else {
+                map->first = rec->next;
+            }
+
+            if (rec->next) {
+                rec->next->prev = prev;
+            }
+
+            if ((rec->flags & FREEREC_INDEXED) 
+              && (rbtree_ptr_ptr_remove(map->index, rec, &findkey) 
+                != RBTREE_OK)) {
+
+                assert(!CRASH);
+                objalloc_free(map->alloc, rec);
+                /* indicate failure (and just lost memory) */
+                map->err = EINVAL;
+                return 0;
+            }
+
+            map->entries--;
+            assert(freemap_invariant(map));
+            objalloc_free(map->alloc, rec);
+            return tmp;
+        } else {
+            tmp = rec->size;
+            rec->size -= additional;
+            rec->offset += additional;
+            SIZEREINDEX(map, rec, tmp);
+            assert(freemap_invariant(map));
+            return additional;
+        }
+    }
+
+    /* attempt to realloc from unused */
+    rec = map->unused;
+
+    /* search forward for correct place */
+    while (rec && freerec_cmp(rec, &key) < 0) {
+        prev = rec;
+        rec = rec->next;
+    }
+
+    if (rec && (rec->fileno == fileno) && (rec->offset == offset + size) 
+      && (rec->size >= additional)) {
+
+        if (rec->size == additional || (!(options & FREEMAP_OPT_EXACT) 
+          && (rec->size <= additional + map->append))) {
+            /* rec is consumed by allocation */
+            tmp = rec->size;
+
+            if (prev) {
+                prev->next = rec->next;
+            } else {
+                map->unused = rec->next;
+            }
+
+            if (rec->next) {
+                rec->next->prev = prev;
+            }
+
+            assert(!rec->flags);
+            map->entries--;
+            assert(freemap_invariant(map));
+            objalloc_free(map->alloc, rec);
+            return tmp;
+        } else {
+            rec->size -= additional;
+            rec->offset += additional;
+            assert(freemap_invariant(map));
+            return additional;
+        }
+    }
+
+    return 0;
+}
+
+int freemap_err(const struct freemap *map) {
+    return map->err;
+}
+
+double freemap_utilisation(const struct freemap *map) {
+    double free = 0.0;
+    double unused = 0.0;
+    const struct freerec *rec;
+
+    for (rec = map->first; rec; rec = rec->next) {
+        free += rec->size;
+    }
+
+    for (rec = map->unused; rec; rec = rec->next) {
+        unused += rec->size;
+    }
+
+    if (map->space == unused) {
+        return 1.0;
+    } else {
+        return (map->space - (unused + free)) / (map->space - unused);
+    }
+}
+
+double freemap_space(const struct freemap *map) {
+    double unused = 0.0;
+    const struct freerec *rec;
+
+    for (rec = map->unused; rec; rec = rec->next) {
+        unused += rec->size;
+    }
+
+    return map->space - unused;
+}
+
+void freemap_print(const struct freemap *map, FILE *output) {
+    struct freerec *rec;
+
+    for (rec = map->first; rec; rec = rec->next) {
+        fprintf(output, "(%u %lu) size %u %s\n", rec->fileno, rec->offset, 
+          rec->size, rec->flags & FREEREC_INDEXED ? "(indexed)" : "");
+    }
+
+    for (rec = map->unused; rec; rec = rec->next) {
+        fprintf(output, "(%u %lu) size %u (unused)\n", rec->fileno, rec->offset,
+          rec->size);
+    }
+
+    return;
+}
+
+unsigned int freemap_entries(const struct freemap *fm) {
+    return fm->entries;
+}
+
+double freemap_wasted(const struct freemap *fm) {
+    return fm->waste;
+}
+
+unsigned int freemap_append(const struct freemap *fm) {
+    return fm->append;
+}
+
+unsigned int freemap_indexed_entries(const struct freemap *fm) {
+    return rbtree_size(fm->index);
+}
+
+enum freemap_strategies freemap_strategy(const struct freemap *fm) {
+    return fm->strategy;
+}
+
+unsigned int freelist_size(const struct freerec *rec) {
+    unsigned int i = 0;
+
+    while (rec) {
+        rec = rec->next;
+        i++;
+    }
+
+    return i;
+}
+
+unsigned int freelist_size_size(const struct freerec *rec) {
+    unsigned int i = 0;
+
+    while (rec) {
+        rec = rec->next_size;
+        i++;
+    }
+
+    return i;
+}
+
+void freemap_print_profile(const struct freemap *map, FILE *output) {
+    unsigned int i;
+    struct freerec *rec;
+    double total = freemap_space(map);
+
+    for (i = 0; i < SIZELISTS; i++) {
+        unsigned int count,
+                     sum;
+
+        count = sizelist_size(map->sizeindex[i], &sum);
+        fprintf(output, "%u - %u: %u entries %u bytes, %f%%\n", 
+          BIT_POW2(i), BIT_POW2(i) + (BIT_POW2(i) - 1), count, sum, 
+          sum * 100.0 / total);
+    }
+
+    for (rec = map->unused; rec; rec = rec->next) {
+        fprintf(output, "unused: %u %lu %u\n", rec->fileno, rec->offset, 
+          rec->size);
+    }
+}
+
diff --git a/src/getlongopt.c b/src/getlongopt.c
new file mode 100644 (file)
index 0000000..a4177ec
--- /dev/null
@@ -0,0 +1,579 @@
+/* getlongopt.c implements option parsing as specified in getlongopt.h
+ * and following the principles put forward in the Single Unix
+ * Specification v3 in the section on getopt the function.
+ *
+ * written nml 2003-04-11
+ *
+ */
+
+/* FIXME: seems to accept args for NONE types */
+
+#include "firstinclude.h"
+
+#include "getlongopt.h"
+
+#include "str.h"
+
+#include <errno.h>
+#include <stdlib.h>
+
+/* all information needed to parse arguments */
+struct getlongopt {
+    unsigned int argc;                   /* size of array of arguments */
+    const char **argv;                   /* array of arguments */
+
+    struct getlongopt_opt *optstring;    /* array of options */
+    unsigned int optstrings;             /* size of array of options */
+
+    unsigned int optind;                 /* argument we're up to */
+    unsigned int pos;                    /* position in argument we're up to */
+};
+
+struct getlongopt *getlongopt_new(unsigned int argc, const char **argv,
+  struct getlongopt_opt *optstring, unsigned int optstrings) {
+    struct getlongopt *opts = malloc(sizeof(*opts));
+    unsigned int i;
+
+    if (opts) {
+        opts->argc = argc;
+        opts->argv = argv;
+        opts->optstring = optstring;
+        opts->optstrings = optstrings;
+        
+        opts->optind = 0;
+        opts->pos = 0;
+
+        /* check that the argument values are valid */
+        for (i = 0; i < optstrings; i++) {
+            if ((optstring[i].argument != GETLONGOPT_ARG_NONE)
+              && (optstring[i].argument != GETLONGOPT_ARG_REQUIRED)
+              && (optstring[i].argument != GETLONGOPT_ARG_OPTIONAL)) {
+                errno = EINVAL;
+                free(opts);
+                return NULL;
+            }
+        }
+    }
+
+    return opts;
+}
+
+void getlongopt_delete(struct getlongopt *opts) {
+    free(opts);
+}
+
+unsigned int getlongopt_optind(struct getlongopt *opts) {
+    return opts->optind;
+}
+
+static int matchshort(struct getlongopt *opts, unsigned int *optind, 
+  unsigned int *optpos, int *optid, const char **optarg, int recurse);
+
+/* internal function to match a long argument and take appropriate action */
+static int matchlong(struct getlongopt *opts, unsigned int *optind, 
+  int *optid, const char **optarg, int recurse) {
+    unsigned int i,
+                 tmpoptind;
+
+    for (i = 0; i < opts->optstrings; i++) {
+        /* check for '--opt arg' syntax */
+        if (opts->optstring[i].longname 
+          && !str_cmp(opts->optstring[i].longname, &opts->argv[*optind][2])) {
+
+            switch (opts->optstring[i].argument) {
+            case GETLONGOPT_ARG_NONE:
+                /* its easy if no argument is allowed */
+                *optarg = NULL;
+                (*optind)++;
+                *optid = opts->optstring[i].id;
+                return GETLONGOPT_OK;
+
+            case GETLONGOPT_ARG_REQUIRED:
+                /* make sure that there actually is an argument following */
+                *optid = opts->optstring[i].id;
+                if ((++(*optind) < opts->argc) && opts->argv[*optind]) {
+                    *optarg = opts->argv[(*optind)++];
+                    return GETLONGOPT_OK;
+                } else {
+                    return GETLONGOPT_MISSING_ARG;
+                }
+                break;
+
+            case GETLONGOPT_ARG_OPTIONAL:
+                /* check for arg and match */
+                tmpoptind = *optind + 1;
+
+                if ((tmpoptind >= opts->argc) || !opts->argv[tmpoptind] 
+                  || !recurse) {
+                    /* matched without argument */
+                    *optid = opts->optstring[i].id;
+                    *optarg = NULL;
+                    (*optind)++;
+                    return GETLONGOPT_OK;
+                }
+
+                if (*opts->argv[tmpoptind] == '-') {
+                    if (opts->argv[tmpoptind][1] == '-') {
+
+                        /* check if we could use next item as an option.  If so,
+                         * don't match if as an argument */
+                        if ((matchlong(opts, &tmpoptind, optid, optarg, 0) 
+                            == GETLONGOPT_OK)
+
+                          /* check for '--', don't match as arg */
+                          || !opts->argv[tmpoptind][2]) {
+                            /* matched without argument */
+                            *optid = opts->optstring[i].id;
+                            *optarg = NULL;
+                            (*optind)++;
+                            return GETLONGOPT_OK;
+                        }
+                    } else {
+                        unsigned int tmpoptpos = 1;
+                        if (matchshort(opts, &tmpoptind, &tmpoptpos, 
+                            optid, optarg, 0) == GETLONGOPT_OK) {
+                            /* matched without argument */
+                            *optid = opts->optstring[i].id;
+                            *optarg = NULL;
+                            (*optind)++;
+                            return GETLONGOPT_OK;
+                        }
+                    }
+                }
+
+                /* matched with argument */
+                *optid = opts->optstring[i].id;
+                (*optind)++;
+                *optarg = opts->argv[*optind];
+                (*optind)++;
+                return GETLONGOPT_OK;
+
+            default:
+                return GETLONGOPT_ERR;
+            };
+
+        /* check for --opt=arg syntax */
+        } else if (opts->optstring[i].longname 
+          && !str_ncmp(opts->optstring[i].longname, 
+              &opts->argv[*optind][2], str_len(opts->optstring[i].longname)) 
+            && (opts->argv[*optind][2 + str_len(opts->optstring[i].longname)] 
+              == '=')) {
+            *optid = opts->optstring[i].id;
+
+            switch (opts->optstring[i].argument) {
+            case GETLONGOPT_ARG_NONE:
+                /* no argument is allowed */
+                *optarg = NULL;
+                (*optind)++;
+                return GETLONGOPT_OK;
+
+            case GETLONGOPT_ARG_REQUIRED:
+            case GETLONGOPT_ARG_OPTIONAL:
+                *optarg = &opts->argv[*optind][3 
+                  + str_len(opts->optstring[i].longname)];
+                (*optind)++;
+                return GETLONGOPT_OK;
+                break;
+
+            default:
+                return GETLONGOPT_ERR;
+            };
+        }
+    }
+
+    /* couldn't match argument */
+    return GETLONGOPT_UNKNOWN;
+}
+
+/* internal function to match a short argument and take appropriate action */
+static int matchshort(struct getlongopt *opts, unsigned int *optind, 
+  unsigned int *optpos, int *optid, const char **optarg, int recurse) {
+    unsigned int i,
+                 tmpoptind;
+
+    for (i = 0; i < opts->optstrings; i++) {
+        if (opts->optstring[i].shortname == opts->argv[*optind][*optpos]) {
+            *optid = opts->optstring[i].id;
+
+            switch (opts->optstring[i].argument) {
+            case GETLONGOPT_ARG_NONE:
+                /* no argument is allowed */
+                *optarg = NULL;
+                (*optpos)++;
+                return GETLONGOPT_OK;
+
+            case GETLONGOPT_ARG_REQUIRED:
+                if (opts->argv[*optind][++(*optpos)]) {
+                    /* there's still more options in this argument */
+                    return GETLONGOPT_MISSING_ARG;
+                }
+
+                /* make sure that there actually is an argument following */
+                if ((++(*optind) < opts->argc) && opts->argv[*optind]) {
+                    *optarg = opts->argv[(*optind)++];
+                    *optpos = 0;
+                    return GETLONGOPT_OK;
+                } else {
+                    return GETLONGOPT_MISSING_ARG;
+                }
+                break;
+
+            case GETLONGOPT_ARG_OPTIONAL:
+                /* check for arg and match */
+                tmpoptind = *optind + 1;
+
+                if ((tmpoptind >= opts->argc) || !opts->argv[tmpoptind] 
+                  || !recurse || opts->argv[*optind][*optpos + 1]) {
+                    /* matched without argument */
+                    *optid = opts->optstring[i].id;
+                    *optarg = NULL;
+                    (*optpos)++;
+                    return GETLONGOPT_OK;
+                }
+
+                if (*opts->argv[tmpoptind] == '-') {
+                    if (opts->argv[tmpoptind][1] == '-') {
+                        if (matchlong(opts, &tmpoptind, optid, optarg, 0) 
+                            == GETLONGOPT_OK) {
+                            /* matched without argument */
+                            *optid = opts->optstring[i].id;
+                            *optarg = NULL;
+                            (*optpos)++;
+                            return GETLONGOPT_OK;
+                        }
+                    } else {
+                        unsigned int tmpoptpos = 1;
+                        if (matchshort(opts, &tmpoptind, &tmpoptpos, 
+                            optid, optarg, 0) == GETLONGOPT_OK) {
+                            /* matched without argument */
+                            *optid = opts->optstring[i].id;
+                            *optarg = NULL;
+                            (*optpos)++;
+                            return GETLONGOPT_OK;
+                        }
+                    }
+                }
+
+                /* matched with argument */
+                *optid = opts->optstring[i].id;
+                (*optind)++;
+                *optarg = opts->argv[*optind];
+                (*optind)++;
+                *optpos = 0;
+                return GETLONGOPT_OK;
+
+            default:
+                return GETLONGOPT_ERR;
+            };
+        }
+    }
+
+    /* couldn't match argument */
+    return GETLONGOPT_UNKNOWN;
+}
+
+int getlongopt(struct getlongopt *opts, int *optid, const char **optarg) {
+
+    /* catch a couple of silly cases */
+    if ((opts->optind >= opts->argc) || !opts->argv[opts->optind]) {
+        /* came to the end of the arguments */
+        return GETLONGOPT_END;
+    }
+
+    if (opts->pos && opts->argv[opts->optind][opts->pos]) {
+        /* have previously parsed a short option, match next charater
+         * against other short options */
+        return matchshort(opts, &opts->optind, &opts->pos, optid, optarg, 1);
+    } else if (opts->pos) {
+        /* came to the end of the current string, advance to the next */
+        opts->pos = 0;
+        opts->optind++;
+    }
+
+    if (opts->argv[opts->optind]) {
+        if (*opts->argv[opts->optind] == '-') {
+            if (opts->argv[opts->optind][1] == '-') {
+                if (opts->argv[opts->optind][2]) {
+                    /* its a long option, try and match it */
+                    return matchlong(opts, &opts->optind, optid, optarg, 1);
+                } else {
+                    /* came to '--', that ends parsing */
+                    return GETLONGOPT_END;
+                }
+            } else if (opts->argv[opts->optind][1]) {
+                /* its a short option, try and match it */
+                opts->pos = 1;
+                return matchshort(opts, &opts->optind, &opts->pos, optid, 
+                  optarg, 1);
+            } else {
+                /* got a single '-', which is an argument and ends parsing */
+                return GETLONGOPT_END;
+            }
+        } else {
+            /* not an option, that ends parsing */
+            return GETLONGOPT_END;
+        }
+    } else {
+        /* came to the end of the arguments */
+        return GETLONGOPT_END;
+    }
+}
+
+#ifdef GETLONGOPT_TEST
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define BUFSIZE 2048
+
+int main(int argc, char *argv[]) {
+    char buf[BUFSIZE];
+    char buf2[BUFSIZE];
+    char buf3[BUFSIZE];
+    unsigned int opts = 0;
+    unsigned int cap = 0,
+                 i;
+    enum getlongopt_ret ret;
+    struct getlongopt_opt *opt = NULL;
+    struct getlongopt *parser = NULL;
+    FILE *input;
+    int verbose = 0;
+    unsigned int line = 0;
+
+    if (argc == 1) {
+        input = stdin;
+    } else if (argc == 2) {
+        if ((input = fopen(argv[1], "rb"))) {
+
+        } else {
+            perror(*argv);
+            return EXIT_FAILURE;
+        }
+    } else if ((argc == 3) && (!str_cmp(argv[1], "-v"))) {
+        if ((input = fopen(argv[2], "rb"))) {
+            verbose = 1;
+        } else {
+            perror(*argv);
+            return EXIT_FAILURE;
+        }
+    } else {
+        fprintf(stderr, "too many args\n");
+        return EXIT_FAILURE;
+    }
+
+    while (fgets(buf, BUFSIZE, input)) {
+        line++;
+        str_rtrim(buf);
+        if (verbose) {
+            printf("> %s\n", buf);
+        }
+        if (!str_ncmp(buf, "option", str_len("option"))) {
+            /* add new option */
+            if (opts >= cap) {
+                void *ptr;
+                if ((ptr = realloc(opt, (2 * cap + 1) * sizeof(*opt)))) {
+                    opt = ptr;
+                    cap = 2 * cap + 1;
+                } else {
+                    perror(*argv);
+                    return EXIT_FAILURE;
+                }
+            }
+
+            if ((sscanf(buf + str_len("option"), "%s %c %d %d", buf2, 
+                &opt[opts].shortname, (int*) &opt[opts].argument, 
+                &opt[opts].id) == 4) 
+              && (opt[opts].longname = str_dup(buf2))) {
+                if (verbose) {
+                    printf("added %s %c %s id %d\n", opt[opts].longname, 
+                      opt[opts].shortname,
+                      opt[opts].argument == GETLONGOPT_ARG_NONE ? "no arg" 
+                        : opt[opts].argument == GETLONGOPT_ARG_REQUIRED 
+                          ? "arg req" 
+                            : opt[opts].argument == GETLONGOPT_ARG_OPTIONAL 
+                              ? "arg opt" : "arg unknown", opt[opts].id);
+                }
+                opts++;
+            } else {
+                buf[str_len(buf) - 1] = '\0';
+                fprintf(stderr, "failed to parse '%s'\n", buf);
+            }
+        } else if (!str_cmp(buf, "print")) {
+            for (i = 0; i < opts; i++) {
+                printf("%s %c %s (%d) id %d\n", opt[i].longname, 
+                  opt[i].shortname,
+                  opt[i].argument == GETLONGOPT_ARG_NONE ? "no arg" 
+                    : opt[i].argument == GETLONGOPT_ARG_REQUIRED ? "arg req" 
+                      : opt[i].argument == GETLONGOPT_ARG_OPTIONAL ? "arg opt" 
+                        : "arg unknown", opt[i].argument, opt[i].id);
+            }
+        } else if (!str_cmp(buf, "clear")) {
+            for (i = 0; i < opts; i++) {
+                free((char *) opt[i].longname);
+            }
+            opts = 0;
+            if (verbose) {
+                printf("cleared\n");
+            }
+        } else if (!str_ncmp(buf, "parse", str_len("parse"))) {
+            /* parse the line */
+            unsigned int splitargs;
+            char **splitarg;
+            int id;
+            const char *arg;
+
+            if ((splitarg 
+              = str_split(buf + str_len("parse"), " \t\n\f\r", &splitargs))
+              && (parser = getlongopt_new(splitargs, splitarg, opt, opts))) {
+
+                while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+                    printf("parsed id %d (", id);
+                    for (i = 0; i < opts; i++) {
+                        if (opt[i].id == id) {
+                            printf("%s", opt[i].longname);
+                        }
+                    }
+                    printf(") ");
+                    if (isprint(id)) {
+                        printf("(%c)", id);
+                    }
+
+                    if (arg) {
+                        printf("arg '%s'\n", arg);
+                    } else {
+                        printf("\n");
+                    }
+                }
+
+                for (i = getlongopt_optind(parser); i < splitargs; i++) {
+                    printf("parsed arg %s\n", splitarg[i]);
+                }
+
+                if (ret != GETLONGOPT_END) {
+                    fprintf(stderr, "didn't end, got %d instead\n", ret);
+                }
+
+                free(splitarg);
+                getlongopt_delete(parser);
+            } else {
+                perror(*argv);
+                return EXIT_FAILURE;
+            }
+        } else if (!str_ncmp(buf, "check", str_len("check"))) {
+            /* parse the line */
+            unsigned int splitargs;
+            char **splitarg;
+            int id,
+                scan_id;
+            const char *arg;
+
+            if ((splitarg 
+              = str_split(buf + str_len("check"), " \t\n\f\r", &splitargs))
+              && (parser 
+                = getlongopt_new(splitargs, splitarg, opt, opts))) {
+
+                ret = GETLONGOPT_OK;
+
+                while ((ret == GETLONGOPT_OK) 
+                  && ((ret = getlongopt(parser, &id, &arg)), 1)
+                  && (fgets(buf3, BUFSIZE, input))
+                  && (++line)
+                  && (sscanf(buf3, "%s", buf2) == 1)) {
+
+                    if (!str_ncmp(buf2, "OK", str_len("OK"))) {
+
+                        if ((ret == GETLONGOPT_OK)
+                          && (buf2[0] = '\0', 1)
+                          && (sscanf(buf3, "%s %d %s", buf, &scan_id, buf2)
+                            >= 2)) {
+                            if ((scan_id == id) 
+                              && ((!arg && !str_len(buf2)) 
+                                || (!str_cmp(arg, buf2)))) {
+
+                                /* matched */
+                                if (verbose) {
+                                    printf("checked OK %d '%s'\n", id, arg);
+                                }
+                            } else {
+                                if (scan_id != id) {
+                                    fprintf(stderr, "expecting id %d, got %d\n",
+                                      id, scan_id);
+                                }
+                                if (str_cmp(arg, buf2)) {
+                                    fprintf(stderr, 
+                                      "expecting arg '%s', got '%s'\n", buf2, 
+                                      arg);
+                                } 
+                            }
+                        } else {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        }
+                    } else if (!str_cmp(buf2, "END")) {
+                        if (ret != GETLONGOPT_END) {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        } else if (verbose) {
+                            printf("checked %s\n", buf2);
+                        }
+                    } else if (!str_cmp(buf2, "UNKNOWN")) {
+                        if (ret != GETLONGOPT_UNKNOWN) {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        } else if (verbose) {
+                            printf("checked %s\n", buf2);
+                        }
+                    } else if (!str_cmp(buf2, "MISSING_ARG")) {
+                        if (ret != GETLONGOPT_MISSING_ARG) {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        } else if (verbose) {
+                            printf("checked %s\n", buf2);
+                        }
+                    } else if (!str_cmp(buf2, "ERR")) {
+                        if (ret != GETLONGOPT_ERR) {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        } else if (verbose) {
+                            printf("checked %s\n", buf2);
+                        }
+                    } else {
+                        fprintf(stderr, "unknown error '%s'\n", buf2);
+                        return EXIT_FAILURE;
+                    }
+                }
+
+                free(splitarg);
+                getlongopt_delete(parser);
+            } else {
+                perror(*argv);
+                return EXIT_FAILURE;
+            }
+        } else if ((str_len(buf) > 0) && (*str_ltrim(buf) != '#')) {
+            printf("command '%s' not understood\n", buf);
+        }
+    }
+
+    if (input != stdin) {
+        fclose(input);
+    }
+
+    if (opt) {
+        for (i = 0; (i < opts) && opt; i++) {
+            free((char *) opt[i].longname);
+        }
+        free(opt);
+    }
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
+
diff --git a/src/getmaxfsize.c b/src/getmaxfsize.c
new file mode 100644 (file)
index 0000000..d3eefd8
--- /dev/null
@@ -0,0 +1,218 @@
+/* getmaxfsize.c implements a function to determine the maximum file size
+ * of an open file.  We'll do this by seeking it to some different
+ * locations and reading/writing to it.  Its important that we don't
+ * alter the file during this process.
+ *
+ * written nml 2003-02-22
+ *
+ */
+
+#include "firstinclude.h" 
+
+#include "getmaxfsize.h"
+
+#include "def.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+
+int getmaxfsize(int fd, unsigned int knownlimit, unsigned int *limit) {
+    off_t fsize;                    /* current size of the file */
+    off_t pos;                      /* current position in file */
+    char buf = '\0';                /* writing buffer */
+
+    /* we can't actually implement this function in an efficient, generalised
+     * way without operating system help, so we're just going to try
+     * some hueristics.  The big thing to worry about is the 2GB
+     * filesize limit thats so prevalent on linux.  Basically we're
+     * going to return the a limit of knownlimit, 2GB or 4GB,
+     * depending on what works.  In other words, this function is just one big
+     * hack. */
+
+    /* XXX: we should really restore the previous signal handler before exiting
+     * this function, but don't */
+    if (signal(SIGXFSZ, SIG_IGN) == SIG_ERR) {
+        return 0;
+    }
+
+    /* determine current position and size of the file */
+    errno = 0;
+    if ((pos = lseek(fd, 0, SEEK_CUR)) == (off_t) -1) {
+        assert(errno);
+        assert(!CRASH);
+        return 0;
+    }
+    if ((fsize = lseek(fd, 0, SEEK_END)) == (off_t) -1) {
+        assert(errno);
+        assert(!CRASH);
+        lseek(fd, pos, SEEK_SET);
+        return 0;
+    }
+
+    /* test 2GB limit */
+    if ((fsize < 2147483647) 
+      && (lseek(fd, 2147483647 - 1, SEEK_SET) != (off_t) -1)) {
+        errno = 0;
+        if ((write(fd, &buf, 1) == -1) && (errno == EFBIG)) {
+            /* limited to less than 2GB, binary search downward to
+             * find an acceptable size */
+            unsigned int size;
+
+            if (knownlimit < 2147483647) {
+                *limit = knownlimit;
+                return (lseek(fd, pos, SEEK_SET) != (off_t) -1)
+                  && (ftruncate(fd, fsize) != -1);
+            }
+
+            for (size = 2147483647 / 2; size > fsize; size /= 2) {
+                if (lseek(fd, size - 1, SEEK_SET) != (off_t) -1) {
+                    if (write(fd, &buf, 1) != -1) {
+                        if ((ftruncate(fd, fsize) != -1) 
+                          && (lseek(fd, pos, SEEK_SET) != (off_t) -1)) {
+                            *limit = size;
+                            return (lseek(fd, pos, SEEK_SET) != (off_t) -1)
+                              && (ftruncate(fd, fsize) != -1);
+                        } else {
+                            assert(!CRASH);
+                            lseek(fd, pos, SEEK_SET);
+                            ftruncate(fd, fsize);
+                            return 0;
+                        }
+                    } else if (errno != EFBIG) {
+                        assert(!CRASH);
+                        lseek(fd, pos, SEEK_SET);
+                        ftruncate(fd, fsize);
+                        return 0;
+                    } 
+                } else {
+                    assert(!CRASH);
+                    lseek(fd, pos, SEEK_SET);
+                    ftruncate(fd, fsize);
+                    return 0;
+                }
+            }
+
+            /* couldn't find a limit */
+            *limit = fsize;
+            return 1;
+        } else if (errno == EBADF) {
+            /* fd probably isn't open for writing */
+            *limit = fsize;
+            return (lseek(fd, pos, SEEK_SET) != (off_t) -1)
+              && (ftruncate(fd, fsize) != -1);
+        }
+    } else if ((fsize < 2147483647)) {
+        assert(!CRASH);
+        lseek(fd, pos, SEEK_SET);
+        ftruncate(fd, fsize);
+        return 0;
+    }
+    if (knownlimit < 4294967295U) {
+        /* if knownlimit is less than 4GB then its probably correct */
+        *limit = knownlimit;
+        return (lseek(fd, pos, SEEK_SET) != (off_t) -1)
+          && (ftruncate(fd, fsize) != -1);
+    }
+
+    /* test 4GB limit */
+    if ((fsize < 4294967295U) && (((off_t) (4294967295U - 1)) > 0) 
+      && (lseek(fd, 4294967295U - 1, SEEK_SET) != (off_t) -1)) {
+        if ((write(fd, &buf, 1) == -1) && (errno == EFBIG)) {
+            /* limited to less than 4GB, but more than 2GB, just use 2GB */
+            *limit = 2147483647;
+            return (lseek(fd, pos, SEEK_SET) != (off_t) -1)
+              && (ftruncate(fd, fsize) != -1);
+        } 
+    } else if ((fsize < 4294967295U)) {
+        /* check if off_t values higher than 2GB go negative */
+        if (((off_t) (4294967295U - 1)) < 0) {
+            *limit = 2147483647;
+            return (lseek(fd, pos, SEEK_SET) != (off_t) -1)
+              && (ftruncate(fd, fsize) != -1);
+        } else {
+            assert(!CRASH);
+            lseek(fd, pos, SEEK_SET);
+            ftruncate(fd, fsize);
+            return 0;
+        }
+    }
+
+    /* otherwise, limited by 32-bit offset size, return 4GB */
+    *limit = 4294967295U;
+    return (lseek(fd, pos, SEEK_SET) != (off_t) -1)
+      && (ftruncate(fd, fsize) != -1);
+}
+
+#ifdef GETMAXFSIZE_TEST
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+
+int main(int argc, char **argv) {
+    int fd;
+    struct rlimit limits;
+    unsigned int limit;
+    struct sigaction sa;
+    int flags = 0;
+    unsigned int i;
+
+    if (argc != 3) {
+        fprintf(stderr, "usage: %s [r|w|rw] filename\n", *argv);
+        return EXIT_FAILURE;
+    }
+
+    /* need to arrange to ignore SIGXFSZ, so we don't exit when we try to write
+     * past 2GB or whatever the maximum file size is */
+    sa.sa_handler = SIG_IGN;
+    sigemptyset(&sa.sa_mask);
+    sa.sa_flags = 0;
+    if (sigaction(SIGXFSZ, &sa, NULL) != 0) {
+        perror(*argv);
+        return EXIT_FAILURE;
+    }
+
+    for (i = 0; i < strlen(argv[1]); i++) {
+        if ((argv[1][i] == 'r') || (argv[1][i] == 'R')) {
+            if (flags & O_WRONLY) {
+                flags = O_RDWR;
+            } else {
+                flags = O_RDONLY;
+            }
+        } else if ((argv[1][i] == 'w') || (argv[1][i] == 'W')) {
+            if (flags & O_RDONLY) {
+                flags = O_RDWR;
+            } else {
+                flags = O_WRONLY;
+            }
+        } else {
+            fprintf(stderr, "usage: %s [r|w|rw] filename\n", *argv);
+            return EXIT_FAILURE;
+        }
+    }
+
+    if ((fd = open(argv[2], flags | O_CREAT, 0xffffffff))) {
+        if ((getrlimit(RLIMIT_FSIZE, &limits) == 0) 
+          && (getmaxfsize(fd, limits.rlim_cur, &limit))) { 
+            printf("limit for file '%s' is %u\n", argv[1], limit);
+        } else {
+            close(fd);
+            perror(*argv);
+            return EXIT_FAILURE;
+        }
+        close(fd);
+    } else {
+        perror(*argv);
+        return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
+
diff --git a/src/hawkapi.c b/src/hawkapi.c
new file mode 100644 (file)
index 0000000..62a328e
--- /dev/null
@@ -0,0 +1,602 @@
+/* hawkapi.c implements the hawkapi metric for the zettair query
+ * subsystem.  This file was automatically generated from
+ * src/hawkapi.metric and src/metric.c
+ * by scripts/metric.py on Thu, 29 Jun 2006 04:12:41 GMT.  
+ *
+ * DO NOT MODIFY THIS FILE, as changes will be lost upon 
+ * subsequent regeneration (and this code is repetitive enough 
+ * that you probably don't want to anyway).  
+ * Go modify src/hawkapi.metric or src/metric.c instead.  
+ * 
+ * Comments from hawkapi.metric:
+ *
+ * hawkapi.metric is a functional description in our funny zettair metric
+ * language (see metric.py) of how the 'AF1' metric should operate.
+ * 
+ * AF1 is Dave Hawking's anchor-text specific okapi variant (see 'Toward better
+ * weighting of anchors', Hawking, Upstill and Craswell, SIGIR 2004 poster).
+ * They called it 'AF1', but i find hawkapi a little less boring ;o).
+ * It's basically a stripped-down version of the okapi metric.  No-one
+ * really knows, at this stage (including Dave Hawking), what a good
+ * value of alpha is.
+ * 
+ * written nml 2005-07-18
+ *
+ */
+
+
+#include "firstinclude.h"
+
+#include "metric.h"
+
+#include "_index.h"
+#include "_docmap.h"
+#include "index_querybuild.h"
+
+#include "def.h"
+#include "objalloc.h"
+#include "docmap.h"
+#include "search.h"
+#include "vec.h"
+
+#include <assert.h>
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+
+static enum search_ret pre(struct index *idx, struct query *query, 
+  int opts, struct index_search_opt *opt) {
+    /* METRIC_PRE */
+
+    return SEARCH_OK;
+}
+
+static enum search_ret post(struct index *idx, struct query *query, 
+  struct search_acc_cons *acc, int opts, struct index_search_opt *opt) {
+    /* METRIC_POST */
+
+
+    while (acc) {
+        assert(acc->acc.docno < docmap_entries(idx->map));
+        /* METRIC_POST_PER_DOC */
+
+        acc = acc->next;
+    }
+
+    return SEARCH_OK;
+}
+
+/* macro to atomically read the next docno and f_dt from a vector 
+ * (note: i also tried a more complicated version that tested for a long vec 
+ * and used unchecked reads, but measurements showed no improvement) */
+#define NEXT_DOC(v, docno, f_dt)                                              \
+    (vec_vbyte_read(v, &docno_d)                                              \
+      && (((vec_vbyte_read(v, &f_dt) && ((docno += docno_d + 1), 1))          \
+        /* second read failed, reposition vec back to start of docno_d */     \
+        || (((v)->pos -= vec_vbyte_len(docno_d)), 0))))
+
+/* macro to scan over f_dt offsets from a vector/source */
+#define SCAN_OFFSETS(src, v, f_dt)                                            \
+    do {                                                                      \
+        unsigned int toscan = f_dt,                                           \
+                     scanned;                                                 \
+        enum search_ret sret;                                                 \
+                                                                              \
+        do {                                                                  \
+            if ((scanned = vec_vbyte_scan(v, toscan, &scanned)) == toscan) {  \
+                toscan = 0;                                                   \
+                break;                                                        \
+            } else if (scanned < toscan) {                                    \
+                toscan -= scanned;                                            \
+                /* need to read more */                                       \
+                if ((sret = src->readlist(src, VEC_LEN(v),                    \
+                    (void **) &(v)->pos, &bytes)) == SEARCH_OK) {             \
+                                                                              \
+                    (v)->end = (v)->pos + bytes;                              \
+                } else if (sret == SEARCH_FINISH) {                           \
+                    /* shouldn't end while scanning offsets */                \
+                    return SEARCH_EINVAL;                                     \
+                } else {                                                      \
+                    return sret;                                              \
+                }                                                             \
+            } else {                                                          \
+                assert("can't get here" && 0);                                \
+                return SEARCH_EINVAL;                                         \
+            }                                                                 \
+        } while (toscan);                                                     \
+    } while (0)
+static enum search_ret or_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc;
+    unsigned int accs_added = 0;   /* number of accumulators added */
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    unsigned int bytes;
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+
+    const float w_t = (float) logf((N - (query->term[qterm].f_t) + 0.5F) / ((query->term[qterm].f_t) + 0.5F));
+
+    const float w_qt = (((opt->u.hawkapi.k3) + 1) * (query->term[qterm].f_qt)) / ((opt->u.hawkapi.k3) + (query->term[qterm].f_qt));
+
+
+    /* METRIC_PER_CALL */
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                prevptr = &acc->next;
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += w_qt * (opt->u.hawkapi.alpha) * ((float) logf(f_dt + 1)) * w_t;
+
+            } else {
+                struct search_acc_cons *newacc;
+                assert(!acc || docno < acc->acc.docno); 
+
+                /* allocate a new accumulator (we have reserved allocators
+                 * earlier, so this should never fail) */
+                newacc = objalloc_malloc(results->alloc, sizeof(*newacc));
+                assert(newacc);
+                newacc->next = acc;
+                acc = newacc;
+                acc->acc.docno = docno;
+                acc->acc.weight = 0.0;
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += w_qt * (opt->u.hawkapi.alpha) * ((float) logf(f_dt + 1)) * w_t;
+
+                *prevptr = newacc;
+                accs_added++;
+            }
+            assert(acc);
+
+            /* go to next accumulator */
+            prevptr = &acc->next;
+            acc = acc->next;
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, update number of accumulators */
+            results->accs += accs_added;
+            results->total_results += accs_added;
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+static enum search_ret and_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src,
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc;
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    struct vec v = {NULL, NULL};
+    unsigned int bytes,
+                 missed = 0,       /* number of list entries that didn't match 
+                                    * an accumulator */
+                 hit = 0,          /* number of entries in both accs and list*/
+                 decoded = 0;      /* number of list entries seen */
+    enum search_ret ret;
+    float cooc_rate;               /* co-occurrance rate for list entries and 
+                                    * accumulators */
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+
+    const float w_t = (float) logf((N - (query->term[qterm].f_t) + 0.5F) / ((query->term[qterm].f_t) + 0.5F));
+
+    const float w_qt = (((opt->u.hawkapi.k3) + 1) * (query->term[qterm].f_qt)) / ((opt->u.hawkapi.k3) + (query->term[qterm].f_qt));
+
+
+    /* METRIC_PER_CALL */
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += w_qt * (opt->u.hawkapi.alpha) * ((float) logf(f_dt + 1)) * w_t;
+
+
+                /* go to next accumulator */
+                acc = acc->next;
+                hit++;
+            } else {
+                missed++;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate number of results */
+
+            /* list entries now divide up into two portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            assert(missed + hit == decoded);
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            if (missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* tolerance value for thresholding estimates.  Should be >= 1.0.  Make higher
+ * for stabler, but higher memory usage, processing. */
+#define TOLERANCE 1.2
+
+/* low-ish approximation of infinity, to make counting up to it acceptable */
+#define INF 2000
+
+static enum search_ret thresh_decode(struct index *idx, struct query *query,
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, 
+  struct search_list_src *src, unsigned int postings, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc,
+                           dummy;
+    unsigned long int f_dt,           /* number of offsets for this document */
+                      docno_d;        /* d-gap */
+
+    /* initial number of accumulators */
+    unsigned int initial_accs = results->accs,
+
+                 decoded = 0,         /* number of postings decoded */
+                 thresh,              /* current discrete threshold */
+                 rethresh,            /* distance to recalculation of the 
+                                       * threshold */
+                 rethresh_dist,
+                 bytes,
+                 step,
+                 missed = 0,        /* number of list entries that didn't match 
+                                     * an accumulator */
+                 hit = 0;           /* number of entries in both accs and list*/
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    int infinite = 0;                 /* whether threshold is infinite */
+    float cooc_rate;
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+
+    const float w_t = (float) logf((N - (query->term[qterm].f_t) + 0.5F) / ((query->term[qterm].f_t) + 0.5F));
+
+    const float w_qt = (((opt->u.hawkapi.k3) + 1) * (query->term[qterm].f_qt)) / ((opt->u.hawkapi.k3) + (query->term[qterm].f_qt));
+
+
+    /* METRIC_PER_CALL */
+
+
+    rethresh_dist = rethresh = (postings + results->acc_limit - 1) 
+      / results->acc_limit;
+
+    if (results->v_t == FLT_MIN) {
+        unsigned long int docno_copy = docno;
+
+        /* this should be the first thresholded list, need to estimate 
+         * threshold */
+        assert(rethresh && rethresh < postings);
+        thresh = 0;
+
+        assert(rethresh < postings);
+        while (rethresh) {
+            while (rethresh && NEXT_DOC(&v, docno, f_dt)) {
+                rethresh--;
+                SCAN_OFFSETS(src, &v, f_dt);
+                if (f_dt > thresh) {
+                    thresh = f_dt;
+                }
+            }
+
+            /* need to read more data, preserving bytes that we already have */
+            if (rethresh && (ret = src->readlist(src, VEC_LEN(&v),
+                (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+                v.end = v.pos + bytes;
+            } else if (rethresh) {
+                assert(ret != SEARCH_FINISH);
+                return ret;
+            }
+        }
+        thresh--;
+
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        acc->acc.weight = 0.0;
+        f_dt = thresh;
+        /* METRIC_CONTRIB */
+        (acc->acc.weight) += w_qt * (opt->u.hawkapi.alpha) * ((float) logf(f_dt + 1)) * w_t;
+
+        results->v_t = acc->acc.weight;
+
+        /* reset source/vector to start */
+        v.pos = v.end = NULL;
+        if ((ret = src->reset(src)) != SEARCH_OK) {
+            return ret;
+        }
+
+        acc = *prevptr;
+        docno = docno_copy;
+        rethresh = rethresh_dist;
+    } else {
+        /* translate the existing v_t threshold to an f_dt */
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        f_dt = 0;
+        do {
+            acc->acc.weight = 0.0;
+            f_dt++;
+            /* METRIC_CONTRIB */
+            (acc->acc.weight) += w_qt * (opt->u.hawkapi.alpha) * ((float) logf(f_dt + 1)) * w_t;
+
+        } while (acc->acc.weight < results->v_t && f_dt < INF);
+        thresh = f_dt; 
+        acc = *prevptr;
+
+        if (thresh == INF) {
+            /* this is not a sensible term */
+            infinite = 1;
+            rethresh = postings + 1;
+        }
+    }
+
+    /* set step to 1/2 of the threshold */
+    step = (thresh + 1) / 2;
+    step += !step; /* but don't let it become 0 */
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                /* perform threshold test */
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = (*prevptr);
+                    results->accs--;
+                } else {
+                    /* retain this accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += w_qt * (opt->u.hawkapi.alpha) * ((float) logf(f_dt + 1)) * w_t;
+
+
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = *prevptr;
+                    results->accs--;
+                } else {
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+                hit++;
+            } else {
+                if (f_dt > thresh) {
+                    struct search_acc_cons *newacc;
+                    assert(!acc || docno < acc->acc.docno); 
+
+                    if ((newacc = objalloc_malloc(results->alloc, 
+                      sizeof(*newacc)))) {
+                        newacc->acc.docno = docno;
+                        newacc->acc.weight = 0.0;
+                        newacc->next = acc;
+                        acc = newacc;
+                        /* note that we have to be careful around here to 
+                         * assign newacc to acc before using PER_DOC, 
+                         * otherwise we end up with nonsense in some 
+                         * accumulators */
+                        /* METRIC_PER_DOC */
+                        (acc->acc.weight) += w_qt * (opt->u.hawkapi.alpha) * ((float) logf(f_dt + 1)) * w_t;
+
+                        *prevptr = newacc;
+                        results->accs++;
+                    } else {
+                        return SEARCH_ENOMEM;
+                    }
+
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                } else {
+                    missed++;
+                }
+            }
+
+            if (!--rethresh) {
+                int estimate;
+                unsigned int prev_thresh = thresh;
+
+                estimate = (int) (results->accs 
+                  + ((postings - decoded) 
+                    * ((float) results->accs - initial_accs)) / decoded);
+
+                if (estimate > TOLERANCE * results->acc_limit) {
+                    thresh += step;
+                } else if ((estimate < results->acc_limit / TOLERANCE) 
+                  && thresh) {
+                    if (thresh >= step) {
+                        thresh -= step;
+                    } else {
+                        thresh = 0;
+                    }
+                }
+
+                step = (step + 1) / 2;
+                assert(step);
+
+                /* note that we don't want to recalculate the threshold if it
+                 * doesn't change because this involves re-discretising it */
+                if (prev_thresh != thresh) {
+                    /* recalculate contribution that corresponds to the new 
+                     * threshold */
+                    f_dt = thresh;
+                    if (f_dt) {
+                        acc = &dummy;
+                        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+                        acc->acc.weight = 0.0;
+                        /* METRIC_CONTRIB */
+                        (acc->acc.weight) += w_qt * (opt->u.hawkapi.alpha) * ((float) logf(f_dt + 1)) * w_t;
+
+                        results->v_t = acc->acc.weight;
+                        acc = *prevptr;
+                    } else {
+                        results->v_t = FLT_MIN;
+                    }
+                }
+
+                rethresh_dist *= 2;
+                rethresh = rethresh_dist;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate total results count */
+            assert(postings == decoded);
+
+            results->total_results += (int) (results->accs - initial_accs);
+
+            /* list entries now divide up into three portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *   - added
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            /* note that the total results are not an estimate if either there
+             * were no accumulators in the list when we started (in which case
+             * missed records exactly the number, uh, missing from the
+             * accumulators) or there were none missed, in which case the
+             * accumulators have fully accounted for everything in this list.
+             * In either case, the (1 - cooc_rate) * missed maths above handles
+             * it exactly (modulo floating point errors of course). */
+            if (initial_accs && missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                if (!infinite) {
+                    /* continue threshold evaluation */
+                    return SEARCH_OK;
+                } else {
+                    /* switch to AND processing */
+                    return SEARCH_FINISH;
+                }
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* Declare a function named the same as the metric that returns a structure 
+ * containing function pointers */
+const struct search_metric * /* METRIC_NAME */ hawkapi () {
+    const static struct search_metric sm 
+      = {pre, /* METRIC_DEPENDS_POST */ 0 ? post : NULL, 
+         or_decode, and_decode, thresh_decode};
+    return &sm;
+}
+
diff --git a/src/hawkapi.metric b/src/hawkapi.metric
new file mode 100644 (file)
index 0000000..5b8dd34
--- /dev/null
@@ -0,0 +1,26 @@
+# hawkapi.metric is a functional description in our funny zettair metric
+# language (see metric.py) of how the 'AF1' metric should operate.  
+#
+# AF1 is Dave Hawking's anchor-text specific okapi variant (see 'Toward better
+# weighting of anchors', Hawking, Upstill and Craswell, SIGIR 2004 poster).
+# They called it 'AF1', but i find hawkapi a little less boring ;o).
+# It's basically a stripped-down version of the okapi metric.  No-one
+# really knows, at this stage (including Dave Hawking), what a good
+# value of alpha is.  
+#
+# written nml 2005-07-18
+
+parameter float alpha;
+parameter float k3;
+
+decode() {
+       const float w_t = (float) logf((N - f_t + 0.5F) / (f_t + 0.5F));
+       const float w_qt = ((k3 + 1) * f_qt) / (k3 + f_qt);
+
+       accumulator += w_qt * alpha * ((float) logf(f_dt + 1)) * w_t;
+}
+
+post() {
+
+}
+
diff --git a/src/heap.c b/src/heap.c
new file mode 100644 (file)
index 0000000..5473cd8
--- /dev/null
@@ -0,0 +1,691 @@
+/* heap.c implements an efficient partial sort using a heap.
+ *
+ * heaps are a classic computer science structure.  If you don't know what one
+ * is i refer you to The Art of Computer Programming, Volume 3, Donald E Knuth.
+ * For a less in-depth but more readable resource you could check out the 
+ * Wikipedia entry on heaps (http://www.wikipedia.org/wiki/Heap), binary heaps
+ * (http://www.wikipedia.org/wiki/Binary_heap), and 
+ * heapsort (http://www.wikipedia.org/wiki/Heapsort).
+ *  
+ * I'll summarise the heap structure so that i can explain some potential
+ * optimisations to this code.  A heap is a tree having the property that each
+ * node is more extreme (greater than or less than, depending whether it is a
+ * minheap or a maxheap) or equal to its children nodes.  This code implements a
+ * minheap, so from now on i'll just refer to parent nodes being <= their 
+ * children.  The minheap property ensures that the (possibly equal) smallest 
+ * node is at the root of the tree, so its an O(1) operation to get the 
+ * smallest node from a heap.  Restoring the heap property to a heap minus its
+ * smallest element takes O(logN) time.  Heaps can be constructed in O(N) time 
+ * given any old bunch of elements.  
+ *
+ * Heapsort is essentially these 4 steps:
+ *    1) make a heap from the elements
+ *    2) for each element in heap
+ *    3)   remove smallest element
+ *    4)   restore heap property to remaining heap
+ *
+ * An optimisation is to build a heap of the number of elements that you want
+ * sorted.  Once your heap has been constructed you can compare each of the
+ * other elements to the largest element on the heap, swapping them if the
+ * candidate item is smaller.  Once this process is completed you have the
+ * smallest N items in the heap, which you can remove in order largest to
+ * smallest to sort them.  Note that to perform the same sort as a unoptimised
+ * minheap, this requires a maxheap.
+ *
+ * we can see from the above complexity measures that this is an 
+ * O(N) (to build heap) + O(NlogN) (to reheapify N times) = O(NlogN) operation.
+ * Heapsort is typically not as fast as quicksort, but its worst case is
+ * O(NlogN), which is far better than quicksort's O(N^2) worst case.
+ * Heapsort can also be made to work in-place, with only one byte of extra
+ * storage required (which this implementation does).  It also has the
+ * interesting property that you can modify step 2 to only iterate a set number
+ * of times, which will give you what is known as a partial sort (where you
+ * extract the M smallest values in sorted order from your heap).
+ *
+ * Binary heaps (where each node has two children) can be represented by an
+ * array, (numbered from 1 ... N for convenience) where each node n has children
+ * n * 2 and n * 2 + 1.  E.g. a heap (ASCII art from wikipedia)
+ * 
+ *         1
+ *        / \
+ *       /   \
+ *      4     3
+ *     / \   / \
+ *    5   6 7   8
+ *
+ * could be represented as array [1, 4, 3, 5, 6, 7, 8].  
+ *
+ * Given an array of elements, we can construct a heap from it.  Start at
+ * element floor(N / 2) (since this is the first element that can have
+ * children).  Find out which child is smaller (the first node might not have 
+ * both children) and compare the smaller child with the parent.  If the child
+ * is smaller than the parent, swap them.  After a swap, you need to recursively
+ * repeat this process with the subheap formed by the newly swapped child and 
+ * its children to ensure the heap property.  After finishing with node floor(N
+ * / 2), repeat with the previous node (floor(N / 2) - 1) until the first node
+ * has been heapified as well.  You now have a heap.
+ *
+ * The second stage of heapsort involves repeatedly removing the smallest
+ * element and reheapifying.  Reheapification is exactly the same recursive
+ * process as we applied to the first half of the array to make the heap, and is
+ * known as siftup or siftdown.  With our array representation, we swap the 
+ * smallest element with the last element and shrink the size of the heap by 
+ * one.  As the heap shrinks, we will accumulate a set of the smallest 
+ * elements, in order, behind the heap (which is exactly what we want).  So, 
+ * with an example: 
+ *
+ * start:                       [1, 4, 3, 5, 6, 7, 8]
+ * swap smallest and last:      [8, 4, 3, 5, 6, 7], 1 
+ * siftdown:                    [3, 4, 8, 5, 6, 7], 1
+ *                              [3, 4, 7, 5, 6, 8], 1
+ * swap smallest and last:      [8, 4, 7, 5, 6], 3, 1 
+ * siftdown:                    [4, 8, 7, 5, 6], 3, 1
+ *                              [4, 5, 7, 8, 6], 3, 1
+ * swap smallest and last:      [6, 5, 7, 8], 4, 3, 1
+ * siftdown:                    [5, 6, 7, 8], 4, 3, 1
+ * swap smallest and last:      [8, 6, 7], 5, 4, 3, 1
+ * siftdown:                    [6, 8, 7], 5, 4, 3, 1
+ * swap smallest and last:      [7, 8], 6, 5, 4, 3, 1
+ * siftdown:                    [7, 8], 6, 5, 4, 3, 1
+ * swap smallest and last:      8, 7, 6, 5, 4, 3, 1         (finished)
+ *
+ * note how the heap shrunk and the sorted array at the back grows.  
+ *
+ * This code implements a basic heapsort.  It sorts about twice as slowly as the
+ * standard library qsort on my machine at the moment.  I believe that this is
+ * acceptible performance for the moment.  There are a number of optimisations
+ * that should make it faster:
+ *
+ *   - improved siftup algorithm
+ *   - altering code to be a ternary heap
+ *
+ * During the siftup algorithm, instead of finding the smallest child and
+ * comparing it to the parent, you can find the smallest child and swap it with
+ * the parent.  This propagates the parent to the bottom of the heap, from where
+ * you have to compare it with its (new) parents and swap it back up to find its
+ * place in the heap.  While this involves more copying of elements, it
+ * apparently saves comparisons, and should improve the performance of this heap
+ * (particularly with a generic comparison function pointer and in-line
+ * swapping).  The downside to this is that i can't find a way to do it with
+ * fast math.
+ *
+ * A ternary heap (where each parent has 3 children) is apparently faster than a
+ * binary heap (and fast math can still be done: x * 3 == (x << 1) + x).
+ *
+ * Another algorithmic improvement might be to implement a weak-heap as
+ * described by Dr Stefan Edelkamp in his master's thesis: Weak-Heapsort: A Fast * Sorting Algorithm, Institute of Computer Science, University of Dortmund.
+ * Unfortunately its in german, and there doesn't seem to be a lot of english
+ * literature on it.  It utilises a weak heap, which is a tree where each parent
+ * is more extreme or equal to the elements in its right subtree, and the root
+ * has no left subtree (this constraint is weaker than the heap constraint, but
+ * is still sufficient to sort the elements, apparently).  Unfortunately it
+ * requires an additional array or r bits, which indicate which elements an
+ * element considers its right subtree.
+ *
+ * written nml 2003-06-03
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "heap.h"
+
+#include "bit.h"
+#include "def.h"  /* for DEAR_DEBUG */
+
+#include "zstdint.h"
+
+#include <stdlib.h>
+
+/* internal function to determine whether an array has the heap property */
+int heap_isheap(void *base, unsigned int nmemb, unsigned int size, 
+  int (*cmp)(const void *, const void *), int max) {
+    char *cbase = base;
+    unsigned int pos = BIT_DIV2(nmemb, 1) - 1,
+                 lchild,
+                 rchild;
+    int mul;
+
+    if (max) {
+        mul = -1;
+    } else {
+        mul = 1;
+    }
+
+    /* heap property: every node is less than (or equal to) its children */
+
+    if (nmemb < 2) {
+        return 1;
+    }
+
+    while (pos + 1 > 0) {
+        lchild = pos * 2 + 1;
+        rchild = lchild + 1;
+
+        if (((cmp(&cbase[pos * size], &cbase[lchild * size]) * mul) > 0) 
+          || ((rchild < nmemb) 
+            && ((cmp(&cbase[pos * size], &cbase[rchild * size]) * mul) > 0))) { 
+            return 0;
+        }
+
+        pos--;
+    }
+
+    return 1;
+}
+
+/* internal function to determine whether an array is sorted */
+int heap_issorted(void *base, unsigned int nmemb, unsigned int size, 
+  int (*cmp)(const void *, const void *), int max) {
+    char *pos,
+         *next,
+         *end = ((char *) base) + nmemb * size;
+    int mul;
+
+    if (max) {
+        mul = -1;
+    } else {
+        mul = 1;
+    }
+
+    /* sorted property: every node is smaller than or equal to the next */
+
+    if (nmemb < 2) {
+        return 1;
+    }
+
+    for (pos = base, next = pos + size; next < end; pos = next, next += size) {
+        if ((cmp(next, pos) * mul) < 0) {
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+/* macro to swap two data elements in place, one byte at a time.  I tried
+ * replacing this with a duff device for optimisation, but it had no noticeable
+ * effect. */
+#define SWAP(one, two, size)                                                  \
+    do {                                                                      \
+        uint8_t SWAP_tmp,                                                     \
+               *SWAP_tone = (uint8_t *) one,                                  \
+               *SWAP_ttwo = (uint8_t *) two;                                  \
+        unsigned int SWAP_size = size;                                        \
+        do {                                                                  \
+            SWAP_tmp = *SWAP_tone;                                            \
+            *SWAP_tone = *SWAP_ttwo;                                          \
+            *SWAP_ttwo = SWAP_tmp;                                            \
+            ++SWAP_tone;                                                      \
+            ++SWAP_ttwo;                                                      \
+        } while (--SWAP_size);                                                \
+    } while (0)
+
+/* sift an element that is out of heap order down the heap (from root to leaf 
+ * if necessary) */
+static void *heap_siftdown(char *element, char *endel, 
+  unsigned int size, unsigned int diff, 
+  int (*cmp)(const void *one, const void *two)) {
+    char *lchild = element + diff;          /* note that the right child is one 
+                                             * array element greater than 
+                                             * lchild */
+    unsigned int right;                     /* whether right child is smaller */
+
+    /* perform all heapifications where both children exist */
+    while (lchild < endel) {
+        /* compare left and right children */
+        right = (cmp(lchild, lchild + size) > 0) * size;
+
+        /* if current element is less extreme than more extreme child ... */
+        if (cmp(element, lchild + right) > 0) {
+            /* swap current element with greatest child */
+            SWAP(element, lchild + right, size);
+            element = lchild + right;
+
+            /* calculate new child positions */
+            diff = BIT_MUL2(diff, 1) + right;
+            lchild = element + diff;
+        } else {
+            /* element is at its final position */
+            break;
+        }
+    }
+
+    /* perform (possible) heapification where only left child exists */
+    if (lchild == endel) {
+        /* if left child is more extreme than current element ... */
+        if (cmp(element, endel) > 0) {
+            /* swap current element with last element */
+            SWAP(element, endel, size);
+            return endel;
+        }
+    } 
+
+    return element;
+}
+
+/* sift an element that is out of heap order up the heap (from leaf to root) */
+static void *heap_siftup(char *root, unsigned int element, 
+  unsigned int size, int (*cmp)(const void *one, const void *two)) {
+    char *curr = root,
+                  *parent;
+
+    while (element) {
+        /* compare with parent */
+        curr = root + size * element;
+        element = BIT_DIV2(element - 1, 1);
+        parent = root + size * element;
+        if (cmp(curr, parent) < 0) {
+            /* swap element and parent and repeat */
+            SWAP(curr, parent, size);
+        } else {
+            break;
+        }
+    }
+
+    return curr;
+}
+
+/* sift an element that is out of heap order down the heap (from root to leaf 
+ * if necessary) */
+static void *maxheap_siftdown(char *element, char *endel, 
+  unsigned int size, unsigned int diff, 
+  int (*cmp)(const void *one, const void *two)) {
+    char *lchild = element + diff;          /* note that the right child is one 
+                                             * array element greater than 
+                                             * lchild */
+    unsigned int right;                     /* whether right child is smaller */
+
+    /* perform all heapifications where both children exist */
+    while (lchild < endel) {
+        /* compare left and right children */
+        right = (cmp(lchild, lchild + size) < 0) * size;
+
+        /* if current element is less extreme than more extreme child ... */
+        if (cmp(element, lchild + right) < 0) {
+            /* swap current element with greatest child */
+            SWAP(element, lchild + right, size);
+            element = lchild + right;
+
+            /* calculate new child positions */
+            diff = BIT_MUL2(diff, 1) + right;
+            lchild = element + diff;
+        } else {
+            /* element is at its final position */
+            break;
+        }
+    }
+
+    /* perform (possible) heapification where only left child exists */
+    if (lchild == endel) {
+        /* if left child is more extreme than current element ... */
+        if (cmp(element, endel) < 0) {
+            /* swap current element with last element */
+            SWAP(element, endel, size);
+            return endel;
+        }
+    } 
+
+    return element;
+}
+
+void heap_heapify(void *base, unsigned int nmemb, unsigned int size, 
+  int (*cmp)(const void *, const void *)) {
+    char *middle, 
+         *element,
+         *lchild,
+         *endel;
+    unsigned int right;
+
+    if (nmemb < 2) {
+        /* arrays of size 1 or 0 are degenerate heaps already */
+        return;
+    }
+
+    /* initialise positions */
+    element = ((char *) base) + size * (BIT_DIV2(nmemb, 1) - 1);
+    middle = element;
+    lchild = element + (size * BIT_DIV2(nmemb, 1));
+    endel = ((char *) base) + size * (nmemb - 1);
+
+    /* do (optional) first heapification, where only left child exists */
+    if (lchild == endel) {
+        if (cmp(element, lchild) > 0) {
+            /* child is more extreme, swap for parent (no siftdown because the
+             * child can't have children of its own) */
+            SWAP(element, lchild, size);
+        }
+        element -= size;
+        lchild -= BIT_MUL2(size, 1);
+    }
+
+    /* perform all heapifications where we know that we don't have to sift down,
+     * because the child subheap will be a single element */
+    while (lchild > middle) {
+        /* compare left and right children */
+        right = (cmp(lchild, lchild + size) > 0) * size;
+
+        /* if current element is less extreme than the most extreme child ... */
+        if (cmp(element, lchild + right) > 0) {
+            /* swap current element with smallest child */
+            SWAP(element, lchild + right, size);
+        }
+        element -= size;
+        lchild -= BIT_MUL2(size, 1);
+    }
+
+    /* do all subsequent heapifications, where both children exist and we have
+     * to restore the heap property to non-trivial subheaps */
+    while (element >= (char *) base) {
+        /* compare left and right children */
+        right = (cmp(lchild, lchild + size) > 0) * size;
+
+        /* if current element is less extreme than the most extreme child ... */
+        if (cmp(element, lchild + right) > 0) {
+            /* swap current element with smallest child and then restore heap
+             * property to subheap */
+            SWAP(element, lchild + right, size);
+            heap_siftdown(lchild + right, endel, size, 
+              BIT_MUL2(lchild - element, 1) + right, cmp);
+        }
+        element -= size;
+        lchild -= BIT_MUL2(size, 1);
+    }
+
+    /* if debugging is on, check the heap order */
+    if (DEAR_DEBUG) {
+        assert(heap_isheap(base, nmemb, size, cmp, 0));
+    }
+
+    return;
+}
+
+static void maxheap_heapify(void *base, unsigned int nmemb, unsigned int size, 
+  int (*cmp)(const void *, const void *)) {
+    char *middle,
+         *element,
+         *lchild,
+         *endel;
+    unsigned int right;
+
+    if (nmemb < 2) {
+        /* arrays of size 1 or 0 are degenerate heaps already */
+        return;
+    }
+
+    /* initialise positions */
+    element = ((char *) base) + size * (BIT_DIV2(nmemb, 1) - 1);
+    middle = element;
+    lchild = element + (size * BIT_DIV2(nmemb, 1));
+    endel = ((char *) base) + size * (nmemb - 1);
+
+    /* do (optional) first heapification, where only left child exists */
+    if (lchild == endel) {
+        if (cmp(element, lchild) < 0) {
+            /* child is more extreme, swap for parent (no siftdown because the
+             * child can't have children of its own) */
+            SWAP(element, lchild, size);
+        }
+        element -= size;
+        lchild -= BIT_MUL2(size, 1);
+    }
+
+    /* perform all heapifications where we know that we don't have to sift down,
+     * because the child subheap will be a single element */
+    while (lchild > middle) {
+        /* compare left and right children */
+        right = (cmp(lchild, lchild + size) < 0) * size;
+
+        /* if current element is less extreme than the most extreme child ... */
+        if (cmp(element, lchild + right) < 0) {
+            /* swap current element with smallest child */
+            SWAP(element, lchild + right, size);
+        }
+        element -= size;
+        lchild -= BIT_MUL2(size, 1);
+    }
+
+    /* do all subsequent heapifications, where both children exist and we have
+     * to restore the heap property to non-trivial subheaps */
+    while (element >= (char *) base) {
+        /* compare left and right children */
+        right = (cmp(lchild, lchild + size) < 0) * size;
+
+        /* if current element is less extreme than the most extreme child ... */
+        if (cmp(element, lchild + right) < 0) {
+            /* swap current element with smallest child and then restore heap
+             * property to subheap */
+            SWAP(element, lchild + right, size);
+            maxheap_siftdown(lchild + right, endel, size, 
+              BIT_MUL2(lchild - element, 1) + right, cmp);
+        }
+        element -= size;
+        lchild -= BIT_MUL2(size, 1);
+    }
+
+    /* if debugging is on, check the heap order */
+    if (DEAR_DEBUG) {
+        assert(heap_isheap(base, nmemb, size, cmp, 1));
+    }
+
+    return;
+}
+
+void *heap_pop(void *base, unsigned int *nmemb, unsigned int size, 
+  int (*cmp)(const void *one, const void *two)) {
+    char *end;
+
+    if (*nmemb) {
+        (*nmemb)--;
+        end = ((char *) base + *nmemb * size);
+
+        /* swap out root element and restore heap condition */
+        SWAP(base, end, size);
+        heap_siftdown(base, end - size, size, size, cmp);
+
+        return end;
+    } else {
+        return NULL;
+    }
+}
+
+void heap_sort(void *base, unsigned int nmemb, unsigned int sort, 
+  unsigned int size, int (*cmp)(const void *, const void *)) {
+    char *element,
+         *endel,
+         *heap_endel;
+
+    /* we don't have to sort 'degenerate' arrays */
+    if (!sort || !size || (nmemb < 2)) {
+        return;
+    }
+
+    /* can only sort as many elements as we are given */
+    sort = (nmemb < sort) ? nmemb : sort;
+
+    /* create a max heap so we can collect the sort lowest elements (knowing
+     * what the highest elements in the lowest element set allows us to do 
+     * this) */
+    maxheap_heapify(base, sort, size, cmp);
+
+    if (DEAR_DEBUG) {
+        assert(heap_isheap(base, sort, size, cmp, 1));
+    }
+
+    /* compare each of the other elements with the largest element currently in
+     * the heap, replacing the largest element in the heap if its smaller */
+    endel = ((char *) base) + (nmemb - 1) * size;
+    element = ((char *) base) + sort * size;
+    heap_endel = element - size;
+    for (; element <= endel; element += size) {
+        if (cmp(element, base) < 0) {
+            /* swap root out */
+            SWAP(element, base, size);
+
+            /* reheapify */
+            maxheap_siftdown(base, heap_endel, size, size, cmp);
+        }
+    }
+
+    /* extract elements from the heap in sorted order */
+    while (heap_endel > (char *) base) {
+        /* swap out root element and restore heap condition */
+        SWAP(base, heap_endel, size);
+        heap_endel -= size;
+        maxheap_siftdown(base, heap_endel, size, size, cmp);
+    }
+
+    /* if debugging is on, check the sort order */
+    if (DEAR_DEBUG) {
+        assert(heap_issorted(base, sort, size, cmp, 0));
+    }
+
+    /* the number of elements they requested should now be sorted */
+    return;
+}
+
+void *heap_replace(void *base, unsigned int nmemb, unsigned int size,
+  int (*cmp)(const void *, const void *), void *element) {
+    char *end;
+
+    if (nmemb) {
+        end = ((char *) base + nmemb * size);
+
+        /* swap out root element and restore heap condition */
+        SWAP(base, element, size);
+        return heap_siftdown(base, end - size, size, size, cmp);
+    } else {
+        return NULL;
+    }
+}
+
+void *heap_peek(void *base, unsigned int nmemb, unsigned int size) {
+    /* most extreme is at root array element */
+    if (nmemb) {
+        return base;
+    } else {
+        return NULL;
+    }
+}
+
+void *heap_insert(void *base, unsigned int *nmemb, unsigned int size,
+  int (*cmp)(const void *, const void *), void *element) {
+    /* put in last place, siftup */
+    memmove(((char *) base) + size * *nmemb, element, size);
+    return heap_siftup(base, (*nmemb)++, size, cmp);
+}
+
+void *heap_remove(void *base, unsigned int *nmemb, unsigned int size,
+  int (*cmp)(const void *, const void *), void *remove) {
+    /* linear search for element, copy last element into its place, siftdown */
+    char *element = base,
+         *endel = element + (size * *nmemb) - size;
+
+    for (element = base; element <= endel; element += size) {
+        if (cmp(element, remove) == 0) {
+            SWAP(element, endel, size);
+            (*nmemb)--;
+            /* note that we use endel - size for the end element because we've
+             * just removed one element from the heap */
+            return heap_siftdown(element, endel - size,
+              size, element - ((char *) base) + size, cmp);
+        } 
+    }
+
+    return NULL;
+}
+
+/* module test code */
+#ifdef HEAP_TEST
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+
+static void printarr(FILE *output, unsigned int *arr, unsigned int elements) {
+    unsigned int i;
+
+    fprintf(output, "\n");
+    for (i = 0; i < elements; i++) {
+        fprintf(output, "%u %u\n", i, arr[i]);
+    }
+    fprintf(output, "\n");
+    return;
+}
+
+static void fillarr(unsigned int *arr, unsigned int elements, 
+  unsigned int seed) {
+    unsigned int i;
+
+    for (srand(seed), i = 0; i < elements; i++) {
+        arr[i] = rand() % (elements << 1);
+    }
+
+    return;
+}
+
+static int cmp_int(const void *vone, const void *vtwo) {
+    const unsigned int *one = vone,
+                       *two = vtwo;
+
+    if (*two < *one) {
+        return 1;
+    } else if (*one < *two) {
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int main(int argc, char **argv) {
+    unsigned int elements;
+    unsigned int seed;
+    unsigned int *arr,
+                 i = 0;
+
+    seed = time(NULL);
+
+    if ((argc == 2) || (argc == 3)) {
+        elements = strtol(argv[1], NULL, 0);
+    } else {
+        fprintf(stderr, "usage: %s elements [seed]\n", *argv);
+        return EXIT_FAILURE;
+    }
+
+    if (argc == 3) {
+        seed = strtol(argv[2], NULL, 0);
+    }
+
+    if (!(arr = malloc(sizeof(*arr) * elements))) {
+        fprintf(stderr, "can't get memory\n");
+    }
+
+    fillarr(arr, elements, seed);
+
+    /* create heap */
+    for (i = 1; i < elements;) {
+        heap_insert(arr, &i, sizeof(*arr), cmp_int, &arr[i]);
+    }
+
+    if (!heap_isheap(arr, elements, sizeof(*arr), cmp_int, 0)) {
+        printarr(stderr, arr, elements);
+        printf("arr is not a heap (seed %u)!\n", seed);
+    } 
+
+    /* sort by popping elements off heap */
+    for (i = elements; i > 1;) {
+        heap_pop(arr, &i, sizeof(*arr), cmp_int);
+    }
+
+    if (!heap_issorted(arr, elements, sizeof(*arr), cmp_int, 1)) {
+        printarr(stderr, arr, elements);
+        printf("arr is not sorted (seed %u)!\n", seed);
+    } 
+
+    free(arr);
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
diff --git a/src/impact.c b/src/impact.c
new file mode 100644 (file)
index 0000000..3487495
--- /dev/null
@@ -0,0 +1,329 @@
+/* impact_search.c implements impact ordered search as proposed by Anh and
+ * Moffat
+ * 
+ * based on code by garcias
+ *
+ */
+
+#include "firstinclude.h"
+
+#include <assert.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "chash.h"
+#include "def.h"
+#include "error.h"
+#include "heap.h"
+#include "impact_build.h"
+#include "impact.h"
+#include "index.h"
+#include "_index.h"
+#include "search.h"
+#include "vec.h"
+#include "vocab.h"
+#include "index_querybuild.h"
+
+struct disksrc {
+    struct search_list_src src;      /* parent source structure */
+    struct alloc alloc;              /* buffer allocation object */
+    char *buf;                       /* available buffer */
+    unsigned int bufsize;            /* size of stuff in buffer */
+    unsigned int bufcap;             /* capacity of buffer */
+    unsigned long int bufpos;        /* position buffer was read from */
+    unsigned int size;               /* size of the list */
+    unsigned int pos;                /* position in list */
+
+    struct index *idx;               /* index we're using */
+    int fd;                          /* pinned fd */
+    unsigned int type;               /* the type of the fd */
+    unsigned int fileno;             /* the file number of the fd */
+    unsigned long int offset;        /* starting offset of the list */
+};
+
+struct term_data {
+    unsigned int impact;                /* current impact */
+    unsigned int w_qt;                  /* term weight */
+    unsigned int blocksize;             /* number of docs remaining in block */
+    unsigned long int docno;            /* current docno */
+    struct vec v;                       /* vector of in-memory data */
+    struct search_list_src *src;        /* list src */
+};
+
+/* internal function to compare phrase term pointers by frequency/estimated
+   frequency */
+static int term_data_cmp(const void *one, const void *two) {
+    const struct term_data *tdone = one,
+                           *tdtwo = two;
+
+    return tdtwo->impact - tdone->impact;
+}
+
+/* internal function to compare phrase term pointers by frequency/estimated
+   frequency */
+static int f_t_cmp(const void *one, const void *two) {
+    const struct conjunct *done = one,
+                          *dtwo = two;
+
+    if (done->f_t < dtwo->f_t) {
+        return -1;
+    } else if (done->f_t > dtwo->f_t) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+/* decode a block and add contributions into accumulators */
+static void impact_decode_block(struct chash *accs, struct term_data *term,
+  unsigned int blockfine) {
+    unsigned int contrib = term->impact - blockfine;
+    unsigned long int docno_d;
+    int ret;
+
+    while (term->blocksize && vec_vbyte_read(&term->v, &docno_d)) {
+        unsigned long int *fw;
+        int found;
+
+        term->docno += docno_d + 1;
+
+        /* should never fail */
+        ret = chash_luint_luint_find_insert(accs, term->docno, &fw, 0, &found);
+        assert(ret == CHASH_OK);
+        *fw += contrib;
+        term->blocksize--;
+    }
+}
+
+/* decode a block and add contributions into accumulators, but don't create new
+ * accumulators */
+static void impact_decode_block_and(struct chash *accs, struct term_data *term,
+  unsigned int blockfine) {
+    unsigned int contrib = term->impact - blockfine;
+    unsigned long int docno_d;
+
+    while (term->blocksize && vec_vbyte_read(&term->v, &docno_d)) {
+        unsigned long int *fw;
+
+        term->docno += docno_d + 1;
+
+        if (chash_luint_luint_find(accs, term->docno, &fw) == CHASH_OK) {
+            *fw += contrib;
+        }
+        term->blocksize--;
+    }
+}
+
+static void source_delete(struct term_data *term, unsigned int terms) {
+    unsigned int i;
+
+    for (i = 0; i < terms; i++) {
+        if (term[i].src) {
+            term[i].src->delet(term[i].src);
+            term[i].src = NULL;
+        }
+    }
+}
+
+enum search_ret impact_ord_eval(struct index *idx, struct query *query, 
+  struct chash *accumulators, unsigned int acc_limit, struct alloc *alloc, 
+  unsigned int mem) {
+    double norm_B;
+    unsigned int i,
+                 terms = 0,
+                 blockfine,
+                 blocks_read,
+                 postings_read = 0,
+                 postings = 0,
+                 bytes = 0,
+                 bytes_read = 0;
+    struct term_data *term,
+                     *largest;
+    struct disksrc *dsrc;
+
+    if (query->terms == 0) {
+        /* no terms to process */
+        return SEARCH_OK;
+    /* allocate space for array */
+    } else if (!(term = malloc(sizeof(*term) * query->terms))) {
+        return SEARCH_ENOMEM;
+    }
+
+    /* sort by selectivity (by inverse t_f) */
+    qsort(query->term, query->terms, sizeof(*query->term), f_t_cmp);
+
+    norm_B = pow(idx->impact_stats.w_qt_max / idx->impact_stats.w_qt_min,
+        idx->impact_stats.w_qt_min 
+          / (idx->impact_stats.w_qt_max - idx->impact_stats.w_qt_min));
+
+    /* initialise data for each query term */
+    for (i = 0; i < query->terms; i++) {
+        unsigned int termfine;
+        double w_qt;
+
+        /* initialise src/vec for term */
+        term[i].v.pos = term[i].v.end = NULL;
+        term[i].src = NULL;
+
+        w_qt = (1 + log(query->term[i].f_qt)) *
+          log(1 + (idx->impact_stats.avg_f_t / query->term[i].f_t));
+        w_qt = impact_normalise(w_qt, norm_B, 
+            idx->impact_stats.slope, idx->impact_stats.w_qt_max, 
+            idx->impact_stats.w_qt_min);
+        term[i].w_qt = impact_quantise(w_qt, 
+            idx->impact_stats.quant_bits, idx->impact_stats.w_qt_max, 
+            idx->impact_stats.w_qt_min);
+
+        /* apply term fine to term impact */
+        termfine = (i < 2) ? 0 : i - 2;
+        if (termfine < term[i].w_qt) {
+            term[i].w_qt -= termfine;
+            /* initialise to highest impact, so we'll select and initialise this
+             * term before real processing */
+            term[i].impact = INT_MAX;
+            terms++;
+        } else {
+            /* we won't use this term */
+            term[i].w_qt = 0;
+            term[i].impact = 0;
+        }
+        term[i].blocksize = 0;
+
+        /* XXX */
+        postings += query->term[i].f_t;
+        bytes += query->term[i].term.vocab.size;
+    }
+
+    /* get sources for each term (do this in a seperate loop so we've already
+     * excluded lists that we won't use) */
+    for (i = 0; i < terms; i++) {
+        unsigned int memsize = mem / (terms - i);
+
+        if (memsize > query->term[i].term.vocab.size) {
+            memsize = query->term[i].term.vocab.size;
+        }
+
+        if (!(term[i].src 
+          = search_term_src(idx, &query->term[i].term, alloc, memsize))) {
+            source_delete(term, terms);
+            free(term);
+            return SEARCH_EINVAL;
+        }
+
+        mem -= memsize;
+    }
+
+    blockfine = blocks_read = 0;
+    heap_heapify(term, terms, sizeof(*term), term_data_cmp);
+
+    do {
+        largest = heap_pop(term, &terms, sizeof(*term), term_data_cmp);
+
+        if (largest && (largest->impact > blockfine)) {
+            postings_read += largest->blocksize;
+            if (chash_size(accumulators) < acc_limit) {
+                /* reserve enough memory for accumulators and decode */
+                if (chash_reserve(accumulators, largest->blocksize) 
+                  >= largest->blocksize) {
+                    impact_decode_block(accumulators, largest, blockfine);
+                } else {
+                    assert(!CRASH); ERROR("impact_ord_eval()");
+                    source_delete(term, terms);
+                    free(term);
+                    return SEARCH_EINVAL;
+                }
+            } else {
+                impact_decode_block_and(accumulators, largest, blockfine);
+            }
+
+            if (VEC_LEN(&largest->v) < 2 * VEC_VBYTE_MAX) {
+                /* need to read more data */
+                unsigned int bytes;
+                enum search_ret sret;
+
+                if ((sret 
+                  = largest->src->readlist(largest->src, VEC_LEN(&largest->v), 
+                    (void **) &largest->v.pos, &bytes)) == SEARCH_OK) {
+
+                    /* read succeeded */
+                    largest->v.end = largest->v.pos + bytes;
+                } else if (sret == SEARCH_FINISH) {
+                    if (VEC_LEN(&largest->v) || largest->blocksize) {
+                        /* didn't finish properly */
+                        assert(!CRASH); ERROR("impact_ord_eval()");
+                        source_delete(term, terms);
+                        free(term);
+                        return SEARCH_EINVAL;
+                    }
+                    /* otherwise it will be finished below */
+                } else {
+                    assert(!CRASH); ERROR("impact_ord_eval()");
+                    source_delete(term, terms);
+                    free(term);
+                    return sret;
+                }
+            }
+
+            if (!largest->blocksize) {
+                /* need to read the start of the next block */
+                unsigned long int tmp_bsize,
+                                  tmp_impact;
+
+                if (vec_vbyte_read(&largest->v, &tmp_bsize)
+                  && (vec_vbyte_read(&largest->v, &tmp_impact) 
+                    /* second read failed, rewind past first vbyte */
+                    || ((largest->v.pos -= vec_vbyte_len(tmp_bsize)), 0))) {
+
+                    blocks_read++;
+                    if (blocks_read > terms) {
+                        blockfine++;
+                    }
+
+                    largest->blocksize = tmp_bsize;
+                    largest->impact = (tmp_impact + 1) * largest->w_qt;
+                    largest->docno = -1;
+                    heap_insert(term, &terms, sizeof(*term), term_data_cmp, 
+                      largest);
+                } else if (!VEC_LEN(&largest->v)) {
+                    /* finished, don't put back on the heap */
+                    dsrc = (void *) largest->src; bytes_read += dsrc->pos;
+                    largest->src->delet(largest->src);
+                    largest->src = NULL;
+                } else if (largest->impact != INT_MAX) {
+                    /* ensure that this vector is chosen next, as we need the
+                     * next impact score */
+                    largest->impact = INT_MAX;
+                    assert(largest->blocksize == 0);
+                    heap_insert(term, &terms, sizeof(*term), term_data_cmp, 
+                      largest);
+                } else {
+                    /* huh? */
+                    assert(!CRASH); ERROR("impact_ord_eval()");
+                    source_delete(term, terms);
+                    free(term);
+                    return SEARCH_EINVAL;
+                }
+            } else {
+                heap_insert(term, &terms, sizeof(*term), term_data_cmp, 
+                  largest);
+            }
+        }
+    } while (largest && (largest->impact > blockfine));
+
+    for (i = 0; i < terms; i++) {
+        dsrc = (void *) term[i].src; bytes_read += dsrc->pos;
+    }
+
+    if (largest) {
+        largest->src->delet(largest->src);
+        largest->src = NULL;
+    }
+
+    /* end of ranking */
+    source_delete(term, terms);
+    free(term);
+    return SEARCH_OK;
+}
+
diff --git a/src/impact_build.c b/src/impact_build.c
new file mode 100644 (file)
index 0000000..ba637ed
--- /dev/null
@@ -0,0 +1,909 @@
+#include "firstinclude.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <float.h>
+
+#include "vocab.h"
+#include "impact_build.h"
+#include "index.h"
+#include "_index.h"
+#include "getmaxfsize.h"
+#include "btbulk.h"
+#include "bucket.h"
+#include "error.h"
+#include "stdio.h"
+#include "iobtree.h"
+#include "vocab.h"
+#include "docmap.h"
+#include "_docmap.h"
+#include "error.h"
+#include "vec.h"
+#include "fdset.h"
+#include "str.h"
+
+#define IMPACT_UNSET -1.0F
+#define W_QT_UNSET -1.0F
+#define E_VALUE 0.0001 
+
+/* In-memory, decompressed representation of a postings list, without wpos. */
+struct list_posting {
+    unsigned long int docno; /* posting document number */
+    unsigned long int f_dt;  /* number of times gram appears in thisdoc */
+    unsigned int impact;     /* impact score of this posting */
+};
+
+struct list_decomp {
+    struct list_posting *postings;   /* array of postings */
+    unsigned int postings_size;      /* size of above array */
+    unsigned long int f_t;           /* term frequency */
+    unsigned long int docno_max;     /* highest doc no this gram appears in */
+};
+
+static enum impact_ret decompress_list(struct vocab_vector *vocab, 
+  char *vec_buf, struct list_decomp *decomp_list);
+
+static enum impact_ret compress_impact_ordered_list(struct list_decomp * list,
+  char ** vec_mem, unsigned int * vec_mem_len, unsigned int * vec_size);
+
+static enum impact_ret load_vector(struct index * idx, const char * term,
+  struct vocab_vector * vocab, char ** vec_mem,
+  unsigned int * vec_mem_len, unsigned int * vec_len); 
+
+static enum impact_ret get_doc_vec(struct index * idx, const char * term,
+  void * term_data, unsigned int term_data_len, 
+  char ** vec_mem, unsigned int * vec_mem_len, 
+  struct vocab_vector * vocab_in);
+
+static enum impact_ret calculate_impact_limits(struct index * idx,
+  double pivot, double * max_impact, double * min_impact, double *ft_avg);
+
+static double calc_impact_pivoted_cosine(unsigned long int f_dt, 
+  unsigned long int f_t, double W_d, double aW_d, double pivot);
+
+static enum impact_ret 
+calculate_list_impact_limits(struct vocab_vector * vocab_entry,
+  char * vec_buf, struct docmap * docmap,
+  double avg_weight, double pivot, double * list_max_impact, 
+  double * list_min_impact);
+
+static void impact_transform_list(struct list_decomp * decomp_list,
+  struct docmap * docmap, double avg_weight, double pivot,
+  double max_impact, double min_impact, double slope, 
+  unsigned int quant_bits, double norm_B, double *w_qt_min, double *w_qt_max, 
+  double f_t_avg);
+
+static void impact_order_sort(struct list_decomp *list);
+
+static int impact_order_compare(const void *p1, const void *p2);
+
+struct addfile_data {
+    struct fdset * fd;
+    unsigned int fd_type;
+};
+
+static enum impact_ret fdset_write(unsigned int fileno,
+  unsigned int filetype, unsigned long int offset,
+  struct fdset *fdset, char *data, unsigned int data_len);
+
+/**
+ *  Routines for creating an impact-ordered index.
+ */
+enum impact_ret impact_order_index(struct index *idx) {
+    unsigned int new_vocab_fileno;
+    unsigned long int new_vocab_file_offset;
+    struct btbulk new_vocab_bulk_inserter;
+    int new_vocab_bulk_inserter_inited = 0;
+    unsigned int tmp_vocab_fd_type;
+
+    unsigned int new_vocab_root_fileno = 0;
+    unsigned long int new_vocab_root_file_offset = 0;
+
+    unsigned int new_vector_fileno;
+    unsigned long int vector_file_offset;
+    int new_vector_fd_out;
+    unsigned int new_vector_fd_type;
+
+    char * vec_mem = NULL;
+    unsigned vec_mem_len = 0;
+
+    ssize_t nwritten;
+    unsigned int term_iterator_state[3] = { 0U, 0U, 0U };
+    const char * term;
+    unsigned int termlen;
+    void * data;
+    unsigned int datalen;
+    enum btbulk_ret bulk_inserter_ret;
+    struct list_decomp decomp_list;
+    double max_impact;
+    double min_impact;
+    enum impact_ret our_ret = IMPACT_OK;
+    double norm_B; /* used for logarithmic normalisation */
+    struct addfile_data addfile_data;
+    unsigned int fileno;
+    unsigned long int terms = 0;
+    unsigned long int dummy_offset = 0;
+    unsigned int dummy_size = 0;
+    int vector_file_is_new = 1;
+    double f_t_avg;
+    double w_qt_max = W_QT_UNSET;
+    double w_qt_min = W_QT_UNSET;
+    double pivot = IMPACT_DEFAULT_PIVOT;
+    double slope = IMPACT_DEFAULT_SLOPE;
+    unsigned int quant_bits = IMPACT_DEFAULT_QUANT_BITS;
+    
+    if ( (our_ret = calculate_impact_limits(idx, pivot,
+              &max_impact, &min_impact, &f_t_avg)) != IMPACT_OK) {
+        ERROR("calculating impact limits");
+        goto ERROR;
+    }
+    assert(min_impact <= max_impact);
+
+    norm_B = pow(max_impact / min_impact, 
+      min_impact / (max_impact - min_impact));
+
+    decomp_list.postings = NULL;
+    decomp_list.postings_size = 0;
+
+    tmp_vocab_fd_type = idx->tmp_type;
+    addfile_data.fd = idx->fd;
+    addfile_data.fd_type = tmp_vocab_fd_type;
+
+    if (!(btbulk_new(idx->storage.pagesize, idx->storage.max_filesize,
+              idx->storage.btleaf_strategy, idx->storage.btnode_strategy,
+              1.0 /* fill factor */, 0, &new_vocab_bulk_inserter))) {
+        ERROR("creating new btbulk inserter for impact ordering");
+        goto ERROR;
+    }
+    new_vocab_bulk_inserter_inited = 1;
+
+    /* add the new vectors to existing vector file set (though starting
+       with a new file. */
+    new_vector_fd_type = idx->index_type;
+    new_vector_fileno = idx->vectors;
+    /* not first_file_header, as these vector files follow 
+       the existings ones. */
+    vector_file_offset = 0;
+
+    new_vocab_fileno = 0;
+    new_vocab_file_offset = 0;
+    /* not first_file_header, as that is only for vectors files */
+    new_vocab_file_offset = 0;
+
+    while ( (term = iobtree_next_term(idx->vocab, term_iterator_state,
+              &termlen, &data, &datalen)) != NULL) {
+        struct vocab_vector vocab_in;
+        unsigned int vec_size;
+        struct vocab_vector vocab_entry_out;
+        unsigned int vocab_entry_out_len;
+        unsigned int vocab_vector_out_len;
+        enum vocab_ret vocab_ret;
+        struct vec vec;
+
+        if ( (our_ret = get_doc_vec(idx, term, data, datalen, 
+                  &vec_mem, &vec_mem_len, &vocab_in)) != IMPACT_OK) {
+            ERROR1("loading document vector for term '%s'", term);
+            goto ERROR;
+        }
+        if ( (our_ret = decompress_list(&vocab_in, vec_mem, &decomp_list))
+          != IMPACT_OK) {
+            goto ERROR;
+        }
+        impact_transform_list(&decomp_list, idx->map, idx->stats.avg_weight, 
+          pivot, max_impact, min_impact, slope, quant_bits, norm_B, 
+          &w_qt_min, &w_qt_max, f_t_avg);
+        if ( (our_ret = compress_impact_ordered_list(&decomp_list,
+                  &vec_mem, &vec_mem_len, &vec_size)) != IMPACT_OK) {
+            goto ERROR;
+        }
+
+        /* Write vector to disk. */
+        /* XXX currently, we write all impact ordered vectors to location
+           type 'file'.  This should be changed in future. */
+        /* NOTE expressed this way to avoid integer overflow, which
+           is a real issue, as the max filesize is quite likely to be 
+           UINT_MAX.  Be VERY CAREFUL about modifying this expression! */
+        if (idx->storage.max_filesize - vec_size < vector_file_offset) {
+            dummy_offset = 0;
+            dummy_size = vector_file_offset;
+            new_vector_fileno++;
+            vector_file_offset = 0;
+            vector_file_is_new = 1;
+        }
+
+        if (vector_file_is_new) {
+            if ( (new_vector_fd_out = fdset_create_seek(idx->fd, 
+                      new_vector_fd_type, new_vector_fileno, 
+                      vector_file_offset)) < 0) {
+                ERROR2("unable to create output temporary vector file number "
+                  "%lu and seek to offset %lu", new_vector_fileno, 
+                  vector_file_offset);
+                goto ERROR;
+            }
+            vector_file_is_new = 0;
+        } else {
+            if ( (new_vector_fd_out = fdset_pin(idx->fd, new_vector_fd_type,
+                      new_vector_fileno, vector_file_offset, SEEK_SET)) < 0) {
+                ERROR2("unable to open output temporary vector file number "
+                       "%lu to offset %lu", new_vector_fileno, 
+                       vector_file_offset);
+                goto ERROR;
+            }
+        }
+
+        nwritten = index_atomic_write(new_vector_fd_out, vec_mem, vec_size);
+        fdset_unpin(idx->fd, new_vector_fd_type, new_vector_fileno,
+          new_vector_fd_out);
+        if (nwritten != (ssize_t) vec_size) {
+            ERROR3("writing vector of size %lu to temporary vector file "
+              "number %lu, offset %lu", vec_size, new_vector_fileno,
+              vector_file_offset);
+            goto ERROR;
+        }
+
+        /* XXX we should really remove any old impact-ordered vector
+           entries; but the policy for this is still unclear. */
+
+        /* Add vocab entry for impact vector to existing vocab entries. */
+        vocab_entry_out.attr = VOCAB_ATTRIBUTES_NONE;
+        vocab_entry_out.attribute = 0;
+        vocab_entry_out.type = VOCAB_VTYPE_IMPACT;
+        vocab_entry_out.size = vec_size;
+        switch (vocab_in.type) {
+        case VOCAB_VTYPE_DOC:
+            vocab_entry_out.header.impact.docs = vocab_in.header.doc.docs;
+            vocab_entry_out.header.impact.occurs = vocab_in.header.doc.occurs;
+            vocab_entry_out.header.impact.last = vocab_in.header.doc.last;
+            break;
+        case VOCAB_VTYPE_DOCWP:
+            vocab_entry_out.header.impact.docs = vocab_in.header.docwp.docs;
+            vocab_entry_out.header.impact.occurs = vocab_in.header.docwp.occurs;
+            vocab_entry_out.header.impact.last = vocab_in.header.docwp.last;
+            break;
+        default:
+            assert("shouldn't happen" && 0);
+        }
+        vocab_entry_out.location = VOCAB_LOCATION_FILE;
+        vocab_entry_out.loc.file.capacity = vec_size;
+        vocab_entry_out.loc.file.fileno = new_vector_fileno;
+        vocab_entry_out.loc.file.offset = vector_file_offset;
+
+        vocab_entry_out_len = vocab_len(&vocab_entry_out);
+        vocab_vector_out_len = datalen + vocab_entry_out_len;
+
+        if (vocab_vector_out_len > vec_mem_len) {
+            char * new_vec_mem;
+            new_vec_mem = realloc(vec_mem, vocab_vector_out_len); 
+            if (new_vec_mem == NULL) {
+                our_ret = IMPACT_MEM_ERROR;
+                goto ERROR;
+            }
+            vec_mem = new_vec_mem;
+            vec_mem_len = vocab_vector_out_len;
+        }
+        memcpy(vec_mem, data, datalen);
+
+        vec.pos = vec_mem + datalen;
+        vec.end = vec_mem + vec_mem_len;
+        vocab_ret = vocab_encode(&vocab_entry_out, &vec);
+        assert(vocab_ret == VOCAB_OK); /* bug if not */
+
+        /* vec_mem now contains new vocab vector to add to new index. */
+        new_vocab_bulk_inserter.term = term;
+        new_vocab_bulk_inserter.termlen = termlen;
+        new_vocab_bulk_inserter.datasize = vocab_vector_out_len;
+        do {
+            new_vocab_bulk_inserter.fileno = new_vocab_fileno;
+            new_vocab_bulk_inserter.offset = new_vocab_file_offset;
+
+            bulk_inserter_ret = btbulk_insert(&new_vocab_bulk_inserter);
+            switch (bulk_inserter_ret) {
+            case BTBULK_OK:
+                memcpy(new_vocab_bulk_inserter.output.ok.data, 
+                  vec_mem, vocab_vector_out_len);
+                break;
+            case BTBULK_WRITE:
+                our_ret = fdset_write(new_vocab_fileno,
+                  tmp_vocab_fd_type, new_vocab_file_offset, idx->fd, 
+                  new_vocab_bulk_inserter.output.write.next_out,
+                  new_vocab_bulk_inserter.output.write.avail_out);
+                if (our_ret != IMPACT_OK)
+                    goto ERROR;
+                new_vocab_file_offset += 
+                      new_vocab_bulk_inserter.output.write.avail_out;
+                break;
+            case BTBULK_FLUSH:
+                new_vocab_fileno++;
+                idx->vectors++;
+                assert(new_vocab_fileno == idx->vectors - 1);
+                new_vocab_file_offset = 0;
+                new_vocab_file_offset = 0;
+                break;
+            case BTBULK_ERR:
+                ERROR2("error on btbulk_insert call for term '%s', "
+                  "data size %u", term, vocab_vector_out_len);
+                goto ERROR;
+                break;
+            default:
+                assert(0);
+            }
+        } while (bulk_inserter_ret != BTBULK_OK);
+        terms++;
+        vector_file_offset += vec_size;
+    } /* end while term = iobtree_next_term */
+    assert(terms == iobtree_size(idx->vocab));
+    assert(w_qt_max > w_qt_min);
+    
+    /* save parameters required at query time for impact ordering in index */
+    /* these are saved in index_params_write() which is called in 
+       index_commit_superblock() below */
+    idx->impact_stats.avg_f_t = f_t_avg;
+    idx->impact_stats.slope = slope;
+    idx->impact_stats.quant_bits = quant_bits;
+    idx->impact_stats.w_qt_min = w_qt_min;
+    idx->impact_stats.w_qt_max = w_qt_max;
+    idx->impact_vectors = 1;
+    
+    dummy_offset = 0;
+    dummy_size = vector_file_offset;
+
+    do {
+        new_vocab_bulk_inserter.fileno = new_vocab_fileno;
+        new_vocab_bulk_inserter.offset = new_vocab_file_offset;
+        bulk_inserter_ret 
+          = btbulk_finalise(&new_vocab_bulk_inserter, &new_vocab_root_fileno, 
+            &new_vocab_root_file_offset);
+        switch (bulk_inserter_ret) {
+        case BTBULK_FINISH:
+        case BTBULK_OK:
+            bulk_inserter_ret = BTBULK_OK;
+            break;
+        case BTBULK_WRITE:
+            our_ret = fdset_write(new_vocab_fileno,
+              tmp_vocab_fd_type, new_vocab_file_offset, idx->fd,
+              new_vocab_bulk_inserter.output.write.next_out,
+              new_vocab_bulk_inserter.output.write.avail_out);
+            if (our_ret != IMPACT_OK)
+                goto ERROR;
+            new_vocab_file_offset += 
+                new_vocab_bulk_inserter.output.write.avail_out;
+            break;
+        case BTBULK_FLUSH:
+            /* XXX copied from main loop. */
+            new_vocab_fileno++;
+            idx->vectors++;
+            assert(new_vocab_fileno == idx->vectors - 1);
+            new_vocab_file_offset = 0;
+            new_vocab_file_offset = 0;
+            break;
+        case BTBULK_ERR:
+            ERROR("error on btbulk_finalise call");
+            goto ERROR;
+            break;
+        default:
+            assert(0);
+        }
+    } while (bulk_inserter_ret != BTBULK_OK);
+
+    /* delete the old vocab */
+    iobtree_delete(idx->vocab);
+    idx->vocab = NULL;
+    for (fileno = 0; fileno < idx->vocabs; fileno++) {
+        if (fdset_unlink(idx->fd, idx->vocab_type, fileno) < 0) {
+            /* ouch, now the index is probably stuffed. */
+            ERROR1("unlinking old vocab file number %u", fileno);
+            our_ret = IMPACT_IO_ERROR;
+            goto ERROR;
+        }
+    }
+    idx->vocabs = 0;
+    for (fileno = 0; fileno <= new_vocab_fileno; fileno++) {
+        char final_fname[FILENAME_MAX + 1];
+        char tmp_fname[FILENAME_MAX + 1];
+        unsigned int final_fname_len;
+        unsigned int tmp_fname_len;
+        int writeable;
+
+        fdset_name(idx->fd, idx->vocab_type, fileno, final_fname, FILENAME_MAX,
+          &final_fname_len, &writeable);
+        fdset_name(idx->fd, tmp_vocab_fd_type, fileno, tmp_fname, FILENAME_MAX,
+          &tmp_fname_len, &writeable);
+        if (fdset_close_file(idx->fd, tmp_vocab_fd_type, fileno) < 0) {
+            /* in fact probably indicates a still-pinned fd, i.e. a 
+               programming error */
+            ERROR1("closing new vocab file %u", fileno);
+            our_ret = IMPACT_IO_ERROR;
+            goto ERROR;
+        }
+        if (rename(tmp_fname, final_fname) < 0) {
+            ERROR3("renaming vocab file number %u from %s to %s\n",
+              fileno, tmp_fname, final_fname);
+            our_ret = IMPACT_IO_ERROR;
+            goto ERROR;
+        }
+    }
+    idx->vocabs = new_vocab_fileno + 1;
+
+    /* do quick load of vocab */
+    idx->vocab = iobtree_load_quick(idx->storage.pagesize, 
+      idx->storage.btleaf_strategy, idx->storage.btnode_strategy,
+      NULL, idx->fd, idx->vocab_type, new_vocab_root_fileno,
+      new_vocab_root_file_offset, terms);
+    if (idx->vocab == NULL) {
+        ERROR("quick-loading new vocab");
+        our_ret = IMPACT_OTHER_ERROR; /* could be mem, io, prob. bug */
+        goto ERROR;
+    }
+    /* commit index superblock */
+    /* XXX check that this is correct. */
+    if (!(index_commit_superblock(idx))) {
+        ERROR("committing superblock for new index");
+        our_ret = IMPACT_IO_ERROR; /* or else a bug */
+        goto ERROR;
+    }
+
+    goto END;
+
+ERROR:
+    if (our_ret == IMPACT_OK)
+        our_ret = IMPACT_OTHER_ERROR;
+
+END:
+    if (new_vocab_bulk_inserter_inited) {
+        btbulk_delete(&new_vocab_bulk_inserter);
+    }
+
+    free(vec_mem);
+    free(decomp_list.postings);
+    return our_ret;
+}
+
+static enum impact_ret decompress_list(struct vocab_vector *vocab, 
+  char *vec_buf, struct list_decomp *decomp_list) {
+    unsigned long int docs;
+    unsigned long int occurs;
+    unsigned long int last;
+    unsigned long int docno;
+    struct vec vec;
+    unsigned long int d;
+
+    assert(vocab->type == VOCAB_VTYPE_DOC || vocab->type == VOCAB_VTYPE_DOCWP);
+    switch (vocab->type) {
+    case VOCAB_VTYPE_DOC:
+        docs = vocab->header.doc.docs;
+        occurs = vocab->header.doc.occurs;
+        last = vocab->header.doc.last;
+        break;
+    case VOCAB_VTYPE_DOCWP:
+        docs = vocab->header.docwp.docs;
+        occurs = vocab->header.docwp.occurs;
+        last = vocab->header.docwp.last;
+        break;
+    default:
+        assert("shouldn't be here" && 0);
+        return IMPACT_OTHER_ERROR;
+    }
+    if (decomp_list->postings_size < docs) {
+        struct list_posting *tmp_postings;
+        if ( (tmp_postings = realloc(decomp_list->postings,
+                  sizeof(*decomp_list->postings) * docs)) == NULL)
+            return IMPACT_MEM_ERROR;
+        decomp_list->postings = tmp_postings;
+        decomp_list->postings_size = docs;
+    }
+    decomp_list->f_t = docs;
+    decomp_list->docno_max = last;
+
+    docno = 0;
+    vec.pos = vec_buf;
+    vec.end = vec_buf + vocab->size;
+    for (d = 0; d < docs; d++) {
+        unsigned long int docno_d;
+        unsigned long int f_dt;
+        vec_vbyte_read(&vec, &docno_d);
+        vec_vbyte_read(&vec, &f_dt);
+        docno += docno_d;
+        decomp_list->postings[d].docno = docno + d;
+        decomp_list->postings[d].f_dt = f_dt;
+        /* N.B. leaving impact unset at this time. */
+        if (vocab->type == VOCAB_VTYPE_DOCWP) {
+            unsigned int bytes;
+            vec_vbyte_scan(&vec, (unsigned int) f_dt, &bytes);
+        }
+        assert(d == 0 || decomp_list->postings[d].docno >
+          decomp_list->postings[d - 1].docno);
+    }
+    assert(decomp_list->docno_max == docno + (d - 1));
+    return IMPACT_OK;
+}
+
+static enum impact_ret load_vector(struct index * idx, const char * term,
+  struct vocab_vector * vocab, char ** vec_mem,
+  unsigned int * vec_mem_len, unsigned int * vec_len) {
+    int fd_in;
+    ssize_t read;
+
+    if (vocab->size > *vec_mem_len) {
+        if (!(*vec_mem = realloc(*vec_mem, vocab->size)))
+            return IMPACT_MEM_ERROR;
+        *vec_mem_len = vocab->size;
+    }
+    *vec_len = vocab->size;
+
+    switch (vocab->location) {
+    case VOCAB_LOCATION_VOCAB:
+        memcpy(*vec_mem, vocab->loc.vocab.vec, vocab->size);
+        /* XXX does loc.vocab.vec need to be freed? */
+        break;
+
+    case VOCAB_LOCATION_FILE:
+        if ( (fd_in = fdset_pin(idx->fd, idx->index_type,
+                  vocab->loc.file.fileno, vocab->loc.file.offset,
+                  SEEK_SET)) < 0) 
+            return IMPACT_IO_ERROR;
+        read = index_atomic_read(fd_in, *vec_mem, vocab->size);
+        fdset_unpin(idx->fd, idx->index_type, vocab->loc.file.fileno, fd_in);
+        if (read < 0)
+            return IMPACT_IO_ERROR;
+        break;
+    default:
+        assert("shouldn't get here" && 0);
+    }
+    return IMPACT_OK;
+}
+
+static enum impact_ret calculate_impact_limits(struct index * idx,
+  double pivot, double * max_impact, double * min_impact, double *ft_avg) {
+    unsigned int term_iterator_state[3] = { 0U, 0U, 0U };
+    const char * term;
+    unsigned int termlen;
+    void * data;
+    unsigned int datalen;
+    char * vec_mem = NULL;
+    unsigned vec_mem_len = 0;
+    double avg_weight;
+    enum impact_ret our_ret = IMPACT_OK;
+    int first_term = 1;
+    enum docmap_ret docmap_ret;
+    unsigned long int ft_sum = 0; /* cumulitive sum of f_t for each term */
+    unsigned long int ft_count = 0; /* number of terms */
+
+    docmap_ret = docmap_cache(idx->map, docmap_get_cache(idx->map) 
+      | DOCMAP_CACHE_WEIGHT);
+    if (docmap_ret != DOCMAP_OK) {
+        ERROR("loading document weights");
+        switch (docmap_ret) {
+        case DOCMAP_MEM_ERROR:
+            our_ret = IMPACT_MEM_ERROR;
+            break;
+        case DOCMAP_IO_ERROR:
+            our_ret = IMPACT_IO_ERROR;
+            break;
+        case DOCMAP_FMT_ERROR:
+            our_ret = IMPACT_FMT_ERROR;
+            break;
+        default:
+            our_ret = IMPACT_OTHER_ERROR;
+        }
+        goto ERROR;
+    }
+
+    avg_weight = idx->stats.avg_weight;
+
+    *max_impact = IMPACT_UNSET;
+    *min_impact = IMPACT_UNSET;
+    while ( (term = iobtree_next_term(idx->vocab, term_iterator_state,
+              &termlen, &data, &datalen)) != NULL) {
+        struct vocab_vector vocab_in;
+        double list_max_impact;
+        double list_min_impact;
+
+        if ( (our_ret = get_doc_vec(idx, term, data, datalen, 
+                  &vec_mem, &vec_mem_len, &vocab_in)) != IMPACT_OK) {
+            ERROR1("loading document vector for term '%s'", term);
+            goto ERROR;
+        }
+        
+        ft_sum += vocab_in.header.docwp.docs;
+        ft_count++;
+        
+        if ( (our_ret = calculate_list_impact_limits(&vocab_in, 
+                  vec_mem, idx->map, avg_weight, pivot,
+                  &list_max_impact, &list_min_impact)) != IMPACT_OK) {
+            ERROR1("calculating max and min impact for term '%s'", term);
+            goto ERROR;
+        }
+        if (first_term) {
+            *max_impact = list_max_impact;
+            *min_impact = list_min_impact;
+            first_term = 0;
+        } else {
+            if (*max_impact < list_max_impact)
+                *max_impact = list_max_impact;
+            if (*min_impact > list_min_impact)
+                *min_impact = list_min_impact;
+        }
+    }
+    *ft_avg = ft_sum/ft_count;
+    goto END;
+
+ERROR:
+    if (our_ret == IMPACT_OK)
+        our_ret = IMPACT_OTHER_ERROR;
+
+END:
+    free(vec_mem);
+    return our_ret;
+}
+
+static enum impact_ret calculate_list_impact_limits(
+  struct vocab_vector * vocab_entry, char * vec_buf, struct docmap * docmap,
+  double avg_weight, double pivot, double * list_max_impact, 
+  double * list_min_impact) {
+    unsigned long int docs;
+    unsigned long int d;
+    unsigned long int docno;
+    struct vec vec;
+
+    *list_max_impact = IMPACT_UNSET;
+    *list_min_impact = IMPACT_UNSET;
+
+    switch (vocab_entry->type) {
+    case VOCAB_VTYPE_DOC:
+        docs = vocab_entry->header.doc.docs;
+        break;
+    case VOCAB_VTYPE_DOCWP:
+        docs = vocab_entry->header.docwp.docs;
+        break;
+    default:
+        assert("shouldn't be here" && 0);
+        return IMPACT_OTHER_ERROR;
+    }
+
+    docno = 0;
+    vec.pos = vec_buf;
+    vec.end = vec_buf + vocab_entry->size;
+    for (d = 0; d < docs; d++) {
+        unsigned long int docno_d;
+        unsigned long int f_dt;
+        double w_dt;
+        
+        vec_vbyte_read(&vec, &docno_d);
+        vec_vbyte_read(&vec, &f_dt);
+        if (vocab_entry->type == VOCAB_VTYPE_DOCWP) {
+            unsigned int bytes;
+            vec_vbyte_scan(&vec, (unsigned int) f_dt, &bytes);
+        }
+        docno += docno_d;
+        w_dt = calc_impact_pivoted_cosine(f_dt, docs, 
+          DOCMAP_GET_WEIGHT(docmap, docno + d), avg_weight, pivot);
+        if (d == 0) 
+            *list_min_impact = *list_max_impact = w_dt;
+        else if (w_dt < *list_min_impact)
+            *list_min_impact = w_dt;
+        else if (w_dt > *list_max_impact)
+            *list_max_impact = w_dt;
+    }
+    return IMPACT_OK;
+}
+
+static double calc_impact_pivoted_cosine(unsigned long int f_dt, 
+  unsigned long int f_t, double W_d, double aW_d, double pivot) {
+    return (1 + log(f_dt)) / ((1.0 - pivot) + (pivot * W_d / aW_d));
+}
+
+/* normalises using "loga" two fixed-point promotion technique. */
+double impact_normalise(double impact, double norm_B, double slope, 
+  double max_impact, double min_impact) {
+    double norm_impact;
+
+    norm_impact = min_impact + (min_impact * (log10(impact / min_impact)
+          / log10(norm_B)));
+    norm_impact = (1.0 - slope) * norm_impact + (slope * impact);
+    if (norm_impact < min_impact)
+        norm_impact = min_impact;
+    else if (norm_impact > max_impact)
+        norm_impact = max_impact;
+    return norm_impact;
+}
+
+unsigned int impact_quantise(double impact, unsigned int quant_bits, 
+  double max_impact, double min_impact) {
+    return (unsigned int) floor(pow(2, quant_bits) 
+        * ((impact - min_impact) / (max_impact - min_impact + E_VALUE))) 
+      + 1;
+}
+
+static enum impact_ret get_doc_vec(struct index * idx, const char * term,
+  void * term_data, unsigned int term_data_len, 
+  char ** vec_mem, unsigned int * vec_mem_len, struct vocab_vector * vocab_in) {
+    struct vec vocab_vec;
+    enum vocab_ret vocab_ret;
+    enum impact_ret our_ret;
+    unsigned int vec_len;
+
+    vocab_vec.pos = (char *)term_data;
+    vocab_vec.end = (char *)term_data + term_data_len;
+    while ( (vocab_ret = vocab_decode(vocab_in, &vocab_vec)) == VOCAB_OK
+      && vocab_in->type != VOCAB_VTYPE_DOC 
+      && vocab_in->type != VOCAB_VTYPE_DOCWP) 
+        ;
+    if (vocab_ret != VOCAB_OK)
+        return IMPACT_FMT_ERROR;
+    if ( (our_ret = load_vector(idx, term, vocab_in, vec_mem, 
+              vec_mem_len, &vec_len)) != IMPACT_OK)
+        return our_ret;
+    return IMPACT_OK;
+}
+
+static void impact_transform_list(struct list_decomp * list,
+  struct docmap * docmap, double avg_weight, double pivot,
+  double max_impact, double min_impact, double slope, 
+  unsigned int quant_bits, double norm_B, double *w_qt_min, 
+  double *w_qt_max, double f_t_avg) {
+    unsigned int d;
+    double impact;
+    double w_qt;
+    
+    for (d = 0; d < list->f_t; d++) {
+        impact = calc_impact_pivoted_cosine(list->postings[d].f_dt, list->f_t,
+          DOCMAP_GET_WEIGHT(docmap, list->postings[d].docno), avg_weight,
+          pivot);
+        impact = impact_normalise(impact, norm_B, slope, max_impact,
+          min_impact);
+        list->postings[d].impact = impact_quantise(impact, quant_bits,
+          max_impact, min_impact);
+          
+        w_qt = (1 + log(list->postings[d].f_dt)) * 
+               (log (1 + (f_t_avg/list->f_t)));
+        if (*w_qt_min == W_QT_UNSET) {
+            *w_qt_min = w_qt;
+            *w_qt_max = w_qt;
+        } else {
+            if (*w_qt_max < w_qt)
+                *w_qt_max = w_qt;
+            if (*w_qt_min > w_qt)
+                *w_qt_min = w_qt;
+        }
+    }
+    impact_order_sort(list);
+#ifndef NDEBUG
+    for (d = 0; d < list->f_t; d++) {
+        if (d != 0) {
+            assert(list->postings[d].docno > list->postings[d - 1].docno
+              || list->postings[d].impact < list->postings[d - 1].impact);
+        }
+    }
+#endif
+}
+
+static void impact_order_sort(struct list_decomp *list) {
+     qsort(list->postings, list->f_t, sizeof(struct list_posting), 
+       impact_order_compare);
+}
+
+static int impact_order_compare(const void *p1, const void *p2) {
+    struct list_posting *d1 = (struct list_posting *)p1;
+    struct list_posting *d2 = (struct list_posting *)p2;
+
+    if (d1->impact < d2->impact)
+        return 1;
+    else if (d1->impact > d2->impact)
+        return -1;
+    else {
+        if (d1->docno > d2->docno)
+            return 1;
+        else if (d1->docno < d2->docno)
+            return -1;
+        else
+            return 0;
+    }
+}
+
+static enum impact_ret compress_impact_ordered_list(struct list_decomp * list,
+  char ** vec_mem, unsigned int * vec_mem_len, unsigned int * vec_size) {
+    unsigned long int prev_docno;
+    unsigned long int block_size;
+    struct vec vec;
+    unsigned long int d;
+    unsigned long int docno_d;
+    unsigned int space_for_block;
+    unsigned int new_block;
+        
+    vec.pos = *vec_mem;
+    vec.end = *vec_mem + *vec_mem_len;
+
+    prev_docno = 0;
+    block_size = 0;
+    new_block = 1;
+
+    for (d = 0; d < list->f_t; d++) {
+        if (block_size == 0) {
+            prev_docno = 0;
+            new_block = 1;
+            for (block_size = 1; block_size + d < list->f_t 
+              && list->postings[block_size + d].impact
+              == list->postings[d].impact; block_size++) 
+                /* no-op */ ;
+
+            /* Check for space only at the start of each block.  This
+               frees us from having to check for any of the vbyte_writes. */
+            space_for_block = (2 + block_size) * VEC_VBYTE_MAX;
+            if (vec_len(&vec) < space_for_block) {
+                char * new_vec_mem;
+                unsigned int new_vec_mem_len;
+                unsigned long int offset;
+                /* realloc enough for this block, and guess that remaining
+                   blocks will be the same size.  We don't try to over-allocate
+                   too much here; we're re-using the vector memory space from
+                   the doc-ordered list, which should generally be larger than
+                   the impact-ordered one anyway.  So we're only dealing with
+                   marginal cases here. */
+                new_vec_mem_len = *vec_mem_len + space_for_block 
+                    * (list->f_t - d);
+                if ( (new_vec_mem = realloc(*vec_mem, 
+                          new_vec_mem_len)) == NULL) {
+                    return IMPACT_MEM_ERROR;
+                }
+                *vec_mem_len = new_vec_mem_len;
+                offset = vec.pos - *vec_mem;
+                *vec_mem = new_vec_mem; 
+                vec.pos = new_vec_mem + offset;
+                vec.end = new_vec_mem + new_vec_mem_len;
+                assert(vec.end > vec.pos);
+                assert(vec_len(&vec) >= space_for_block);
+            }
+            vec_vbyte_write(&vec, block_size);
+
+            /* Note: as long as impact quantisation bits B < 8, impact will 
+               only be one byte, so there is no gain in storing delta values.  
+               Since this will generally be the case, and this simplifies 
+               the code, we don't calculate the deltas.  This code will 
+               work even for B >= 8, just with a (very slight) loss 
+               in compression. */
+            vec_vbyte_write(&vec, list->postings[d].impact);
+        } 
+        --block_size;
+        
+        if (new_block == 1) { 
+            new_block = 0;
+            /* first document in block is an absolute value, not a difference */
+            docno_d = list->postings[d].docno;
+        } else {
+            assert (list->postings[d].docno > prev_docno);
+            docno_d = list->postings[d].docno - (prev_docno + 1);
+            /* we store the docno delta - 1, as it will always be at least
+               1 (doc numbers always increase) */
+        }
+        prev_docno = list->postings[d].docno;
+        vec_vbyte_write(&vec, docno_d);
+        /* vec_vbyte_write(&vec, list->postings[d].f_dt); */ 
+        /* dont need offsets */
+    }
+    *vec_size = vec.pos - *vec_mem;
+    return IMPACT_OK;
+}
+
+static enum impact_ret fdset_write(unsigned int fileno,
+  unsigned int filetype, unsigned long int offset,
+  struct fdset *fdset, char *data, unsigned int data_len) {
+    int fd;
+    ssize_t nwritten;
+    fd = fdset_pin(fdset, filetype, fileno, offset, SEEK_SET);
+    if (fd < 0 
+      && ((fd = fdset_create_seek(fdset, filetype, fileno, offset)) < 0)) {
+        ERROR2("opening output file number %u to offset %lu", fileno, offset);
+        return IMPACT_IO_ERROR;
+    }
+    nwritten = index_atomic_write(fd, data, data_len);
+    fdset_unpin(fdset, filetype, fileno, fd);
+    if (nwritten != (ssize_t) data_len) {
+        ERROR3("writing %u bytes to file number %u at offset %lu", 
+          data_len, fileno, offset);
+        return IMPACT_IO_ERROR;
+    }
+    return IMPACT_OK;
+}
+
diff --git a/src/include/_btbucket.h b/src/include/_btbucket.h
new file mode 100644 (file)
index 0000000..9215971
--- /dev/null
@@ -0,0 +1,99 @@
+/* _btbucket.h declares the internal details of a btree bucket and
+ * some macros for fast operation
+ *
+ * written nml 2003-02-17
+ *
+ */
+
+#ifndef PRIVATE_BTBUCKET__H
+#define PRIVATE_BTBUCKET__H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "zstdint.h"
+
+struct btbucket {
+    union {
+        char mem[1];           /* pointer to allow access to the raw btree 
+                                * bucket memory using a struct hack.  Extra 
+                                * memory will be allocated to allow this array 
+                                * to be of size pagesize. */
+
+        /* struct representing logical information inside mem array.  
+         *
+         *   - tailsize:   indicates the length of the information trailing the 
+         *                 bucket in mem.  Also includes overhead bytes at the 
+         *                 front of the page and prefixsize.
+         *
+         *   - prefixsize: The bottom 7 bits of the prefixsize indicate how long
+         *                 a prefix that this btree bucket has. The top bit 
+         *                 indicates whether the bucket is an internal 
+         *                 node (0) or a leaf (1).  Note that this limits the
+         *                 prefixsize value to 128.  This entry also ensures
+         *                 that the alignment of the bucket array is exactly 
+         *                 two bytes off of four byte alignment.
+         *
+         *   - bucket:     struct hack array that gives access to bucket memory.
+         *                 Note that the bucket memory will start at mem[2] 
+         *                 which ensures that the bucket memory alignment is 2 
+         *                 bytes off of 4 byte alignment */
+        struct {
+            uint8_t tailsize;
+            uint8_t prefixsize;
+            char bucket[1];
+        } s;
+
+        unsigned int dummy;    /* dummy variable, used to ensure that mem is 
+                                * aligned to integer boundary */
+    } u;
+
+    /* the prefix and then the sibling pointers are placed at the end of the 
+     * bucket in prefix, fileno, offset order.  It would be nice to represent 
+     * them in the struct somehow, but their lack of alignment prevents that. */
+};
+
+/* macro to return the size of a btree bucket */
+#define BTBUCKET_SIZE(bucket, bucketsize)                                     \
+    ((bucketsize)                                                             \
+      - (BIT_LMASK(7) & ((struct btbucket *) (bucket))->u.s.tailsize))
+         
+/* macro to return the offset to the bucket within a btree bucket */
+#define BTBUCKET_BUCKET(bbucket)                                              \
+    (((struct btbucket *) bbucket)->u.s.bucket)
+
+/* macro to determine whether the btree bucket is a leaf node */
+#define BTBUCKET_LEAF(bucket, size)                                           \
+    BIT_GET(((struct btbucket *) bucket)->u.s.prefixsize, 7)
+
+/* macro to return a pointer to the prefix of the bucket */
+#define BTBUCKET_PREFIX(bbucket, size, prefixlen_ptr)                         \
+    ((*prefixlen_ptr                                                          \
+      = BIT_SET(((struct btbucket *) bbucket)->u.s.prefixsize, 7, 0)),        \
+        &((struct btbucket *) bbucket)->u.s.bucket[BTBUCKET_SIZE((bbucket),   \
+          (size))])
+
+/* size of a btbucket internal node entry */
+#define BTBUCKET_ENTRY_SIZE() (sizeof(unsigned int) + sizeof(unsigned long int))
+
+/* decodes a btbucket internal node entry (entry must be of size
+ * btbucket_entry_size) */
+#define BTBUCKET_ENTRY(entryptr, filenoptr, offsetptr)                        \
+    MEM_NTOH((filenoptr), (entryptr), sizeof(unsigned int));                  \
+    MEM_NTOH((offsetptr), ((char *) entryptr) + sizeof(unsigned int),         \
+      sizeof(unsigned long int));
+
+/* encodes a btbucket internal node entry (entry must be of size
+ * btbucket_entry_size) */
+#define BTBUCKET_SET_ENTRY(entryptr, fileno, offset)                          \
+    MEM_NTOH((entryptr), &(fileno), sizeof(unsigned int));                    \
+    MEM_NTOH(((char *) entryptr) + sizeof(unsigned int), &(offset),           \
+      sizeof(unsigned long int));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/_chash.h b/src/include/_chash.h
new file mode 100644 (file)
index 0000000..714aa15
--- /dev/null
@@ -0,0 +1,97 @@
+/* _chash.h contains the implementation details of the chash data
+ * structure
+ *
+ * written nml 2003-05-29
+ *
+ */
+
+#ifndef PRIVATE_CHASH_H
+#define PRIVATE_CHASH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* get the current number of elements in the table */
+#define CHASH_SIZE(chash) ((const unsigned int) (chash)->elements)
+
+struct chash_link {
+    union {
+        void *d_ptr;
+        unsigned long int d_luint;
+        double d_dbl;
+        float d_flt;
+        /* add other types as needed */
+    } data;                             /* data associated with key */
+
+    union {
+        void *k_ptr;
+        unsigned long int k_luint;
+        struct {
+            unsigned int len;           /* length of string */
+            unsigned int ptr;           /* pointer (offset from start) to 
+                                         * string in strings array */
+        } k_str;
+        /* add other types as needed */
+    } key;                              /* lookup key */
+
+    struct chash_link *next;            /* next entry in the table */
+    unsigned int hash;                  /* hash value (pre-mod) of this 
+                                         * entry */
+};
+
+/* the type of the hash elements */
+enum chash_type {
+    CHASH_TYPE_UNKNOWN,
+    CHASH_TYPE_LUINT,
+    CHASH_TYPE_PTR,
+    CHASH_TYPE_STR,
+    CHASH_TYPE_FLT,
+    CHASH_TYPE_DBL
+};
+
+struct chash {
+    unsigned int elements;              /* number of elements currently in 
+                                         * table */
+    struct chash_link **table;          /* table of ptrs to links */
+    unsigned int bits;                  /* table is (2 ** bits) big */
+
+    union {
+        unsigned int (*h_ptr)(const void *key);
+        /* h_luint won't be used, as we hash int's differently, but its needed
+         * for compilation */
+        unsigned int (*h_luint)(unsigned long int key);
+        unsigned int (*h_dbl)(double key);
+        unsigned int (*h_str)(const char *str, unsigned int len);
+    } hashfn;                           /* function to hash the data */
+
+    /* not used for primitive types */
+    int (*cmpfn)(const void *key1, const void *key2);
+
+    float resize_load;                  /* load to double size at */
+    unsigned int resize_point;          /* count to double size at */
+    struct objalloc *alloc;             /* link allocator */
+
+    /* structure to store strings stored in the hashtable (that aren't small 
+     * enough to be completely stored within the prefix/suffix ints) */
+    struct {
+        char *strings;                  /* strings area */
+        unsigned int used;              /* number of free bytes in strings */
+        unsigned int size;              /* size of strings array in bytes */
+        unsigned int unpacked;          /* number of bytes we can reclaim by 
+                                         * repacking */
+    } strings;
+
+    enum chash_type key_type;
+    enum chash_type data_type;
+
+    unsigned int timestamp;             /* allows checks that hash doesn't 
+                                         * get modified during iteration */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/_docmap.h b/src/include/_docmap.h
new file mode 100644 (file)
index 0000000..0c016ea
--- /dev/null
@@ -0,0 +1,150 @@
+/* _docmap.h provides access to the internals of docmap for those who need 
+ * to use them.
+ *
+ * This provides direct access to the measures and location arrays
+ * for efficiency.  
+ *
+ * written wew 2004-10-06
+ *
+ */
+
+#ifndef PRIVATE_DOCMAP_H
+#define PRIVATE_DOCMAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "docmap.h"
+#include "vec.h"
+#include "zstdint.h"
+
+/* macros/fns for fast access to loaded entries */
+#define DOCMAP_GET_WORDS(docmap, docno) docmap->cache.words[docno] 
+#define DOCMAP_GET_DISTINCT_WORDS(docmap, docno) docmap->cache.dwords[docno] 
+#define DOCMAP_GET_WEIGHT(docmap, docno) docmap->cache.weight[docno] 
+unsigned int docmap_get_bytes_cached(struct docmap *dm, unsigned int docno);
+
+struct fdset;
+
+/* represents a single entry within the docmap */
+struct docmap_entry {
+    off_t offset;                     /* offset within repository file */
+    unsigned int docno;               /* doc number */
+    unsigned int fileno;              /* repository file number */
+    unsigned int dwords;              /* number of distinct words in doc */
+    unsigned int words;               /* number of words in doc */
+    float weight;                     /* the cosine weight of the doc */
+    unsigned int bytes;               /* size of doc in bytes */
+    enum mime_types mtype;            /* mime type of document */
+    enum docmap_flag flags;
+
+    char *trecno;                     /* TREC id number for doc */
+    unsigned int trecno_len;          /* length of current TREC id */
+    unsigned int trecno_size;         /* size of trecno buffer */
+};
+
+/* represents a buffer with current decoding position */
+struct docmap_buffer {
+    unsigned int page;                /* page number occupying buffer */
+    char *buf;                        /* buffer */
+    unsigned int buflen;              /* length of buffer (in pages) */
+    unsigned int bufsize;             /* capacity of buffer (in pages) */
+    int dirty;                        /* whether buffer requires writing */
+};
+
+/* structure representing a read/write cursor */
+struct docmap_cursor {
+    unsigned long int first_docno;    /* first docno in pos page */
+    unsigned long int last_docno;     /* first docno not in pos page */
+    struct vec pos;                   /* (de)encoding position */
+    struct docmap_entry entry;        /* entry previously (de)encoded */
+    unsigned int past;                /* number of entries past */
+    uint32_t entries;                 /* number of entries in pos page */
+    struct docmap_buffer *buf;        /* buffer we're operating on */
+    unsigned int page;                /* page we're currently in */
+};
+
+/* structure to represent a cache buf */
+struct docmap_cbuf {
+    char *buf;
+    unsigned int len;
+    unsigned int size;
+};
+
+/* describes a type exception */
+struct docmap_type_ex {
+    unsigned int docno;
+    enum mime_types mtype;
+};
+
+struct docmap {
+    struct fdset *fdset;
+    struct reposset *rset;
+    int fd_type;
+    unsigned int pagesize;            /* size of each page */
+    unsigned long int entries;        /* number of entries in docmap */
+    unsigned long int max_filesize;   /* maximum filesize in bytes */
+    unsigned int file_pages;          /* maximum number of pages in a file */
+
+    struct docmap_buffer readbuf;     /* read buffer */
+    struct docmap_buffer appendbuf;   /* append buffer */
+    char *buf;                        /* allocated buffer */
+
+    struct docmap_cursor read;        /* read cursor */
+    struct docmap_cursor write;       /* write cursor */
+
+    unsigned long int *map;           /* array of the first docno in each 
+                                       * page */
+    unsigned int map_size;            /* capacity of page array */
+    unsigned int map_len;             /* number of pages in docmap */
+
+    int dirty;                        /* whether the docmap has changed since 
+                                       * being loaded */
+
+    struct {
+        enum docmap_cache cache;      /* whether we're caching anything in 
+                                       * main memory */
+        unsigned int len;             /* number of entries cached */
+        unsigned int size;            /* size of cache arrays */
+        unsigned int *words;          /* length-in-words cache */
+        unsigned int *dwords;         /* length-in-distinct-words cache */
+        float *weight;                /* cosine weight cache */
+
+        unsigned int *trecno_off;     /* trec docnos, as offsets 
+                                       * into trecno array */
+        struct docmap_cbuf trecno;    /* buffer for front-coded trecnos */
+
+        unsigned int *loc_off;        /* length-in-bytes cache, as offsets 
+                                       * into loc array */
+        struct docmap_cbuf loc;       /* buffer for encoded locations */
+
+        struct docmap_type_ex *typeex;/* type exceptions (not X_TREC) */
+        unsigned int typeex_len;      /* utilised length of typeex array */
+        unsigned int typeex_size;     /* capacity of typeex array */
+    } cache;
+
+    /* aggregate quantities */
+    struct {
+        double avg_words;
+        double sum_words;
+        double avg_dwords;
+        double sum_dwords;
+        double avg_bytes;
+        double sum_bytes;
+        double avg_weight;
+        double sum_weight;           /* note that sum_weight isn't updated 
+                                      * except when weights are being cached, 
+                                      * due to cost of calculating square 
+                                      * roots */
+
+        double sum_trecno;           /* total length of trecno entries */
+    } agg;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif 
+
diff --git a/src/include/_index.h b/src/include/_index.h
new file mode 100644 (file)
index 0000000..d4b6b2f
--- /dev/null
@@ -0,0 +1,145 @@
+/* _index.h defines the index structure and declares internal functions 
+ *
+ * written nml 2003-06-02
+ *
+ */
+
+/* can't use _INDEX_H because names with underscore are reserved for 
+ * compiler */
+#ifndef PRIVATE_INDEX_H
+#define PRIVATE_INDEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "firstinclude.h"
+
+#include "index.h"
+#include "storagep.h"
+#include "stream.h"
+
+enum index_flags {
+    INDEX_BUILT = (1 << 0),             /* the index has been constructed */
+    INDEX_SORTED = (1 << 1),            /* the index is sorted by vocabulary 
+                                         * order (more or less) */
+    INDEX_SOURCE = (1 << 2),            /* source text for the documents is 
+                                         * available */
+    INDEX_STEMMED = (3 << 3),           /* mask to tell whether index is 
+                                         * stemmed */
+    INDEX_STEMMED_PORTERS = (1 << 3),   /* whether its stemmed with porter's 
+                                         * stemmer */
+    INDEX_STEMMED_EDS = (1 << 4),       /* whether its stemmed with eds 
+                                         * stemmer */
+    INDEX_STEMMED_LIGHT = (3 << 3)      /* whether its stemmed with the light 
+                                         * stemmer */
+};
+
+struct index {
+    enum index_flags flags;             /* flags to indicate various global 
+                                         * states of the index */
+
+    unsigned int repos;                 /* number of repositories */
+    unsigned int vectors;               /* number of vector files */
+    unsigned int vocabs;                /* number of vocab files */
+    unsigned long int repos_pos;        /* byte position of the last repos_fd */
+
+    struct fdset *fd;                   /* dynamic file descriptor set for all 
+                                         * index/repository files */
+    struct iobtree *vocab;              /* vocabulary */
+    struct docmap *map;                 /* document map */
+    struct psettings *settings;         /* parser settings */
+    struct summarise *sum;              /* summary producing object */
+
+    struct stem_cache *stem;            /* stemmer cache (or NULL) */
+    struct stop *istop;                 /* construction stoplist (or NULL) */
+    struct stop *qstop;                 /* construction stoplist (or NULL) */
+
+    /* construction stuff */
+    struct postings *post;              /* accumulated in-memory postings */
+    struct pyramid *merger;             /* pointers to dumped postings */
+    struct storagep storage;            /* storage parameters */
+
+    /* 'types' for accessing files through the fdset */
+    unsigned int param_type;            /* index parameter file type */
+    unsigned int index_type;            /* index fileset type */
+    unsigned int repos_type;            /* repos fileset type */
+    unsigned int tmp_type;              /* temporary fileset type */
+    unsigned int vtmp_type;             /* temporary vocabulary fileset type */
+    unsigned int vocab_type;            /* vocab btree fileset type */
+    unsigned int docmap_type;           /* docmap fileset type */
+
+    struct {
+        unsigned int parsebuf;          /* size of parse buffer */
+        unsigned int tblsize;           /* size of postings hashtable */
+        unsigned int memory;            /* how much memory we can use */
+        char *config;                   /* configuration file location (or 
+                                         * NULL for built-in configuration) */
+    } params;
+
+    struct {
+        unsigned int updates;           /* number of updates index has 
+                                         * undergone */
+        double avg_weight;              /* average document weight */
+        double avg_length;              /* average document length in bytes */
+
+        /* total number of term occurrances */
+        unsigned int terms_high;        /* high word */
+        unsigned int terms_low;         /* low word */
+    } stats;
+
+    struct imp_stats {
+        double avg_f_t;          /* average term frequency */
+        double slope;            /* used in normalising */
+        unsigned int quant_bits; /* used in quantising */
+        double w_qt_min;
+        double w_qt_max;
+    } impact_stats;              /* statistics required at query time for 
+                                    impact ordered vectors */
+
+    unsigned int doc_order_vectors; /* indicates if standard document order 
+                                       vectors are in index */
+    unsigned int doc_order_word_pos_vectors; /* indicates if document 
+                                       ordered with word 
+                                       positions vectors are in index */
+    unsigned int impact_vectors;    /* indicates if impact ordered vectors 
+                                       are in index */
+};
+
+/* internal function to merge the current postings into the index */
+int index_remerge(struct index *idx, unsigned int commitopts, 
+  struct index_commit_opt *commitopt);
+
+/* commit the superblock of an index to disk.  Only here for usage
+ * of programs bypassing the normal building mechanism, such as 
+ * partitioning programs. */
+int index_commit_superblock(struct index *idx);
+
+/* internal function to atomically perform a read */
+ssize_t index_atomic_read(int fd, void *buf, unsigned int size);
+
+/* internal function to atomically perform a write */
+ssize_t index_atomic_write(int fd, void *buf, unsigned int size);
+
+/* write the header block of the index to disk. */
+int index_commit_superblock(struct index *idx);
+
+/* exactly the same as index_commit, except doesn't bugger around with restoring
+ * indexes to exact on-disk representation */
+int index_commit_internal(struct index *idx, unsigned int opts, 
+  struct index_commit_opt *opt,
+  unsigned int addopts, struct index_add_opt *addopt);
+
+/* function to return the stemming function used by an index */
+void (*index_stemmer(struct index *idx))(void *, char *);
+
+/* utility function to read into a stream from a file/buffer */
+enum stream_ret index_stream_read(struct stream *instream, int fd, 
+  char *buf, unsigned int bufsize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/_mem.h b/src/include/_mem.h
new file mode 100644 (file)
index 0000000..88f7a56
--- /dev/null
@@ -0,0 +1,152 @@
+/* _mem.h declares macros to quickly implement memory operations
+ *
+ * written nml 2003-12-29
+ *
+ */
+
+#include "config.h"
+
+#ifndef PRIVATE_MEM_H
+#define PRIVATE_MEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MEM_PTRDIFF(one, two) (((char*) (one)) - ((char*) (two)))
+
+#define MEM_PTRADD(ptr, size) ((void*)(((char*) (ptr)) + (size)))
+
+#define MEM_PTRADDR(ptr) (((char*) (ptr)) - ((char*) 0))
+
+/* mem_hton (since big-endian and little-endian schemes are symmetric, we can
+ * use the same macro to perform both conversions) */
+#define MEM_HTON MEM_NTOH
+
+/* mem_ntoh */
+#ifdef WORDS_BIGENDIAN
+
+/* big endian version */
+#define MEM_NTOH(dst, src, size)                                              \
+    if (1) {                                                                  \
+        uint8_t *mem_ntoh_dst = (uint8_t *) dst;                              \
+                                                                              \
+        switch (size) {                                                       \
+        case 8:                                                               \
+            *(mem_ntoh_dst + 7) = *(((uint8_t *) src) + 7);                   \
+            *(mem_ntoh_dst + 6) = *(((uint8_t *) src) + 6);                   \
+            *(mem_ntoh_dst + 5) = *(((uint8_t *) src) + 5);                   \
+            *(mem_ntoh_dst + 4) = *(((uint8_t *) src) + 4);                   \
+        case 4:                                                               \
+            *(mem_ntoh_dst + 3) = *(((uint8_t *) src) + 3);                   \
+            *(mem_ntoh_dst + 2) = *(((uint8_t *) src) + 2);                   \
+        case 2:                                                               \
+            *(mem_ntoh_dst + 1) = *(((uint8_t *) src) + 1);                   \
+        case 1:                                                               \
+            *mem_ntoh_dst = *(((uint8_t *) src));                             \
+        case 0:                                                               \
+            break;                                                            \
+                                                                              \
+        default:                                                              \
+            if (1) {                                                          \
+                unsigned int mem_ntoh_i;                                      \
+                                                                              \
+                for (mem_ntoh_i = 0; mem_ntoh_i < size; mem_ntoh_i++) {       \
+                    mem_ntoh_dst[mem_ntoh_i]                                  \
+                      = ((uint8_t *) src)[mem_ntoh_i];                        \
+                }                                                             \
+            }                                                                 \
+            break;                                                            \
+        }                                                                     \
+    } 
+
+#else
+
+/* little endian version */
+#define MEM_NTOH(dst, src, size)                                              \
+    if (1) {                                                                  \
+        uint8_t *mem_ntoh_dst = (uint8_t *) dst;                              \
+                                                                              \
+        switch (size) {                                                       \
+        case 8:                                                               \
+            *(mem_ntoh_dst + 7) = *(((uint8_t *) src) + 0);                   \
+            *(mem_ntoh_dst + 6) = *(((uint8_t *) src) + 1);                   \
+            *(mem_ntoh_dst + 5) = *(((uint8_t *) src) + 2);                   \
+            *(mem_ntoh_dst + 4) = *(((uint8_t *) src) + 3);                   \
+            *(mem_ntoh_dst + 3) = *(((uint8_t *) src) + 4);                   \
+            *(mem_ntoh_dst + 2) = *(((uint8_t *) src) + 5);                   \
+            *(mem_ntoh_dst + 1) = *(((uint8_t *) src) + 6);                   \
+            *(mem_ntoh_dst + 0) = *(((uint8_t *) src) + 7);                   \
+            break;                                                            \
+                                                                              \
+        case 4:                                                               \
+            *(mem_ntoh_dst + 3) = *(((uint8_t *) src) + 0);                   \
+            *(mem_ntoh_dst + 2) = *(((uint8_t *) src) + 1);                   \
+            *(mem_ntoh_dst + 1) = *(((uint8_t *) src) + 2);                   \
+            *(mem_ntoh_dst + 0) = *(((uint8_t *) src) + 3);                   \
+            break;                                                            \
+                                                                              \
+        case 2:                                                               \
+            *(mem_ntoh_dst + 1) = *(((uint8_t *) src) + 0);                   \
+            *(mem_ntoh_dst + 0) = *(((uint8_t *) src) + 1);                   \
+            break;                                                            \
+                                                                              \
+        case 1:                                                               \
+            *mem_ntoh_dst = *(((uint8_t *) src));                             \
+            break;                                                            \
+                                                                              \
+        case 0:                                                               \
+            break;                                                            \
+                                                                              \
+        default:                                                              \
+            if (1) {                                                          \
+                unsigned int mem_ntoh_i;                                      \
+                                                                              \
+                for (mem_ntoh_i = 0; mem_ntoh_i < size; mem_ntoh_i++) {       \
+                    mem_ntoh_dst[mem_ntoh_i]                                  \
+                      = ((uint8_t *) src)[size - mem_ntoh_i - 1];             \
+                }                                                             \
+            }                                                                 \
+            break;                                                            \
+        }                                                                     \
+    } 
+
+#endif
+
+/* alignment stuff */
+
+/* call this macro once for each type that you wish to align.  Then you can 
+ * call mem_align_(type) with no arguments to get the alignment for each type */
+#define MEM_ALIGN_TYPE(type)                                                  \
+   unsigned int mem_align_##type () {                                         \
+      static struct {                                                         \
+         char pad;                                                            \
+         type align;                                                          \
+      } s;                                                                    \
+      return ((unsigned int) &s.align) - ((unsigned int) &s.pad);             \
+   }
+
+/* this macro returns what should be the maximum alignment on this platform */
+#define MEM_ALIGN_MAX                                                         \
+   ((mem_align_long() > mem_align_double()) ? mem_align_long() :              \
+     mem_align_double())
+
+/* this macro returns the next place in the given buffer that conforms to the
+ * given alignment.  It is assumed that the alignment is a power of two. */
+#define MEM_ALIGN(buf, align)                                                 \
+   ((void*) (((char*) buf) + (align - (((MEM_PTRADDR((char*) buf) - 1)        \
+     & (align - 1)) + 1))))
+
+/* this macro returns the next place in the given buffer that conforms to the
+ * given alignment.  It is *not* assumed that the alignment is a power of 
+ * two */
+#define MEM_ALIGN_SAFE(buf, align)                                            \
+   ((void*) (((char*) buf) + (align - (((MEM_PTRADDR((char*) buf) - 1)        \
+     % align) + 1))))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/_postings.h b/src/include/_postings.h
new file mode 100644 (file)
index 0000000..b9e0be1
--- /dev/null
@@ -0,0 +1,54 @@
+/* _postings.h contains the private declarations of the postings
+ * module, which need to be exposed to some other modules for
+ * efficiency reasons 
+ *
+ * written nml 2003-04-30
+ *
+ */
+
+#ifndef PRIVATE_POSTINGS_H
+#define PRIVATE_POSTINGS_H
+
+#include "vec.h"
+
+struct postings_node {
+    char *term;                       /* what this term is */
+    struct vec vec;                   /* encoded postings for this term */
+    unsigned long int last_offset;    /* last offset encoded */
+    unsigned int offsets;             /* number of offsets for current docno */
+    unsigned long int last_docno;     /* last docno encoded */
+    unsigned int docs;                /* number of documents in current list */
+    unsigned int occurs;              /* total number of occurances */
+    char *vecmem;                     /* start of vec */
+    char *last_count;                 /* where in the vec the last count was 
+                                       * encoded */
+    struct postings_node *next;       /* next element in hash linked list */
+    struct postings_node *update;     /* next element in update linked list */
+};
+
+struct postings {
+    struct postings_node **hash;      /* implicit hashtable of nodes */
+    unsigned int tblsize;             /* number of slots in hash */
+    unsigned int tblbits;             /* log2(tblsize) */
+    unsigned int dterms;              /* number of items (distinct terms) */
+    unsigned int terms;               /* total number of terms in postings */
+    unsigned int size;                /* current size of postings */
+    unsigned int docs;                /* current number of documents */
+    struct poolalloc *string_mem;     /* allocator for strings */
+    struct objalloc *node_mem;        /* allocator for nodes */
+    struct postings_node *update;     /* first node in list to update */
+    unsigned long int docno;          /* the current document number */
+    int update_required;              /* whether there are unupdated postings */
+    int err;                          /* last error that occurred or 0 */
+    struct stop *stop;                /* build-time stoplist */
+
+    /* stemming function and opaque data for it */
+    void *stem_opaque;
+    void (*stem)(void *opaque, char *term);
+};
+
+/* compare two posting_node ** lexographically by term (for qsort) */
+int post_cmp(const void *vone, const void *vtwo);
+
+#endif
+
diff --git a/src/include/_reposset.h b/src/include/_reposset.h
new file mode 100644 (file)
index 0000000..add7339
--- /dev/null
@@ -0,0 +1,77 @@
+/* _reposset.h declares a private interface to the reposset module.
+ *
+ * written nml 2006-04-21
+ *
+ */
+
+#ifndef PRIVATE_REPOSSET
+#define PRIVATE_REPOSSET
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* our representation of repository numbers is based around
+ * compressing the two common (only?) cases: many documents in a file
+ * or one document per file.  In the first case we have a single file
+ * containing many sequential docno's and in the second we have many
+ * files with one sequential docno each.  We will represent this with
+ * an array of records, where each record either represents a
+ * sequential run of one-file-to-one-docno or one-file-with-many-docnos.
+ * Alternating these records allows us to compactly represent any
+ * series of docno/reposno allocations. */
+
+/* XXX: idea for offsets: one-in-some delta coding, all single-files have
+ * offset 0: should go in docmap, because it doesn't always live in
+ * memory */
+
+enum reposset_rectype {
+    REPOSSET_SINGLE_FILE = 0,        /* single file, many docno's */
+    REPOSSET_MANY_FILES = 1          /* many files, many docno's */
+};
+
+struct reposset_record {
+    enum reposset_rectype rectype;
+    unsigned int reposno;           /* start repository number */
+    unsigned int docno;             /* start document number */
+    unsigned int quantity;          /* number of docnos */
+};
+
+/* fetch the record containing docno from the reposset */
+struct reposset_record *reposset_record(struct reposset *rset, 
+  unsigned int docno);
+struct reposset_record *reposset_record_last(struct reposset *rset);
+
+/* the following methods allow the reposset to be compactly stored on
+ * disk and restored by an external module */
+
+/* insert a record into the reposset */
+enum reposset_ret reposset_set_record(struct reposset *rset, 
+  struct reposset_record *rec);
+
+struct reposset_check {
+    unsigned int reposno;              /* repository number */
+    unsigned long int offset;          /* byte offset of checkpoint */
+    enum mime_types comp;              /* compression type */
+};
+
+/* returns a pointer to the first checkpoint in repos array */
+struct reposset_check *reposset_check_first(struct reposset *rset);
+
+/* returns a pointer to first checkpoint relevant to the given repository 
+ * number */
+struct reposset_check *reposset_check(struct reposset *rset, 
+  unsigned int reposno);
+
+/* returns number of checkpoint entries */
+unsigned int reposset_checks(struct reposset *rset);
+
+unsigned int reposset_reposno_rec(struct reposset_record *rec, 
+  unsigned int docno);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/_uri.h b/src/include/_uri.h
new file mode 100644 (file)
index 0000000..99efa01
--- /dev/null
@@ -0,0 +1,77 @@
+/* _uri.h contains the implementation details of uri.c 
+ *
+ * written nml 2003-06-2
+ *
+ */
+
+#ifndef PRIVATE_URI_H
+#define PRIVATE_URI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "uri.h"
+
+/* same as the uriparse_new constructor, except that it doesn't malloc
+ * the returned parser or uri. */
+struct uriparse *uriparse_new_inplace(struct uriparse *parser, 
+  struct uri *uri);
+
+/* use with the uriparse_new_inplace constructor */
+struct uri *uriparse_delete_inplace(struct uriparse *parser);
+
+/* free all resources used by a uri */
+void uri_delete_inplace(struct uri *uri);
+
+/* copy uri into given space, returning a pointer to space on
+ * success, and NULL on failure */
+struct uri *uri_copy_inplace(const struct uri *uri, struct uri *space);
+
+/* note: strings require lengths because all except host and scheme can contain
+ * encoded characters (which can encode the '\0' character).  using short int
+ * (to save space - this is a large structure) limits us to URLs of 65534
+ * characters or less, but this doesn't seem likely to cause a problem) */
+typedef unsigned short int uri_ushort;
+struct uri {
+    int port;                    /* port number (or -1 for no port) */
+    uri_ushort *split_path;      /* path string split by slashes */
+    char *buf;                   /* buffer where all strings are held */
+    uri_ushort scheme;           /* scheme string */
+    uri_ushort scheme_len;       /* length of scheme string */
+    uri_ushort userinfo;         /* userinfo string */
+    uri_ushort userinfo_len;     /* length of userinfo string */
+    uri_ushort host;             /* host string */
+    uri_ushort host_len;         /* length of host string */
+    uri_ushort reg;              /* non-server authority */
+    uri_ushort reg_len;          /* length of non-server authority string */
+    uri_ushort path;             /* path string */
+    uri_ushort path_len;         /* length of path string */
+    uri_ushort split_len;        /* number of split path elements */
+    uri_ushort query;            /* query string */
+    uri_ushort query_len;        /* length of query string */
+    uri_ushort frag;             /* fragment string */
+    uri_ushort frag_len;         /* length of fragment string */
+    uri_ushort buflen;           /* how many bytes the buf has */
+};
+
+struct uriparse {
+    struct uri *uri;             /* uri we're parsing into */
+    int parse_state;             /* state in our parser */
+    int next_state;              /* next state for meta-states that can 
+                                  * transition to multiple next states */
+    unsigned int state_count;    /* number of matches for the current state */
+    int err;                     /* last error as errno code or 0 if none */
+    unsigned int bytes;          /* how many bytes of uri there were */
+    unsigned int bufsize;        /* how many bytes the uri buf can take */
+    unsigned int split_size;     /* how many elements in the path array */
+    int flags;                   /* flags indicating some hacky but necessary 
+                                  * stuff */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/alloc.h b/src/include/alloc.h
new file mode 100644 (file)
index 0000000..f12fa54
--- /dev/null
@@ -0,0 +1,44 @@
+/* alloc.h is mostly a stub file that ties together all of the
+ * allocation functions.  It typedefs function types for a few useful
+ * things and provides wrappers around the system malloc, free and
+ * realloc functions.
+ *
+ * written nml 2005-03-10
+ *
+ */
+
+#ifndef ALLOC_H
+#define ALLOC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* form of a malloc-like function */
+typedef void *(*alloc_mallocfn)(void *opaque, unsigned int size);
+
+/* form of a free-like function */
+typedef void (*alloc_freefn)(void *opaque, void *ptr);
+
+/* structure of an allocator */
+struct alloc {
+    void *opaque;
+    alloc_mallocfn malloc;
+    alloc_freefn free;
+};
+
+/* wrapper around system malloc */
+void *alloc_malloc(void *opaque, unsigned int size);
+
+/* wrapper around system free */
+void alloc_free(void *opaque, void *ptr);
+
+/* system allocator */
+extern const struct alloc alloc_system;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/ascii.h b/src/include/ascii.h
new file mode 100644 (file)
index 0000000..e9df84f
--- /dev/null
@@ -0,0 +1,105 @@
+/* ascii.h includes some declarations that allow categorisation of
+ * ASCII values in case statements, which i find very useful in
+ * constructing parsers.
+ *
+ * XXX: the symbolic forms are nice, but pure numbers would allow
+ * correct operation on non-ASCII machines
+ *
+ * written nml 2004-04-30
+ *
+ */
+
+#ifndef ASCII_H
+#define ASCII_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* catch uppercase letters in a case statement */
+#define ASCII_CASE_UPPER                                                      \
+         'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':     \
+    case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N':     \
+    case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U':     \
+    case 'V': case 'W': case 'X': case 'Y': case 'Z'                         
+
+/* catch lowercase letters in a case statement */
+#define ASCII_CASE_LOWER                                                      \
+         'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':     \
+    case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':     \
+    case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':     \
+    case 'v': case 'w': case 'x': case 'y': case 'z'
+
+/* catch extended ASCII charset (> 127) for preservation as per UTF8 */
+#define ASCII_CASE_EXTENDED                                                   \
+         (char) 128: case (char) 129: case (char) 130: case (char) 131:       \
+    case (char) 132: case (char) 133: case (char) 134: case (char) 135:       \
+    case (char) 136: case (char) 137: case (char) 138: case (char) 139:       \
+    case (char) 140: case (char) 141: case (char) 142: case (char) 143:       \
+    case (char) 144: case (char) 145: case (char) 146: case (char) 147:       \
+    case (char) 148: case (char) 149: case (char) 150: case (char) 151:       \
+    case (char) 152: case (char) 153: case (char) 154: case (char) 155:       \
+    case (char) 156: case (char) 157: case (char) 158: case (char) 159:       \
+    case (char) 160: case (char) 161: case (char) 162: case (char) 163:       \
+    case (char) 164: case (char) 165: case (char) 166: case (char) 167:       \
+    case (char) 168: case (char) 169: case (char) 170: case (char) 171:       \
+    case (char) 172: case (char) 173: case (char) 174: case (char) 175:       \
+    case (char) 176: case (char) 177: case (char) 178: case (char) 179:       \
+    case (char) 180: case (char) 181: case (char) 182: case (char) 183:       \
+    case (char) 184: case (char) 185: case (char) 186: case (char) 187:       \
+    case (char) 188: case (char) 189: case (char) 190: case (char) 191:       \
+    case (char) 192: case (char) 193: case (char) 194: case (char) 195:       \
+    case (char) 196: case (char) 197: case (char) 198: case (char) 199:       \
+    case (char) 200: case (char) 201: case (char) 202: case (char) 203:       \
+    case (char) 204: case (char) 205: case (char) 206: case (char) 207:       \
+    case (char) 208: case (char) 209: case (char) 210: case (char) 211:       \
+    case (char) 212: case (char) 213: case (char) 214: case (char) 215:       \
+    case (char) 216: case (char) 217: case (char) 218: case (char) 219:       \
+    case (char) 220: case (char) 221: case (char) 222: case (char) 223:       \
+    case (char) 224: case (char) 225: case (char) 226: case (char) 227:       \
+    case (char) 228: case (char) 229: case (char) 230: case (char) 231:       \
+    case (char) 232: case (char) 233: case (char) 234: case (char) 235:       \
+    case (char) 236: case (char) 237: case (char) 238: case (char) 239:       \
+    case (char) 240: case (char) 241: case (char) 242: case (char) 243:       \
+    case (char) 244: case (char) 245: case (char) 246: case (char) 247:       \
+    case (char) 248: case (char) 249: case (char) 250: case (char) 251:       \
+    case (char) 252: case (char) 253: case (char) 254: case (char) 255 
+
+/* catch control characters (all non-printing non-whitespace ASCII 
+ * characters) */
+#define ASCII_CASE_CONTROL                                                    \
+         127: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: \
+    case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21:   \
+    case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29:   \
+    case 30: case 31
+
+/* catch all ASCII punctuation characters */
+#define ASCII_CASE_PUNCTUATION                                                \
+         '!': case '"': case '#': case '$': case '%': case '&': case '\'':    \
+    case '(': case ')': case '*': case '+': case ',': case '-': case '.':     \
+    case '/': case ':': case ';': case '<': case '=': case '>': case '?':     \
+    case '@': case '[': case '\\': case ']': case '^': case '_': case '`':    \
+    case '{': case '|': case '}': case '~'
+
+/* catch digits in a case statement */
+#define ASCII_CASE_DIGIT                                                      \
+         '0': case '1': case '2': case '3': case '4': case '5': case '6':     \
+    case '7': case '8': case '9'
+
+/* catch whitespace characters in a case statement (no ending colon and 
+ * no first case so we can use case syntax) note: for our purposes, \0 is a 
+ * space character. */
+#define ASCII_CASE_SPACE                                                      \
+         ' ': case '\t': case '\n': case '\f': case '\v': case '\r': case '\0'
+
+/* ASCII optimised versions of toupper and tolower (though they only work on 
+ * upper and lowercase letters respectively) */
+#define ASCII_TOLOWER(c) (c | 0x20)   
+#define ASCII_TOUPPER(c) (c & ~0x20)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/binsearch.h b/src/include/binsearch.h
new file mode 100644 (file)
index 0000000..99431a0
--- /dev/null
@@ -0,0 +1,26 @@
+/* binsearch.h declares a function for binary searching that is much like
+ * the standard library bsearch
+ *
+ * written nml 2002-12-12
+ *
+ */
+
+#ifndef BINSEARCH_H
+#define BINSEARCH_H
+
+#include <stdlib.h>
+
+/* returns the position where the element given would be in the sorted array.
+   If it is there then you can use compar to establish that with one further
+   comparison.  If not then you could possibly insert it there.  Bear in mind
+   that this routine can return one element past the end of the array (if it
+   is greater than all elements in current array) so that address needs to be
+   valid. (sorry, this is the nature of the algorithm, think about it).  Note
+   that this differs from c89 bsearch in that this can be used for sorted 
+   insertion as well as pure binary search, as the c89 version returns NULL if
+   the key is not found */
+void *binsearch(const void* key, const void* base, size_t nel, 
+  size_t width, int (*compar)(const void* one, const void* two));
+
+#endif
+
diff --git a/src/include/bit.h b/src/include/bit.h
new file mode 100644 (file)
index 0000000..41ee96a
--- /dev/null
@@ -0,0 +1,144 @@
+/* bit.h declares a lot of macros to do bit manipulation in a
+ * portable way
+ *
+ * make sure the variables you're operating on are *unsigned*, else
+ * the results are undefined 
+ *
+ * written nml 2003-04-29
+ *
+ */
+
+#ifndef BIT_H
+#define BIT_H
+
+#include <assert.h>
+#include <string.h>
+
+extern unsigned long int bit_lbits[];
+
+/* basic functions */
+
+/* bit_set sets bit number bit in var to val (0 is lsb), evaluating to the
+ * result (var is not changed in place) */
+#define BIT_SET(var, bit, val) \
+  (assert(((bit) >= 0) && ((bit) <= (8 * sizeof(int)))), \
+    (((var) & ~(1 << (bit))) | (!!(val) << (bit))))
+
+/* bit_toggle toggles bit number bit in var (0 is lsb), evaluating to
+ * the result (var is not changed in place) */
+#define BIT_TOGGLE(var, bit) \
+  (assert(((bit) >= 0) && ((bit) <= (8 * sizeof(int)))), \
+    ((var) ^ (1 << (bit))))
+
+/* bit_get returns bit number bit in var (0 is lsb) */
+#define BIT_GET(var, bit) \
+  (assert(((bit) >= 0) && ((bit) <= (8 * sizeof(int)))), \
+    ((var) & (1 << (bit))))
+
+/* strength-reduced arithmetic */
+
+/* bit_mul2 performs integer multiplication between num and a power of two 
+ * (specified by pow) */
+#define BIT_MUL2(num, pow) ((num) << (pow))
+
+/* bit_div2 performs integer division between num and a power of two
+ * (specified by pow) */
+#define BIT_DIV2(num, pow) ((num) >> (pow))
+
+/* bit_mod2 performs integer modulus between num and a power of two
+ * (specified by pow) */
+#define BIT_MOD2(num, pow) ((num) & BIT_LMASK((pow)))
+
+/* bit_pow2 performs integer exponentiation of a power of
+ * two (specified by pow) (pow must be between 0 and the wordsize of
+ * your computer in bits - 1, else 0 is returned) */
+#define BIT_POW2(pow) \
+  (assert(((pow) >= 0) && ((pow) <= (8 * sizeof(int)))), \
+    (unsigned int) (bit_lbits[(pow)] + 1))
+
+/* bit_log2 returns floor(log_2(num)) except if num is 0, in which case 0 is
+ * returned. */
+unsigned int bit_log2(unsigned long int num);
+
+/* masking */
+
+/* return the a mask for bits upper bits */
+#define BIT_UMASK(bits) \
+  (assert(((bits) >= 0) && ((bits) <= (8 * sizeof(long)))), \
+    (unsigned int)(~bit_lbits[(8 * (sizeof(long))) - (bits)]))
+
+/* return the a mask for bits lower bits */
+#define BIT_LMASK(bits) \
+  (assert(((bits) >= 0) && ((bits) <= (8 * sizeof(int)))), \
+    (unsigned int)(bit_lbits[(bits)]))
+
+/* pointer setting (FIXME: this version is non-portable) */
+#define BIT_ARRAY_NULL(arr, size) (memset((arr), 0, (size) * sizeof((arr)[0])))
+
+/* bits to bytes and vice versa */
+
+/* return floor(number of bytes in given bits) */
+#define BIT_TO_BYTE(bits) (BIT_DIV2((bits), 3))
+
+/* return number of bits in given bytes */
+#define BIT_FROM_BYTE(bytes) (BIT_MUL2((bytes), 3))
+
+/* place a reversed version of src in dst */
+#define BIT_REV(dst, src)                                                     \
+    do {                                                                      \
+        assert(sizeof(dst) == sizeof(src));                                   \
+        switch (sizeof(dst)) {                                                \
+        case 1:                                                               \
+            dst = bit_revbits[(src >> 0) & BIT_LMASK(8)];                     \
+            break;                                                            \
+                                                                              \
+        case 2:                                                               \
+            dst = (bit_revbits[(src >> 0) & BIT_LMASK(8)] << 8)               \
+                  | bit_revbits[(src >> 8) && BIT_LMASK(8)];                  \
+            break;                                                            \
+                                                                              \
+        case 4:                                                               \
+            dst = (bit_revbits[(src >> 0) & BIT_LMASK(8)] << 24)              \
+                  | (bit_revbits[(src >> 8) & BIT_LMASK(8)] << 16)            \
+                  | (bit_revbits[(src >> 16) & BIT_LMASK(8)] << 8)            \
+                  | (bit_revbits[(src >> 24) & BIT_LMASK(8)] << 0);           \
+            break;                                                            \
+                                                                              \
+        case 8:                                                               \
+            dst = (bit_revbits[(src >> 0) & BIT_LMASK(8)] << 56)              \
+                  | (bit_revbits[(src >> 8) & BIT_LMASK(8)] << 48)            \
+                  | (bit_revbits[(src >> 16) & BIT_LMASK(8)] << 40)           \
+                  | (bit_revbits[(src >> 24) & BIT_LMASK(8)] << 32)           \
+                  | (bit_revbits[(src >> 32) & BIT_LMASK(8)] << 24)           \
+                  | (bit_revbits[(src >> 40) & BIT_LMASK(8)] << 16)           \
+                  | (bit_revbits[(src >> 48) & BIT_LMASK(8)] << 8)            \
+                  | (bit_revbits[(src >> 56) & BIT_LMASK(8)] << 0);           \
+            break;                                                            \
+                                                                              \
+        default:                                                              \
+            dst = 0;                                                          \
+            for (i = 0; i < sizeof(dst); i++) {                               \
+                dst |= bit_revbits[(src >> BIT_FROM_BYTE(i)) & BIT_LMASK(8)]  \
+                  << BIT_FROM_BYTE(sizeof(dst) - (i + 1));                    \
+            }                                                                 \
+        }                                                                     \
+    } while (0)
+
+/* wrapper functions */
+
+unsigned int bit_set(unsigned int var, unsigned int bit, unsigned int val);
+unsigned int bit_toggle(unsigned int var, unsigned int bit);
+unsigned int bit_get(unsigned int var, unsigned int bit);
+unsigned int bit_mul2(unsigned int num, unsigned int pow);
+unsigned int bit_div2(unsigned int num, unsigned int pow);
+unsigned int bit_mod2(unsigned int num, unsigned int pow);
+unsigned int bit_pow2(unsigned int pow);
+unsigned int bit_umask(unsigned int bits);
+unsigned int bit_lmask(unsigned int bits);
+void bit_array_null(void *arr, unsigned int nmemb, unsigned int width);
+unsigned int bit_to_byte(unsigned int bits);
+unsigned int bit_from_byte(unsigned int bits);
+unsigned int bit_rev(unsigned int num, unsigned int byte_width);
+
+#endif
+
diff --git a/src/include/btbucket.h b/src/include/btbucket.h
new file mode 100644 (file)
index 0000000..98d2e9e
--- /dev/null
@@ -0,0 +1,104 @@
+/* btbucket.h declares a set of utility functions for manipulating
+ * blocks of raw memory that will serve as btree buckets.  The
+ * bucket.h interface allows storage of (reasonably) arbitrary keys
+ * and values within raw memory, and this interface wraps that
+ * functionality with some accounting details that are necessary for a
+ * btree (like sibling pointers for leaf buckets only and common prefixes for 
+ * all buckets), while still containing an ordinary bucket.
+ *
+ * written nml 2003-02-17
+ *
+ */
+
+#ifndef BTBUCKET_H
+#define BTBUCKET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* initialise a new btree bucket, of size bucketsize, using bucketing
+ * strategy strategy, and with a sibling pointers of sib_fileno,
+ * sib_offset.  Terminating sibling pointers are set to point to the bucket 
+ * itself. leaf indicates whether this bucket is a leaf bucket.  prefix and
+ * prefix_size give the prefix for this bucket.  prefix_size is written with the
+ * size of the prefix accepted by the bucket on return. */
+void btbucket_new(void *btbucket, unsigned int bucketsize, 
+  unsigned int sib_fileno, unsigned int sib_offset, int leaf, void *prefix, 
+  unsigned int *prefix_size);
+
+/* get the sibling pointer for this bucket (assuming that its a leaf node) */
+void btbucket_sibling(void *btbucket, unsigned int bucketsize, 
+  unsigned int *fileno, unsigned long int *offset);
+
+/* set the sibling pointer for this bucket (assuming that its a leaf node) */
+void btbucket_set_sibling(void *btbucket, unsigned int bucketsize, 
+  unsigned int fileno, unsigned long int offset);
+
+/* get the size of the bucket within this btree bucket */
+unsigned int btbucket_size(void *btbucket, unsigned int bucketsize);
+
+/* return a pointer to the start of the bucket within the btree bucket */
+void *btbucket_bucket(void *btbucket);
+
+/* return indication of whether the btree bucket is a leaf node */
+int btbucket_leaf(void *btbucket, unsigned int bucketsize);
+
+/* return the prefix and prefix size of the prefix for this btree bucket */
+void *btbucket_prefix(void *btbucket, unsigned int bucketsize, 
+  unsigned int *prefix_size);
+
+/* set the prefix for this btree bucket to prefix, which is of length 
+ * *prefix_size.  Note that the bucket may not be able to accomodate all of
+ * *prefix_size, in which case it will be shortened and *prefix_size set
+ * appropriately.  The bucket inside the btbucket has to be resized to
+ * accomodate the change, so its possible for this method to fail, (if the
+ * bucket is too full to be resized downward) in which case it returns 0. */
+int btbucket_set_prefix(void *btbucket, unsigned int bucketsize, 
+  void *prefix, unsigned int *prefix_size);
+
+/* size of a btbucket internal node entry */
+unsigned int btbucket_entry_size();
+
+/* decodes a btbucket internal node entry (entry must be of size
+ * btbucket_entry_size) */
+void btbucket_entry(void *entry, unsigned int *fileno, 
+  unsigned long int *offset);
+
+/* encodes a btbucket internal node entry (entry must be of size
+ * btbucket_entry_size) */
+void btbucket_set_entry(void *entry, unsigned int fileno, 
+  unsigned long int offset);
+
+/* return the number of entries that should be split to the lexically smaller 
+ * bucket (btbucket, bucketsize, strategy), given 
+ * that we're inserting/reallocating an entry (term, termlen, additional) in
+ * the bucket at the same time.  Additional should be the length of the vector
+ * if the split is in response to an insert, otherwise it should be the
+ * additional space requested by a reallocation operation.  The shortest entry 
+ * within range bytes of the perfect split is returned, or the nearest entry 
+ * if this isn't possible.  Note that the additional term *must* be
+ * considered to obtain a workable split in all cases.  the value of left
+ * after execution indicates whether additional term should be placed in left
+ * or right bucket.  This routine is exposed for testing and because it may be
+ * useful for other btrees based on the same bucketing schemes. */
+unsigned int btbucket_find_split_entry(void *btbucket, unsigned int bucketsize,
+  int strategy, unsigned int range, const char *term, 
+  unsigned int termlen, unsigned int additional, int *left);
+
+/* determine what the common prefix for strings in the range [one, two) is, by
+ * returning its length and last character (written into lastchar).  Note that
+ * the prefix has to be the prefix of both the strings, except for the last
+ * character, so you can infer what the prefix is by its length and last
+ * character.  one is presumed to be lexographically smaller than two by this
+ * function. */
+unsigned int btbucket_common_prefix(const char *one, 
+  unsigned int onelen, const char *two, unsigned int twolen, 
+  char *lastchar);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/btbulk.h b/src/include/btbulk.h
new file mode 100644 (file)
index 0000000..7af0e77
--- /dev/null
@@ -0,0 +1,164 @@
+/* btbulk.h declares an interface that allows efficient (time and
+ * space) construction of a btree via bulk loading.  In order to do this you 
+ * need to ensure that the keys you insert into the tree are sorted prior to
+ * insertion.  All hell will break loose if this is not the case.
+ *
+ * This module only allows for complete construction of a new btree,
+ * not bulk updates of a previous one.  I've also now included an efficient way
+ * to bulk-read the leaf pages from an existing b-tree.
+ *
+ * written nml 2004-05-21
+ *
+ */
+
+#ifndef BTBULK_H
+#define BTBULK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* structure representing the state of the bulk loading algorithm */
+struct btbulk {
+    /* inputs (caller manipulates these, btbulk only reads them) */
+    const char *term;                  /* term to be inserted */
+    unsigned int termlen;              /* length of term (excluding NUL) */
+    unsigned int datasize;             /* how large the data entry for this 
+                                        * term is */
+    unsigned int fileno;               /* what the current file number is */
+    unsigned long int offset;          /* what the current offset within that 
+                                        * file number is */
+
+    /* outputs (btbulk manipulates these, caller only reads them) */
+    union {
+        /* outputs returned with BTBULK_WRITE return value */
+        struct {
+            char *next_out;            /* buffer that needs to be written */
+            unsigned int avail_out;    /* size of buffer that needs to be 
+                                        * written */
+        } write;
+
+        /* outputs returned with BTBULK_OK return value */
+        struct {
+            void *data;                /* pointer to memory area to write term 
+                                        * data into, of size input datasize */
+        } ok;
+
+    } output;
+
+    struct btbulk_state *state;        /* opaque state */
+};
+
+/* create a new bulk insertion object in memory pointed to by space,
+ * that creates a btree with pages of size pagesize bytes, using
+ * leaf_strategy bucket strategy for tree leaves and node_strategy
+ * bucket strategy for tree internal nodes.  The b-tree will be filled
+ * to a percentage roughly equal to fill_factor, which should be in
+ * range (0.0, 1.0].  Anything outside this range will be considered
+ * to be a fill factor of 1.0.  buffer_pages is the number of pages to buffer
+ * before writing them out. Returns a pointer to the space on success, 
+ * or NULL on failure. */
+struct btbulk *btbulk_new(unsigned int pagesize, unsigned long int maxfilesize,
+  int leaf_strategy, int node_strategy, float fill_factor, 
+  unsigned int buffer_pages, struct btbulk *space);
+
+/* delete a bulk insertion object */
+void btbulk_delete(struct btbulk *bulk);
+
+/* values that can be returned from btbulk_insert or btbulk_read */
+enum btbulk_ret {
+    BTBULK_ERR = -1,                   /* an unexpected error has occurred */
+    BTBULK_OK = 0,                     /* operation succeeded */
+    BTBULK_WRITE = 1,                  /* current buffer must be output 
+                                        * before insertion can proceed */
+    BTBULK_READ = 2,                   /* requested buffer must be read before 
+                                        * operation can proceed */
+    BTBULK_FINISH = 3,                 /* end of b-tree has been reached */
+    BTBULK_FLUSH = 4                   /* a new file must be started before a 
+                                        * bucket can be written out */
+};
+
+/* insert a term and associated data into the btree.  On successful
+ * insertion a pointer to the new data area is returned so that you
+ * can write data into it (data area is of size datasize) and
+ * BTBULK_OK is returned.  If insertion requires an existing bucket to
+ * be written out, BTBULK_WRITE is returned and the write elements
+ * in the output structure indicate the memory location (next_out) and
+ * size (avail_out) the write must be.  The bulk loading algorithm
+ * assumes that the output will be written to the location specified by 
+ * fileno,offset.  This means that they have to be accurate upon every entry to 
+ * this function, and needs to be updated after you've written the
+ * buffer indicated by a _WRITE call.  _FLUSH indicates that there isn't enough
+ * room for the bucket in the current file, and that a new one should be
+ * started. */
+int btbulk_insert(struct btbulk *bulk);
+
+/* finish up the bulk insert.  This call will write the remaining
+ * btree buckets out to disk, so you need to keep calling it until it
+ * returns _FINISH.  It behaves exactly like _insert, with respect to
+ * input and returned values.  on _FINISH the btree root node fileno and offset
+ * are written into *root_fileno and *root_offset. */
+int btbulk_finalise(struct btbulk *bulk, unsigned int *root_fileno, 
+  unsigned long int *root_offset);
+
+/* structure representing the state of the bulk reading algorithm */
+struct btbulk_read {
+    /* inputs (caller manipulates these, btbulk only reads them) */
+    const char *next_in;               /* current input buffer */
+    unsigned int avail_in;             /* size of current input buffer */
+    unsigned int fileno_in;            /* what the current file number is */
+    unsigned long int offset_in;       /* what the current offset within that 
+                                        * file number is */
+
+    /* outputs (btbulk manipulates these, caller only reads them) */
+    union {
+        /* outputs returned with BTBULK_READ return value */
+        struct {
+            unsigned int fileno;       /* fileno of next buffer required */
+            unsigned long int offset;  /* offset of next buffer required */
+        } read;
+
+        /* outputs returned with BTBULK_OK return value */
+        struct {
+            const char *term;          /* current term */
+            unsigned int termlen;      /* length of current term */
+            unsigned int datalen;      /* how large the data entry for this 
+                                        * term is */
+            const void *data;          /* data entry for current term */
+        } ok;
+    } output;
+
+    struct btbulk_read_state *state;   /* opaque state */
+};
+
+/* create a new bulk reading object in memory pointed to by space.  pagesize
+ * should be obvious, strategy is the leaf strategy of the b-tree in question
+ * (no index nodes will be read).  first_page_fileno and first_page_offset
+ * specify where, in the b-tree file, the leftmost leaf node occurs.  Returns
+ * NULL on failure */
+struct btbulk_read *btbulk_read_new(unsigned int pagesize, 
+  int strategy, unsigned int first_page_fileno, 
+  unsigned long int first_page_offset, struct btbulk_read *space);
+
+/* delete a bulk reading object */
+void btbulk_read_delete(struct btbulk_read *bulk);
+
+/* read next term and associated data from the b-tree.  Returns BTBULK_OK if the
+ * term is currently available in the output structure.  Returns BTBULK_FINISH
+ * if the b-tree doesn't have any further terms.  Returns BTBULK_READ if the
+ * input buffer does not contain the required data, with an indication of which
+ * section of the file needs to be read.  In all cases where BTBULK_READ is
+ * returned it is expected that the subsequent next_in buffer will be of at
+ * least pagesize bytes.  If this is not the case BTBULK_READ will continue to
+ * be read */
+enum btbulk_ret btbulk_read(struct btbulk_read *bulk);
+
+/* return the offset of the bucket currently being read */
+unsigned long int btbulk_read_offset(struct btbulk_read *bulk);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/include/bucket.h b/src/include/bucket.h
new file mode 100644 (file)
index 0000000..f49a752
--- /dev/null
@@ -0,0 +1,151 @@
+/* bucket.h declares an interface for a operations that store variable length
+ * lists with variable length keys into buckets
+ *
+ * written nml 2003-10-06
+ *
+ */
+
+#ifndef BUCKET_H
+#define BUCKET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bucket;
+
+int bucket_new(void *bucketmem, unsigned int bucketsize, int strategy);
+
+/* allocate space for term term within bucket b.  index is the integer index
+ * within the bucket that was assigned, and may be NULL */
+void *bucket_alloc(void *bucketmem, unsigned int bucketsize, int strategy,
+  const char *term, unsigned int termlen, unsigned int newsize, 
+  int *toobig, unsigned int *index);
+
+/* return the in-memory address that an inverted list identified by
+ * bucketno,termno occupies in memory.  NULL is returned on failure.  index is
+ * the integer index of the term within the bucket and may be NULL. */
+void *bucket_find(void *bucketmem, unsigned int bucketsize,
+  int strategy, const char *term, unsigned int termlen, 
+  unsigned int *veclen, unsigned int *index);
+
+/* search is just like find, except that it returns the lexographically largest
+ * term that is less than the search target, instead of an exact match. index
+ * is the integer index of the term within the bucket and may be NULL. */
+void *bucket_search(void *bucketmem, unsigned int bucketsize, int strategy, 
+  const char *term, unsigned int termlen, unsigned int *veclen, 
+  unsigned int *index);
+
+/* remove the specified term from the bucket */
+int bucket_remove(void *bucketmem, unsigned int bucketsize, int strategy,
+  const char *term, unsigned int termlen);
+int bucket_remove_at(void *bucketmem, unsigned int bucketsize, int strategy,
+  unsigned int index);
+
+/* grow (or shrink) the list associated with the term to newlen.  On
+ * success, the address of the list in-memory is returned.  NULL is returned on
+ * failure, which indicates that there isn't enough room in the bucket for the
+ * additional length.  On failure, if toobig is set, it indicates that the term
+ * and vector are too long to fit into an empty bucket. */
+void *bucket_realloc(void *bucketmem, unsigned int bucketsize, 
+  int strategy, const char *term, unsigned int termlen, 
+  unsigned int newsize, int *toobig);
+void *bucket_realloc_at(void *bucketmem, unsigned int bucketsize, 
+  int strategy, unsigned int index, unsigned int newsize, int *toobig);
+
+/* retrieve the next term in the bucket.  Iterate over the terms in the bucket
+ * by setting *state to 0, then calling bucket_next_term until it 
+ * returns NULL */
+/* XXX: note that this call will have to be changed if buckets stop storing the
+ * term contiguously */
+const char *bucket_next_term(void *bucketmem, unsigned int bucketsize, 
+  int strategy, unsigned int *state, unsigned int *termlen, 
+  void **data, unsigned int *len);
+const char *bucket_term_at(void *bucketmem, unsigned int bucketsize,
+  int strategy, unsigned int index, unsigned int *termlen, void **data, 
+  unsigned int *len);
+
+/* split the entries in bucket 1 lexographically so that the terms
+ * lexographically least number of terms are left in bucket 1.  Bucket 2 gets
+ * the remainder, and is presumed to be uninitialised.  Return value indicates 
+ * success or failure. */
+int bucket_split(void *bucketmem1, unsigned int bucketsize1, 
+  void *bucketmem2, unsigned int bucketsize2, int strategy, 
+  unsigned int terms);
+
+/* resize the working area of the bucket.  Return value indicates success or
+ * failure. */
+int bucket_resize(void *bucketmem, unsigned int old_bucketsize, int strategy, 
+  unsigned int new_bucketsize);
+
+/* return number of entries in bucket */
+unsigned int bucket_entries(void *bucketmem, unsigned int bucketsize, 
+  int strategy);
+
+/* return number of bytes utilised in bucket */
+unsigned int bucket_utilised(void *bucketmem, unsigned int bucketsize, 
+  int strategy);
+
+/* return number of bytes of string in bucket */
+unsigned int bucket_string(void *bucketmem, unsigned int bucketsize, 
+  int strategy);
+
+/* return number of bytes of overhead in bucket */
+unsigned int bucket_overhead(void *bucketmem, unsigned int bucketsize, 
+  int strategy);
+
+/* return number of free bytes in bucket */
+unsigned int bucket_unused(void *bucketmem, unsigned int bucketsize, 
+  int strategy);
+
+/* whether this bucket scheme sorts its entries */
+int bucket_sorted(int strategy);
+
+/* return the number of entries that should be split to the lexically smaller 
+ * bucket (btbucket, bucketsize, strategy), given 
+ * that we're inserting/reallocating an entry (term, termlen, additional) in
+ * the bucket at the same time.  Additional should be the length of the vector
+ * if the split is in response to an insert, otherwise it should be the
+ * additional space requested by a reallocation operation.  The shortest entry 
+ * within range bytes of the perfect split is returned, or the nearest entry 
+ * if this isn't possible.  Note that the additional term *must* be
+ * considered to obtain a workable split in all cases.  the value of left
+ * after execution indicates whether additional term should be placed in left
+ * or right bucket. */
+unsigned int bucket_find_split_entry(void *bucketmem, unsigned int bucketsize,
+  int strategy, unsigned int range, const char *term, 
+  unsigned int termlen, unsigned int additional, int *smaller);
+
+/* append a term to a bucket, providing the quickest way to get a term into a
+ * bucket.  No attempt is made to sort the bucket, so you'll have to append them
+ * in sorted order if the bucket format requires it */
+void *bucket_append(void *bucketmem, unsigned int bucketsize, int strategy,
+  const char *term, unsigned int termlen, unsigned int size, 
+  int *toobig);
+
+/* XXX: things we may need in the future: */
+
+/* merge two lexographically sorted buckets (where all entries in bucket1 are
+ * less than all entries in bucket2) into one bucket (bucket1) */
+int bucket_merge(void *bucketmem1, unsigned int bucketsize1, void *bucketmem2, 
+  unsigned int bucketsize2, int strategy);
+
+/* set the term of entry termno to newterm, without attempting to maintain
+ * sorting order.  This is very much an 'i know what i'm doing call', its up to
+ * you to ensure that the entry number is correct and that the ordering (if the
+ * strategy is ordered) is not affected by this call.  Return value indicates
+ * success. */
+/* FIXME: relationship b/w newsize and newtermlen indicates whether to
+ * completely change term, to remove chars from front of term or add chars to
+ * front of term. */
+/* XXX: maybe something that does this to all entries at once? */
+int bucket_set_term(void *bucketmem, unsigned int bucketsize, int strategy, 
+  unsigned int termno, unsigned int newsize, const char *newterm, 
+  unsigned int newtermlen, int *toobig);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/chash.h b/src/include/chash.h
new file mode 100644 (file)
index 0000000..c2a59f7
--- /dev/null
@@ -0,0 +1,226 @@
+/* chash.h declares interfaces for a generic chained hashtable, that
+ * features pipeling, (storing of hash values) dynamic expansion and 
+ * move-to-front searching.  The hashtable has been designed to be as 
+ * extensible and fast as possible, at the expense of neatness.  It
+ * does not handle duplicates, so don't insert them.
+ *
+ * written nml 2003-05-29
+ *
+ */
+
+#ifndef CHASH_H
+#define CHASH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum chash_ret {
+    CHASH_OK = 0,              /* operation succeeded */
+    CHASH_ITER_FINISH = 1,     /* no more items to iterate over */
+
+    CHASH_ENOMEM = -1,         /* operation failed due to lack of memory */
+    CHASH_ENOENT = -2          /* operation failed as the specified item 
+                                * wasn't found */
+};
+
+struct chash;
+struct chash_iter;
+
+/* construct a new table that contains pointer keys in the space given.  
+ * (2 ** startbits) is the initial size of the table, and it will double 
+ * whenever resize_load is exceeded. hash is the hash function and cmp is the 
+ * comparison function. */
+struct chash *chash_ptr_new(unsigned int startbits, float resize_load, 
+  unsigned int (*hash)(const void *key), 
+  int (*cmp)(const void *key1, const void *key2));
+
+/* construct a new table that contains long integer keys in the space given.  
+ * (2 ** startbits) is the initial size of the table, and it will double 
+ * whenever resize_load is exceeded. the value of the key mod the tablesize 
+ * will be taken as the hash value */
+struct chash *chash_luint_new(unsigned int startbits, float resize_load);
+
+/* construct a new table that contains string keys in the space given.
+ * Strings are copied into the table upon insertion (no need to keep strings 
+ * lying around).  (2 ** startbits) is the initial size of the table, and it 
+ * will double whenever resize_load is exceeded.  hash is the string hash 
+ * function */
+struct chash *chash_str_new(unsigned int startbits, float resize_load, 
+  unsigned int (*hash)(const char *key, unsigned int len));
+
+/* delete a table */
+void chash_delete(struct chash *hash);
+
+/* remove all elements from the table */
+void chash_clear(struct chash *hash);
+
+/* create a new iterator over the hashtable */
+struct chash_iter *chash_iter_new(struct chash *hash);
+
+void chash_iter_delete(struct chash_iter *iter);
+
+/* get the number of elements in the table */
+unsigned int chash_size(const struct chash *hash);
+
+/* ensure that at least enough space is available to allocate reserve objects
+ * without failure from lack of memory.  Value returned is the number of
+ * reserved items, which should be higher than reserve if the call 
+ * succeeded. */
+unsigned int chash_reserve(struct chash *hash, unsigned int reserve);
+
+/* documentation for template functions:
+ *
+ * chash_[keytype]_[datatype]_insert:
+ *   accepts a key of keytype and data of datatype and inserts them into the
+ *   hashtable.  Don't insert duplicates.  Returns CHASH_OK on success.
+ * 
+ * chash_[keytype]_[datatype]_remove:
+ *   removes first instance found matching key, writing the data associated
+ *   with key into *data on success.  Returns CHASH_OK on success.
+ *
+ * chash_[keytype]_[datatype]_find:
+ *   find first instance matching given key, writing a pointer to the data
+ *   associated with the key into *data (so you can change the data in-situ -
+ *   although you should beware cases where this changes the key!) on success
+ *
+ * chash_[keytype]_[datatype]_find_insert:
+ *   find entry associated with key, or insert a new entry using ins_data if it
+ *   can't be found.  On all successful cases, *fnd_data is written with a
+ *   pointer to the found/inserted data.  On success, *find will be 1 if found,
+ *   0 if inserted.  Returns CHASH_OK on success.
+ *
+ * chash_[keytype]_[datatype]_foreach:
+ *   execute a given fn on each element of the hashtable.  Returns CHASH_OK on
+ *   success, currently can't fail.
+ *
+ * chash_iter_[keytype]_[datatype]_next:
+ *   obtain the next value from an iterator, writing the key value into *key
+ *   and the data value into *data on success.  Returns CHASH_OK on success and
+ *   CHASH_ITER_FINISH once iteration is finished.
+ *
+ */
+
+/* ptr to ptr functions */
+
+enum chash_ret chash_ptr_ptr_insert(struct chash *hash, const void *key, 
+  void *data);
+enum chash_ret chash_ptr_ptr_remove(struct chash *hash, const void *key, 
+  void **data);
+enum chash_ret chash_ptr_ptr_find(struct chash *hash, const void *key, 
+  void ***data);
+enum chash_ret chash_ptr_ptr_find_insert(struct chash *hash, const void *key, 
+  void ***fnd_data, void *ins_data, int *find);
+enum chash_ret chash_ptr_ptr_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, const void *key, void **data));
+enum chash_ret chash_iter_ptr_ptr_next(struct chash_iter *iter, 
+  const void **key, void ***data);
+
+/* ptr to luint functions */
+
+enum chash_ret chash_ptr_luint_insert(struct chash *hash, const void *key, 
+  unsigned long int data);
+enum chash_ret chash_ptr_luint_remove(struct chash *hash, const void *key, 
+  unsigned long int *data);
+enum chash_ret chash_ptr_luint_find(struct chash *hash, const void *key, 
+  unsigned long int **data);
+enum chash_ret chash_ptr_luint_find_insert(struct chash *hash, 
+  const void *key, unsigned long int **fnd_data, unsigned long int ins_data, 
+  int *find);
+enum chash_ret chash_ptr_luint_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, const void *key, unsigned long int *data));
+enum chash_ret chash_iter_ptr_luint_next(struct chash_iter *iter, 
+  const void **key, unsigned long int **data);
+
+/* uint to ptr functions */
+
+enum chash_ret chash_luint_ptr_insert(struct chash *hash, 
+  unsigned long int key, void *data);
+enum chash_ret chash_luint_ptr_remove(struct chash *hash, 
+  unsigned long int key, void **data);
+enum chash_ret chash_luint_ptr_find(struct chash *hash, unsigned long int key, 
+  void ***data);
+enum chash_ret chash_luint_ptr_find_insert(struct chash *hash, 
+  unsigned long int key, void ***fnd_data, void *ins_data, int *find);
+enum chash_ret chash_luint_ptr_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, unsigned long int key, void **data));
+enum chash_ret chash_iter_luint_ptr_next(struct chash_iter *iter, 
+  unsigned long int *key, void ***data);
+
+/* uint to uint functions */
+
+enum chash_ret chash_luint_luint_insert(struct chash *hash, 
+  unsigned long int key, unsigned long int data);
+enum chash_ret chash_luint_luint_remove(struct chash *hash, 
+  unsigned long int key, unsigned long int *data);
+enum chash_ret chash_luint_luint_find(struct chash *hash, unsigned long int key,
+  unsigned long int **data);
+enum chash_ret chash_luint_luint_find_insert(struct chash *hash, 
+  unsigned long int key, unsigned long int **fnd_data, 
+  unsigned long int ins_data, int *find);
+enum chash_ret chash_luint_luint_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, unsigned long int key, unsigned long int *data));
+enum chash_ret chash_iter_luint_luint_next(struct chash_iter *iter, 
+  unsigned long int *key, unsigned long int **data);
+
+/* uint to dbl functions */
+
+enum chash_ret chash_luint_dbl_insert(struct chash *hash, 
+  unsigned long int key, double data);
+enum chash_ret chash_luint_dbl_remove(struct chash *hash, 
+  unsigned long int key, double *data);
+enum chash_ret chash_luint_dbl_find(struct chash *hash, unsigned long int key, 
+  double **data);
+enum chash_ret chash_luint_dbl_find_insert(struct chash *hash, 
+  unsigned long int key, double **fnd_data, double ins_data, int *find);
+enum chash_ret chash_luint_dbl_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, unsigned long int key, double *data));
+enum chash_ret chash_iter_luint_dbl_next(struct chash_iter *iter, 
+  unsigned long int *key, double **data);
+
+/* uint to flt functions */
+
+enum chash_ret chash_luint_flt_insert(struct chash *hash, 
+  unsigned long int key, float data);
+enum chash_ret chash_luint_flt_remove(struct chash *hash, 
+  unsigned long int key, float *data);
+enum chash_ret chash_luint_flt_find(struct chash *hash, unsigned long int key, 
+  float **data);
+enum chash_ret chash_luint_flt_find_insert(struct chash *hash, 
+  unsigned long int key, float **fnd_data, float ins_data, int *find);
+enum chash_ret chash_luint_flt_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, unsigned long int key, float *data));
+enum chash_ret chash_iter_luint_flt_next(struct chash_iter *iter, 
+  unsigned long int *key, float **data);
+
+/* str to ptr functions */
+
+enum chash_ret chash_str_ptr_insert(struct chash *hash, 
+  const char *key, void *data);
+enum chash_ret chash_str_ptr_remove(struct chash *hash, 
+  const char *key, void **data);
+enum chash_ret chash_str_ptr_find(struct chash *hash, const char *key, 
+  void ***data);
+enum chash_ret chash_str_ptr_find_insert(struct chash *hash, 
+  const char *key, void ***fnd_data, void *ins_data, int *find);
+enum chash_ret chash_nstr_ptr_insert(struct chash *hash, 
+  const char *key, unsigned int keylen, void *data);
+enum chash_ret chash_nstr_ptr_remove(struct chash *hash, 
+  const char *key, unsigned int keylen, void **data);
+enum chash_ret chash_nstr_ptr_find(struct chash *hash, const char *key, 
+  unsigned int keylen, void ***data);
+enum chash_ret chash_nstr_ptr_find_insert(struct chash *hash, 
+  const char *key, unsigned int keylen, void ***fnd_data, void *ins_data, 
+  int *find);
+enum chash_ret chash_nstr_ptr_foreach(struct chash *hash, void *userdata,
+  void (*fn)(void *userdata, const char *key, unsigned int keylen, 
+      void **data));
+enum chash_ret chash_iter_nstr_ptr_next(struct chash_iter *iter, 
+  const char **key, unsigned int *keylen, void ***data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/compat/zglob.h b/src/include/compat/zglob.h
new file mode 100644 (file)
index 0000000..82710ea
--- /dev/null
@@ -0,0 +1,74 @@
+/* zglob.h declares an interface similar to POSIX glob functionality,
+ * using win32 system calls.  Note that we can't use the name glob, because
+ * otherwise we can't include the system glob header file.
+ *
+ * written nml 2004-11-23
+ *
+ */
+
+#ifndef ZGLOB_H
+#define ZGLOB_H
+
+#ifndef WIN32
+/* we just use the provided implementation on most platforms */
+
+#include <glob.h>
+
+#else
+/* we provide our own implementation on win32 */
+
+#include <stdlib.h>   /* for size_t */
+
+typedef struct {
+    size_t gl_pathsize;         /* capacity of pathv array */
+    size_t gl_pathc;            /* current size of pathv array */
+    char **gl_pathv;            /* array of matching filenames */
+    size_t gl_offs;             /* number of leading NULL's to insert into 
+                                 * gl_pathv if GLOB_DOOFFS is set */
+} glob_t;
+
+/* create or add to a specific glob structure (given by pglob).  The
+ * glob structure must point to a valid structure with correct
+ * alignment and with enough space to hold a glob_t.  Returns 0 on
+ * success, or an element from glob_error on failure.  glob structures
+ * are guaranteed to be usable after both errors and successful
+ * returns.  See glob_flags for various flags and their effects.  
+ * Note that this version of glob *always* behaves as if GLOB_ERR is
+ * on, so errfunc isn't used and all errors halt the glob */
+int glob(const char *pattern, int flags, 
+  int (*errfunc)(const char *epath, int eerrno), glob_t *pglob);
+
+/* free memory associated with a pglob structure */
+void globfree(glob_t *pglob);
+
+enum glob_flags {
+    GLOB_APPEND = (1 << 0),     /* append to previous glob() results */
+    GLOB_DOOFFS = (1 << 1),     /* reserve gl_offs number of spaces in gl_pathv
+                                 * before glob results (must be used
+                                 * consistently for multiple glob()
+                                 * calls with GLOB_APPEND) */
+    GLOB_MARK = (1 << 3),       /* mark directories with trailing '/' */
+    GLOB_NOCHECK = (1 << 4)     /* if the pattern doesn't match anything, 
+                                 * then glob() returns a single result, 
+                                 * which is the original pattern */
+#if 0
+    /* these options are in POSIX glob, but currently not supported in
+     * this version */
+    GLOB_ERR = (1 << 2),        /* stop on errors */
+    GLOB_NOESCAPE = (1 << 5),   /* disable backslash escaping */
+    GLOB_NOSORT = (1 << 6)      /* don't sort according to LC_COLLATE */
+#endif
+};
+
+enum glob_error {
+    GLOB_OK = 0,                /* successful */
+    GLOB_ABORTED = -1,          /* GLOB_ERR was set or errfunc returned 
+                                 * non-zero */
+    GLOB_NOMATCH = -2,          /* no matches, and GLOB_NOCHECK wasn't set */
+    GLOB_NOSPACE = -3,          /* failed to allocate memory */
+};
+
+#endif
+
+#endif
+
diff --git a/src/include/compat/zstdint.h b/src/include/compat/zstdint.h
new file mode 100644 (file)
index 0000000..4441a81
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef ZSTDINT_H
+#define ZSTDINT_H
+
+#include "config.h"
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif 
+
+#include <limits.h>
+
+#ifndef UINT32_MAX
+#define UINT32_MAX UINT_MAX
+#endif
+
+#ifndef UINT16_MAX
+#define UINT16_MAX USHRT_MAX
+#endif
+
+/* define an appropriate string for printing off_t quantities */
+#if _FILE_OFFSET_BITS == 64
+ #define ZPRI_OFF PRId64
+#else
+ #define ZPRI_OFF PRId32
+#endif
+
+#endif
+
diff --git a/src/include/compat/zvalgrind.h b/src/include/compat/zvalgrind.h
new file mode 100644 (file)
index 0000000..12133d9
--- /dev/null
@@ -0,0 +1,65 @@
+/* zvalgrind.h is a small wrapper around the valgrind.h functions to make them
+ * do nothing when valgrind isn't present.
+ *
+ * written nml 2004-08-30
+ *
+ */
+
+#ifndef ZVALGRIND_H
+#define ZVALGRIND_H
+
+#include "config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* if they requested use of valgrind */
+#ifdef WITH_VALGRIND
+
+#ifdef HAVE_VALGRIND_H
+#include <valgrind.h>
+#endif
+#ifdef HAVE_MEMCHECK_H
+#include <memcheck.h>
+#else
+/* its probably valgrind prior to version 2, should still be able to use it.
+ * Check for FREELIKE_BLOCK and MALLOCLIKE_BLOCK, because earlier versions
+ * didn't have these */
+#ifndef VALGRIND_MALLOCLIKE_BLOCK
+#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed)
+#endif
+#ifndef VALGRIND_FREELIKE_BLOCK
+#define VALGRIND_FREELIKE_BLOCK(addr, rzB)
+#endif
+#endif
+
+#else
+/* haven't got valgrind, define empty macros */
+
+#define VALGRIND_MAKE_NOACCESS(_qzz_addr,_qzz_len) 
+#define VALGRIND_MAKE_WRITABLE(_qzz_addr,_qzz_len) 
+#define VALGRIND_MAKE_READABLE(_qzz_addr,_qzz_len) 
+#define VALGRIND_DISCARD(_qzz_blkindex) 
+#define VALGRIND_CHECK_WRITABLE(_qzz_addr,_qzz_len) 
+#define VALGRIND_CHECK_READABLE(_qzz_addr,_qzz_len) 
+#define VALGRIND_CHECK_DEFINED(__lvalue) 
+#define VALGRIND_MAKE_NOACCESS_STACK(_qzz_addr,_qzz_len) /* no value */
+#define RUNNING_ON_VALGRIND 0
+#define VALGRIND_DO_LEAK_CHECK /* no value */
+#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) /* no value */
+#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed)
+#define VALGRIND_FREELIKE_BLOCK(addr, rzB)
+#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed)
+#define VALGRIND_DESTROY_MEMPOOL(pool)
+#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size)
+#define VALGRIND_MEMPOOL_FREE(pool, addr)
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/config_h.in b/src/include/config_h.in
new file mode 100644 (file)
index 0000000..2a19776
--- /dev/null
@@ -0,0 +1,165 @@
+/* src/include/config_h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the <float.h> header file. */
+#undef HAVE_FLOAT_H
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `mx' library (-lmx). */
+#undef HAVE_LIBMX
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* memcheck.h */
+#undef HAVE_MEMCHECK_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+   and to 0 otherwise. */
+#undef HAVE_REALLOC
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+   zero-length file name argument. */
+#undef HAVE_STAT_EMPTY_STRING_BUG
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#undef HAVE_STRNCASECMP
+
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* valgrind.h */
+#undef HAVE_VALGRIND_H
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+   slash. */
+#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* indicates whether to use valgrind */
+#undef WITH_VALGRIND
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `unsigned short int' if <sys/types.h> does not define. */
+#undef uint16_t
+
+/* Define to `unsigned long int' if <sys/types.h> does not define. */
+#undef uint32_t
+
+/* Define to `unsigned char' if <sys/types.h> does not define. */
+#undef uint8_t
+
+/* Define to `unsigned long int' if <sys/types.h> does not define. */
+#undef uint_fast32_t
diff --git a/src/include/crc.h b/src/include/crc.h
new file mode 100644 (file)
index 0000000..ae6a901
--- /dev/null
@@ -0,0 +1,31 @@
+/* crc.h declares a module that calculates cyclic redundancy checksums over
+ * arbitrary sequences of bytes.
+ *
+ * written nml 2004-08-26
+ *
+ */
+
+#ifndef CRC_H
+#define CRC_H
+
+#include <zstdint.h>
+
+struct crc;
+
+/* create a new CRC object */
+struct crc *crc_new();
+
+/* reinitialise the CRC object, to restart the checksumming */
+void crc_reinit(struct crc *crc);
+
+/* add avail_in bytes, from next_in to next_in + avail_in, to the checksum */
+void crc(struct crc *crc, const void *next_in, unsigned int avail_in);
+
+/* retrieve the current checksum */
+uint32_t crc_sum(struct crc *crc);
+
+/* delete a CRC object */
+void crc_delete(struct crc *crc);
+
+#endif
+
diff --git a/src/include/cygwin/firstinclude.h b/src/include/cygwin/firstinclude.h
new file mode 100644 (file)
index 0000000..909afd9
--- /dev/null
@@ -0,0 +1,32 @@
+/* cygwin/firstinclude.h defines feature macros to allow us to use the
+ * functions we want (primarily POSIX, but a few other bits and pieces
+ * too) on cygwin
+ *
+ * written nml 2003-04-24
+ *
+ */
+
+#ifndef FIRSTINCLUDE_H
+#define FIRSTINCLUDE_H
+
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64           /* large file support */
+#endif
+#define _BSD_SOURCE                    /* for snprintf */
+#define _POSIX_SOURCE                  /* for lots of stuff */
+#define _POSIX_C_SOURCE 199309L
+#include <features.h>
+
+/* indicate what the directory separator character is for this OS */
+#define OS_SEPARATOR '/'
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "config.h"
+
+/* declare "don't break me" flag for win32 compatibility */
+#define O_BINARY 0
+
+#endif
+
diff --git a/src/include/darwin/firstinclude.h b/src/include/darwin/firstinclude.h
new file mode 100644 (file)
index 0000000..4c8d7b7
--- /dev/null
@@ -0,0 +1,28 @@
+/* darwin/firstinclude.h defines feature macros to allow us to use the
+ * functions we want (primarily POSIX, but a few other bits and pieces
+ * too) on mac OS X and darwin
+ *
+ * written nml 2004-07-07
+ *
+ */
+
+#ifndef FIRSTINCLUDE_H
+#define FIRSTINCLUDE_H
+
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64           /* large file support */
+#endif
+
+/* indicate what the directory separator character is for this OS */
+#define OS_SEPARATOR '/'
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "config.h"
+
+/* declare "don't break me" flag for win32 compatibility */
+#define O_BINARY 0
+
+#endif
+
diff --git a/src/include/def.h b/src/include/def.h
new file mode 100644 (file)
index 0000000..2cf7517
--- /dev/null
@@ -0,0 +1,95 @@
+/* def.h defines constants to control the operation of the search
+ * engine
+ *
+ * originally by Hugh Williams
+ *
+ */
+
+#ifndef DEF_H
+#define DEF_H
+
+#include "index.h"   /* needed for constants from interface */
+
+/* general options */
+
+/* whether to produce a core file when things start to go wrong (useful for
+ * debugging, obviously not for production systems) */
+#ifndef CRASH
+#define CRASH 1
+#endif
+
+/* whether to perform expensive debugging checks (define to 0 to turn off) */
+#ifdef NDEBUG
+#define DEAR_DEBUG 0
+#else
+#ifndef DEAR_DEBUG
+#define DEAR_DEBUG 1
+#endif
+#endif
+
+/* how far to look ahead to verify SGML tags and comments */
+#define LOOKAHEAD 999
+
+/* whether to case fold or not */
+#define CASE_FOLDING 
+
+/* maximum length of a word */
+#define TERMLEN_MAX 1024
+#define TERMLEN_DEFAULT 49
+
+/* number of bytes in a punchcard */
+#define PUNCHCARD_SIZE (80 * 12)
+
+/* maximum plausible number of computers in a cluster */
+#define IBM_CLUSTER_SIZE 5
+
+/* maximum amount of memory anyone could possible need */
+#define GATES_MEM_MAX (640 * 1024)
+
+/* filename extensions */
+#define INDSUF "index"         /* index file extension name */
+#define REPOSSUF "repos"       /* repository file extension name */
+#define VECTORSUF "v"          /* vector file extension name */
+#define DOCMAPSUF "map"        /* map file extension name */
+#define VOCABSUF "vocab"       /* vocabulary file extension name */
+#define PARAMSUF "param"       /* parameters file extension name */
+
+/* prompt for query interface */
+#define PROMPT "> "
+
+/* General constants */
+#define QUERYBUF       2000      /* Size of Query Buffer */
+#define QUERY_WORDS 20        /* default maximum number of words read from 
+                               * query */
+
+/* whether to spit out timings of build */
+#undef TIME_BUILD
+
+/* pyramid_width controls number of temporary files during build */
+#define PYRAMID_WIDTH 50
+
+/* default memory constants */
+#define TABLESIZE (1024 * 1024)            /* size of postings hashtable */
+#define DUMP_BUFFER (1024 * 1024)          /* how much to buffer for dumps */
+#define PARSE_BUFFER (1024 * 1024)         /* how much to use for parsing */
+#define MERGE_BUFFER (1024 * 1024)         /* how much to use for merging */
+#define ACCUMULATOR_LIMIT (20000)          /* how many document accumulators to 
+                                              allow */
+#define MEMORY_DEFAULT (10 * 1024 * 1024)  /* how much memory to consume by 
+                                            * default */
+
+/* memory constants for 'big-and-fast' operation */
+#define BIG_TABLESIZE (8 * 1024 * 1024)
+#define BIG_PARSE_BUFFER (10 * 1024 * 1024)
+#define BIG_MEMORY_DEFAULT (200 * 1024 * 1024)
+
+/* how big term vectors are initially */
+#define INITVECLEN 8
+
+/* minimum ratio of the accumulator limit to perform thresholding for.  Note
+ * that search may not work correctly unless this value is significantly 
+ * smaller than 0.5 */
+#define SEARCH_SAMPLES_MIN 0.05  /* 5% */
+
+#endif
+
diff --git a/src/include/docmap.h b/src/include/docmap.h
new file mode 100755 (executable)
index 0000000..f9b6d99
--- /dev/null
@@ -0,0 +1,318 @@
+/* docmument map interface.  The docmap holds all per-document data, 
+ * including document sizes, locations, word/byte counts and identifiers.
+ *
+ * written wew 2004-09-24
+ *
+ */
+
+#ifndef DOCMAP_H
+#define DOCMAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mime.h"
+
+struct freemap;
+struct fdset;
+
+enum docmap_ret {
+    DOCMAP_OK = 0,
+    DOCMAP_MEM_ERROR = -1,      /* out of memory */
+    DOCMAP_IO_ERROR = -2,       /* I/O error */
+    DOCMAP_BUFSIZE_ERROR = -3,  /* provided buffer too small */
+    DOCMAP_FMT_ERROR = -4,      /* internal format error */
+    DOCMAP_ARG_ERROR = -5       /* provided argument was incorrect */
+};
+
+enum docmap_flag {
+    DOCMAP_NO_FLAGS = 0,
+    DOCMAP_COMPRESSED = (1 << 0)  /* doc src stored compressed in repos */
+};
+
+enum docmap_cache {
+    DOCMAP_CACHE_NOTHING = 0,
+    DOCMAP_CACHE_LOCATION = (1 << 1),
+    DOCMAP_CACHE_WORDS = (1 << 2),
+    DOCMAP_CACHE_DISTINCT_WORDS = (1 << 3),
+    DOCMAP_CACHE_WEIGHT = (1 << 4),
+    DOCMAP_CACHE_TRECNO = (1 << 5)
+};
+
+struct docmap;
+
+/*
+ *  Create a new, empty docmap.
+ *
+ *  Returns the new docmap or NULL on error.  The status code is set in
+ *  RET.  PAGES is the number of docmap pages to hold in memory.  MAX_FILESIZE
+ *  governs how often the docmap starts a new file (in bytes).  CACHE 
+ *  determines  what quantities are held in-memory by the docmap 
+ *  (can be changed later using docmap_cache())
+ *
+ *  Status values:
+ *
+ *  DOCMAP_OK         - new docmap created ok
+ *  DOCMAP_MEM_ERROR  - out of memory.
+ */
+struct docmap *docmap_new(struct fdset *fdset, 
+  int fd_type, unsigned int pagesize, unsigned int pages, 
+  unsigned long int max_filesize, enum docmap_cache cache, 
+  enum docmap_ret *ret);
+
+/*
+ *  Load a docmap.
+ *
+ *  Arguments are identical to those for docmap_new() 
+ *  Returns the loaded docmap or NULL on error.  The status code is set in
+ *  RET.
+ *
+ *  Status values:
+ *
+ *  DOCMAP_OK          - new docmap loaded ok
+ *  DOCMAP_MEM_ERROR   - out of memory
+ *  DOCMAP_IO_ERROR    - error reading off disk
+ *  DOCMAP_FMT_ERROR   - error in the on-disk format
+ */
+struct docmap *docmap_load(struct fdset *fdset, 
+  int fd_type, unsigned int pagesize, unsigned int pages, 
+  unsigned long int max_filesize, enum docmap_cache cache, 
+  enum docmap_ret *ret);
+
+/*
+ *  Save the docmap to disk.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK        - save successfully
+ *  DOCMAP_MEM_ERROR - error allocating internal memory
+ *  DOCMAP_IO_ERROR  - error writing to disk
+ */
+enum docmap_ret docmap_save(struct docmap *docmap);
+
+/*
+ *  Delete a docmap.
+ */
+void docmap_delete(struct docmap *docmap);
+
+/*
+ *  Add a document to the docmap.
+ *
+ *  DOC_INFO specifies the document to add.  The docmap will set 
+ *  DOCNO to the new document number; the passed-in value
+ *  is ignored.  TRECNO_LEN specifies the length of the TRECNO entry
+ *  (NUL-termination is ignored)
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - new document added
+ *  DOCMAP_MEM_ERROR  - out of memory
+ *  DOCMAP_IO_ERROR   - I/O error loading or flushing buffers 
+ *  DOCMAP_FMT_ERROR  - format error with loaded buffer.
+ */
+enum docmap_ret docmap_add(struct docmap *docmap, 
+  unsigned int sourcefile, off_t offset, 
+  unsigned int bytes, enum docmap_flag flags, 
+  unsigned int words, unsigned int distinct_words,
+  float weight, const char *trecno, unsigned trecno_len, 
+  enum mime_types type, unsigned long int *docno);
+
+/*
+ *  Get the TREC document number for a document.
+ *
+ *  DOCNO is the document number to retrieve.  It must be less than
+ *  the current number of documents.
+ *
+ *  TRECNO_BUF must be an allocated buffer of length TRECNO_BUF_LEN.  The
+ *  length of the DOCNO, even if it is truncated by insufficient space, is
+ *  set in TRECNO_LEN.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK            - auxiliary retrieved ok
+ *  DOCMAP_MEM_ERROR     - error allocating memory internally
+ *  DOCMAP_FMT_ERROR     - internal format error
+ *  DOCMAP_IO_ERROR      - error reading info from disk
+ */
+enum docmap_ret docmap_get_trecno(struct docmap *docmap, 
+  unsigned long int docno, char *trecno_buf, unsigned trecno_buf_len, 
+  unsigned *trecno_len);
+
+/*
+ *  Get the location information for a document.
+ *
+ *  DOCNO must be less than the number of documents.
+ *  The required information is written out into SOURCEFILE, OFFSET,
+ *  BYTES, and TYPE.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK           - location information retrieved ok.
+ *  DOCMAP_MEM_ERROR    - error allocating memory internally
+ *  DOCMAP_FMT_ERROR    - error in on-disk format
+ *  DOCMAP_IO_ERROR     - error reading info from disk
+ */
+enum docmap_ret docmap_get_location(struct docmap *docmap,
+  unsigned long int docno, unsigned int *sourcefile, 
+  off_t *offset, unsigned int *bytes, enum mime_types *type,
+  enum docmap_flag *flags);
+
+/*
+ *  Get the number of bytes for a document.
+ *
+ *  DOCNO must be less than the number of documents.
+ *  The required information is written out into BYTES.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK        - byte information retrieved ok.
+ *  DOCMAP_MEM_ERROR    - error allocating memory internally
+ *  DOCMAP_FMT_ERROR    - error in on-disk format
+ *  DOCMAP_IO_ERROR     - error reading info from disk
+ */
+enum docmap_ret docmap_get_bytes(struct docmap *docmap,
+  unsigned long int docno, unsigned int *bytes);
+
+/*
+ *  Get the number of words for a document.
+ *
+ *  DOCNO must be less than the number of documents.
+ *  The required information is written out into BYTES.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - word information retrieved ok.
+ *  DOCMAP_MEM_ERROR  - error allocating memory internally
+ *  DOCMAP_FMT_ERROR  - error in on-disk format
+ *  DOCMAP_IO_ERROR   - error reading info from disk
+ */
+enum docmap_ret docmap_get_words(struct docmap *docmap,
+  unsigned long int docno, unsigned int *words);
+
+/*
+ *  Get the number of distinct words for a document.
+ *
+ *  DOCNO must be less than the number of documents.
+ *  The required information is written out into BYTES.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - distinct word information retrieved ok.
+ *  DOCMAP_MEM_ERROR  - error allocating memory internally
+ *  DOCMAP_FMT_ERROR  - error in on-disk format
+ *  DOCMAP_IO_ERROR   - error reading info from disk
+ */
+enum docmap_ret docmap_get_distinct_words(struct docmap *docmap,
+  unsigned long int docno, unsigned int *distinct_words);
+
+/*
+ *  Get the weight of a document.
+ *
+ *  DOCNO must be less than the number of documents.
+ *  The required information is written out into BYTES.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - weight information retrieved ok.
+ *  DOCMAP_MEM_ERROR  - error allocating memory internally
+ *  DOCMAP_FMT_ERROR  - error in on-disk format
+ *  DOCMAP_IO_ERROR   - error reading info from disk
+ */
+enum docmap_ret docmap_get_weight(struct docmap *docmap,
+  unsigned long int docno, double *weight);
+
+/*
+ *  Get the average number of bytes per document.
+ *
+ *  The required information is written out into AVG_BYTES.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - information retrieved ok.
+ *  DOCMAP_MEM_ERROR  - error allocating memory internally
+ *  DOCMAP_FMT_ERROR  - error in on-disk format
+ *  DOCMAP_IO_ERROR   - error reading info from disk
+ */
+enum docmap_ret docmap_avg_bytes(struct docmap *docmap, double *avg_bytes);
+
+/*
+ *  Get the total number of bytes for all documents.
+ *
+ *  The required information is written out into TOTAL_BYTES.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - information retrieved ok.
+ *  DOCMAP_MEM_ERROR  - error allocating memory internally
+ *  DOCMAP_FMT_ERROR  - error in on-disk format
+ *  DOCMAP_IO_ERROR   - error reading info from disk
+ */
+enum docmap_ret docmap_total_bytes(struct docmap *docmap, double *total_bytes);
+
+/*
+ *  Get the average weight of each document.  Note that, unlike the other
+ *  average functions, docmap_avg_weight requires that the weights be held in
+ *  cache by the docmap, else DOCMAP_ARG_ERROR is returned.
+ *
+ *  The required information is written out into AVG_WEIGHT.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - information retrieved ok.
+ *  DOCMAP_MEM_ERROR  - error allocating memory internally
+ *  DOCMAP_FMT_ERROR  - error in on-disk format
+ *  DOCMAP_IO_ERROR   - error reading info from disk
+ *  DOCMAP_ARG_ERROR  - weights not held in cache
+ */
+enum docmap_ret docmap_avg_weight(struct docmap *docmap, double *avg_weight);
+
+/*
+ *  Get the average number of words per document.
+ *
+ *  The required information is written out into AVG_WORDS.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - information retrieved ok.
+ *  DOCMAP_MEM_ERROR  - error allocating memory internally
+ *  DOCMAP_FMT_ERROR  - error in on-disk format
+ *  DOCMAP_IO_ERROR   - error reading info from disk
+ */
+enum docmap_ret docmap_avg_words(struct docmap *docmap, double *avg_words);
+
+/*
+ *  Get the average number of distinct words per document.
+ *
+ *  The required information is written out into AVG_DISTINCT_WORDS.
+ *
+ *  Return values:
+ *
+ *  DOCMAP_OK         - information retrieved ok.
+ *  DOCMAP_MEM_ERROR  - error allocating memory internally
+ *  DOCMAP_FMT_ERROR  - error in on-disk format
+ *  DOCMAP_IO_ERROR   - error reading info from disk
+ */
+enum docmap_ret docmap_avg_distinct_words(struct docmap *docmap,
+  double *avg_distinct_words);
+
+/* Get the number of documents in the docmap */
+unsigned long int docmap_entries(struct docmap *docmap);
+
+/* Get a string described a docmap error code. */
+const char *docmap_strerror(enum docmap_ret nd_ret);
+
+/* find out what values are currently cached by the docmap */
+enum docmap_cache docmap_get_cache(struct docmap *docmap);
+
+/* set the values for the docmap to cache (this may cause the docmap to read 
+ * all values from disk) */
+enum docmap_ret docmap_cache(struct docmap *docmap, 
+  enum docmap_cache cache);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/error.h b/src/include/error.h
new file mode 100644 (file)
index 0000000..0edc61e
--- /dev/null
@@ -0,0 +1,113 @@
+/* error.h declares macros and other facilities for error logging
+ *
+ * written wew 2004-06-07
+ *
+ */
+
+#ifndef ERROR_H
+#define ERROR_H
+
+#include <stdio.h>
+
+/* Variadic macros from C99 */
+/*
+#define ERROR(format, ...) \
+  error_loc(-1, __func__, __FILE__, __LINE__, format, ##__VA_ARGS__)
+
+#define ERROR_CODE(code, format, ...) \
+  error_loc(code, __func__, __FILE__, __LINE__, format, ##__VA_ARGS__)
+  */
+
+/* C99 provides __func__ as the name of the current function.
+   Before this, GCC had the extension __FUNCTION__.   Otherwise,
+   we don't attempt to determine it. */
+#if __STDC_VERSION__ >= 199901L
+   #define FUNC_NAME __func__
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
+   #define FUNC_NAME __FUNCTION__
+#else
+   #define FUNC_NAME "(unknown function)"
+#endif
+
+/* What C89 provides */
+#define ERROR(format) \
+  error_loc(-1, FUNC_NAME, __FILE__, __LINE__, format)
+
+#define ERROR_CODE(code, format) \
+  error_loc(code, FUNC_NAME, __FILE__, __LINE__, format)
+
+#define ERROR1(format, arg1) \
+  error_loc(-1, FUNC_NAME, __FILE__, __LINE__, format, arg1)
+
+#define ERROR_CODE1(code, format, arg1) \
+  error_loc(code, FUNC_NAME, __FILE__, __LINE__, format, arg1)
+
+#define ERROR2(format, arg1, arg2) \
+  error_loc(-1, FUNC_NAME, __FILE__, __LINE__, format, arg1, arg2)
+
+#define ERROR_CODE2(code, format, arg1, arg2) \
+  error_loc(code, FUNC_NAME, __FILE__, __LINE__, format, arg1, arg2)
+
+#define ERROR3(format, arg1, arg2, arg3) \
+  error_loc(-1, FUNC_NAME, __FILE__, __LINE__, format, arg1, arg2, arg3)
+
+#define ERROR_CODE3(code, format, arg1, arg2, arg3) \
+  error_loc(code, FUNC_NAME, __FILE__, __LINE__, format, arg1, arg2, arg3)
+
+#define ERROR4(format, arg1, arg2, arg3, arg4) \
+  error_loc(-1, FUNC_NAME, __FILE__, __LINE__, format, arg1, arg2, arg3, arg4)
+
+#define ERROR_CODE4(code, format, arg1, arg2, arg3) \
+  error_loc(code, FUNC_NAME, __FILE__, __LINE__, format, arg1, arg2, arg3, arg4)
+
+/*
+ *  Is there an error to report?.
+ */
+int error_has_msg();
+
+/*
+ *  Get the last error message as set by error_loc()/ERROR().
+ */
+const char * error_last_msg();
+
+/*
+ *  Get the last error code as set by error_loc()/ERROR().
+ */
+int error_last_code();
+
+/*
+ *  Set the stream that errors are logged to.
+ *
+ *  Setting to NULL stops errors being logged.
+ *
+ *  By default, errors are not logged, unless the LOGERRORS 
+ *  macros is defined at compile time, in which case they go
+ *  to stderr.
+ */
+void error_set_log_stream(FILE * stream);
+
+/*
+ *  Record an error message.
+ *
+ *  The error message will have the form 
+ *  "ERROR: <func> (<file>::<line>): <msg> [(system error is "<syserr>")].
+ *  This message is retrievable by error_last_msg().  It will also be
+ *  logged to the stream set by error_set_stream() (unless this is
+ *  NULL).
+ *
+ *  This function is most conveniently called via the ERROR macro.
+ *
+ *  @param code the code for this error.
+ *  @param func the name of the function this error occurs in.
+ *  @param file the name of the file this error occurs in.
+ *  @param line the line of this file for this error message.
+ *  @param fmt user-defined format.  It is not necessary to precede
+ *    it with "ERROR", or put a trailing newline.
+ *
+ *  @return the error code, for convenience.
+ */
+int error_loc(int code, const char * func, const char * file, int line,
+  const char * fmt, ...);
+
+#endif
+
diff --git a/src/include/fdset.h b/src/include/fdset.h
new file mode 100644 (file)
index 0000000..015404a
--- /dev/null
@@ -0,0 +1,154 @@
+/* fdset.h manages a set of file descriptions, allowing a maximum
+ * number of them to be open at one time, whilst not requiring that
+ * they all be open at once.  It attempts to minimise the number of times that
+ * file descriptors are re-opened by caching them internally.  
+ * It draws a distinction between different types of file descriptors, 
+ * which allows in the search engine domain to have seperate numbering for 
+ * repository and index file descriptors
+ *
+ * written nml 2004-02-13
+ *
+ */
+
+#ifndef FDSET_H
+#define FDSET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>  /* for whence values */
+#include <sys/types.h>  /* for off_t */
+
+enum {
+    FDSET_OK = 0
+};
+
+struct fdset;
+
+/* FIXME: security of file creation */
+
+/* create a new fdset.  umask is used as the creation mask for any fds that need
+ * to be created.  sizehint is a hint as to how many file descriptors will be
+ * open. */
+struct fdset *fdset_new(int umask, unsigned int sizehint);
+
+/* delete an fdset object */
+void fdset_delete(struct fdset *set);
+
+/* set a general prefix for the type, which will be used with the
+ * fileno to generate a default filename (used when no name set with
+ * set_fd_name is present).  Returns FDSET_OK on success or -errno on 
+ * failure. */
+int fdset_set_type_name(struct fdset *set, unsigned int type, 
+  const char *name, unsigned int namelen, int write);
+
+/* create a new type, assigning it a name made up of "basename" and
+   "suffix".  The number of the new type is returned in "type".  
+   Returns FDSET_OK on success, -errno on failure. */
+int fdset_create_new_type(struct fdset *set, const char *basename,
+  const char *suffix, int write, unsigned int *typeno);
+
+/* set the name of a specific file in the file set, which will be used
+ * to open the fd if required.  Write indicates whether the file will
+ * be opened for writing or not (they're always opened for reading).  Returns
+ * FDSET_OK on success and -errno on failure. */
+int fdset_set_fd_name(struct fdset *set, unsigned int type, unsigned int fileno,
+  const char *name, unsigned int namelen, int write);
+
+/* create a new file.  The file must not currently exist.  Returns the
+ * file descriptor on success, or -errno on failure.  */
+int fdset_create(struct fdset *set, unsigned int type, unsigned int fileno);
+
+/* as above, but also seek to an offset.  */
+int fdset_create_seek(struct fdset *set, unsigned int type, unsigned int fileno,
+  off_t offset);
+
+/* get an fd from the fdset specified by type and fileno.  Returns an open fd
+ * or -errno on failure.  offset is where the fd should be seeked to upon
+ * opening (has to be done, otherwise fd could be at a random location) and
+ * whence is the usual seek flag indicating what offset is relative to.  Pass
+ * offset 0 and whence SEEK_CUR to disable seeking.  The file must already
+ * exist (see fdset_create above for how to make one). */
+int fdset_pin(struct fdset *set, unsigned int type, unsigned int fileno, 
+  off_t offset, int whence);
+
+/* allow an fd allocated by pinfd to be reused for a different file
+ * (note that its important that you use this call after calling
+ * pinfd).  Returns FDSET_OK on success and -errno on failure. */
+int fdset_unpin(struct fdset *set, unsigned int type, unsigned int fileno, 
+  int fd);
+
+/* close an fd (any fd) so that another module can open one.  Returns FDSET_OK
+ * on success and -errno on failure. */
+int fdset_close(struct fdset *set);
+
+/* write the name of an fd into the provided buffer.  Writes as much as it can
+ * into buffer (which is of length buflen) and writes how long the name should
+ * be into len.  Returns FDSET_OK on success and -errno on failure. */
+int fdset_name(struct fdset *set, unsigned int type, unsigned int fileno, 
+  char *buffer, unsigned int buflen, unsigned int *len, int *write);
+
+/* same as fdset_name, except that it returns the type template name */
+int fdset_type_name(struct fdset *set, unsigned int type, 
+  char *buffer, unsigned int buflen, unsigned int *len, int *write);
+
+/* returns the number of open fds */
+unsigned int fdset_opened(struct fdset *set);
+
+/* returns the number of pinned fds */
+unsigned int fdset_pinned(struct fdset *set);
+
+/* returns FDSET_OK and writes whether this particular name (identified by type,
+ * fileno) is specifically set (via set_fd_name) into *set on success */
+int fdset_isset(struct fdset *set, unsigned int type, unsigned int fileno, 
+  int *isset);
+
+/* return number of types currently in the fdset */
+unsigned int fdset_types(struct fdset *set);
+
+/* close all fds for a specified file.  Returns FDSET_OK upon success.
+ * Will fail if pinned fds exist for this file. */
+int fdset_close_file(struct fdset *set, unsigned int type, unsigned int fileno);
+
+/* unlink the specified file.  This needs to happen through the fdset so that
+ * the fd cache is cleared of open files for this file.  Returns FDSET_OK upon 
+ * success.  Will fail if the specified file isn't writable, or if pinned fds
+ * exist for this file. */
+int fdset_unlink(struct fdset *set, unsigned int type, unsigned int fileno);
+
+/* debugging code. */
+
+int fdset_debug_create(struct fdset *set, unsigned int typeno, 
+  unsigned int fileno, const char * src_file, int src_line);
+
+int fdset_debug_create_seek(struct fdset *set, unsigned int type, 
+  unsigned int fileno, off_t offset, const char * src_file,
+  int src_line);
+
+int fdset_debug_pin(struct fdset *set, unsigned int type, unsigned int fileno, 
+  off_t offset, int whence, const char * src_file, int src_line);
+
+int fdset_debug_unpin(struct fdset *set, unsigned int type, 
+  unsigned int fileno, int fd, const char * src_file, int src_line);
+
+/* 
+#define fdset_create(set, type, fileno) \
+   fdset_debug_create(set, type, fileno, __FILE__, __LINE__)
+
+#define fdset_create_seek(set, type, fileno, offset) \
+   fdset_debug_create_seek(set, type, fileno, offset, __FILE__, __LINE__)
+
+#define fdset_pin(set, type, fileno, offset, whence) \
+   fdset_debug_pin(set, type, fileno, offset, whence, __FILE__, __LINE__)
+
+#define fdset_unpin(set, type, fileno, fd) \
+   fdset_debug_unpin(set, type, fileno, fd, __FILE__, __LINE__)
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/freebsd/firstinclude.h b/src/include/freebsd/firstinclude.h
new file mode 100644 (file)
index 0000000..0c82dcb
--- /dev/null
@@ -0,0 +1,28 @@
+/* freebsd/firstinclude.h defines feature macros to allow us to use the
+ * functions we want (primarily POSIX, but a few other bits and pieces
+ * too) on freebsd
+ *
+ * written nml 2003-04-24
+ *
+ */
+
+#ifndef FIRSTINCLUDE_H
+#define FIRSTINCLUDE_H
+
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64           /* large file support */
+#endif
+
+/* indicate what the directory separator character is for this OS */
+#define OS_SEPARATOR '/'
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "config.h"
+
+/* declare "don't break me" flag for win32 compatibility */
+#define O_BINARY 0
+
+#endif
+
diff --git a/src/include/freemap.h b/src/include/freemap.h
new file mode 100644 (file)
index 0000000..6c9ecaf
--- /dev/null
@@ -0,0 +1,116 @@
+/* freemap.h declares an interface to a structure that manages free
+ * space.  
+ *
+ * This interface assumes that the need for space outstrips the word length 
+ * of the current architecture, thus pointers to files are represented by 
+ * [fileno,offset] pairs.
+ *
+ * written nml 2003-04-28
+ *
+ */
+
+#ifndef FREEMAP_H
+#define FREEMAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum freemap_strategies {
+    FREEMAP_STRATEGY_FIRST,       /* first fit */
+    FREEMAP_STRATEGY_BEST,        /* best fit */
+    FREEMAP_STRATEGY_WORST,       /* worst fit */
+    FREEMAP_STRATEGY_CLOSE        /* close fit, choose via size-lists */
+};
+
+struct freemap;
+
+/* create a new, empty freemap.  append is how much space we're allowed to
+ * append to entries in order to keep the number of entries down */
+struct freemap *freemap_new(enum freemap_strategies strategy, 
+  unsigned int append, void *opaque, 
+  int (*addfile)(void *opaque, unsigned int file, unsigned int *maxsize));
+
+/* delete the freemap */
+void freemap_delete(struct freemap *map);
+
+enum {
+    FREEMAP_OPT_NONE = 0,                      /* no options */
+    FREEMAP_OPT_EXACT = (1 << 1),              /* don't overallocate */
+    FREEMAP_OPT_LOCATION = (1 << 2)            /* allocate at location
+                                                * (given as unsigned int, 
+                                                * unsigned long int arguments) 
+                                                * or fail */
+};
+/* allocate size bytes of memory.  fileno and offset are written into
+ * parameters on success (true is returned).  Size is read from the size
+ * parameter, and then the total space allocated is written into it.
+ * On failure 0 is returned.  If exact is true then size will always be
+ * unchanged, otherwise the freemap is free to overallocate slightly to suit
+ * itself.  Note that if the structure doesn't have space to
+ * allocate requested space, zero is returned but _err is not set. */
+int freemap_malloc(struct freemap *fm, unsigned int *fileno, 
+  unsigned long int *offset, unsigned int *size, int options, ...);
+
+/* return some memory to the freemap */
+int freemap_free(struct freemap *fm, unsigned int fileno, 
+  unsigned long int offset, unsigned int size);
+
+/* waste some memory (don't do this!), removing it from the freemap 
+ * permanently (freemap keeps stats about this though) */
+int freemap_waste(struct freemap *fm, unsigned int fileno, 
+  unsigned long int offset, unsigned int size);
+/* XXX: should probably be folded into freemap_free as option */
+
+/* change the size of a previously allocated section of memory to greater than
+ * or equal to size + additional.
+ * Unlike realloc(3), there is no NULL pointer and so the previous
+ * memory must have been allocated by _malloc.  Also, because the
+ * freemap doesn't access disk, it doesn't know how move the contents
+ * of a previous allocation to a new location, so it will fail if it
+ * can't grow the current allocation.  On success, the additional amount of 
+ * space allocated is returned (0 on failure) */
+unsigned int freemap_realloc(struct freemap *fm, unsigned int fileno, 
+  unsigned long int offset, unsigned int size, unsigned int additional, 
+  int options, ...);
+/* FIXME: additional should be an int */
+
+/* last error that occurred with the freemap */
+int freemap_err(const struct freemap *fm);
+
+/* get the utilisation of the freemap, as a percentage [0.0, 1.0] */
+double freemap_utilisation(const struct freemap *fm);
+
+/* get the total amount of space managed by the freemap */
+double freemap_space(const struct freemap *fm);
+
+/* get the total amount of space wasted */
+double freemap_wasted(const struct freemap *fm);
+
+/* return the number of entries in the freemap */
+unsigned int freemap_entries(const struct freemap *fm);
+
+/* return the maximum amount that the freemap will append onto an entry */
+unsigned int freemap_append(const struct freemap *fm);
+
+/* checks that the freemap is internally consistent */
+int freemap_consistent(const struct freemap *fm);
+
+/* return the number of freemap entries in the index */
+unsigned int freemap_indexed_entries(const struct freemap *fm);
+
+/* return the strategy that this freemap is using. */
+enum freemap_strategies freemap_strategy(const struct freemap *fm);
+
+#include <stdio.h>
+
+/* print the map to a stream for debugging purposes */
+void freemap_print(const struct freemap *fm, FILE *output);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/getlongopt.h b/src/include/getlongopt.h
new file mode 100644 (file)
index 0000000..b222237
--- /dev/null
@@ -0,0 +1,78 @@
+/* getlongopt.h attempts to emulate (but without some of the
+ * stupidity) the GNU getopt_long library to portably allow the
+ * parsing of long and short options.  Because getlongopt provides the ability
+ * to provide optional arguments, this means that parsing of command lines is
+ * somewhat ambiguous: '--option-with-optional-arg -f' could be interpreted as 
+ * two options or an option with an argument (of '-f').  This conflict is solved
+ * by checking whether the next argument can be parsed as an option.  If it can
+ * be, its assumed to be an option, otherwise its assumed to be an argument.
+ *
+ * written nml 2003-04-11
+ *
+ */
+
+#ifndef GETLONGOPT_H
+#define GETLONGOPT_H
+
+enum getlongopt_ret {
+    GETLONGOPT_OK = 0,              /* everything went fine, value returned */
+    GETLONGOPT_END = 1,             /* ran out of options */
+    GETLONGOPT_UNKNOWN = -1,        /* parsed an unknown option */
+    GETLONGOPT_MISSING_ARG = -2,    /* option has a missing argument */
+    GETLONGOPT_ERR = -3             /* unexpected error occurred */
+};
+
+/* possible values for argument in getlongopt_opt */
+enum getlongopt_arg {
+    GETLONGOPT_ARG_NONE = 0,        /* no argument can be provided */
+    GETLONGOPT_ARG_REQUIRED = 1,    /* an argument must be provided */
+    GETLONGOPT_ARG_OPTIONAL = 2     /* an argument may be provided */
+};
+
+struct getlongopt_opt {
+    const char *longname;           /* long option name (i.e. 'help').  Can be 
+                                     * NULL if this option doesn't have a
+                                     * long name. */
+    char shortname;                 /* short option name (i.e. h).  Can be \0 
+                                     * if this option doesn't have a short 
+                                       name. */
+    enum getlongopt_arg argument;   /* a value from above enum indicating 
+                                     * whether this option takes an argument, 
+                                     * and whether its optional */
+    int id;                         /* identifying value returned when this 
+                                     * option is parsed */
+};
+
+struct getlongopt;
+
+/* create a new option parser that will parse at most argc strings
+ * from argv.  optstrings options from the optstring array will be
+ * recognised as options.  Returns NULL on failure (including passing
+ * the wrong thing as argument value).  Don't change any
+ * of the stuff pointed to by argv or optstring until after calling
+ * getlongopt_delete or the results are undefined (and almost certainly bad). 
+ * Note that the first element in argv is NOT skipped over as in historical
+ * getopt and getopt_long, (so you probably want to pass argc - 1, &argv[1] as
+ * argc and argv in the simple case) */
+struct getlongopt *getlongopt_new(unsigned int argc, 
+  const char **argv, struct getlongopt_opt *optstring, 
+  unsigned int optstrings);
+
+/* delete a getlongopt structure */
+void getlongopt_delete(struct getlongopt *opts);
+
+/* get the next option from the option set.  Returns GETLONGOPT_OK on
+ * success, and writes optid with the id of the parsed option, and optarg
+ * with a pointer to the option or NULL if no option was given.
+ * Returns GETLONGOPT_END if there are no more options to get.
+ * Returns GETLONGOPT_UNKNOWN if it parses an unknown option.
+ * Returns GETLONGOPT_MISSING_ARG if it parses an option that requires
+ * an argument but that doesn't have one. */
+int getlongopt(struct getlongopt *opts, int *optid, const char **optarg);
+
+/* returns the current parsing index, works the same as optind in
+ * traditional getopt */
+unsigned int getlongopt_optind(struct getlongopt *opts);
+
+#endif
+
diff --git a/src/include/getmaxfsize.h b/src/include/getmaxfsize.h
new file mode 100644 (file)
index 0000000..fca8ec9
--- /dev/null
@@ -0,0 +1,30 @@
+/* getmaxfsize.h is a work-around for the problem that we can't determine
+ * how large files can be under unix.  They seem to have this notion
+ * that filesystems will provide large enough files that no-one will
+ * care, even though history and the existance of this file seem to
+ * prove them wrong
+ *
+ * written nml 2003-02-23
+ *
+ */
+
+#ifndef GETMAXFS_H
+#define GETMAXFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* accepts an open file descriptor fd and an upper limit knownlimit
+ * (which could be acquired through getrlimit(2)).  On success it
+ * returns true and writes the upper limit to which the file descriptor can be 
+ * extended, or UINT_MAX if no limit was found, into limit. (note that this
+ * means read_only fds can't be extended) */
+int getmaxfsize(int fd, unsigned int knownlimit, unsigned int *limit);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/heap.h b/src/include/heap.h
new file mode 100644 (file)
index 0000000..00cbb56
--- /dev/null
@@ -0,0 +1,75 @@
+/* heap.h declares some implicit minheap functions and a partial sorting 
+ * function that uses the classic heapsort to work its magic :o)
+ *
+ * written nml 2003-06-03
+ *
+ */
+
+#ifndef HEAP_H
+#define HEAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* heap sort sorts the given array (array can be in any order).  base is a 
+ * pointer to the start of the
+ * array, nmemb is the number of elements in the array, sort is the number of
+ * elements in the array that you would like sorted [0, nmemb], 
+ * size is the size of each individual element (shouldn't be 0), and compar is 
+ * a comparison function for elements.  After execution, the top sort elements 
+ * of the array will be in sorted order, and will be smaller than the rest of 
+ * the elements. */
+void heap_sort(void *base, unsigned int nmemb, unsigned int sort, 
+  unsigned int size, int (*compar)(const void *, const void *));
+
+/* heapify creates an implicit heap from the given array by moving elements
+ * around within the array */
+void heap_heapify(void *base, unsigned int nmemb, unsigned int size, 
+  int (*compar)(const void *, const void *));
+
+/* replace replaces the root (smallest) element of the heap, and then returns
+ * the new position of element within the heap.  Old root is copied into 
+ * element */
+void *heap_replace(void *base, unsigned int nmemb, unsigned int size,
+  int (*compar)(const void *, const void *), void *element);
+
+/* returns a pointer to the smallest element in the heap */
+void *heap_peek(void *base, unsigned int nmemb, unsigned int size);
+
+/* remove the smallest element from the heap, placing it at the back of the
+ * array, decrementing *nmemb and returning a pointer to it.  Returns NULL on
+ * failure (which can only happen if *nmemb is 0) */
+void *heap_pop(void *base, unsigned int *nmemb, unsigned int size, 
+  int (*cmp)(const void *one, const void *two));
+
+/* insert inserts element into the heap, growing it by size in the process
+ * (nmemb will be incremented to reflect the new number of elements).  
+ * It is assumed that the array is large enough to hold another element */
+void *heap_insert(void *base, unsigned int *nmemb, unsigned int size,
+  int (*compar)(const void *, const void *), void *element);
+
+/* remove a given element from the heap, shrinking it in the process (nmemb will
+ * be decremented to reflect the new number of elements). */
+void *heap_remove(void *base, unsigned int *nmemb, unsigned int size,
+  int (*compar)(const void *, const void *), void *element);
+
+/* finding an arbitrary element has to be implemented as a linear search along
+ * the array, which you're entirely capable of doing yourself ;o) */
+
+/* returns true if the array has the heap property (max reverses heap condition,
+ * with function returning whether the heap is a maxheap) */
+int heap_isheap(void *base, unsigned int nmemb, unsigned int size,
+  int (*compar)(const void *, const void *), int max);
+
+/* returns true if the array is sorted (max indicates that the array is sorted
+ * in reverse order) */
+int heap_issorted(void *base, unsigned int nmemb, unsigned int size,
+  int (*compar)(const void *, const void *), int max);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/impact.h b/src/include/impact.h
new file mode 100644 (file)
index 0000000..3489c08
--- /dev/null
@@ -0,0 +1,28 @@
+/* Adding impact-ordered querying of inverted lists 
+ *
+ * written jyiannis 2005-01-25
+ *
+ */
+
+#ifndef IMPACT_H
+#define IMPACT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct index;
+struct query;
+struct chash;
+struct alloc;
+
+int impact_ord_eval(struct index *idx, struct query *query, 
+  struct chash *accumulators, unsigned int acc_limit, struct alloc *alloc, 
+  unsigned int mem);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/impact_build.h b/src/include/impact_build.h
new file mode 100644 (file)
index 0000000..95346ab
--- /dev/null
@@ -0,0 +1,40 @@
+/* Adding impact-ordered inverted lists to an index.
+ *
+ * written wew 2005-01-19
+ */
+
+#ifndef IMPACT_BUILD_H
+#define IMPACT_BUILD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "index.h"
+
+#define IMPACT_DEFAULT_PIVOT      0.2
+#define IMPACT_DEFAULT_SLOPE      0.0
+#define IMPACT_DEFAULT_QUANT_BITS 5
+
+enum impact_ret {
+    IMPACT_OK = 0,
+    IMPACT_FMT_ERROR = -1,   /* error with format of input index */
+    IMPACT_IO_ERROR = -2,    /* I/O error */
+    IMPACT_MEM_ERROR = -3,   /* out of memory */
+    IMPACT_OTHER_ERROR = -10 /* some other error */
+};
+
+enum impact_ret impact_order_index(struct index *idx);
+
+double impact_normalise(double impact, double norm_B, double slope, 
+  double max_impact, double min_impact);
+
+unsigned int impact_quantise(double impact, unsigned int quant_bits, 
+  double max_impact, double min_impact);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/index_querybuild.h b/src/include/index_querybuild.h
new file mode 100644 (file)
index 0000000..a5b821f
--- /dev/null
@@ -0,0 +1,69 @@
+/* index_querybuild.h declares a query structure and a function to
+ * construct it from a query string
+ *
+ * written nml 2003-06-02 (moved from index_search.c 2003-09-23)
+ *
+ */
+
+#ifndef INDEX_QUERYBUILD_H
+#define INDEX_QUERYBUILD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "vocab.h"
+
+struct index;
+
+/* struct to hold information about a word being queried for */
+struct term {
+    struct term *next;                    /* linked list of terms */
+    struct vocab_vector vocab;            /* vocab term */
+    char *term;                           /* term text */
+    char *vecmem;                         /* pointer to vector for this word */
+};
+
+/* types of conjunction (in priority order) */
+enum conjunct_type {
+    CONJUNCT_TYPE_EXCLUDE = 0,            /* single word that needs to be 
+                                           * excluded from results */
+    CONJUNCT_TYPE_PHRASE = 1,             /* phrase */
+    CONJUNCT_TYPE_AND = 2,                /* AND */
+    CONJUNCT_TYPE_WORD = 3                /* its just a single word */
+};
+
+/* struct to hold a linked list of conjuct terms for querying */
+struct conjunct {
+    struct term term;                     /* first term */
+    unsigned int terms;                   /* number of terms */
+    unsigned int f_t;                     /* total estimated freq of conjunct */
+    unsigned int F_t;                     /* total estimated occurances of 
+                                           * conjunct */
+    unsigned int f_qt;                    /* its frequency in the query */
+    char *vecmem;                         /* base pointer for vector memory */
+    unsigned int vecsize;                 /* size of vector memory */
+    enum conjunct_type type;              /* type of the conjuct, see enum */
+    unsigned int sloppiness;              /* sloppiness of phrase */
+    unsigned int cutoff;                  /* must find phrase in this number 
+                                           * of words (0 means infinite) */
+};
+
+/* struct to hold a parsed query */
+struct query {
+    unsigned int terms;                   /* number of terms in query */
+    struct conjunct *term;                /* array of terms in query */
+};
+
+/* function to construct a query structure from a given string
+ * (querystr) of length len.  At most maxwords will be read from the query. */ 
+unsigned int index_querybuild(struct index *idx, struct query *query, 
+  const char *querystr, unsigned int len, unsigned int maxwords, 
+  unsigned int maxtermlen, int impact);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/iobtree.h b/src/include/iobtree.h
new file mode 100644 (file)
index 0000000..f896780
--- /dev/null
@@ -0,0 +1,220 @@
+/* ioiobtree.h declares an interface to a btree datastructure that
+ * performs IO internally to the btree using POSIX read/write calls.  This btree
+ * allows both variable length keys and variable length values.
+ *
+ * actually, the btree is a b+ tree, and i haven't implemented
+ * implement utilisation guarantees with deleting, since its not particularly
+ * interesting to me.  See "The Ubiquitous B-tree" by Comer for a survey
+ * of btree techniques.  Datastructures and algorithms textbooks should also
+ * have descriptions of them.
+ *
+ * the current version doesn't handle the extended character set within words
+ * properly while splitting buckets :o(
+ *
+ * written nml 2004-01-06
+ *
+ */
+
+#ifndef IOBTREE_H
+#define IOBTREE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct iobtree;
+struct freemap;
+struct fdset;
+
+/* create a new btree, with page size pagesize (note that this will constrain
+ * the size of the objects you insert into it to be less than a quarter of the
+ * pagesize), with bucket strategies leaf_strategy and node_strategy for leaves
+ * and nodes respectively.  freemap provides space management, with access to
+ * the files through fdset (using fdset_type as the type). */
+struct iobtree *iobtree_new(unsigned int pagesize, int leaf_strategy, 
+  int node_strategy, struct freemap *freemap, struct fdset *fds, 
+  unsigned int fdset_type);
+
+/* load a previously written btree.  All parameters except root_fileno and
+ * root_offset are the same as for iobtree_new, and must be the same as when 
+ * the btree was created.  root_fileno and root_offset specify where the root 
+ * of the btree is on disk.  On load, the entire btree will be read once so 
+ * that it can be removed from the freemap if the freemap is not NULL */
+struct iobtree *iobtree_load(unsigned int pagesize, int leaf_strategy,
+  int node_strategy, struct freemap *freemap, struct fdset *fds, 
+  unsigned int fdset_type, unsigned int root_fileno, 
+  unsigned long int root_offset);
+
+/* load_quick does the same thing as load except it avoids reading the btree 
+ * by not modifying the btree (you have to do this yourself) and by having the
+ * caller supply the number of entries in the btree */
+struct iobtree *iobtree_load_quick(unsigned int pagesize, int leaf_strategy,
+  int node_strategy, struct freemap *freemap, struct fdset *fds, 
+  unsigned int fdset_type, unsigned int root_fileno, 
+  unsigned long int root_offset, unsigned long int entries);
+
+/* delete a btree object.  You probably want to flush it to disk first 
+ * though */
+void iobtree_delete(struct iobtree *iobtree);
+
+/* flush a btree object to disk.  Returns true on success. */
+int iobtree_flush(struct iobtree *iobtree);
+
+/* allocate some space of size size to key term, termlen.  Returns a pointer to
+ * the space if successful.  If unsuccessful, sets *toobig to true if the
+ * requested space is too big to ever fit into the tree.  Keys should be
+ * distinct, the result of inserting a duplicate key is undefined.  NOTE: 
+ * Returned pointer is good until the next call to iobtree, don't use it after 
+ * that. */
+void *iobtree_alloc(struct iobtree *iobtree, const char *term, 
+  unsigned int termlen, unsigned int size, int *toobig);
+
+/* change the amount of space allocated to key term, termlen to newsize (which
+ * can be larger or smaller than original allocation).  Returns a pointer to 
+ * the new space on success, writes *toobig to let you know if the request 
+ * was too big on failure.  The old contents associated with the key is 
+ * preserved as far as is possible (will be truncated for shrinking calls, 
+ * otherwise will be preserved).  This function will return NULL if the key 
+ * cannot be found.  NOTE: returned pointer is good until the next call to 
+ * iobtree */
+void *iobtree_realloc(struct iobtree *iobtree, const char *term, 
+  unsigned int termlen, unsigned int newsize, int *toobig);
+
+/* remove a key term, termlen and entry associated with it from the btree.
+ * Returns true on success. */
+int iobtree_remove(struct iobtree *iobtree, const char *term, 
+  unsigned int termlen);
+
+/* find the entry associated with key term, termlen in the btree.  Returns a
+ * pointer to it and writes its length into veclen on success.  write indicates
+ * whether you are going to change the returned entry, so that the btree can
+ * flush it to disk if necessary.  NOTE: returned pointer is good until the 
+ * next call to iobtree, don't use it after that. */
+void *iobtree_find(struct iobtree *iobtree, const char *term, 
+  unsigned int termlen, int write, unsigned int *veclen);
+
+/* append a new term, of length termlen, to the end of the btree.  
+ * Successive application of this call can be used to bulk-load a btree.  Note 
+ * that it is the caller's responsibility to ensure that the new term is 
+ * lexically the greatest currently in the btree.  Returns a pointer to the 
+ * data area allocated by this call, which is of length veclen, or NULL on
+ * failure. */
+void *iobtree_append(struct iobtree *iobtree, const char *term,
+  unsigned int termlen, unsigned int veclen, int *toobig);
+
+/* iterate over all of the entries in the btree.  Returns each a pointer to 
+ * each term, writing its length, a data pointer and the data length into 
+ * *termlen, *data and *len respectively.  Pointers are only good until next 
+ * call to iobtree.  state must be an array of 3 unsigned ints, which you must
+ * initialise to 0 prior to the first call and then leave alone.  Will return
+ * NULL once no more terms are available. */
+const char *iobtree_next_term(struct iobtree *iobtree, 
+  unsigned int *state, unsigned int *termlen, 
+  void **data, unsigned int *len);
+
+/* new interface stuff */
+
+enum iobtree_ret {
+    IOBTREE_ERR = -1,
+    IOBTREE_EIO = -2,
+    IOBTREE_ENOENT = -3,
+    IOBTREE_ENOMEM = -4,
+    IOBTREE_EINTR = -5,
+    IOBTREE_EAGAIN = -6,
+
+    IOBTREE_OK = 0,
+    IOBTREE_ITER_FINISH = 1
+};
+
+/* read a portion of an entry from the btree.  Up to buflen bytes are read 
+ * from offset within the btree entry into buf.  The total size of the entry 
+ * is written into *veclen on success.  The number of bytes read is written 
+ * into *numread on success */
+enum iobtree_ret iobtree_read(struct iobtree *iobtree, const char *term, 
+  unsigned int termlen, unsigned int *veclen, unsigned int offset, void *buf, 
+  unsigned int buflen, unsigned int *numread);
+
+/* write part of an entry into the btree.  If the entry doesn't exist it 
+ * will be inserted with size offset + buflen.  If the entry exists it will 
+ * be widened if necessary to hold offset + buflen bytes, but will be 
+ * shortened to the larger of offset + buflen bytes and maxveclen bytes */
+enum iobtree_ret iobtree_write(struct iobtree *iobtree, const char *term, 
+  unsigned int termlen, unsigned int maxveclen, unsigned int offset, 
+  const void *buf, unsigned int buflen);
+
+/* iteration functions */
+
+struct iobtree_iter;
+
+/* create a new iterator over the btree, starting at term (with length 
+ * termlen), which can be NULL, 0 if iteration from the start is desired.  Note
+ * that you don't have to call iobtree_iter_next immediately after this, 
+ * the iterator is initialised to the first requested term. */
+struct iobtree_iter *iobtree_iter_new(struct iobtree *iobtree, 
+  const char *term, unsigned int termlen);
+
+/* delete an iterator */
+void iobtree_iter_delete(struct iobtree_iter *iter);
+
+/* read the key that the iteration is currently up to.  a maximum of termbuflen
+ * bytes of key are written into termbuf on successful return, with the length
+ * of the term written into termlen.  Note that keys can't be any greater than
+ * 1/4 of a page if they are resident in the btree. */
+enum iobtree_ret iobtree_iter_curr(struct iobtree_iter *iter,
+  char *termbuf, unsigned int termbuflen, unsigned int *termlen, 
+  unsigned int *datalen);
+
+/* move forward in the iteration to another term.  If termlen is 0, then the
+ * iteration moves to the next term, otherwise iteration moves to the smallest
+ * term not smaller than the given seek term.  once a term is found, a maximum
+ * of termbuflen bytes of it are written into termbuf, with the length of the
+ * term written into *termlen, similar to iobtree_iter_curr. */
+enum iobtree_ret iobtree_iter_next(struct iobtree_iter *iter, 
+  char *termbuf, unsigned int termbuflen, unsigned int *termlen,
+  const char *seekterm, unsigned int seektermlen);
+
+/* blech, iterator equivalent of old interface _alloc, for convenience */
+void *iobtree_iter_alloc(struct iobtree_iter *iter,
+  const char *term, unsigned int termlen, unsigned int veclen, int *toobig);
+
+/* blech, iterator equivalent of old interface _realloc, for convenience */
+void *iobtree_iter_realloc(struct iobtree_iter *iter, unsigned int newsize, 
+  int *toobig);
+
+/* utility functions */
+
+/* return the number of entries in the btree */
+unsigned int iobtree_size(struct iobtree *iobtree);
+
+/* return the number of bytes of overhead (used space not holding data) in the
+ * btree */
+unsigned long int iobtree_overhead(struct iobtree *iobtree);
+
+/* return the total amount of space occupied by the btree in bytes */
+unsigned long int iobtree_space(struct iobtree *iobtree);
+
+/* return the number of bytes of utilised space in the btree (holding keys or
+ * entries) */
+unsigned long int iobtree_utilised(struct iobtree *iobtree);
+
+/* writes the root file number and offset into params */
+void iobtree_root(struct iobtree *iobtree, unsigned int *fileno, 
+  unsigned long int *offset);
+
+/* return the number of pages in the btree.  Split into leaves and nodes are
+ * written into leaves and nodes if not NULL. */
+unsigned int iobtree_pages(struct iobtree *iobtree, unsigned int *leaves, 
+  unsigned int *nodes);
+
+/* return the size of the pages in the btree */
+unsigned int iobtree_pagesize(struct iobtree *iobtree);
+
+/* returns the current number of levels in the btree */
+unsigned int iobtree_levels(struct iobtree *iobtree);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/lcrand.h b/src/include/lcrand.h
new file mode 100644 (file)
index 0000000..017201a
--- /dev/null
@@ -0,0 +1,95 @@
+/* lcrand.h declares a module to generate linear congruential
+ * psuedo-random (henceforth PR) numbers.  Its included in the search engine
+ * more for repeatability of some algorithms that require random numbers than
+ * anything else.  Linear congruential generators take the form 
+ *
+ *   x(n) = (a * x(n - 1) + b) mod c
+ *
+ * where a, b and c are parameters that can be altered to form
+ * different PR sequences.  This module sets c to 2^32, which should be
+ * efficient on modern hardware.  Bad choices of a and b can result in
+ * extremely non-random sequences.  Some good defaults have been
+ * provided below to get long PR sequences.  The generated numbers have 
+ * something resembling uniform distribution.
+ *
+ * Linear-congruential generators have been shown to be shockingly bad
+ * psuedo-random number generators (PRNG's) from a number of
+ * perspectives.  Even the best choices of parameters cannot result in
+ * a non-repeating sequence of longer than 2^32, and they expose a lot of 
+ * state as they generate numbers, making them totally unsuitable for anything
+ * resembling cryptographic use.  PRNG's like the (currently popular)
+ * mersenne twister are both faster and more secure than linear
+ * congruential generators.  However, its a hell of a lot more effort
+ * to write ;o).  Linear congruential generators can be random enough
+ * for some purposes.  One thing to be careful of in particular is that
+ * the low-order bits of the number can show less randomness than the
+ * high-order bits.  Numerical Recipes in c has this to say:
+ *
+ *            "If you want to generate a random integer between 1
+ *            and 10, you should always do it by using high-order
+ *            bits, as in
+ *
+ *                   j=1+(int) (10.0*rand()/(RAND_MAX+1.0));
+ *
+ *            and never by anything resembling
+ *
+ *                   j=1+(rand() % 10);
+ *
+ *            (which uses lower-order bits)."
+ *
+ * Note in this case RAND_MAX is LCRAND_MAX.
+ *
+ * More information on linear congruential generators can be found at 
+ * http://en.wikipedia.org/wiki/Linear_congruential_generator, and
+ * PRNG's in general at http://en.wikipedia.org/wiki/PRNG.  Theres lots
+ * of maths associated with PRNGs, which can be found in good number
+ * theory textbooks.
+ *
+ * "Anyone who considers arithmetical methods of producing random digits is, 
+ * of course, in a state of sin".
+ *
+ *   -- John von Neumann
+ *
+ * written nml 2004-08-27
+ *
+ */
+
+#ifndef LCRAND_H
+#define LCRAND_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <limits.h>
+
+/* define the largest number that can be generated */
+#define LCRAND_MAX UINT_MAX
+
+struct lcrand;
+
+/* create a new PRNG with default parameters and given seed */
+struct lcrand *lcrand_new(unsigned int seed);
+
+/* create a new PRNG with given parameters and given seed */
+struct lcrand *lcrand_new_custom(unsigned int seed, unsigned int a, 
+  unsigned int b);
+
+/* delete the random number generator */
+void lcrand_delete(struct lcrand *prng);
+
+/* get the next psuedo-random number */
+unsigned int lcrand(struct lcrand *prng);
+
+/* get a psuedo-random unsigned int n the range [0, limit) */
+unsigned int lcrand_limit(struct lcrand *prng, unsigned int limit);
+
+/* get the seed used to seed the random number generator */
+unsigned int lcrand_seed(struct lcrand *prng);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/linux/firstinclude.h b/src/include/linux/firstinclude.h
new file mode 100644 (file)
index 0000000..0767314
--- /dev/null
@@ -0,0 +1,42 @@
+/* linux/firstinclude.h defines feature macros to allow us to use the
+ * functions we want (primarily POSIX, but a few other bits and pieces
+ * too) on linux
+ *
+ * written nml 2003-04-24
+ *
+ */
+
+#ifndef FIRSTINCLUDE_H
+#define FIRSTINCLUDE_H
+
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64           /* large file support */
+#endif
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE                    /* for snprintf */
+#endif
+#ifndef _POSIX_SOURCE
+#define _POSIX_SOURCE                  /* for lots of stuff */
+#endif
+#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 199309L
+#endif
+#include <features.h>
+
+/* indicate what the directory separator character is for this OS */
+#define OS_SEPARATOR '/'
+
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "config.h"
+
+/* declare "don't break me" flag for win32 compatibility */
+#define O_BINARY 0
+
+#endif
+
diff --git a/src/include/makeindex.h b/src/include/makeindex.h
new file mode 100644 (file)
index 0000000..5935352
--- /dev/null
@@ -0,0 +1,93 @@
+/* makeindex.h declares an interface for procedures to create postings from
+ * input documents 
+ *
+ * originally written Hugh Williams
+ *
+ * updated nml 2003-03-27
+ *
+ */
+
+#ifndef MAKEINDEX_H
+#define MAKEINDEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "postings.h"
+#include "mime.h"
+
+struct postings;
+struct mlparse;
+struct stem_cache;
+struct psettings;
+
+enum makeindex_ret {
+    MAKEINDEX_ERR = -1,                     /* unexpected error */
+    MAKEINDEX_OK = 0,                       /* request successful */
+    MAKEINDEX_ENDDOC = 1,                   /* received the end of a document */
+    MAKEINDEX_EOF = 2,                      /* got the end of the file */
+
+    MAKEINDEX_INPUT = 3                     /* more input required */
+    /* MAKEINDEX_OUTPUT = 4 */              /* need to flush postings (currently
+                                             * not used)*/
+};
+
+/* FIXME: document what has to be initialised by user */
+struct makeindex {
+    const char *next_in;                    /* input buffer */
+    unsigned int avail_in;                  /* size of input buffer */
+
+    unsigned long int docs;                 /* number of documents parsed */
+
+    struct postings *post;                  /* output postings */
+    struct postings_docstats stats;         /* document statistics */
+
+    struct makeindex_state *state;          /* opaque state */
+};
+
+/* create a new makeindex structure, using configuration settings, with
+ * maximum term length termlen.  Returns MAKEINDEX_OK on success, MAKEINDEX_ERR
+ * on failure */
+enum makeindex_ret makeindex_new(struct makeindex *mi, 
+  struct psettings *settings, unsigned int termlen, enum mime_types type);
+
+/* reset the internal state of the makeindex structure */
+enum makeindex_ret makeindex_renew(struct makeindex *mi, enum mime_types type);
+
+/* remove the makeindex structure */
+void makeindex_delete(struct makeindex *mi);
+
+/* indicate to the makeindex struct that eof has been reached */
+void makeindex_eof(struct makeindex *mi);
+
+/* return a count of the number of bytes buffered by the parser within 
+ * makeindex */
+unsigned int makeindex_buffered(const struct makeindex *mi);
+
+/* return a pointer to the docno received for the last document */
+const char *makeindex_docno(const struct makeindex *mi);
+
+/* return the MIME type for the last document */
+enum mime_types makeindex_type(const struct makeindex *mi);
+
+/* set internal docno to docno.  Returns MAKEINDEX_OK on success */
+enum makeindex_ret makeindex_set_docno(struct makeindex *mi, const char *docno);
+enum makeindex_ret makeindex_append_docno(struct makeindex *mi, 
+  const char *docno);
+
+/* This function takes text input via the next_in/avail_in members, and 
+ * converts it into postings contained within the
+ * post member.  After each document has ended, MAKEINDEX_ENDDOC will be
+ * returned.  When more input is required, MAKEINDEX_INPUT is returned.  After
+ * all input has been exhausted, MAKEINDEX_EOF is returned.  The makeindex
+ * module will try to recover from errors, but if anything goes badly wrong,
+ * MAKEINDEX_ERR will be returned. */
+enum makeindex_ret makeindex(struct makeindex *mi);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/mem.h b/src/include/mem.h
new file mode 100644 (file)
index 0000000..6f239d1
--- /dev/null
@@ -0,0 +1,69 @@
+/* mem.h declares functions for manipulating memory
+ *
+ * written nml 2003-09-17
+ *
+ */
+
+#ifndef MEM_H
+#define MEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* returns the difference between two pointers, assuming that they can be 
+ * meaningfully compared */
+unsigned long int mem_ptrdiff(const void *b1, const void *b2);
+
+/* returns a (void) pointer location pointer + size */
+void *mem_ptradd(const void *b, unsigned int offset);
+
+/* returns the numerical address of a pointer (dodgily) */
+unsigned long int mem_ptraddr(const void *b);
+
+/* translate a network-ordered integer at src of size size into a host-ordered 
+ * integer at dst */
+void mem_ntoh(void *dst, const void *src, unsigned int size);
+
+/* translate a host-ordered integer at src of size size into a network-ordered 
+ * integer at dst */
+void mem_hton(void *dst, const void *src, unsigned int size);
+
+/* standard stuff that could (possibly) be improved but is time-consuming to
+ * reimplement */
+#if 0
+void *mem_cpy(void *dst, const void *src, unsigned int len);
+
+void *mem_move(void *dst, const void *src, unsigned int len);
+
+void *mem_chr(const void *b, int c, unsigned int len);
+
+int mem_cmp(const void *b1, const void *b2, unsigned int len);
+
+void *mem_set(void *b, int c, unsigned int len);
+#endif
+
+/* alignment stuff */
+
+/* get alignments of basic types */
+unsigned int mem_align_char();
+unsigned int mem_align_short();
+unsigned int mem_align_int();
+unsigned int mem_align_long();
+unsigned int mem_align_float();
+unsigned int mem_align_double();
+unsigned int mem_align_ptr();
+
+/* return the maximum alignment (probably) for this platform */
+unsigned int mem_align_max();
+
+/* return the next point in the buffer that conforms to the given alignment.
+ * align is assumed to be a power of two. */
+void *mem_align(void *buf, unsigned int align);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/merge.h b/src/include/merge.h
new file mode 100644 (file)
index 0000000..0bdccff
--- /dev/null
@@ -0,0 +1,172 @@
+/* merge.h declares a set of functions merge numbers of runs together
+ * into either a single run or a single final index.  
+ * Note that the final merge assumes that all full-text vectors contain 
+ * mutually-exclusive and non-overlapping sets of document numbers.  
+ * This assumption allows optimised merging to occur.  If some of the input 
+ * runs do not meet these conditions you should merge into further intermediate
+ * runs before final merging.
+ *
+ * written nml 2003-02-11
+ *
+ */
+
+#ifndef MERGE_H
+#define MERGE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+    
+struct storagep;
+
+/* return values from merge calls */
+enum merge_ret {
+    MERGE_ERR = 0,                   /* an error has occurred */
+    MERGE_OK = 1,                    /* call was successful */
+    MERGE_INPUT = 2,                 /* need to fill an input buffer */
+    MERGE_OUTPUT = 3,                /* need to flush the output buffer */
+    MERGE_OUTPUT_BTREE = 4           /* need to flush a btree bucket from 
+                                      * output buffer */
+};
+
+/* struct to represent an input source to merge from */
+struct merge_input {
+    char *next_in;                   /* input buffer or NULL when finished */
+    unsigned int avail_in;           /* size of input buffer */
+};
+
+/* Note that these structures below are *not* a next_out, avail_out 
+ * arrangement ALA zlib. the output buffer is under the control of the merge 
+ * module.  You just write buf_out out when indicated and set size_out to 0 
+ * when you're done */
+
+/* struct to represent the state of a final merge.  All elements other
+ * than state should be initially set by the caller, and maintained as
+ * necessary (input requires refilling when asked for, output requires flushing
+ * when asked for) */
+struct merge_final {
+    struct merge_input *input;       /* array of input sources */
+    unsigned int inputs;             /* number of input sources */
+
+    /* output for vector files */
+    struct {
+        char *buf_out;                   /* output buffer */
+        unsigned int size_out;           /* size of stuff in output buffer */
+        unsigned int fileno_out;         /* output location (file number) */
+        unsigned long int offset_out;    /* output location (file offset) */
+    } out;
+    
+    /* output for vocab files */
+    struct {
+        char *buf_out;                   /* output buffer */
+        unsigned int size_out;           /* size of stuff in output buffer */
+        unsigned int fileno_out;         /* output location (file number) */
+        unsigned long int offset_out;    /* output location (file offset) */
+    } out_btree;
+
+    struct merge_final_state *state; /* internal state */
+};
+
+/* struct to represent the state of an intermediate merge.  All elements other
+ * than state should be initially set by the caller, and maintained as
+ * necessary (input requires refilling when asked for, output requires flushing
+ * when asked for) */
+struct merge_inter {
+    struct merge_input *input;       /* array of input sources */
+    unsigned int inputs;             /* number of input sources */
+
+    char *buf_out;                   /* output buffer */
+    unsigned int size_out;           /* size of stuff in output buffer */
+
+    struct merge_inter_state *state; /* internal state 
+                                      * (merge_inter_state is what the fitzroy 
+                                      * lions did ;o) */
+};
+
+/* initialise a final merge object.  Params are:
+ *    - opaque: an opaque data handle for memory allocation functions
+ *    - allocfn: a function through which to allocate memory
+ *    - freefn: a function through which to free memory
+ *    - storage: a set of storage paramters (see storagep.h)
+ *    - outbuf: an output buffer
+ *    - outbufsz: size of the output buffer 
+ *
+ * merge_new returns MERGE_OK on success.  Pass opaque, allocfn and
+ * freefn as NULL to use malloc and free. */
+int merge_final_new(struct merge_final *merger, void *opaque,
+  void *(*allocfn)(void *opaque, unsigned int size),
+  void (*freefn)(void *opaque, void *mem), struct storagep *storage,
+  void *outbuf, unsigned int outbufsz);
+
+/* perform a final merge.  Keep on calling this function until it returns
+ * FMERGE_OK.  It will return FMERGE_INPUT when it requires more input (the
+ * input that requires filling will be written into *index, a hint as to what
+ * the next read will be will be written into *next_read, although this will be
+ * 0 if it can't be predicted.  This function will return FMERGE_OUTPUT when it
+ * requires the output buffer to be flushed to disk.  Don't fiddle with the
+ * output buffer other than to write it and set size_out to 0, as the merger 
+ * swaps inputs into the output to avoid copying large amounts of data.  Pay
+ * attention to fileno_out and offset_out, as the final merger keeps the output
+ * within the filesize limit by using these variables to place the output.
+ * Other than that, the output will be contiguous. */
+int merge_final(struct merge_final *merger, unsigned int *index, 
+  unsigned int *next_read);
+
+/* indicate that an input has reached the end of its data to the merger object.
+ * input is the index of the finished input in the original inputs array.
+ * Returns MERGE_OK on success */
+int merge_final_input_finish(struct merge_final *merger, unsigned int input);
+
+/* complete a final merge, obtaining the final btree root fileno and offset, 
+ * the number of distinct terms merged and the total number of terms. */
+int merge_final_finish(struct merge_final *merger, unsigned int *root_fileno, 
+  unsigned long int *root_offset, unsigned long int *dterms, 
+  unsigned int *terms_high, unsigned int *terms_low);
+
+/* delete a final merge object */
+void merge_final_delete(struct merge_final *merger);
+
+/* initialise an intermediate merge object.  Params are:
+ *    - opaque: an opaque data handle for memory allocation functions
+ *    - allocfn: a function through which to allocate memory
+ *    - freefn: a function through which to free memory
+ *    - outbuf: an output buffer
+ *    - outbufsz: size of the output buffer 
+ *
+ * merge_inter_new returns MERGE_OK on success.  Pass opaque, allocfn and
+ * freefn as NULL to use malloc and free. */
+int merge_inter_new(struct merge_inter *merger, void *opaque,
+  void *(*allocfn)(void *opaque, unsigned int size),
+  void (*freefn)(void *opaque, void *mem), 
+  void *outbuf, unsigned int outbufsz, unsigned int max_termlen,
+
+  /* XXX: newfile call is a blatant hack to get around the problem where we
+   * still store intermediate merges in one file, which means we need a way to
+   * limit them to < 2GB.  This should be removed when we start treating
+   * intermediate files as collections of extents (about when we do in-place
+   * merging) 
+   *
+   * anyway, basically newfile is called when the intermediate file needs to be
+   * moved to a new file. */
+  void *opaque_newfile, void (*newfile)(void *opaque_newfile), 
+  unsigned long int filesize);
+
+/* perform an intermediate merge.  works the same as the final merge method,
+ * except that you don't have to worry about fileno_out and offset_out */
+int merge_inter(struct merge_inter *merger, unsigned int *index, 
+  unsigned int *next_read);
+
+/* indicate that an input has reached the end of its data to the merger object.
+ * input is the index of the finished input in the original inputs array.
+ * Returns MERGE_OK on success */
+int merge_inter_input_finish(struct merge_inter *merger, unsigned int input);
+
+/* delete an intermediate merge object */
+void merge_inter_delete(struct merge_inter *merger);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/metric.h b/src/include/metric.h
new file mode 100644 (file)
index 0000000..8896d13
--- /dev/null
@@ -0,0 +1,29 @@
+/* metric.h contains signatures for all of the metrics currently known
+ * in the system.  It contains functions of different prefixes, but it
+ * beats having a different header file for each metric, since they
+ * consist of a single function
+ *
+ * written nml 2005-05-31
+ *
+ */
+
+#ifndef METRIC_H
+#define METRIC_H
+
+/* okapi metric */
+const struct search_metric *okapi_k3();
+
+/* dirichlet metric */
+const struct search_metric *dirichlet();
+
+/* pivoted cosine metric */
+const struct search_metric *pcosine();
+
+/* (incredibly simple) cosine metric */
+const struct search_metric *cosine();
+
+/* Dave Hawking's AF1 metric */
+const struct search_metric *hawkapi();
+
+#endif
+
diff --git a/src/include/mime.h b/src/include/mime.h
new file mode 100644 (file)
index 0000000..4e19564
--- /dev/null
@@ -0,0 +1,566 @@
+/* mime.h provides support for MIME types as originally proposed 
+ * by RFCs 1521 and 1522, and updated by RFCs 2045 through 2049.
+ * It provides enumerations for convenient representation of 
+ * recognised MIME types, as well as a functions for determining
+ * MIME types for given MIME names and file contents.
+ *
+ * DO NOT modify this file, as it is automatically generated 
+ * and changes will be lost upon subsequent regeneration.
+ *
+ * It is automatically generated from media-type files describing 
+ * valid MIME types by scripts/mime.py.  The definitive list can be found at 
+ * http://www.isi.edu/in-notes/iana/assignments/media-types/media-types, 
+ * although scripts/mime.py will accept multiple files (in the same format), 
+ * allowing you to define your own MIME types as convenient.
+ *
+ * This file was generated on Wed, 03 May 2006 07:26:21 +0000 
+ * by scripts/mime.py
+ *
+ */
+
+#ifndef MIME_H
+#define MIME_H
+
+#ifdef _cplusplus
+extern "C" {
+#endif
+
+enum mime_top_types {
+    MIME_TOP_TYPE_APPLICATION = 0,
+    MIME_TOP_TYPE_AUDIO = 1,
+    MIME_TOP_TYPE_CHEMICAL = 2,
+    MIME_TOP_TYPE_IMAGE = 3,
+    MIME_TOP_TYPE_MESSAGE = 4,
+    MIME_TOP_TYPE_MODEL = 5,
+    MIME_TOP_TYPE_MULTIPART = 6,
+    MIME_TOP_TYPE_TEXT = 7,
+    MIME_TOP_TYPE_VIDEO = 8,
+    MIME_TOP_TYPE_X_CONFERENCE = 9,
+    MIME_TOP_TYPE_ERR = -1
+};
+
+/* numbered so that (hopefully) commonly used MIME types have 
+   low numbers */
+enum mime_types {
+    MIME_TYPE_APPLICATION_ACTIVEMESSAGE = 223,
+    MIME_TYPE_APPLICATION_ANDREW_INSET = 204,
+    MIME_TYPE_APPLICATION_APPLEFILE = 149,
+    MIME_TYPE_APPLICATION_ATOMICMAIL = 165,
+    MIME_TYPE_APPLICATION_BATCH_SMTP = 166,
+    MIME_TYPE_APPLICATION_BEEP_XML = 136,
+    MIME_TYPE_APPLICATION_CALS_1840 = 150,
+    MIME_TYPE_APPLICATION_COMMONGROUND = 205,
+    MIME_TYPE_APPLICATION_CYBERCASH = 151,
+    MIME_TYPE_APPLICATION_DCA_RFT = 119,
+    MIME_TYPE_APPLICATION_DEC_DX = 105,
+    MIME_TYPE_APPLICATION_DVCS = 83,
+    MIME_TYPE_APPLICATION_EDIFACT = 118,
+    MIME_TYPE_APPLICATION_EDI_CONSENT = 183,
+    MIME_TYPE_APPLICATION_EDI_X12 = 117,
+    MIME_TYPE_APPLICATION_ESHOP = 97,
+    MIME_TYPE_APPLICATION_FONT_TDPFR = 167,
+    MIME_TYPE_APPLICATION_HTTP = 84,
+    MIME_TYPE_APPLICATION_HYPERSTUDIO = 184,
+    MIME_TYPE_APPLICATION_IGES = 85,
+    MIME_TYPE_APPLICATION_INDEX = 98,
+    MIME_TYPE_APPLICATION_INDEX_CMD = 152,
+    MIME_TYPE_APPLICATION_INDEX_OBJ = 153,
+    MIME_TYPE_APPLICATION_INDEX_RESPONSE = 241,
+    MIME_TYPE_APPLICATION_INDEX_VND = 154,
+    MIME_TYPE_APPLICATION_IOTP = 86,
+    MIME_TYPE_APPLICATION_IPP = 73,
+    MIME_TYPE_APPLICATION_ISUP = 87,
+    MIME_TYPE_APPLICATION_MACWRITEII = 168,
+    MIME_TYPE_APPLICATION_MAC_BINHEX40 = 206,
+    MIME_TYPE_APPLICATION_MAC_COMPACTPRO = 461,
+    MIME_TYPE_APPLICATION_MARC = 88,
+    MIME_TYPE_APPLICATION_MATHEMATICA = 31,
+    MIME_TYPE_APPLICATION_MATHEMATICA_OLD = 471,
+    MIME_TYPE_APPLICATION_MSWORD = 24,
+    MIME_TYPE_APPLICATION_NEWS_MESSAGE_ID = 254,
+    MIME_TYPE_APPLICATION_NEWS_TRANSMISSION = 282,
+    MIME_TYPE_APPLICATION_OCSP_REQUEST = 207,
+    MIME_TYPE_APPLICATION_OCSP_RESPONSE = 224,
+    MIME_TYPE_APPLICATION_OCTET_STREAM = 32,
+    MIME_TYPE_APPLICATION_ODA = 74,
+    MIME_TYPE_APPLICATION_OGG = 406,
+    MIME_TYPE_APPLICATION_PARITYFEC = 155,
+    MIME_TYPE_APPLICATION_PDF = 17,
+    MIME_TYPE_APPLICATION_PGP_ENCRYPTED = 225,
+    MIME_TYPE_APPLICATION_PGP_KEYS = 137,
+    MIME_TYPE_APPLICATION_PGP_SIGNATURE = 226,
+    MIME_TYPE_APPLICATION_PKCS10 = 106,
+    MIME_TYPE_APPLICATION_PKCS7_MIME = 169,
+    MIME_TYPE_APPLICATION_PKCS7_SIGNATURE = 255,
+    MIME_TYPE_APPLICATION_PKIXCMP = 120,
+    MIME_TYPE_APPLICATION_PKIX_CERT = 156,
+    MIME_TYPE_APPLICATION_PKIX_CRL = 138,
+    MIME_TYPE_APPLICATION_POSTSCRIPT = 30,
+    MIME_TYPE_APPLICATION_PRS_ALVESTRAND_TITRAX_SHEET = 369,
+    MIME_TYPE_APPLICATION_PRS_CWW = 121,
+    MIME_TYPE_APPLICATION_PRS_NPREND = 170,
+    MIME_TYPE_APPLICATION_QSIG = 89,
+    MIME_TYPE_APPLICATION_REMOTE_PRINTING = 256,
+    MIME_TYPE_APPLICATION_RISCOS = 107,
+    MIME_TYPE_APPLICATION_RTF = 75,
+    MIME_TYPE_APPLICATION_SDP = 76,
+    MIME_TYPE_APPLICATION_SET_PAYMENT = 185,
+    MIME_TYPE_APPLICATION_SET_PAYMENT_INITIATION = 333,
+    MIME_TYPE_APPLICATION_SET_REGISTRATION = 270,
+    MIME_TYPE_APPLICATION_SET_REGISTRATION_INITIATION = 370,
+    MIME_TYPE_APPLICATION_SGML = 90,
+    MIME_TYPE_APPLICATION_SGML_OPEN_CATALOG = 283,
+    MIME_TYPE_APPLICATION_SIEVE = 99,
+    MIME_TYPE_APPLICATION_SLATE = 100,
+    MIME_TYPE_APPLICATION_SMIL = 412,
+    MIME_TYPE_APPLICATION_TIMESTAMP_QUERY = 257,
+    MIME_TYPE_APPLICATION_TIMESTAMP_REPLY = 258,
+    MIME_TYPE_APPLICATION_VEMMI = 101,
+    MIME_TYPE_APPLICATION_VND_3M_POST_IT_NOTES = 322,
+    MIME_TYPE_APPLICATION_VND_ACCPAC_SIMPLY_ASO = 329,
+    MIME_TYPE_APPLICATION_VND_ACCPAC_SIMPLY_IMP = 330,
+    MIME_TYPE_APPLICATION_VND_ACUCOBOL = 208,
+    MIME_TYPE_APPLICATION_VND_AETHER_IMP = 243,
+    MIME_TYPE_APPLICATION_VND_ANSER_WEB_CERTIFICATE_ISSUE_INITIATION = 389,
+    MIME_TYPE_APPLICATION_VND_ANSER_WEB_FUNDS_TRANSFER_INITIATION = 388,
+    MIME_TYPE_APPLICATION_VND_AUDIOGRAPH = 244,
+    MIME_TYPE_APPLICATION_VND_BMI = 122,
+    MIME_TYPE_APPLICATION_VND_BUSINESSOBJECTS = 305,
+    MIME_TYPE_APPLICATION_VND_CANON_CPDL = 245,
+    MIME_TYPE_APPLICATION_VND_CANON_LIPS = 246,
+    MIME_TYPE_APPLICATION_VND_CLAYMORE = 209,
+    MIME_TYPE_APPLICATION_VND_COMMERCE_BATTELLE = 480,
+    MIME_TYPE_APPLICATION_VND_COMMONSPACE = 259,
+    MIME_TYPE_APPLICATION_VND_COMSOCALLER = 260,
+    MIME_TYPE_APPLICATION_VND_CONTACT_CMSG = 271,
+    MIME_TYPE_APPLICATION_VND_COSMOCALLER = 472,
+    MIME_TYPE_APPLICATION_VND_CTC_POSML = 227,
+    MIME_TYPE_APPLICATION_VND_CUPS_POSTSCRIPT = 306,
+    MIME_TYPE_APPLICATION_VND_CUPS_RASTER = 261,
+    MIME_TYPE_APPLICATION_VND_CUPS_RAW = 210,
+    MIME_TYPE_APPLICATION_VND_CYBANK = 171,
+    MIME_TYPE_APPLICATION_VND_DNA = 123,
+    MIME_TYPE_APPLICATION_VND_DPGRAPH = 186,
+    MIME_TYPE_APPLICATION_VND_DXR = 124,
+    MIME_TYPE_APPLICATION_VND_ECDIS_UPDATE = 272,
+    MIME_TYPE_APPLICATION_VND_ECOWIN_CHART = 273,
+    MIME_TYPE_APPLICATION_VND_ECOWIN_FILEREQUEST = 334,
+    MIME_TYPE_APPLICATION_VND_ECOWIN_FILEUPDATE = 331,
+    MIME_TYPE_APPLICATION_VND_ECOWIN_SERIES = 284,
+    MIME_TYPE_APPLICATION_VND_ECOWIN_SERIESREQUEST = 350,
+    MIME_TYPE_APPLICATION_VND_ECOWIN_SERIESUPDATE = 344,
+    MIME_TYPE_APPLICATION_VND_ENLIVEN = 187,
+    MIME_TYPE_APPLICATION_VND_EPSON_ESF = 228,
+    MIME_TYPE_APPLICATION_VND_EPSON_MSF = 229,
+    MIME_TYPE_APPLICATION_VND_EPSON_QUICKANIME = 323,
+    MIME_TYPE_APPLICATION_VND_EPSON_SALT = 247,
+    MIME_TYPE_APPLICATION_VND_EPSON_SSF = 230,
+    MIME_TYPE_APPLICATION_VND_ERICSSON_QUICKCALL = 335,
+    MIME_TYPE_APPLICATION_VND_EUDORA_DATA = 262,
+    MIME_TYPE_APPLICATION_VND_FDF = 125,
+    MIME_TYPE_APPLICATION_VND_FFSNS = 157,
+    MIME_TYPE_APPLICATION_VND_FLOGRAPHIT = 242,
+    MIME_TYPE_APPLICATION_VND_FRAMEMAKER = 248,
+    MIME_TYPE_APPLICATION_VND_FSC_WEBLAUNCH = 285,
+    MIME_TYPE_APPLICATION_VND_FUJITSU_OASYS = 286,
+    MIME_TYPE_APPLICATION_VND_FUJITSU_OASYS2 = 296,
+    MIME_TYPE_APPLICATION_VND_FUJITSU_OASYS3 = 297,
+    MIME_TYPE_APPLICATION_VND_FUJITSU_OASYSGP = 307,
+    MIME_TYPE_APPLICATION_VND_FUJITSU_OASYSPRS = 324,
+    MIME_TYPE_APPLICATION_VND_FUJIXEROX_DDD = 287,
+    MIME_TYPE_APPLICATION_VND_FUJIXEROX_DOCUWORKS = 345,
+    MIME_TYPE_APPLICATION_VND_FUJIXEROX_DOCUWORKS_BINDER = 380,
+    MIME_TYPE_APPLICATION_VND_FUT_MISNET = 249,
+    MIME_TYPE_APPLICATION_VND_GRAFEQ = 172,
+    MIME_TYPE_APPLICATION_VND_GROOVE_ACCOUNT = 298,
+    MIME_TYPE_APPLICATION_VND_GROOVE_IDENTITY_MESSAGE = 371,
+    MIME_TYPE_APPLICATION_VND_GROOVE_INJECTOR = 308,
+    MIME_TYPE_APPLICATION_VND_GROOVE_TOOL_MESSAGE = 346,
+    MIME_TYPE_APPLICATION_VND_GROOVE_TOOL_TEMPLATE = 351,
+    MIME_TYPE_APPLICATION_VND_GROOVE_VCARD = 274,
+    MIME_TYPE_APPLICATION_VND_HHE_LESSON_PLAYER = 332,
+    MIME_TYPE_APPLICATION_VND_HP_HPGL = 188,
+    MIME_TYPE_APPLICATION_VND_HP_HPID = 189,
+    MIME_TYPE_APPLICATION_VND_HP_HPS = 174,
+    MIME_TYPE_APPLICATION_VND_HP_PCL = 173,
+    MIME_TYPE_APPLICATION_VND_HP_PCLXL = 211,
+    MIME_TYPE_APPLICATION_VND_HTTPHONE = 212,
+    MIME_TYPE_APPLICATION_VND_HZN_3D_CROSSWORD = 325,
+    MIME_TYPE_APPLICATION_VND_IBM_AFPLINEDATA = 309,
+    MIME_TYPE_APPLICATION_VND_IBM_MINIPAY = 263,
+    MIME_TYPE_APPLICATION_VND_IBM_MODCAP = 250,
+    MIME_TYPE_APPLICATION_VND_INFORMIX_VISIONARY = 336,
+    MIME_TYPE_APPLICATION_VND_INTERCON_FORMNET = 326,
+    MIME_TYPE_APPLICATION_VND_INTERTRUST_DIGIBOX = 337,
+    MIME_TYPE_APPLICATION_VND_INTERTRUST_NNCP = 310,
+    MIME_TYPE_APPLICATION_VND_INTU_QBO = 213,
+    MIME_TYPE_APPLICATION_VND_INTU_QFX = 214,
+    MIME_TYPE_APPLICATION_VND_IREPOSITORY_PACKAGE_XML = 372,
+    MIME_TYPE_APPLICATION_VND_IS_XPR = 175,
+    MIME_TYPE_APPLICATION_VND_JAPANNET_DIRECTORY_SERVICE = 381,
+    MIME_TYPE_APPLICATION_VND_JAPANNET_JPNSTORE_WAKEUP = 377,
+    MIME_TYPE_APPLICATION_VND_JAPANNET_PAYMENT_WAKEUP = 373,
+    MIME_TYPE_APPLICATION_VND_JAPANNET_REGISTRATION = 354,
+    MIME_TYPE_APPLICATION_VND_JAPANNET_REGISTRATION_WAKEUP = 385,
+    MIME_TYPE_APPLICATION_VND_JAPANNET_SETSTORE_WAKEUP = 378,
+    MIME_TYPE_APPLICATION_VND_JAPANNET_VERIFICATION = 355,
+    MIME_TYPE_APPLICATION_VND_JAPANNET_VERIFICATION_WAKEUP = 386,
+    MIME_TYPE_APPLICATION_VND_KOAN = 139,
+    MIME_TYPE_APPLICATION_VND_LOTUS_1_2_3 = 264,
+    MIME_TYPE_APPLICATION_VND_LOTUS_APPROACH = 299,
+    MIME_TYPE_APPLICATION_VND_LOTUS_FREELANCE = 311,
+    MIME_TYPE_APPLICATION_VND_LOTUS_NOTES = 265,
+    MIME_TYPE_APPLICATION_VND_LOTUS_ORGANIZER = 312,
+    MIME_TYPE_APPLICATION_VND_LOTUS_SCREENCAM = 313,
+    MIME_TYPE_APPLICATION_VND_LOTUS_WORDPRO = 288,
+    MIME_TYPE_APPLICATION_VND_MCD = 126,
+    MIME_TYPE_APPLICATION_VND_MEDIASTATION_CDKEY = 338,
+    MIME_TYPE_APPLICATION_VND_MERIDIAN_SLINGSHOT = 339,
+    MIME_TYPE_APPLICATION_VND_MIF = 127,
+    MIME_TYPE_APPLICATION_VND_MINISOFT_HP3000_SAVE = 352,
+    MIME_TYPE_APPLICATION_VND_MITSUBISHI_MISTY_GUARD_TRUSTWEB = 387,
+    MIME_TYPE_APPLICATION_VND_MOBIUS_DAF = 462,
+    MIME_TYPE_APPLICATION_VND_MOBIUS_DIS = 463,
+    MIME_TYPE_APPLICATION_VND_MOBIUS_MBK = 464,
+    MIME_TYPE_APPLICATION_VND_MOBIUS_MQY = 465,
+    MIME_TYPE_APPLICATION_VND_MOBIUS_MSL = 466,
+    MIME_TYPE_APPLICATION_VND_MOBIUS_PLC = 467,
+    MIME_TYPE_APPLICATION_VND_MOBIUS_TXF = 468,
+    MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE = 340,
+    MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_ADSI = 374,
+    MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_FIS = 362,
+    MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_GOTAP = 379,
+    MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_KMR = 363,
+    MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_TTC = 364,
+    MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_WEM = 365,
+    MIME_TYPE_APPLICATION_VND_MOZILLA_XUL_XML = 314,
+    MIME_TYPE_APPLICATION_VND_MSEQ = 140,
+    MIME_TYPE_APPLICATION_VND_MSIGN = 158,
+    MIME_TYPE_APPLICATION_VND_MS_ARTGALRY = 266,
+    MIME_TYPE_APPLICATION_VND_MS_ASF = 176,
+    MIME_TYPE_APPLICATION_VND_MS_EXCEL = 215,
+    MIME_TYPE_APPLICATION_VND_MS_LRM = 177,
+    MIME_TYPE_APPLICATION_VND_MS_POWERPOINT = 289,
+    MIME_TYPE_APPLICATION_VND_MS_PROJECT = 251,
+    MIME_TYPE_APPLICATION_VND_MS_TNEF = 190,
+    MIME_TYPE_APPLICATION_VND_MS_WORKS = 216,
+    MIME_TYPE_APPLICATION_VND_MUSICIAN = 217,
+    MIME_TYPE_APPLICATION_VND_MUSIC_NIFF = 252,
+    MIME_TYPE_APPLICATION_VND_NETFPX = 178,
+    MIME_TYPE_APPLICATION_VND_NOBLENET_DIRECTORY = 341,
+    MIME_TYPE_APPLICATION_VND_NOBLENET_SEALER = 315,
+    MIME_TYPE_APPLICATION_VND_NOBLENET_WEB = 275,
+    MIME_TYPE_APPLICATION_VND_NOVADIGM_EDM = 276,
+    MIME_TYPE_APPLICATION_VND_NOVADIGM_EDX = 277,
+    MIME_TYPE_APPLICATION_VND_NOVADIGM_EXT = 278,
+    MIME_TYPE_APPLICATION_VND_OSA_NETDEPLOY = 290,
+    MIME_TYPE_APPLICATION_VND_PALM = 141,
+    MIME_TYPE_APPLICATION_VND_PG_FORMAT = 231,
+    MIME_TYPE_APPLICATION_VND_PG_OSASLI = 232,
+    MIME_TYPE_APPLICATION_VND_POWERBUILDER6 = 291,
+    MIME_TYPE_APPLICATION_VND_POWERBUILDER6_S = 316,
+    MIME_TYPE_APPLICATION_VND_POWERBUILDER7 = 292,
+    MIME_TYPE_APPLICATION_VND_POWERBUILDER75 = 300,
+    MIME_TYPE_APPLICATION_VND_POWERBUILDER75_S = 327,
+    MIME_TYPE_APPLICATION_VND_POWERBUILDER7_S = 317,
+    MIME_TYPE_APPLICATION_VND_PREVIEWSYSTEMS_BOX = 342,
+    MIME_TYPE_APPLICATION_VND_PUBLISHARE_DELTA_TREE = 356,
+    MIME_TYPE_APPLICATION_VND_PVI_PTID1 = 233,
+    MIME_TYPE_APPLICATION_VND_PWG_XHTML_PRINT_XML = 347,
+    MIME_TYPE_APPLICATION_VND_RAPID = 159,
+    MIME_TYPE_APPLICATION_VND_S3SMS = 160,
+    MIME_TYPE_APPLICATION_VND_SEEMAIL = 191,
+    MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_FORMDATA = 375,
+    MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_FORMTEMPLATE = 383,
+    MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_INTERCHANGE = 382,
+    MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_PACKAGE = 366,
+    MIME_TYPE_APPLICATION_VND_SSS_COD = 192,
+    MIME_TYPE_APPLICATION_VND_SSS_DTF = 193,
+    MIME_TYPE_APPLICATION_VND_SSS_NTF = 194,
+    MIME_TYPE_APPLICATION_VND_STREET_STREAM = 293,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_CALC = 473,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_CALC_TEMPLATE = 482,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_DRAW = 474,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_DRAW_TEMPLATE = 483,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_IMPRESS = 478,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_IMPRESS_TEMPLATE = 486,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_MATH = 475,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_WRITER = 477,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_WRITER_GLOBAL = 484,
+    MIME_TYPE_APPLICATION_VND_SUN_XML_WRITER_TEMPLATE = 485,
+    MIME_TYPE_APPLICATION_VND_SVD = 128,
+    MIME_TYPE_APPLICATION_VND_SWIFTVIEW_ICS = 294,
+    MIME_TYPE_APPLICATION_VND_TRISCAPE_MXS = 279,
+    MIME_TYPE_APPLICATION_VND_TRUEAPP = 195,
+    MIME_TYPE_APPLICATION_VND_TRUEDOC = 196,
+    MIME_TYPE_APPLICATION_VND_TVE_TRIGGER = 267,
+    MIME_TYPE_APPLICATION_VND_UFDL = 142,
+    MIME_TYPE_APPLICATION_VND_UPLANET_ALERT = 295,
+    MIME_TYPE_APPLICATION_VND_UPLANET_ALERT_WBXML = 348,
+    MIME_TYPE_APPLICATION_VND_UPLANET_BEARER_CHOICE = 357,
+    MIME_TYPE_APPLICATION_VND_UPLANET_BEARER_CHOICE_WBXML = 384,
+    MIME_TYPE_APPLICATION_VND_UPLANET_CACHEOP = 318,
+    MIME_TYPE_APPLICATION_VND_UPLANET_CACHEOP_WBXML = 358,
+    MIME_TYPE_APPLICATION_VND_UPLANET_CHANNEL = 319,
+    MIME_TYPE_APPLICATION_VND_UPLANET_CHANNEL_WBXML = 359,
+    MIME_TYPE_APPLICATION_VND_UPLANET_LIST = 280,
+    MIME_TYPE_APPLICATION_VND_UPLANET_LISTCMD = 320,
+    MIME_TYPE_APPLICATION_VND_UPLANET_LISTCMD_WBXML = 360,
+    MIME_TYPE_APPLICATION_VND_UPLANET_LIST_WBXML = 343,
+    MIME_TYPE_APPLICATION_VND_UPLANET_SIGNAL = 301,
+    MIME_TYPE_APPLICATION_VND_VCX = 129,
+    MIME_TYPE_APPLICATION_VND_VECTORWORKS = 268,
+    MIME_TYPE_APPLICATION_VND_VIDSOFT_VIDCONFERENCE = 361,
+    MIME_TYPE_APPLICATION_VND_VISIO = 161,
+    MIME_TYPE_APPLICATION_VND_VIVIDENCE_SCRIPTFILE = 353,
+    MIME_TYPE_APPLICATION_VND_WAP_SIC = 197,
+    MIME_TYPE_APPLICATION_VND_WAP_SLC = 198,
+    MIME_TYPE_APPLICATION_VND_WAP_WBXML = 234,
+    MIME_TYPE_APPLICATION_VND_WAP_WMLC = 218,
+    MIME_TYPE_APPLICATION_VND_WAP_WMLSCRIPTC = 302,
+    MIME_TYPE_APPLICATION_VND_WEBTURBO = 219,
+    MIME_TYPE_APPLICATION_VND_WRQ_HP3000_LABELLED = 349,
+    MIME_TYPE_APPLICATION_VND_WT_STF = 179,
+    MIME_TYPE_APPLICATION_VND_XARA = 143,
+    MIME_TYPE_APPLICATION_VND_XFDL = 144,
+    MIME_TYPE_APPLICATION_VND_YELLOWRIVER_CUSTOM_MENU = 376,
+    MIME_TYPE_APPLICATION_WHOISPP_QUERY = 235,
+    MIME_TYPE_APPLICATION_WHOISPP_RESPONSE = 281,
+    MIME_TYPE_APPLICATION_WITA = 91,
+    MIME_TYPE_APPLICATION_WORDPERFECT5_1 = 253,
+    MIME_TYPE_APPLICATION_X400_BP = 130,
+    MIME_TYPE_APPLICATION_XHTML_XML = 444,
+    MIME_TYPE_APPLICATION_XML = 77,
+    MIME_TYPE_APPLICATION_XML_DTD = 131,
+    MIME_TYPE_APPLICATION_XML_EXTERNAL_PARSED_ENTITY = 367,
+    MIME_TYPE_APPLICATION_X_BCPIO = 428,
+    MIME_TYPE_APPLICATION_X_BITTORRENT = 456,
+    MIME_TYPE_APPLICATION_X_BZIP2 = 429,
+    MIME_TYPE_APPLICATION_X_CDLINK = 435,
+    MIME_TYPE_APPLICATION_X_CHESS_PGN = 450,
+    MIME_TYPE_APPLICATION_X_COMPRESS = 445,
+    MIME_TYPE_APPLICATION_X_CPIO = 422,
+    MIME_TYPE_APPLICATION_X_CSH = 414,
+    MIME_TYPE_APPLICATION_X_DIRECTOR = 446,
+    MIME_TYPE_APPLICATION_X_DVI = 415,
+    MIME_TYPE_APPLICATION_X_FUTURESPLASH = 469,
+    MIME_TYPE_APPLICATION_X_GTAR = 423,
+    MIME_TYPE_APPLICATION_X_GZIP = 424,
+    MIME_TYPE_APPLICATION_X_HDF = 416,
+    MIME_TYPE_APPLICATION_X_INEX = 2,
+    MIME_TYPE_APPLICATION_X_JAVASCRIPT = 457,
+    MIME_TYPE_APPLICATION_X_KCHART = 436,
+    MIME_TYPE_APPLICATION_X_KILLUSTRATOR = 470,
+    MIME_TYPE_APPLICATION_X_KOAN = 425,
+    MIME_TYPE_APPLICATION_X_KPRESENTER = 458,
+    MIME_TYPE_APPLICATION_X_KSPREAD = 440,
+    MIME_TYPE_APPLICATION_X_KWORD = 430,
+    MIME_TYPE_APPLICATION_X_LATEX = 431,
+    MIME_TYPE_APPLICATION_X_NETCDF = 437,
+    MIME_TYPE_APPLICATION_X_RPM = 417,
+    MIME_TYPE_APPLICATION_X_SH = 413,
+    MIME_TYPE_APPLICATION_X_SHAR = 426,
+    MIME_TYPE_APPLICATION_X_SHOCKWAVE_FLASH = 476,
+    MIME_TYPE_APPLICATION_X_STUFFIT = 441,
+    MIME_TYPE_APPLICATION_X_SV4CPIO = 442,
+    MIME_TYPE_APPLICATION_X_SV4CRC = 438,
+    MIME_TYPE_APPLICATION_X_TAR = 33,
+    MIME_TYPE_APPLICATION_X_TCL = 418,
+    MIME_TYPE_APPLICATION_X_TEX = 419,
+    MIME_TYPE_APPLICATION_X_TEXINFO = 443,
+    MIME_TYPE_APPLICATION_X_TREC = 3,
+    MIME_TYPE_APPLICATION_X_TROFF = 432,
+    MIME_TYPE_APPLICATION_X_TROFF_MAN = 451,
+    MIME_TYPE_APPLICATION_X_TROFF_ME = 447,
+    MIME_TYPE_APPLICATION_X_TROFF_MS = 448,
+    MIME_TYPE_APPLICATION_X_USTAR = 433,
+    MIME_TYPE_APPLICATION_X_WAIS_SOURCE = 460,
+    MIME_TYPE_APPLICATION_ZIP = 18,
+
+    MIME_TYPE_AUDIO_32KADPCM = 67,
+    MIME_TYPE_AUDIO_BASIC = 13,
+    MIME_TYPE_AUDIO_DAT12 = 395,
+    MIME_TYPE_AUDIO_G_722_1 = 399,
+    MIME_TYPE_AUDIO_L16 = 390,
+    MIME_TYPE_AUDIO_L20 = 391,
+    MIME_TYPE_AUDIO_L24 = 392,
+    MIME_TYPE_AUDIO_MIDI = 394,
+    MIME_TYPE_AUDIO_MP4A_LATM = 407,
+    MIME_TYPE_AUDIO_MPA_ROBUST = 92,
+    MIME_TYPE_AUDIO_MPEG = 9,
+    MIME_TYPE_AUDIO_PARITYFEC = 78,
+    MIME_TYPE_AUDIO_PRS_SID = 47,
+    MIME_TYPE_AUDIO_TELEPHONE_EVENT = 162,
+    MIME_TYPE_AUDIO_TONE = 38,
+    MIME_TYPE_AUDIO_VND_CISCO_NSE = 132,
+    MIME_TYPE_AUDIO_VND_CNS_ANP1 = 108,
+    MIME_TYPE_AUDIO_VND_CNS_INF1 = 109,
+    MIME_TYPE_AUDIO_VND_DIGITAL_WINDS = 199,
+    MIME_TYPE_AUDIO_VND_EVERAD_PLJ = 145,
+    MIME_TYPE_AUDIO_VND_LUCENT_VOICE = 180,
+    MIME_TYPE_AUDIO_VND_NORTEL_VBK = 146,
+    MIME_TYPE_AUDIO_VND_NUERA_ECELP4800 = 236,
+    MIME_TYPE_AUDIO_VND_NUERA_ECELP7470 = 237,
+    MIME_TYPE_AUDIO_VND_NUERA_ECELP9600 = 238,
+    MIME_TYPE_AUDIO_VND_OCTEL_SBC = 133,
+    MIME_TYPE_AUDIO_VND_QCELP = 79,
+    MIME_TYPE_AUDIO_VND_RHETOREX_32KADPCM = 269,
+    MIME_TYPE_AUDIO_VND_VMX_CVSD = 110,
+    MIME_TYPE_AUDIO_X_AIFF = 398,
+    MIME_TYPE_AUDIO_X_MPEGURL = 408,
+    MIME_TYPE_AUDIO_X_PN_REALAUDIO = 439,
+    MIME_TYPE_AUDIO_X_REALAUDIO = 420,
+    MIME_TYPE_AUDIO_X_WAV = 396,
+
+    MIME_TYPE_CHEMICAL_X_PDB = 403,
+    MIME_TYPE_CHEMICAL_X_XYZ = 404,
+
+    MIME_TYPE_IMAGE_BMP = 393,
+    MIME_TYPE_IMAGE_CGM = 34,
+    MIME_TYPE_IMAGE_G3FAX = 42,
+    MIME_TYPE_IMAGE_GIF = 7,
+    MIME_TYPE_IMAGE_IEF = 35,
+    MIME_TYPE_IMAGE_JPEG = 10,
+    MIME_TYPE_IMAGE_NAPLPS = 43,
+    MIME_TYPE_IMAGE_PNG = 8,
+    MIME_TYPE_IMAGE_PRS_BTIF = 68,
+    MIME_TYPE_IMAGE_PRS_PTI = 48,
+    MIME_TYPE_IMAGE_TIFF = 11,
+    MIME_TYPE_IMAGE_VND_CNS_INF2 = 111,
+    MIME_TYPE_IMAGE_VND_DJVU = 405,
+    MIME_TYPE_IMAGE_VND_DWG = 49,
+    MIME_TYPE_IMAGE_VND_DXF = 50,
+    MIME_TYPE_IMAGE_VND_FASTBIDSHEET = 181,
+    MIME_TYPE_IMAGE_VND_FPX = 51,
+    MIME_TYPE_IMAGE_VND_FST = 52,
+    MIME_TYPE_IMAGE_VND_FUJIXEROX_EDMICS_MMR = 303,
+    MIME_TYPE_IMAGE_VND_FUJIXEROX_EDMICS_RLC = 304,
+    MIME_TYPE_IMAGE_VND_MIX = 53,
+    MIME_TYPE_IMAGE_VND_NET_FPX = 102,
+    MIME_TYPE_IMAGE_VND_SVF = 54,
+    MIME_TYPE_IMAGE_VND_WAP_WBMP = 112,
+    MIME_TYPE_IMAGE_VND_XIFF = 69,
+    MIME_TYPE_IMAGE_X_CMU_RASTER = 427,
+    MIME_TYPE_IMAGE_X_PORTABLE_ANYMAP = 452,
+    MIME_TYPE_IMAGE_X_PORTABLE_BITMAP = 453,
+    MIME_TYPE_IMAGE_X_PORTABLE_GRAYMAP = 459,
+    MIME_TYPE_IMAGE_X_PORTABLE_PIXMAP = 454,
+    MIME_TYPE_IMAGE_X_RGB = 397,
+    MIME_TYPE_IMAGE_X_XBITMAP = 409,
+    MIME_TYPE_IMAGE_X_XPIXMAP = 410,
+    MIME_TYPE_IMAGE_X_XWINDOWDUMP = 434,
+
+    MIME_TYPE_MESSAGE_DELIVERY_STATUS = 200,
+    MIME_TYPE_MESSAGE_DISPOSITION_NOTIFICATION = 328,
+    MIME_TYPE_MESSAGE_EXTERNAL_BODY = 28,
+    MIME_TYPE_MESSAGE_HTTP = 14,
+    MIME_TYPE_MESSAGE_NEWS = 44,
+    MIME_TYPE_MESSAGE_PARTIAL = 19,
+    MIME_TYPE_MESSAGE_RFC822 = 15,
+    MIME_TYPE_MESSAGE_S_HTTP = 16,
+
+    MIME_TYPE_MODEL_IGES = 39,
+    MIME_TYPE_MODEL_MESH = 40,
+    MIME_TYPE_MODEL_VND_DWF = 55,
+    MIME_TYPE_MODEL_VND_FLATLAND_3DML = 201,
+    MIME_TYPE_MODEL_VND_GDL = 56,
+    MIME_TYPE_MODEL_VND_GS_GDL = 93,
+    MIME_TYPE_MODEL_VND_GTW = 57,
+    MIME_TYPE_MODEL_VND_MTS = 58,
+    MIME_TYPE_MODEL_VND_PARASOLID_TRANSMIT_BINARY = 481,
+    MIME_TYPE_MODEL_VND_PARASOLID_TRANSMIT_TEXT = 479,
+    MIME_TYPE_MODEL_VND_VTU = 59,
+    MIME_TYPE_MODEL_VRML = 41,
+
+    MIME_TYPE_MULTIPART_ALTERNATIVE = 29,
+    MIME_TYPE_MULTIPART_APPLEDOUBLE = 163,
+    MIME_TYPE_MULTIPART_BYTERANGES = 27,
+    MIME_TYPE_MULTIPART_DIGEST = 22,
+    MIME_TYPE_MULTIPART_ENCRYPTED = 26,
+    MIME_TYPE_MULTIPART_FORM_DATA = 134,
+    MIME_TYPE_MULTIPART_HEADER_SET = 147,
+    MIME_TYPE_MULTIPART_MIXED = 20,
+    MIME_TYPE_MULTIPART_PARALLEL = 25,
+    MIME_TYPE_MULTIPART_RELATED = 103,
+    MIME_TYPE_MULTIPART_REPORT = 94,
+    MIME_TYPE_MULTIPART_SIGNED = 23,
+    MIME_TYPE_MULTIPART_VOICE_MESSAGE = 202,
+
+    MIME_TYPE_TEXT_CALENDAR = 60,
+    MIME_TYPE_TEXT_CSS = 4,
+    MIME_TYPE_TEXT_DIRECTORY = 70,
+    MIME_TYPE_TEXT_ENRICHED = 61,
+    MIME_TYPE_TEXT_HTML = 0,
+    MIME_TYPE_TEXT_PARITYFEC = 71,
+    MIME_TYPE_TEXT_PLAIN = 1,
+    MIME_TYPE_TEXT_PRS_LINES_TAG = 113,
+    MIME_TYPE_TEXT_RFC822_HEADERS = 135,
+    MIME_TYPE_TEXT_RICHTEXT = 62,
+    MIME_TYPE_TEXT_RTF = 5,
+    MIME_TYPE_TEXT_SGML = 36,
+    MIME_TYPE_TEXT_T140 = 37,
+    MIME_TYPE_TEXT_TAB_SEPARATED_VALUES = 239,
+    MIME_TYPE_TEXT_URI_LIST = 63,
+    MIME_TYPE_TEXT_VND_ABC = 45,
+    MIME_TYPE_TEXT_VND_CURL = 64,
+    MIME_TYPE_TEXT_VND_DMCLIENTSCRIPT = 203,
+    MIME_TYPE_TEXT_VND_FLATLAND_3DML = 449,
+    MIME_TYPE_TEXT_VND_FLY = 46,
+    MIME_TYPE_TEXT_VND_FMI_FLEXSTOR = 164,
+    MIME_TYPE_TEXT_VND_IN3D_3DML = 115,
+    MIME_TYPE_TEXT_VND_IN3D_SPOT = 116,
+    MIME_TYPE_TEXT_VND_IPTC_NEWSML = 148,
+    MIME_TYPE_TEXT_VND_IPTC_NITF = 114,
+    MIME_TYPE_TEXT_VND_LATEX_Z = 95,
+    MIME_TYPE_TEXT_VND_MOTOROLA_REFLEX = 220,
+    MIME_TYPE_TEXT_VND_MS_MEDIAPACKAGE = 221,
+    MIME_TYPE_TEXT_VND_WAP_SI = 80,
+    MIME_TYPE_TEXT_VND_WAP_SL = 81,
+    MIME_TYPE_TEXT_VND_WAP_WML = 96,
+    MIME_TYPE_TEXT_VND_WAP_WMLSCRIPT = 182,
+    MIME_TYPE_TEXT_XML = 6,
+    MIME_TYPE_TEXT_XML_EXTERNAL_PARSED_ENTITY = 321,
+    MIME_TYPE_TEXT_X_SETEXT = 400,
+
+    MIME_TYPE_VIDEO_MP4V_ES = 401,
+    MIME_TYPE_VIDEO_MPEG = 12,
+    MIME_TYPE_VIDEO_PARITYFEC = 82,
+    MIME_TYPE_VIDEO_POINTER = 65,
+    MIME_TYPE_VIDEO_QUICKTIME = 21,
+    MIME_TYPE_VIDEO_VND_FVT = 66,
+    MIME_TYPE_VIDEO_VND_MOTOROLA_VIDEO = 222,
+    MIME_TYPE_VIDEO_VND_MOTOROLA_VIDEOP = 240,
+    MIME_TYPE_VIDEO_VND_MPEGURL = 104,
+    MIME_TYPE_VIDEO_VND_MTS = 402,
+    MIME_TYPE_VIDEO_VND_NOKIA_INTERLEAVED_MULTIMEDIA = 368,
+    MIME_TYPE_VIDEO_VND_VIVO = 72,
+    MIME_TYPE_VIDEO_X_MSVIDEO = 411,
+    MIME_TYPE_VIDEO_X_SGI_MOVIE = 421,
+
+    MIME_TYPE_X_CONFERENCE_X_COOLTALK = 455,
+
+    MIME_TYPE_UNKNOWN_UNKNOWN = -1
+};
+
+/* returns string representation of mime type */
+const char *mime_string(enum mime_types mtype);
+
+/* determine which toplevel-type a given mimetype is */
+enum mime_top_types mime_top_type(enum mime_types mtype);
+
+/* attempts to hueristically identify MIME types by content, 
+ * returns MIME_TYPE_APPLICATION_OCTET_STREAM if unable to do 
+ * so. */
+enum mime_types mime_content_guess(const void *buf, unsigned int len);
+
+/* returns the mime type indicated by the provided string.  
+ * This function probably needs to be turned 
+ * into an object accepting a stream at some stage. */
+enum mime_types mime_type(const char *str);
+
+#ifdef _cplusplus
+}
+#endif
+          
+#endif
+
diff --git a/src/include/mlparse.h b/src/include/mlparse.h
new file mode 100644 (file)
index 0000000..b870cf3
--- /dev/null
@@ -0,0 +1,231 @@
+/* mlparse.h declares a parser that parses SGML and XML based markup languages 
+ * in a basic way
+ *
+ * SGML is defined in ISO 8879:1986, although you're probably already familiar
+ * with (a subset of) it as the basis of HTML.  There is an informative book by
+ * Charles Goldfarb (the 'G' in SGML, sort-of) entitled 'The SGML Handbook'
+ * which contains the full text of the standard as well as annotations,
+ * commentry and other material.  The BNF productions of SGML could be found
+ * (last i checked) by searching for 'sgml productions' on the web.
+ *
+ * XML is defined in the W3C recommendation, found at 
+ * http://www.w3.org/TR/REC-xml/.  It was designed to be compatible with SGML,
+ * but far simpler (thank god!)
+ *
+ * short glossary:
+ *   - tag: <name param=pval ... > construct, basic unit of markup, where 'name'
+ *     identifies the type of tag that it is
+ *   - param: parameter name within a tag (shown above)
+ *   - pval: parameter value within a tag (shown above)
+ *   - eref: entity reference, indirect reference to some text 
+ *     (i.e. &amp; == '&')
+ *   - marked section: obscure <![ label [ ... ]]> construct, where label is
+ *     CDATA, RCDATA, IGNORE, INCLUDE or TEMP
+ *   - declaration, decl: <!declaration ...> construct, like a tag with the 
+ *     name starting with '!' (although thats over simplification)
+ *
+ * The parser attempts to extract entities (tags, comments, marked sections and
+ * other data) from SGML-like data.  HTML and numeric entity references are
+ * recognised and replaced with the relevant text.  Non-markup data is seperated
+ * by tokenising it into words and whitespace, where a word is delimited by
+ * whitespace, but contains at most two consecutive punctuation marks (so 'wo
+ * rd' == wo, rd, 'wo.rd' == word and 'wo..rd' == wo, rd).  If a word exceeds
+ * the wordlen (and hence the buffer space provided) specified, it is returned
+ * in as many different chunks as necessary, with a flag set to indicate that
+ * this has occurred.  If stripping is requested, the parser will remove all 
+ * punctuation from the words, and will 
+ * case-fold uppercase letters to lowercase if CASE_FOLD is defined (see def.h).
+ * Whitespace is not returned when stipping is enabled, and neither are words 
+ * where the entire content has been stripped (note that this means you may get 
+ * different word counts for stripping and non-stripping operation).  Control
+ * characters are removed from the output stream regardless of whether stripping
+ * is enabled, as they don't really make any sense under non-obscure character
+ * encodings (which we make no attempt to deal with).  Sentence ending 
+ * punctuation ('.', '?' or '!') followed by whitespace is counted as 
+ * the end of a sentence and is indicated in the return value (see below).  
+ * This is so that phrase matching can avoid matches over sentence/paragraph 
+ * boundaries.  An exception to this rule is if the word looks like an acronym 
+ * (i.e. U.S.), which the parser recognises by looking for words with capital 
+ * letters only with every second letter a period ('.').  These hueristics
+ * aren't perfect, but they cover the majority of observed cases.
+ *
+ * Declarations and marked sections other than CDATA aren't currently
+ * recognised, although most declarations will be returned as tags.  Parmeter
+ * entity references are also not supported.  There is no reason other than 
+ * the time and effort involved why these things couldn't be supported.  Some 
+ * hueristics are applied when detecting comments, tags and CDATA sections 
+ * (primarily looking ahead in the text for the corresponding end 
+ * tag/comment/section).  This is useful when parsing dirty HTML, which 
+ * can contain any number of nasty surprises like this.  The parser tries to 
+ * err on the side of *not* recognising tags and comments, in which case they 
+ * will be returned as words.
+ *
+ * Parameters and parameter values occurring within tags are treated like words
+ * and are returned in whitespace delimited words (with only two consecutive
+ * punctuation marks), although subject to parameter delimiters as well.  No end
+ * of sentence processing is performed.  Stripping is performed if requested,
+ * although some characters are stripped out of parameter names and
+ * whitespace delimited values, since they are illegal in SGML/XML.  Entity
+ * references are recognised within (double-)quote delimited values.  Bear in
+ * mind that SGML allows parameter values to appear like parameter names so long
+ * as the context is unambiguous (i.e. <p center> where the full tag is 
+ * <p align='center'>) so you may have to be prepared to interpret parameters as
+ * parameter values.
+ *
+ * Comments must be XML comments (<!-- ... --> whereas SGML allows -- to open
+ * and close comments anywhere within a declaration 
+ * (i.e. <!decl -- SGML, but not XML comment -- >).  Data within comments or
+ * CDATA section (<![ CDATA [ cdata section data ]]>) are broken into words the
+ * same as parameter values, except that no markup (entity references) is 
+ * recognised within them.  SGML CDATA sections are supposed to nest, but the
+ * parser doesn't allow this.
+ *
+ * Known bugs and quirks:
+ *   - mlparse_eof may have to be called multiple times
+ *   - mlparse_eof can *only* be called when the parser has returned
+ *     MLPARSE_INPUT
+ *   - CDATA sections don't nest
+ *   - TEMP, RCDATA, INCLUDE and IGNORE sections aren't recognised
+ *   - SGML declarations aren't handled properly (which also affects comments)
+ *   - <!> comments (yes, SGML says that this is an empty comment) is returned
+ *     as tag '!'
+ *   - removing extended character set to cut down on the produced vocabulary
+ *     (proper handling of the extended character set requires recognising
+ *     punctuation and so on in it, which is beyond what i'm currently willing
+ *     to do)
+ *
+ * Note: mlparse doesn't handle extremely short word lengths (i.e. 4 characters
+ * or less) very well, so i suggest you make word length a reasonable amount.
+ *
+ * written nml 2003-03-15
+ *
+ */
+
+#ifndef MLPARSE_H
+#define MLPARSE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* possible return values from mlparse_parse.  Explanation:
+ *
+ *    ERR: something bad and unexpected happened.  Contact the developers,
+ *    including the text that caused this error and output of mlparse_err_line.
+ *
+ *    INPUT: more input is required before the parser can proceed.  Always
+ *    returned by itself.
+ *
+ *    EOF: hit the end of the file.
+ *
+ *    TAG: got an SGML tag.  word now contains the name of
+ *    the element.  self ending tags (i.e. <p/>) are detected and correctly 
+ *    returned as, in this case, </p>, after the parameters have been processed.
+ *
+ *    WORD: got a word, which has been copied into the word buffer.  It 
+ *    shouldn't be empty but may contain some markup characters if the parser
+ *    couldn't make sense of it.  
+ *
+ *    PARAM: got a parameter in a structural element, which has been
+ *    copied into the word buffer.  It should only happen
+ *    after a TAG, after which zero or more PARAMs may occur.  May actually be a
+ *    paramval, since in SGML you can't tell without understanding the DTD.
+ *
+ *    PARAMVAL: got a parameter value, which has now been copied into
+ *    the word buffer.  It should only occur after a PARAM,
+ *    after which zero or more PARAMVALs may occur.  
+ *
+ *    COMMENT: received a comment start or end.  Comments contain zero or more 
+ *    WORDs and WHITESPACE tokens.
+ *
+ *    CDATA: received a cdata section start or end.   CDATA sections contain
+ *    zero or more WORDSs and WHITESPACE tokens.
+ *
+ *    WHITESPACE: received some whitespace (only returned if not stripping)
+ * 
+ *    OK: only used in utility functions (not _parse), indicates success
+ *
+ *    FLAGS:
+ * 
+ *      END: indicates that the end of an entity was reached.  With COMMENT
+ *      or CDATA means end of the comment/cdata section.  With WORD means the
+ *      end of the sentence.  Shouldn't be returned with anything else.
+ *
+ *      CONT: indicates that the entity overflowed the provided buffer, and that
+ *      only the first section has been copied into the word buffer.  The rest
+ *      of the entity should follow.  Should be returned only with things that
+ *      return stuff in the buffer (word, whitespace, param, paramval, tag).
+ *
+ */
+enum mlparse_ret {
+    MLPARSE_ERR = 0, 
+    MLPARSE_OK = (10 << 2),
+
+    /* flags */
+    MLPARSE_CONT = 1,
+    MLPARSE_END = 2, 
+
+    /* need input */
+    MLPARSE_INPUT = (1 << 2),
+
+    /* entities */
+    MLPARSE_TAG = (2 << 2), 
+    MLPARSE_WORD = (3 << 2), 
+    MLPARSE_PARAM = (4 << 2), 
+    MLPARSE_PARAMVAL = (5 << 2), 
+    MLPARSE_COMMENT = (6 << 2), 
+    MLPARSE_WHITESPACE = (7 << 2),
+    MLPARSE_CDATA = (8 << 2),
+
+    MLPARSE_EOF = (9 << 2)
+};
+
+struct mlparse {
+    const char *next_in;                 /* next input buffer */
+    unsigned int avail_in;               /* how much data is in input buffer */
+    struct mlparse_state *state;         /* internal parser state */
+};
+
+/* create a new parser that breaks entities up into chunks of size wordlen, and
+ * looks at most lookahead characters ahead to validate entities.  (the parser
+ * will use approximately 2 * wordlen + 2 * lookahead bytes of RAM) */
+int mlparse_new(struct mlparse *space, unsigned int wordlen, 
+  unsigned int lookahead);
+
+/* clear parser state */
+void mlparse_reinit(struct mlparse *parser);
+
+/* return the next entity from the file (see comment about return
+ * types above).  Word buffer must be at least size wordlen and is not NUL
+ * terminated on return.  length indicates how large the returned entity was.
+ * strip is boolean as to whether you would like the next entity returned
+ * stripped of some characters and whitespace (see header comment).  strip and 
+ * the word buffer must be preserved across calls of mlparse_parse where the 
+ * return value is MLPARSE_INPUT, or else you'll get junk out.  If 
+ * MLPARSE_INPUT is returned and you've hit the end of the file you are 
+ * parsing, call mlparse_eof. */
+int mlparse_parse(struct mlparse *parser, char *word, unsigned int *length, 
+  int strip);
+
+/* indicate to the parser that end of file has occurred.  Must be called
+ * immediately after mlparse_parse has returned MLPARSE_INPUT. */
+void mlparse_eof(struct mlparse *parser);
+
+/* destroy the parser */
+void mlparse_delete(struct mlparse *parser);
+
+/* return the number of bytes buffered in the parser (so you can tell how many
+ * bytes have been parsed at any given point) */
+unsigned long int mlparse_buffered(struct mlparse *parser);
+
+/* returns a pointer into the internal buffer of the parser */
+const char *mlparse_buffer(struct mlparse *parser);
+
+unsigned int mlparse_err_line(struct mlparse *parser);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/mlparse_wrap.h b/src/include/mlparse_wrap.h
new file mode 100644 (file)
index 0000000..1ea3c06
--- /dev/null
@@ -0,0 +1,58 @@
+/* mlparse_wrap.h declares a module that wraps the mlparse module with some 
+ * convenience code that takes care of buffering and IO
+ *
+ * written nml 2004-05-13
+ *
+ */
+
+#ifndef MLPARSE_WRAP_H
+#define MLPARSE_WRAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mlparse.h"
+
+#include <stdio.h>
+
+struct mlparse_wrap;
+
+/* create a wrapper from an fd, using bufsize allocated space for buffering.
+ * Limit specifies how much to read (or 0 for no limit) */
+struct mlparse_wrap *mlparse_wrap_new_fd(unsigned int wordlen, 
+  unsigned int lookahead, int fd, unsigned int bufsize, unsigned int limit);
+
+/* create a wrapper from a file pointer, using bufsize allocated space for 
+ * buffering.  Limit specifies how much to read (or 0 for no limit) */
+struct mlparse_wrap *mlparse_wrap_new_file(unsigned int wordlen, 
+  unsigned int lookahead, FILE *fp, unsigned int bufsize, unsigned int limit);
+
+/* reinitialise an mlparse_wrapper to read from a different fd, with a different
+ * byte limit */
+void mlparse_wrap_reinit_fd(struct mlparse_wrap *wrapper, int fd, 
+  unsigned int limit);
+
+/* reinitialise an mlparse_wrapper to read from a different file pointer, with 
+ * a different byte limit */
+void mlparse_wrap_reinit_file(struct mlparse_wrap *wrapper, FILE *fp, 
+  unsigned int limit);
+
+/* get next entity from the parser.  Returns the same things as
+ * mlparse_parse, except that MLPARSE_INPUT returns will be
+ * intercepted and dealt with */
+enum mlparse_ret mlparse_wrap_parse(struct mlparse_wrap *wrapper, 
+  char *buf, unsigned int *len, int strip);
+
+/* return the number of bytes parsed thus far */
+unsigned int mlparse_wrap_bytes(struct mlparse_wrap *wrapper);
+
+/* delete the wrapper */
+void mlparse_wrap_delete(struct mlparse_wrap *wrapper);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/objalloc.h b/src/include/objalloc.h
new file mode 100644 (file)
index 0000000..e736f58
--- /dev/null
@@ -0,0 +1,94 @@
+/* objalloc.h declares an interface to an object that quickly allocates objects 
+ * of the same size from a common memory pool.  The object also has various
+ * debugging features, including integration with valgrind
+ * (http://valgrind.kde.org/)
+ *
+ * written nml 2004-08-30
+ *
+ */
+
+#ifndef OBJALLOC_H
+#define OBJALLOC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "alloc.h"
+
+struct objalloc;
+
+/* create a new object allocator, which allocates chunks of memory of size
+ * size from the alloc allocator, that are aligned on an address divisible by
+ * align.  An alignment of 0 returns objects suitable for anything on this
+ * architecture.  A redzone of at least redzone bytes is 
+ * placed before and after each object allocated from this allocator.  
+ * The underlying allocation mechanism is used to allocate bulkalloc bytes at 
+ * a time (can be rounded up if its too small).  
+ * If alloc is NULL the system allocation functions (malloc, free) are used */
+struct objalloc *objalloc_new(unsigned int size, unsigned int align, 
+  unsigned int redzone, unsigned int bulkalloc, const struct alloc *alloc);
+    
+/* delete an object allocator, freeing all memory utilised by it, regardless of
+ * whether it is being used or not.  Note that outstanding allocations will be
+ * reported by valgrind as leaks unless you call objalloc_clear first. */
+void objalloc_delete(struct objalloc *alloc);
+
+/* allocate an object from the allocator.  the call will fail if size is
+ * greater than the size of object this allocator can allocate.  Otherwise
+ * returns a pointer to the memory on success.  Note that all allocations
+ * occupy the number of bytes specified in the constructor, regardless of how
+ * small size is here */
+void *objalloc_malloc(struct objalloc *alloc, unsigned int size);
+
+/* free a prior allocation, after which ptr is no longer valid. */
+void objalloc_free(struct objalloc *alloc, void *ptr);
+
+/* reallocate an object which has been previously allocated to be of size size.
+ * Will return a pointer to the new location of the allocation on success, and
+ * NULL on failure (which will occur if size is greater than the size specified
+ * in the constructor).  Will free the given allocation if the given size is 0,
+ * and will return a new allocation if the given pointer is NULL and size is
+ * greater than 0 (same semantics as relloc(3)). */
+void *objalloc_realloc(struct objalloc *alloc, void *ptr, unsigned int size);
+
+/* return all allocated memory to this allocator (but doesn't return the memory
+ * to the underlying alloctor though, see _drain below for that) */
+void objalloc_clear(struct objalloc *alloc);
+
+/* return as much memory as possible to the underlying memory allocator */
+void objalloc_drain(struct objalloc *alloc);
+
+/* returns the number of allocations currently active */
+unsigned int objalloc_allocated(struct objalloc *alloc);
+
+/* ensure that at least enough space is available to allocate reserve objects
+ * without failure.  Value returned is the minimum number of allocations 
+ * available without possible failure, and should be greater than or equal to
+ * reserve if the call succeeded. */
+unsigned int objalloc_reserve(struct objalloc *alloc, unsigned int reserve);
+
+/* returns 1 if the given pointer is an object allocated from this allocator, 0
+ * otherwise.  This is not a particularly efficient operation, so don't rely on
+ * it being fast (intended for debugging purposes).  It can also return false
+ * positives if you pass it pointers that lie between valid objects. */
+int objalloc_is_managed(struct objalloc *alloc, void *ptr);
+
+/* returns size of objects allocated */
+unsigned int objalloc_objsize(struct objalloc *obj);
+
+/* overhead on first block allocated */
+unsigned int objalloc_overhead_first();
+
+/* overhead on blocks after first allocated */
+unsigned int objalloc_overhead();
+
+/* returns the amount of memory held by the allocator */
+unsigned int objalloc_memsize();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/poolalloc.h b/src/include/poolalloc.h
new file mode 100644 (file)
index 0000000..c3538a7
--- /dev/null
@@ -0,0 +1,81 @@
+/* poolalloc.h declares an interface to an object that quickly allocates memory
+ * from a common pool.  The pool allocator does not reuse free'd memory, so
+ * memory consumption will grow until you delete or clear the pool.  This makes
+ * it suitable for allocating a set of entities quickly from a common pool and
+ * then free'ing them all at once.  The pool allocator also supports a number 
+ * of debugging features, including integration with valgrind.
+ * (http://valgrind.kde.org/)
+ *
+ * written nml 2004-09-02
+ *
+ */
+
+#ifndef POOLALLOC_H
+#define POOLALLOC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "alloc.h"
+
+struct poolalloc;
+
+/* create a new pool allocator, which requests memory in chunks of at least
+ * bulkalloc size from the alloc allocator.  
+ * It will request larger chunks of memory in response to
+ * requests that can't be satisfied any other way, or if you specify a size
+ * that is too small to support normal operation.  A redzone of at least 
+ * redzone bytes is placed before and after each object allocated from this 
+ * allocator.  If alloc_opaque, mallocfn and freefn are NULL, system malloc/free
+ * are used. */
+struct poolalloc *poolalloc_new(unsigned int redzone, unsigned int bulkalloc, 
+  const struct alloc *alloc);
+
+/* delete a pool allocator, freeing all memory utilised by it, regardless of
+ * whether it is being used or not */
+void poolalloc_delete(struct poolalloc *pool);
+
+/* allocate some memory of at least size size from the allocator.  Returns a
+ * pointer to the memory on success and NULL on failure. */
+void *poolalloc_malloc(struct poolalloc *pool, unsigned int size);
+
+/* free a prior allocation, after which ptr is no longer valid. */
+void poolalloc_free(struct poolalloc *pool, void *ptr);
+
+/* allocate some memory that is aligned on a boundary evenly divisible by
+ * align.  0 is taken to mean no alignment requirement.  align is assumed to be
+ * a power of two */
+void *poolalloc_memalign(struct poolalloc *pool, unsigned int size, 
+  unsigned int align);
+
+/* no realloc because otherwise we'd have to track how large memory allocations
+ * are */
+
+/* return all allocated memory to this allocator (but doesn't return the memory
+ * to the underlying alloctor though, see _drain below for that) */
+void poolalloc_clear(struct poolalloc *pool);
+
+/* return as much memory as possible to the underlying memory allocator.  Note
+ * that due to the nature of the allocator (free'd memory isn't reused),
+ * _drain()ing will do nothing unless you've first _clear()'d the pool. */
+void poolalloc_drain(struct poolalloc *pool);
+
+/* returns the number of allocations currently active */
+unsigned int poolalloc_allocated(struct poolalloc *pool);
+
+/* returns 1 if the given pointer was allocated from this allocator, 0
+ * otherwise.  This is not a particularly efficient operation, so don't rely on
+ * it being fast (intended for debugging purposes). */
+int poolalloc_is_managed(struct poolalloc *pool, void *ptr);
+
+/* memory overhead of the first and subsequent chunks allocated */
+unsigned int poolalloc_overhead_first();
+unsigned int poolalloc_overhead();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/postings.h b/src/include/postings.h
new file mode 100644 (file)
index 0000000..2cfbab2
--- /dev/null
@@ -0,0 +1,104 @@
+/* postings.h declares a structure that accumulates encoded terms and
+ * vectors (a postings list) and then dumps them to a file for merging
+ *
+ * if you didn't understand that you need to read up on search
+ * engines, inverted (postings) lists 
+ *
+ * this postings list generates postings in a form that is
+ * compatible with merger.[ch]
+ *
+ * based on code written by Hugh Williams
+ *
+ * written nml 2003-03-9
+ *
+ */
+
+#ifndef POSTINGS_H
+#define POSTINGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* users of postings should note that to add to the postings, you must
+ * now use the sequence (adddoc(), addword()*, update())*, dump() to
+ * get sensible postings out */
+
+struct postings;
+struct vec;
+struct stop;
+
+/* structure to allow returning of statistics from update.  More per
+ * document stats can easily be added and calculated */
+struct postings_docstats {
+    float weight;                      /* vector space length of document */
+    unsigned int terms;                /* number of terms in document */
+    unsigned int distinct;             /* number of distinct terms in document*/
+};
+
+/* constructor, creates a new (empty) postings list.  tablesize is
+ * the size of the hashtable to create.  stem and opaque define the stemming to
+ * be used, where both can be NULL (for no stemming).  stop is the build-time
+ * stoplist to be used, or NULL for none. */
+struct postings* postings_new(unsigned int tablesize, 
+  void (*stem)(void *opaque, char *term), void *opaque, struct stop *list);
+
+/* remove a postings structure */
+void postings_delete(struct postings *post);
+
+/* add a document to the postings list.  All subsequent words added
+ * will be added to this document.  If addword is called prior to this
+ * function, it will add to document 0 */
+void postings_adddoc(struct postings *post, unsigned long int docno);
+
+/* a reference to a word in a document, identified by term, wordno and docno
+ * respectively.  Returns true on success and 0 on failure. vocab is a pointer
+ * to the current vocabulary, can be NULL, and is used to look up the last docno
+ * encoded for this word.  Note that the term will be stemmed in this function
+ * if needed. */
+int postings_addword(struct postings *post, char *term, 
+  unsigned long int wordno);
+
+/* whether postings list needs an update */
+int postings_needs_update(struct postings *post);
+
+/* add the current document to the accumulated postings.  Note that
+ * this action must be taken prior to a new adddoc or dump. */
+int postings_update(struct postings *post, struct postings_docstats *stats);
+
+/* dump the postings to a file, returning true on success and 0 on
+ * failure */
+int postings_dump(struct postings *post, void *buf, unsigned int bufsize, 
+  int fd);
+
+/* remove all postings from the postings list */
+void postings_clear(struct postings *post);
+
+/* return the size of the postings held in memory */
+unsigned int postings_size(struct postings *post);
+
+/* return the size of the total postings structure in memory */
+unsigned int postings_memsize(struct postings *post);
+
+/* returns the last error encountered by the postings list, or 0 */
+int postings_err(struct postings *post);
+
+/* returns the number of terms that have accumulated postings */
+unsigned int postings_distinct_terms(struct postings *post);
+
+/* returns the number of total terms that have been recorded */
+unsigned int postings_total_terms(struct postings *post);
+
+/* returns the number of documents in the postings */
+unsigned int postings_documents(struct postings *post);
+
+/* returns a vector for a given word.  Remember to stem (if required) term
+ * before passing it to this function. */
+struct vec *postings_vector(struct postings *post, char *term);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/psettings.h b/src/include/psettings.h
new file mode 100644 (file)
index 0000000..668585c
--- /dev/null
@@ -0,0 +1,119 @@
+/* psettings.h declares an interface to an object that encapsulates parser
+ * settings.  
+ *
+ * A useful improvement might be to improve the parsing to handle tree
+ * structured documents properly (particularly with implicit end-tags).  
+ * Ultimately this has to be done as part of the HTML parser, since it requires
+ * a stack and other things.  However, some stuff could be done using 
+ * an additive/subtractive model of psettings.
+ *
+ * written nml 2004-08-09
+ *
+ */
+
+#ifndef PSETTINGS_H
+#define PSETTINGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <limits.h>
+
+#include "mime.h"
+
+/* attributes and indexes */
+
+enum psettings_attr {
+    /* note that these attributes are all mutually exclusive */
+    PSETTINGS_ATTR_DOCEND = (1 << 1),   /* tag denotes the start/end of a 
+                                         * document.  This attribute is
+                                         * different than the others, because
+                                         * its information about the tag itself,
+                                         * not the text following the tags. */
+    PSETTINGS_ATTR_INDEX = (1 << 0),    /* tag content should be indexed */
+    PSETTINGS_ATTR_ID = (1 << 2),       /* tag content should be treated as 
+                                         * the document identifier */
+    PSETTINGS_ATTR_CHECKBIN = (1 << 3), /* tag content should be hueristically 
+                                         * checked to see if it is binary 
+                                         * content, and indexed if not.  If so,
+                                         * it should be skipped.  This is really
+                                         * just here so we can skip some of the
+                                         * crap in the TREC collections, so it's
+                                         * pretty hacky by nature. */
+    PSETTINGS_ATTR_POP = (1 << 4),      /* return to the state before the 
+                                         * previous change */
+    PSETTINGS_ATTR_NOOP = (1 << 5),     /* don't alter the state */
+    PSETTINGS_ATTR_OFF_END = (1 << 6),  /* don't index anything until the 
+                                         * corresponding end tag has been 
+                                         * processed (this is pretty much a 
+                                         * hack to get backward compatibility 
+                                         * with the previous parsing setup) */
+    PSETTINGS_ATTR_FLOW = (1 << 7),     /* this attribute indicates that text 
+                                         * can continue to flow 'through' the 
+                                         * tag */
+    PSETTINGS_ATTR_TITLE = (1 << 8)     /* indicates the start of a title */
+};
+
+enum psettings_ret {
+    PSETTINGS_OK = 0,
+    PSETTINGS_ENOMEM = -ENOMEM,
+    PSETTINGS_EEXIST = -EEXIST,
+    PSETTINGS_EINVAL = -EINVAL,
+    PSETTINGS_ETOOBIG = INT_MIN
+};
+
+struct psettings;
+struct psettings_type;
+
+/* create a new psettings object */
+struct psettings *psettings_new(enum psettings_attr def);
+
+/* read a new psettings object from a file */
+struct psettings *psettings_read(FILE *file, enum psettings_attr def);
+
+/* delete a psettings object */
+void psettings_delete(struct psettings *pset);
+
+/* set the attributes associated with a tag */
+enum psettings_ret psettings_set(struct psettings *pset, enum mime_types type,
+  const char *tag, enum psettings_attr attr);
+
+/* set the default associated with a mime type */
+enum psettings_ret psettings_type_default(struct psettings *pset, 
+  enum mime_types type, enum psettings_attr def);
+
+/* get the attributes for a tag in a given mime type.  Defaults are returned if
+ * the tag isn't found. */
+enum psettings_attr psettings_find(struct psettings *pset, 
+  enum mime_types type, const char *tag);
+enum psettings_attr psettings_type_find(struct psettings *pset, 
+  struct psettings_type *type, const char *tag);
+
+/* get the set of tags for a given mime type */
+enum psettings_ret psettings_type_tags(struct psettings *pset, 
+  enum mime_types type, struct psettings_type **ptype);
+
+/* output c code to create a function psettings_new_default based on the
+ * contents of the current psettings object */
+enum psettings_ret psettings_write_code(struct psettings *pset, FILE *output);
+
+/* create a psettings object with default settings */
+struct psettings *psettings_new_default(enum psettings_attr def);
+
+/* returns the overall default setting from the given settings */
+enum psettings_attr psettings_default(struct psettings *pset);
+
+/* returns a boolean indication of whether the given type contains a tag that
+ * identifies each document (i.e. whether a tag in that type has 
+ * PSETTINGS_ATTR_ID).  Returns 0 for unknown types */
+int psettings_self_id(struct psettings *pset, enum mime_types type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/pyramid.h b/src/include/pyramid.h
new file mode 100644 (file)
index 0000000..077ba22
--- /dev/null
@@ -0,0 +1,68 @@
+/* pyramid.h declares an object which progressively merges a series of
+ * postings files together, until it performs a final merge.  This object used
+ * to be called merger.[ch], but i decided that pyramid described it better
+ * (implements a merging pyramid, whereas other code does the actual merging)
+ *
+ * based upon code originally by Hugh Williams (merge.[hc])
+ *
+ * written nml 2003-03-3
+ *
+ */
+
+#ifndef PYRAMID_H
+#define PYRAMID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    PYRAMID_OK = 0
+};
+
+struct pyramid;
+struct fdset;
+struct storagep;
+struct freemap;
+
+/* create a new merger pyramid, which performs a pyramid merge with width
+ * maxfiles. Files are accessed through the
+ * fdset, with fdset type number tmp_type for temporary files and type number
+ * final_type for final index files. */
+struct pyramid *pyramid_new(struct fdset *fds, unsigned int tmp_type,
+  unsigned int final_type, unsigned int vocab_type, unsigned int maxfiles, 
+  struct storagep *storagep, struct freemap *map, struct freemap *vocab_map);
+
+/* delete the pyramid object, deleting any temporary files created */
+void pyramid_delete(struct pyramid *pyramid);
+
+/* perform final merge, returning the number of files created, distinct and
+ * total terms merged and the btree root page file number and offset in *files,
+ * *dterms, *terms_high, *terms_low, *root_fileno and *root_offset respectively 
+ * on success (returns PYRAMID_OK on success, -errno on failure)  After calling 
+ * this method all further add_file calls will fail. */
+int pyramid_merge(struct pyramid *pyramid, unsigned int *files, 
+  unsigned int *vocabs, unsigned long int *dterms, unsigned int *terms_high, 
+  unsigned int *terms_low, unsigned int *root_fileno, 
+  unsigned long int *root_offset, void *buf, unsigned int bufsize);
+
+/* get an fd for the next file in the pyramid.  Returns -errno on failure. */
+int pyramid_pin_next(struct pyramid *pyramid);
+
+/* return an fd for the next file in the pyramid.  Returns -errno on failure */
+int pyramid_unpin_next(struct pyramid *pyramid, int fd);
+
+/* add another file to the merging process.  It is assumed that files
+ * are added in order of creation.  If a merge occurs it will use buffer buf of
+ * size bufsize to perform the merge.  Returns PYRAMID_OK on success and -errno
+ * on failure.  allow_merge specifies whether a merge is allowed to occur 
+ * (so you can prevent partial merges for the final file added and so on). */
+int pyramid_add_file(struct pyramid *pyramid, int allow_merge, void *buf, 
+  unsigned int bufsize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/queryparse.h b/src/include/queryparse.h
new file mode 100644 (file)
index 0000000..43729ff
--- /dev/null
@@ -0,0 +1,95 @@
+/* queryparse.h declares an interface for a parser that supports a
+ * google-like query syntax
+ *
+ * the supported syntax is:
+ *    - words and operators are seperated by whitespace
+ *    - words are returned with everything but alphanumeric, '-' and
+ *      extended characters removed.  Upper case characters are
+ *      converted to lowercase
+ *    - +word indicates that the word is to be included regardless of stopping
+ *    - -word indicates that results containing the word are to be excluded
+ *    - "a phrase" indicates that the contained words are to be treated as a 
+ *      phrase
+ *    - [mod:word1 word2] indicates that the query is to be modified by
+ *      mod, with parameters word1 and word2 (which will be
+ *      subsequently returned as words
+ *    - nesting of operators is not allowed
+ *    - round parentheses () are not allowed (particularly with boolean 
+ *      operators) to prevent queries of arbitrary complexity
+ *    - hueristic end-of-sentence detection is used while parsing phrases
+ *
+ * note that this parser must match the word parsing of the other
+ * parsers, that are used to parse documents (currently mlparse)
+ *
+ * written nml 2003-07-08
+ *
+ */
+
+#ifndef QUERYPARSE_H
+#define QUERYPARSE_H
+
+struct queryparse;
+
+enum queryparse_ret {
+    QUERYPARSE_ERR = 0,                    /* parser received an error */
+    QUERYPARSE_EOF = 1,                    /* parser received end-of-file */
+    QUERYPARSE_WORD = 2,                   /* parser received a word */
+    QUERYPARSE_WORD_NOSTOP = 3,            /* parser received a word that the 
+                                            * querier didn't want stopped */
+    QUERYPARSE_WORD_EXCLUDE = 4,           /* parser received a word that the 
+                                            * querier wants excluded from 
+                                            * results */
+    QUERYPARSE_OR = 5,                     /* parser received the OR operator */
+    QUERYPARSE_AND = 6,                    /* parser received the AND operator*/
+    QUERYPARSE_START_PHRASE = 7,           /* parser received the start of a 
+                                            * phrase */
+    QUERYPARSE_END_PHRASE = 8,             /* parser received the end of a 
+                                            * phrase */
+    QUERYPARSE_START_MODIFIER = 9,         /* parser received a query modifier*/
+    QUERYPARSE_END_MODIFIER = 10,          /* parser received the end of a query
+                                            * modifier */
+    QUERYPARSE_END_SENTENCE = 11           /* parser received the end of a 
+                                              sentence */
+};
+
+/* warnings */
+enum queryparse_warn {
+    QUERYPARSE_WARN_PARENS_BOOLEAN = (1 << 0),   /* warning: round parens used 
+                                                  * in fashion that looks like 
+                                                  * a boolean search attempt */
+    QUERYPARSE_WARN_PARENS_NESTED = (1 << 1),    /* warning: nested parens */
+    QUERYPARSE_WARN_PARENS_UNMATCHED = (1 << 2), /* warning: unmatched parens */
+    QUERYPARSE_WARN_QUOTES_UNMATCHED = (1 << 3), /* warning: unmatched quotes */
+    QUERYPARSE_WARN_EMPTY_OP = (1 << 4),         /* operator with empty param */
+    QUERYPARSE_WARN_NONWORD = (1 << 5)           /* warning: found sequence 
+                                                  * that wasn't a word*/
+};
+
+/* construct a new queryparser to parse query, which is of length
+ * querylen.  words will be limited to maxwordlen bytes */
+struct queryparse *queryparse_new(unsigned int maxwordlen, 
+  const char *query, unsigned int querylen);
+
+/* retrieve the next entity from parser.  See enum comments for meaning
+ * of return code.  In all cases where code needs to return a string,
+ * it will be stored in word, NULL terminated and the length stored in
+ * len.  These cases are: _WORD, _WORD_NOSTOP, _WORD_EXCLUDE,
+ * START_MODIFIER */
+enum queryparse_ret queryparse_parse(struct queryparse *parser, 
+  char *word, unsigned int *len);
+
+/* destruct a query parser */
+void queryparse_delete(struct queryparse *parser);
+
+/* returns the number of bytes processed by the parser thus far */
+unsigned int queryparse_bytes(struct queryparse *parser);
+
+/* retuns the last err or 0 */
+int queryparse_err(struct queryparse *parser);
+
+/* returns a bitset with OR'd errors or 0 for none.  The warnings are then
+ * cleared from the parser. */
+unsigned int queryparse_warn(struct queryparse *parser);
+
+#endif
+
diff --git a/src/include/rbtree.h b/src/include/rbtree.h
new file mode 100644 (file)
index 0000000..3648a9d
--- /dev/null
@@ -0,0 +1,146 @@
+/* rbtree.h declares a generic red-black tree.  Red-black trees are
+ * balanced binary search trees that operate according the following
+ * invariants:
+ *
+ *   - The root is black.
+ *   - All leaves are black (and NIL).
+ *   - Red nodes can only have black children.
+ *   - All paths from a node to its leaves contain the same number of black 
+ *     nodes.
+ *
+ * these ensure that the longest path in the tree is at most twice as
+ * long as the shortest path (which means that the tree is roughly
+ * balanced).  Note that the above invariants assume that empty nodes
+ * exist to indicate the end of the search structure and are treated as black 
+ * nodes.
+ *
+ * see http://en.wikipedia.org/wiki/Red-black_tree or a good
+ * datastructures and algorithms book (like Introduction to
+ * Algorithms, Cormen et al, page 273 in 2nd ed) for more information.
+ *
+ * written nml 2004-07-12
+ *
+ */
+
+#ifndef RBTREE_H
+#define RBTREE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <errno.h>
+
+enum rbtree_ret {
+    RBTREE_EEXIST = -EEXIST,         /* element already exists */
+    RBTREE_ENOENT = -ENOENT,         /* specified element doesn't exist */
+    RBTREE_ENOMEM = -ENOMEM,         /* ran out of memory */
+    RBTREE_EINVAL = -EINVAL,         /* kind of a last resort error */
+    RBTREE_OK = 0,                   /* operation succeeded */
+    RBTREE_ITER_END = 1              /* end of iteration (could return ENOENT 
+                                      * instead, but thats an error, not a 
+                                      * logical condition) */
+};
+
+struct rbtree;
+struct rbtree_iter;
+
+/* create a new red-black tree that will have pointers as keys, and uses cmp to
+ * compare keys.  Returns NULL on failure. */
+struct rbtree *rbtree_ptr_new(int (*cmp)(const void *key1, const void *key2));
+
+/* create a new red-black tree that will have unsigned long ints as keys, with
+ * natural ordering.  Returns NULL on failure. */
+struct rbtree *rbtree_luint_new();
+
+/* delete a red-black tree.  This operation can fail (as traversing the tree to
+ * free the contained nodes requires dynamic memory), but operates on a best
+ * effort basis.  This means that memory leaks are minimized and the red-black 
+ * tree is unusable afterward regardless of whether the operation fails or not.
+ * I'm not sure what you're supposed to do on failure, but at least it indicates
+ * when failure occurs. */
+enum rbtree_ret rbtree_delete(struct rbtree *rb);
+
+/* remove all elements from the tree */
+enum rbtree_ret rbtree_clear(struct rbtree *rb);
+
+/* return the number of elements in the tree */
+unsigned int rbtree_size(struct rbtree *rb);
+
+/* specify the order of iteration over the tree */
+enum rbtree_iter_order {
+    RBTREE_ITER_PREORDER = 0,        /* root, left subtree, right subtree */
+    RBTREE_ITER_INORDER = 1,         /* left subtree, root, right subtree */
+    RBTREE_ITER_POSTORDER = 2        /* left subtree, right subtree, root */
+};
+
+/* get an iterator over the rbtree.  The iterator is only valid as long as the
+ * tree remains unchanged.  Returns NULL on success. */
+struct rbtree_iter *rbtree_iter_new(struct rbtree *rb, 
+  enum rbtree_iter_order order, int reversed);
+
+/* delete an iterator */
+void rbtree_iter_delete(struct rbtree_iter *rbi);
+
+/* insert functions accept a key and data, and insert it if it's not a
+ * duplicate.
+ *
+ * remove functions accept a key, and writes the data that has been removed into
+ * a data element that you provide a pointer to
+ *
+ * find accepts a key, and writes a pointer to the data element into a pointer
+ * that you provide a pointer to.  The extra level of indirection is so that 
+ * you can alter data elements stored within the rbtree.
+ *
+ * find_near accepts a key, and writes the found key into a key element that you
+ * provide a pointer to, and a pointer to the found data into a pointer that you
+ * provide a pointer to, same as find.  Key returned is the largest key that is
+ * smaller than or equal to the key you provided.
+ *
+ * foreach executes a function over all elements in the tree
+ *
+ * iter_*_next functions iterate over the elements in the rbtree in the order
+ * specified in the iter constructor, writing a each successive key
+ * element into the pointer you provide, and writing a pointer to each data
+ * element into the pointer you provide.
+ *
+ * in no cases are any of the pointers allowed to be NULL
+ *
+ */
+
+/* ptr to ptr functions */
+
+enum rbtree_ret rbtree_ptr_ptr_insert(struct rbtree *rb, void *key, 
+  void *data);
+enum rbtree_ret rbtree_ptr_ptr_remove(struct rbtree *rb, void *key, 
+  void **data);
+enum rbtree_ret rbtree_ptr_ptr_find(struct rbtree *rb, void *key, 
+  void ***data);
+enum rbtree_ret rbtree_ptr_ptr_find_near(struct rbtree *rb, void *key, 
+  void **found_key, void ***data);
+enum rbtree_ret rbtree_ptr_ptr_foreach(struct rbtree *rb, void *opaque, 
+  void (*fn)(void *opaque, void *key, void **data));
+enum rbtree_ret rbtree_iter_ptr_ptr_next(struct rbtree_iter *rbi, 
+  void **key, void ***data);
+
+/* uint to uint functions */
+
+enum rbtree_ret rbtree_luint_luint_insert(struct rbtree *rb, 
+  unsigned long int key, unsigned long int data);
+enum rbtree_ret rbtree_luint_luint_remove(struct rbtree *rb, 
+  unsigned long int key, unsigned long int *data);
+enum rbtree_ret rbtree_luint_luint_find(struct rbtree *rb, 
+  unsigned long int key, unsigned long int **data);
+enum rbtree_ret rbtree_luint_luint_find_near(struct rbtree *rb, 
+  unsigned long int key, unsigned long int *found_key, unsigned long int **data);
+enum rbtree_ret rbtree_luint_luint_foreach(struct rbtree *rb, void *opaque,
+  void (*fn)(void *opaque, unsigned long int key, unsigned long int *data));
+enum rbtree_ret rbtree_iter_luint_luint_next(struct rbtree_iter *rbi, 
+  unsigned long int *key, unsigned long int **data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/reposset.h b/src/include/reposset.h
new file mode 100644 (file)
index 0000000..c31b079
--- /dev/null
@@ -0,0 +1,67 @@
+/* reposset.h declares an interface for a collection of information
+ * about the collection indexed.  This information includes the range
+ * of document numbers assigned to documents inside the repositories,
+ * the compression (or lack thereof) applied to each repository and so
+ * forth.
+ *
+ * written nml 2006-04-21
+ *
+ */
+
+#ifndef REPOSSET
+#define REPOSSET
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mime.h"
+
+enum reposset_ret {
+    REPOSSET_OK = 0,              /* operation succeeded */
+    REPOSSET_ERR = -1,            /* unexpected error */
+    REPOSSET_ENOMEM = -2,         /* out-of-memory error */
+    REPOSSET_ENOENT = -3,         /* no such entry */
+    REPOSSET_EINVAL = -4          /* invalid argument (translation: programmer 
+                                   * error) */
+};
+
+struct reposset;
+
+struct reposset *reposset_new();
+void reposset_delete(struct reposset *rset);
+
+/* add a new repository.  reposno will contain the number assigned to this
+ * repository. */
+enum reposset_ret reposset_append(struct reposset *rset, 
+  unsigned int start_docno, unsigned int *reposno);
+
+/* append a docno or set of docnos onto the last
+ * repository in the set */
+enum reposset_ret reposset_append_docno(struct reposset *rset, 
+  unsigned int start_docno, unsigned int docs);
+
+/* add a checkpoint to a repository.  A checkpoint is a point in a
+ * *compressed* file (don't do this to files that aren't compressed)
+ * from where decompression can start.  Note that compression_type must
+ * currently either be GZIP or BZIP2. */
+enum reposset_ret reposset_add_checkpoint(struct reposset *rset, 
+  unsigned int reposno, enum mime_types compression_type,
+  unsigned long int point);
+
+/* translate a docno to a reposno */
+enum reposset_ret reposset_reposno(struct reposset *rset, unsigned int docno, 
+  unsigned int *reposno);
+
+/* returns the number of repositories in the set */
+unsigned int reposset_entries(struct reposset *rset);
+
+/* clear a reposset of all records */
+void reposset_clear(struct reposset *db);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/search.h b/src/include/search.h
new file mode 100644 (file)
index 0000000..a655b63
--- /dev/null
@@ -0,0 +1,148 @@
+/* _search.h declares the internal details of how searching works.
+ * Not much in here at the moment.
+ *
+ * written nml 2005-05-11
+ *
+ */
+
+#ifndef SEARCH_H
+#define SEARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "def.h"
+
+enum search_ret {
+    SEARCH_OK = 0,
+    SEARCH_FINISH = 1,        /* no error, but at the end */
+    SEARCH_ENOMEM = -1,
+    SEARCH_EINVAL = -2,
+    SEARCH_EAGAIN = -3,
+    SEARCH_EIO = -4 
+};
+
+/* structure to accumulate the weight for a document during ranking */
+struct search_acc {
+    unsigned long int docno;
+    float weight;
+};
+
+/* linked list of accumulators */
+struct search_acc_cons {
+    struct search_acc_cons *next;
+    struct search_acc acc;
+};
+
+/* declaration we'll need for the metric structure below */
+struct query;
+struct objalloc;
+struct index;
+struct index_search_opt;
+
+/* struct to model the operation of a source of compressed postings */
+struct search_list_src {
+    void *opaque;
+    /* method to reset the list src to the start of the list */
+    enum search_ret (*reset)(struct search_list_src *src);
+    /* method to read bytes from the src into buf, which is of length len.
+     * read_len contains the number of bytes written into the buffer when the
+     * return value is SEARCH_OK, with 0 indicating that the end of the list has
+     * been reached.  leftover indicates how many bytes where left from the
+     * previous read, and need to be preserved in the next bufferload.  Note
+     * that this could be handled elsewhere, but making it the responsibility of
+     * the reader simplifies things in the face of different buffer sources,
+     * since the source can either adjust the existing buffer or read the extra
+     * few bytes again. */
+    enum search_ret (*readlist)(struct search_list_src *src, 
+      unsigned int leftover, void **retbuf, unsigned int *retlen);
+    /* method to delete the src structure and free all resources used by it */
+    void (*delet)(struct search_list_src *src);
+};
+
+/* structure to represent results being passed between evaluation calls */
+struct search_metric_results {
+     struct search_acc_cons *acc;     /* list of accumulators */
+     unsigned int accs;               /* count of accumulators */
+     unsigned int acc_limit;          /* 'soft' accumulator limit */
+     struct objalloc *alloc;          /* allocator for acc's */
+     float v_t;                       /* threshold for accepting accumulators */
+     int estimated;                   /* whether total_results is estimated */
+     double total_results;            /* total number of possible results for 
+                                       * this query */
+};
+
+/* structure containing a set of functions that define a metric over document 
+ * ordered lists.  Each function accepts options in the same flags and 
+ * structure form as index_search.  Here are the meanings of common arguments:
+ *   idx: index which we are evaluating the query on
+ *   query: user query that we are evaluating 
+ *   qterm: index of the term in the query that we're dealing with
+ *   start_docno: what document number to start decoding the list relative to.
+ *                use SEARCH_DOCNO_START if decoding from the start of a list
+ *   src: list to decode
+ *   postings: number of documents in list v.  This will often 
+ *             (but not always) be equal to f_t
+ *   opts: option flags, from index_search
+ *   opt: option structure, from index_search
+ */
+struct search_metric {
+    /* prepares to evaluate the metric on index idx */
+    enum search_ret (*pre)(struct index *idx, struct query *query, 
+      int opts, struct index_search_opt *opt);
+
+    /* post-processes (typically this involves document length normalisation) 
+     * accumulators that have been generated by the xxx_decode fns */
+    enum search_ret (*post)(struct index *idx, struct query *query, 
+      struct search_acc_cons *acc, int opts, struct index_search_opt *opt);
+
+    /* decode a list in OR mode (initialising new accumulators) */
+    enum search_ret (*or_decode)(struct index *idx, struct query *query, 
+      unsigned int qterm, unsigned long int start_docno, 
+      struct search_metric_results *results, struct search_list_src *src,
+      int opts, struct index_search_opt *opt);
+
+    /* decode a list in AND mode (not initialising new accumulators) */
+    enum search_ret (*and_decode)(struct index *idx, struct query *query, 
+      unsigned int qterm, unsigned long int start_docno, 
+      struct search_metric_results *results, struct search_list_src *src,
+      int opts, struct index_search_opt *opt);
+
+    /* decode a list in THRESH mode (hueristically attempts to initialise 
+     * accumulators only for the highest scoring documents in the list).
+     * results->acc_limit is the accumulator limit that we are trying to reach.
+     * results->v_t is the current threshold, which is updated during the 
+     * course of the procedure.  
+     * thresh_decode can return SEARCH_FINISH to indicate that
+     * AND processing should be performed on the subsequent lists. */
+    enum search_ret (*thresh_decode)(struct index *idx, struct query *query,
+      unsigned int qterm, unsigned long int start_docno, 
+      struct search_metric_results *results, 
+      struct search_list_src *src, unsigned int postings, 
+      int opts, struct index_search_opt *opt);
+};
+
+/* constant to pass as start_docno when decoding from the start of a list */
+#define SEARCH_DOCNO_START -1
+
+/* function to return the number of terms in a query structure */
+unsigned int search_qterms(struct query *q);
+
+/* function to return the cosine weight of a query structure */
+float search_qweight(struct query *q);
+
+#include "alloc.h"
+#include "index_querybuild.h"
+
+/* function to return a list source for a given term (FIXME: move to a different
+ * module) */
+struct search_list_src *search_term_src(struct index *idx, struct term *term,
+  struct alloc *alloc, unsigned int mem);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/signals.h b/src/include/signals.h
new file mode 100644 (file)
index 0000000..ef29850
--- /dev/null
@@ -0,0 +1,19 @@
+/* signals.h declares a set of functions for convenient handling of signals,
+ * primarily during index construction
+ *
+ * written wew 2004-06-18
+ *
+ */
+
+#ifndef SIGNALS_H
+#define SIGNALS_H
+
+#include "index.h"
+#include "pyramid.h"
+
+void signals_set_index_under_construction(struct index * index);
+void signals_clear_index_under_construction(void);
+void signals_cleanup_handler(int signal);
+
+#endif
+
diff --git a/src/include/stack.h b/src/include/stack.h
new file mode 100644 (file)
index 0000000..ebd72e6
--- /dev/null
@@ -0,0 +1,61 @@
+/* stack.h declares a templated version of the very useful data
+ * structure, the LIFO (Last-In, First-Out) stack.  
+ * See http://en.wikipedia.org/wiki/Stack_(computing) if you need more
+ * information on what a stack is.
+ *
+ * written nml 2004-12-07
+ *
+ */
+
+#ifndef STACK_H
+#define STACK_H
+
+#include <errno.h>
+
+/* return values from stack functions */
+enum stack_ret {
+    STACK_OK = 0,
+    STACK_ENOMEM = -ENOMEM,
+    STACK_ENOENT = -ENOENT
+};
+
+struct stack;
+
+struct stack *stack_new(unsigned int sizehint);
+
+void stack_delete(struct stack *stk);
+
+unsigned int stack_size(struct stack *stk);
+
+/* ptr functions */
+
+enum stack_ret stack_ptr_push(struct stack *stk, void *ptr);
+enum stack_ret stack_ptr_pop(struct stack *stk, void **ptr);
+enum stack_ret stack_ptr_peek(struct stack *stk, void **ptr);
+enum stack_ret stack_ptr_foreach(struct stack *stk, void *opaque, 
+  void (*fn)(void *opaque, void **data));
+enum stack_ret stack_ptr_fetch(struct stack *stk, unsigned int index, 
+  void **ptr);
+
+/* luint functions */
+
+enum stack_ret stack_luint_push(struct stack *stk, unsigned long int ptr);
+enum stack_ret stack_luint_pop(struct stack *stk, unsigned long int *ptr);
+enum stack_ret stack_luint_peek(struct stack *stk, unsigned long int *ptr);
+enum stack_ret stack_luint_foreach(struct stack *stk, void *opaque,
+  void (*fn)(void *opaque, unsigned long int *data));
+enum stack_ret stack_luint_fetch(struct stack *stk, unsigned int index, 
+  unsigned long int *ptr);
+
+/* double functions */
+
+enum stack_ret stack_dbl_push(struct stack *stk, double ptr);
+enum stack_ret stack_dbl_pop(struct stack *stk, double *ptr);
+enum stack_ret stack_dbl_peek(struct stack *stk, double *ptr);
+enum stack_ret stack_dbl_foreach(struct stack *stk, void *opaque,  
+  void (*fn)(void *opaque, double *data));
+enum stack_ret stack_dbl_fetch(struct stack *stk, unsigned int index, 
+  double *ptr);
+
+#endif
+
diff --git a/src/include/staticalloc.h b/src/include/staticalloc.h
new file mode 100644 (file)
index 0000000..847b75a
--- /dev/null
@@ -0,0 +1,73 @@
+/* staticalloc.h declares an interface to an object that manages a static piece
+ * of memory, allocating it (all) in response to requests.  This is a useful
+ * complement to the other allocators (poolalloc, objalloc) if you want to use
+ * statically (i.e. on the stack) allocated memory.  It is designed to be as
+ * lightweight as possible, using only a single word of overhead.
+ *
+ * The allocator will not allocate any further memory after the provided area
+ * has been allocated, until it is next freed.
+ *
+ * written nml 2005-03-10
+ *
+ */
+
+#ifndef STATICALLOC_H
+#define STATICALLOC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct staticalloc;
+
+/* create a new static allocation object, which will allocate area (which is of
+ * size bytes) in response to an allocation request.  In order to keep overhead
+ * to a minimum, size cannot be greater than INT_MAX or construction will 
+ * fail.  Note that the area must be great enough to support the allocations you
+ * wish to make as well as one extra machine word of overhead. */
+struct staticalloc *staticalloc_new(void *area, unsigned int size);
+
+/* delete a static allocator object, releasing the given area */
+void staticalloc_delete(struct staticalloc *alloc);
+
+/* allocate some memory of at least size size from the allocator.  Returns a
+ * pointer to the memory on success and NULL on failure. */
+void *staticalloc_malloc(struct staticalloc *alloc, unsigned int size);
+
+/* free a prior allocation, after which ptr is no longer valid. */
+void staticalloc_free(struct staticalloc *alloc, void *ptr);
+
+/* returns the number of allocations currently active.  Will be either 1 or
+ * 0. */
+unsigned int staticalloc_allocated(struct staticalloc *alloc);
+
+/* returns 1 if the given pointer was allocated from this allocator, 0
+ * otherwise. */
+int staticalloc_is_managed(struct staticalloc *alloc, void *ptr);
+
+unsigned int staticalloc_overhead();
+
+/* STATICALLOC_DECL is a macro to make it convenient to allocate space 
+ * on the stack.  Provide the variable name and a constant number of bytes 
+ * required, and a properly aligned space of at least that size (sometimes a 
+ * little padding is necessary) will be declared.  Overhead is included in the 
+ * calculation, so you don't need to worry about it.  
+ * You can then use name as a static allocator that will allocate its area 
+ * of size bytes.  This macro can only be used in the same locations as 
+ * you can declare variables.  Note that you'll still need to 
+ * staticalloc_delete(name) after use to get valgrind leak detection 
+ * working properly. */
+#define STATICALLOC_DECL(name, bytes)                                         \
+  /* declare a number of words on the stack, using void * as word type to     \
+   * avoid sizeof(int) issues */                                              \
+  void *name##_stackspace[1 + (bytes + sizeof(void *) - 1) / sizeof(void *)]; \
+  /* now declare the static allocator */                                      \
+  struct staticalloc *name                                                    \
+    = staticalloc_new(name##_stackspace, sizeof(void*) + bytes)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/stem.h b/src/include/stem.h
new file mode 100644 (file)
index 0000000..6289992
--- /dev/null
@@ -0,0 +1,56 @@
+/* stem.h implements a generic stemming interface that caches a
+ * limited number of stemmed entries.  It also provides some
+ * implementations of common stemming algorithms (currently just
+ * Porter's stemmer)
+ *
+ * written nml 2004-06-17
+ *
+ */
+
+#ifndef STEM_H
+#define STEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* structure to speed up stemming by caching previous results */
+struct stem_cache;
+
+/* create a new stem cache using stemming algorithm stemmer, and that
+ * stores entries number of cached entries 
+ *
+ * FIXME: describe interface better, because we wouldn't want to 
+ * confuse bodo ;o) */
+struct stem_cache *stem_cache_new(void (*stemmer)(void *opaque, char *term), 
+  void *opaque, unsigned int entries);
+
+/* stem the given term using cache */
+void stem_cache_stem(struct stem_cache *cache, char *term);
+
+/* delete the stem cache */
+void stem_cache_delete(struct stem_cache *cache);
+
+/* returns maximum number of entries stem_cache can handle */
+unsigned int stem_cache_capacity(struct stem_cache *cache);
+
+/* individual stemmers below */
+
+/* stuff used to implement a (bad) porters stemmer */
+void stem_porters(void *opaque, char *term);
+
+/* stem_eds implements a function to stem terms by removing (from the end)
+ * -e, -ed, and -s */
+void stem_eds(void *opaque, char *term);
+
+/* stem_light implements a function to lightly stem english terms by 
+ *  - removing suffix -e -es -s -ed -ing -ly -ingly
+ *  - replacing suffix -ies, -ied  with -y */
+void stem_light(void *opaque, char *term);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/stop.h b/src/include/stop.h
new file mode 100644 (file)
index 0000000..5bfb410
--- /dev/null
@@ -0,0 +1,85 @@
+/* stop.h is a simple stoplist (i.e. a list of (common) words we don't to 
+ * deal with).  Stopping is an extremely common information retrieval 
+ * technique, see Managing Gigabytes for more information.
+ *
+ * written nml 2004-11-19
+ *
+ */
+
+#ifndef STOP_H
+#define STOP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+
+/* return values from (most) stop functions */
+enum stop_ret {
+    STOP_OK = 0,
+    STOP_STOPPED = 1,
+
+    /* error values */
+    STOP_EEXIST = -EEXIST,
+    STOP_EINVAL = -EINVAL,
+    STOP_ENOMEM = -ENOMEM,
+    STOP_EACCESS = -EACCES 
+};
+
+struct stop;
+
+/* create a new (empty) stop list */
+struct stop *stop_new(void (*stem)(void *opaque, char *term), void *opaque);
+
+/* create a new stop list from the contents of filename.  This is just
+ * a wrapper for stop_new followed by stop_add_file.  See
+ * stop_add_file for more details. */
+struct stop *stop_new_file(void (*stem)(void *opaque, char *term), 
+  void *opaque, const char *filename);
+
+/* creates a stoplist populated with default data */
+struct stop *stop_new_default(void (*stem)(void *opaque, char *term), 
+  void *opaque);
+
+/* delete a stop list */
+void stop_delete(struct stop *list);
+
+/* add the contents of the given file to the stoplist.  The file
+ * format is one word per line, comments starting with # ignored, with
+ * a line length limit of 4096.  Various things can go wrong when
+ * reading the file, with error return values corresponding to those
+ * returned from the system calls open() and read(), anything
+ * unrecognised is returned as STOP_EINVAL.  Returns STOP_OK on
+ * success.  All terms are case-folded to lower-case as they are put
+ * into the table. */
+enum stop_ret stop_add_file(struct stop *list, const char *filename);
+
+/* add a term to the stoplist.  Can return STOP_ENOMEM if memory
+ * cannot be allocated, otherwise returns STOP_OK.  Returns EEXIST if
+ * the term already appears in the table.  term is case-folded to
+ * lowercase and stemmed prior to insertion. */
+enum stop_ret stop_add_term(struct stop *list, const char *term);
+
+/* test a term to see if it is stopped by the stoplist.  Returns
+ * STOP_STOPPED if the term is stopped, STOP_OK if not.  No
+ * case-folding or stemming are performed, so you'd better make sure that 
+ * term is in the case that you want (typically lower) and appropriately 
+ * stemmed before calling this function.  */
+enum stop_ret stop_stop(struct stop *list, const char *term);
+
+/* output c code to write function stop_new_default based on current contents 
+ * of the stoplist */
+enum stop_ret stop_write_code(struct stop *list, FILE *output);
+
+/* outputs the contents of the stoplist, one word per line, to the given output
+ * file */
+enum stop_ret stop_print(struct stop *list, FILE *output);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/storagep.h b/src/include/storagep.h
new file mode 100644 (file)
index 0000000..0efb746
--- /dev/null
@@ -0,0 +1,75 @@
+/* storagep.h declares a structure that contains all necessary information 
+ * regarding how an index is to be physically stored on disk (the
+ * storage parameters).  Its a convenience class intended to reduce the number 
+ * of parameters passed to some routines.
+ *
+ * written nml 2003-02-17
+ *
+ */
+
+#ifndef STORAGEP_H
+#define STORAGEP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "zstdint.h"
+
+struct storagep {
+    unsigned int pagesize;           /* size of one 'disk block' */
+    unsigned int max_termlen;        /* maximum length of one term */
+    unsigned int max_filesize;       /* maximum file size */
+    unsigned int vocab_lsize;        /* size of inverted lists to try to 
+                                      * store in the vocabulary */
+    unsigned int file_lsize;         /* maximum size of inverted lists to try 
+                                      * to store in files */
+    uint8_t btleaf_strategy;         /* btree leaf bucket format */
+    uint8_t btnode_strategy;         /* btree internal node bucket format */
+    uint8_t bigendian;               /* whether to store stuff in big-endian 
+                                      * byte order (if false we store
+                                      * little-endian.  I am aware that other
+                                      * obscure byte orders exist, but we're
+                                      * ignoring them) */
+};
+
+/* return the space needed to store a set of storage parameters */
+unsigned int storagep_size();
+
+/* read a set of storage parameters from memory (where memory is at least
+ * storagep_size bytes long) */
+int storagep_read(struct storagep *sp, const void *addr);
+
+/* write a set of storage parameters to memory (where memory is at least
+ * storagep_size bytes long) */
+int storagep_write(const struct storagep *sp, void *addr);
+
+/* overallocation function that rounds up to the nearest power of two */
+unsigned int storagep_power2_overalloc(unsigned int size);
+
+/* overallocation function that overallocates linearly according to
+ * parameters given to storagep_linear_overalloc_init (note that only
+ * *one* logical instance of this function can be active at once) */
+unsigned int storagep_linear_overalloc(unsigned int size);
+
+/* performs exact allocation */
+unsigned int storagep_no_overalloc(unsigned int size);
+
+/* initialise storagep_linear_overalloc with parameters for linear
+ * overallocation.  If the size given is over thresh, it is multiplied
+ * by gradient (must be > 1.0) and has offset added to it.  It is then rounded
+ * up to the nearest multiple of granularity. */
+void storagep_linear_overalloc_init(unsigned int thresh, float gradient, 
+  unsigned int offset, unsigned int granularity);
+
+/* fill a struct with storage default values (fd is a file to provide default
+ * maximum file size limits. XXX: a bit of a hack, but the whole problem 
+ * promotes that kind of thing).  Returns 0 on success, < 0 on failure. */
+int storagep_defaults(struct storagep *storage, int fd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/str.h b/src/include/str.h
new file mode 100644 (file)
index 0000000..c5aa2aa
--- /dev/null
@@ -0,0 +1,197 @@
+/* str.h declares different (hopefully quicker) implementations of the
+ * standard library string functions (and some additional extras such
+ * as strlcat and strlcpy from the OpenBSD project)
+ *
+ * this is an attempt to stop everyone writing their own versions of
+ * strlen and strcmp for every different project.
+ *
+ * note that although i'd like to use unsigned char's here, to specify char
+ * range [0,255] instead of leaving it possibly [-128,127], but this tends to 
+ * mean a lot of casting for three reasons:
+ *
+ *   - most (other) library calls use char *
+ *   - string literals in c are char *
+ *   - main argv (to be portable) must be char *
+ *
+ * unfortunately my solution is merely to deal with the value of extended 
+ * characters in the positions locally (i.e. parsers and other stuff that 
+ * cares).  There are macros at the bottom of this file to help.
+ *
+ * written nml 2003-03-26
+ *
+ */
+
+#ifndef STR_H
+#define STR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+/* version of strlen.  calculates the length of the string s *not*
+ * including the terminating '\0' */
+size_t str_len(const char *s);
+
+/* version of strlen with maximum size */
+size_t str_nlen(const char *s, size_t maxlen);
+
+/* version of strcmp.  return an integer less than, equal to or greater
+ * than 0 if s1 is less than, equal to or greater than s2 respectively. */
+int str_cmp(const char *s1, const char *s2);
+
+/* version of strncmp.  return an integer less than, equal to or greater
+ * than 0 if the first size characters of s1 are less than, equal to
+ * or greater than the first size characters of s2 respectively
+ * (comparison doesn't continue past '\0' terminators however) */
+int str_ncmp(const char *s1, const char *s2, size_t size);
+
+/* equivalent to str_ncmp, except that both strings have a limiting length.  If
+ * the strings are identical until one ends, the shorter string is considered 
+ * smaller.  */
+int str_nncmp(const char *s1, size_t size1, const char *s2, size_t size2);
+
+/* version of strcasecmp.  return an integer less than, equal to or greater
+ * than 0 if s1 is less than, equal to or greater than s2, ignoring case.
+ * If a letter gets compared with []\^_` the letter will be evaluate to more
+ * than these characters (equivalent to conversion to lowercase) */
+int str_casecmp(const char *s1, const char *s2);
+
+/* version of strncasecmp.  return an integer less than, equal to or greater
+ * than 0 if the first size characters of s1 are less than, equal to or greater 
+ * than the first size charactesr of s2, ignoring case.
+ * If a letter gets compared with []\^_` the letter will be evaluate to more
+ * than these characters (equivalent to conversion to lowercase) */
+int str_ncasecmp(const char *s1, const char *s2, size_t size);
+
+/* version of strcpy.  Copy src to dst, including '\0' termination.
+ * Returns a pointer to dst. */
+char *str_cpy(char *dst, const char *src);
+
+/* version of strcat.  Copies src to the end of dst, including '\0'
+ * termination.  Returns a pointer to dst */
+char *str_cat(char *dst, const char *src);
+
+/* version of strncpy.  Copy src to dst and '\0' fill the rest of the
+ * space given by size.  Returns a pointer to dst. */
+char *str_ncpy(char *dst, const char *src, 
+  size_t size);
+
+/* version of strncat.  Copy src to dst, including '\0' termination,
+ * but copy size bytes at most.  Returns a pointer to dst */
+char *str_ncat(char *dst, const char *src, 
+  size_t size);
+
+/* version of strlcpy (safer version of strncat as produced by OpenBSD).
+ * copy src to dst, given size space (which *includes* space for the
+ * terminating character).  '\0' termination is guaranteed so long as
+ * size is non-zero.  Returns total length (excluding '\0'
+ * termination) of the string that was created, assuming no truncation
+ * occurred.  Refer to 
+ * 'strlcpy and strlcat - consistent, safe, string copy and concatenation' 
+ * by Todd C. Miller, Theo de Raadt for more detail. */
+size_t str_lcpy(char *dst, const char *src, size_t size);
+
+/* version of strlcat (safer version of strncat as produced by OpenBSD).
+ * concatenate src onto the end of dst, given size space (which
+ * *includes* space for the terminating character).  '\0' termination
+ * is guaranteed so long as size > strlen(dst). 
+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).  Refer to 
+ * 'strlcpy and strlcat - consistent, safe, string copy and concatenation' 
+ * by Todd C. Miller, Theo de Raadt for more detail. */
+size_t str_lcat(char *dst, const char *src, size_t size);
+
+/* return a malloc'd copy of s1, or NULL */
+char *str_dup(const char *s1);
+
+/* return a malloc'd copy of at most the first size bytes of str, NULL
+ * terminated */
+char *str_ndup(const char *str, size_t size);
+
+/* return a pointer to the first non-whitespace element of a string (may be the
+ * '\0' ending) */
+const char *str_ltrim(const char *s);
+
+/* remove trailing whitespace from a string by terminating it over the first
+ * character of the last whitespace sequence */
+unsigned int str_rtrim(char *s);
+
+/* convert an ASCII string to lowercase (non-ASCII characters are preserved),
+ * returning the number of substitutions made. */
+unsigned int str_tolower(char *s);
+
+/* convert an ASCII string to lowercase (non-ASCII characters are preserved),
+ * returning the number of substitutions made.  At most size characters will be
+ * converted. */
+unsigned int str_ntolower(char *s, size_t size);
+
+/* convert an ASCII string to uppercase (non-ASCII characters are preserved),
+ * returning the number of substitutions made. */
+unsigned int str_toupper(char *s);
+
+/* convert an ASCII string to uppercase (non-ASCII characters are preserved),
+ * returning the number of substitutions made.  At most size characters will be
+ * converted. */
+unsigned int str_ntoupper(char *s, size_t size);
+
+/* version of strchr.  returns a pointer to the first instance of c in s, or
+ * NULL if it isn't in the string */
+char *str_chr(const char *s, int c);
+
+/* version of strchr.  returns a pointer to the last instance of c in s, or
+ * NULL if it isn't in the string */
+char *str_rchr(const char *s, int c);
+
+/* version of split method common to scripting languages. 
+ * split str into parts delimited by characters of delim.  The returned array 
+ * is malloc'd and NULL terminated, but
+ * contains pointers into original string, which will have delimiters changed to
+ * \0 as needed to delimit the split strings.  The size of the returned array 
+ * will be written into parts.  If no delim is found, then an array of one is 
+ * returned and the string is untouched. errno will be set and NULL returned 
+ * if an error occurred. */
+char **str_split(char *str, const char *delim, 
+  unsigned int *parts);
+
+/* remove all whitespace, control and punctuation characters from str (with the
+ * exception of single, internal hyphens.  Returns the number of characters
+ * removed from the string */
+unsigned int str_strip(char *str);
+
+/* indicates whether characters are signed or not by default (1 if they are, 0
+ * if they are not) */
+int str_signed_char();
+#define STR_SIGNED_CHAR (((int) ((char) 255)) == -1)     /* macro version */
+
+/* get an integer value from a character, forcing character values into [0,255]
+ * range */
+unsigned int str_from_char(char c);
+#define STR_FROM_CHAR(x) (((x) + UCHAR_MAX + 1) & 0xff)  /* macro version */
+
+/* get a character value from [0,255] range integer */
+char str_to_char(unsigned int c);
+#define STR_TO_CHAR(x) ((char) (x))                      /* macro version */
+
+/* write the name of the directory in src, up to and including the last
+ * seperator character, into dst (which is of length dstsize).  If src doesn't
+ * contain any seperator characters, the string '.' is written into dst */
+char *str_dirname(char *dst, unsigned int dstsize, const char *src);
+
+/* return a pointer to the filename component of a path.  Pretty much like
+ * basename in the libgen library, except that we don't alter the string, which
+ * prevents us from normalising away seperators that libgen does (e.g.
+ * basename("tmp/") = "tmp/" instead of "tmp"). */
+const char *str_basename(const char *src);
+
+/* produce a hash value (using Justin Zobel's bitwise hashing function) for the
+ * given string */
+unsigned int str_hash(const char *str);
+unsigned int str_nhash(const char *str, unsigned int len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/stream.h b/src/include/stream.h
new file mode 100644 (file)
index 0000000..f3f5226
--- /dev/null
@@ -0,0 +1,264 @@
+/* stream.h declares an interface for objects that transparently process
+ * text (or any stream of bytes) to adhere to such that they can be placed in 
+ * a chain of cooperating objects, providing transparent buffering where 
+ * necessary, but minimising the amount of copying that is done.
+ *
+ * stream.h also declares constructors for a bunch of stream filters, since
+ * most of them don't have a seperate interface, apart from a constructor.
+ *
+ * stream.h embodies a philosophy on how to deal with text in a general way,
+ * one that was inspired by the interfaces of zlib and bzlib (thanks to the
+ * authors of those excellent packages).  The philosophy that i've adopted is 
+ * to try to keep the text manipulation code as free from assumptions 
+ * as possible.  For this reason, the stream interface works with 
+ * pointer/length descriptions of text, instead of accepting file pointers, 
+ * file descriptors, or some object representing a text stream.  
+ * The benefit of this approach is that code conforming to these
+ * interface can be applied to all situations with some code to perform
+ * adaptation to the particular circumstances.  Input can be passed to the
+ * stream in any size, and control flow can pass to other code in between
+ * successive reads, but no synchronisation or other concurrency control 
+ * is necessary.  This represents a burden to the code within the
+ * stream, which has to keep sufficient state to be able to process input in
+ * any form, at any time (although this burden can be eased with appropriate
+ * buffering).  This will mean that in practice they will have to be some form
+ * of state machine.  However, i believe that this is justified, because this
+ * is the manner in which text is delivered from input sources such as disks
+ * and network interfaces to programs.  Text is delivered in arbitrarily-sized
+ * chunks, with some, often long, intervals in between successive chunks.  It
+ * seems reasonable to pass this requirement along to code that has to
+ * deal with text, especially since there are difficult issues in situations
+ * where the responsibility for dealing with these problems is delegated
+ * elsewhere.  Ultimately however, the major benefit of this philosophy is 
+ * that *you* don't have to follow it, or agree with it.  This approach is 
+ * flexible enough that with a small amount of code and buffer space you can 
+ * adapt it to multi-threaded, blocking situations, make it translate text 
+ * between pipes, or read text directly from a file on disk.
+ *
+ * The model of how filters delete one another will probably need to be revised
+ * some time soon, as i don't think it covers all likely needs.  There will
+ * probably also be more need to transparency about what is on the filter
+ * stream.
+ *
+ * written nml 2004-08-19
+ *
+ */
+
+#ifndef STREAM_H
+#define STREAM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <errno.h>
+
+/* return values from stream functions */
+enum stream_ret {
+    STREAM_ENOMEM = -ENOMEM,         /* out of memory error */
+    STREAM_EINVAL = -EINVAL,         /* filtering error */
+    STREAM_EEXIST = -EEXIST,         /* specified something that doens't 
+                                      * exist */
+
+    STREAM_OK = 0,                   /* filtering succeeded, output is ready */
+    STREAM_END = 1,                  /* stream has ended, no output is ready */
+    STREAM_INPUT = 2,                /* require more input */
+
+    STREAM_DELETE = 3,               /* delete a filter that is either this 
+                                      * filter or immediatly after this filter, 
+                                      * depending on the after variable */
+
+    STREAM_INSERT = 4,               /* insert a new filter, in the insert 
+                                      * output variable, before or after (as 
+                                      * specified by the after variable) */
+
+    STREAM_OOB = 5                   /* data returned 'out-of-band'.  This is 
+                                      * used to implement a tee stream filter,
+                                      * that transparently returns data from an 
+                                      * arbitrary point in the stream to the 
+                                      * caller */
+};
+
+/* values that can be passed to indicate whether filters should be flushed */
+enum stream_flush {
+    STREAM_FLUSH_NONE = 0,
+    STREAM_FLUSH_FINISH = 3
+};
+
+struct stream_state;
+
+struct stream {
+    char *next_in;                   /* next input buffer */
+    unsigned int avail_in;           /* size of next input buffer */
+
+    char *curr_out;                  /* current output buffer */
+    unsigned int avail_out;          /* size of text at current output buffer */
+
+    int id;                          /* id of returning filter, 0 for normal 
+                                      * returns, and the id of the returning
+                                      * filter for out-of-band returns or 
+                                      * errors */
+
+    struct stream_state *state;      /* opaque data pointer */
+};
+
+/* the basic idea is that each element in the chain accepts next_in/avail_in
+ * pointers, and produces curr_out/avail_out pointers, doing whatever they have
+ * to do on the way.  curr_out/avail_out either point to sections of the input
+ * buffer, or to an internal buffer in the filter, so that output buffering
+ * stream_filter objects isn't necessary.  This arrangement allows both filters
+ * that copy from one buffer to the next, and filters that pass pointers through
+ * from one to the next. */
+struct stream_filter {
+    char *next_in;                        /* next input buffer */
+    unsigned int avail_in;                /* size of next input buffer */
+
+    union {
+        /* stuff returned when ret is _OK */
+        struct {
+            char *curr_out;               /* current output */
+            unsigned int avail_out;       /* size of current output */
+        } ok;
+
+        /* stuff returned when ret is _INSERT */
+        struct {
+            struct stream_filter *insert;
+            int after;
+        } insert;
+
+        /* stuff returned when ret is _DELETE */
+        struct {
+            int after;
+        } delet; /* can't call this delete, because of the c++ keyword */
+
+        /* stuff returned when ret is _OOB */
+        struct {
+            char *curr_out;               /* out-of-bound output */
+            unsigned int avail_out;       /* size of out-of-bound output */
+            int id;                       /* id of returning filter */
+        } oob;
+    } out;
+
+    /* function to filter the stream, aiming to produce output */
+    enum stream_ret (*filter)(struct stream_filter *filter, 
+      enum stream_flush flush);
+
+    /* function to delete the stream object, including cleaning up whatever
+     * resources were allocated by the stream_filter object.  Returns
+     * stream_filter_OK on success, can indicate errors using other return
+     * codes.  Some return codes don't make much sense, so don't return them. */
+    enum stream_ret (*deletefn)(struct stream_filter *filter);
+
+    /* function to return a string identifing this stream_filter module */
+    const char *(*idfn)(struct stream_filter *filter);
+};
+
+/* create a new stream */
+struct stream *stream_new();
+
+/* flush output from a stream.  The exact behaviour depends on which flush value
+ * is given.  Currently only FLUSH_FINISH is available, which flushes all output
+ * from the stream and finishes the stream.  No further input should be given to
+ * the stream after stream_flush has been called with FLUSH_FINISH. */
+enum stream_ret stream_flush(struct stream *stream, 
+  enum stream_flush flushtype);
+
+/* push a filter onto stream.  The filter then belongs to the stream, which
+ * will delete it when necessary.  Note that you can't delete a filter from a
+ * stream, they should be self-deleting.  Also note that you need to update the
+ * output position of the stream, as the new filter will take whatever is left
+ * on the output as the beginning of its input. */
+enum stream_ret stream_filter_push(struct stream *stream, 
+  struct stream_filter *filter);
+
+/* push a filter on the stream, same as stream_filter_push.  However, the
+ * filter is pushed onto the stream immediately before the current position.
+ * This function is intended to be used by filters that shouldn't necessarily
+ * be aware that they are part of a stream, so that they can easily adapt to
+ * being either the ultimate consumer of a stream, or merely one filter in a
+ * stream. */
+enum stream_ret stream_filter_push_current(struct stream *stream,
+  struct stream_filter *filter);
+
+/* number of filters on this stream */
+unsigned int stream_filters(struct stream *stream);
+
+/* return the identifing string for the filter on this stream at position pos,
+ * by writing a pointer into it into id. */
+enum stream_ret stream_filter(struct stream *stream, unsigned int pos, 
+  const char **id);
+
+/* get more output from stream.  If flush is true within the stream struct, 
+ * filters aren't allowed to buffer text.  You should do this immediately 
+ * prior to attempting to read the input to exhaustion, but be careful doing 
+ * it in other circumstances, as filters may delete themselves in reponse 
+ * to being ordered to flush. */
+enum stream_ret stream(struct stream *stream);
+
+/* delete a stream and all its filters */
+void stream_delete(struct stream *stream);
+
+/* ideas for filters:
+   - compression/decompression methods (gzip, bzip, lzw, zip)
+   - conversion between encoding methods (probably via iconv)
+   - encryption/decryption methods
+   - 'collector' filter to ensure minimum size output (buffering if necessary)
+   - 'distributor' filter to pass out text in small configurable chunks, 
+     for debugging
+   - base64, base85, hex, percent-encoding etc etc
+   - filters to remove text from different document types
+   - compression/encryption recogniser
+   - HTTP chunked encoding/decoding
+   - '\0' terminator
+   - string matcher with subsequent actions (primarily to automatically delete
+     filters when finding end-of-data markers)
+   - byte counter with subsequent action
+   - 'spy', which prints to stdout (for debugging)
+*/
+
+/* note that all of these methods return different types of filters, but that a
+ * pointer to each of them should be able to be (sort-of) safely cast into a
+ * stream_filter pointer */
+
+/* collectorfilter is a simple stream filter that performs buffering to ensure 
+ * a minimum input size for subsequent elements.  size indicates the amount
+ * that should be 'collected', bytes the number of bytes required to be
+ * processed in chunks of size size.  After bytes number of bytes have been
+ * processed, the collectorfilter will remove itself from the stream.  0
+ * indicates no limit on the number of bytes processed in chunks. */
+struct collectorfilter;
+struct collectorfilter *collectorfilter_new(unsigned int size, 
+  unsigned int bytes);
+
+/* detectfilter recursively detects encodings such as gzip and bzip compression
+ * on the input stream, and pushes filters onto the stream to remove them.
+ * limit encodings at most will be undone, before the detectfilter will
+ * refuse to process any more (this is a defense mechanism against
+ * denial-of-service attacks by encoding text a near-infinite number of times).
+ * A limit of 0 is considered to be unlimited.  bufsize is the size of the
+ * buffer that each decoding filter will be initialised with. */
+struct detectfilter;
+struct detectfilter *detectfilter_new(unsigned int bufsize, unsigned int limit);
+/* XXX: should add tar/zip detection to this, although it has consequences for
+ * stripping of internal communication characters */
+
+/* teefilter returns data that passes through it via the out-of-bounds
+ * mechanism.  id is the id that will be returned with the out-of-bounds 
+ * data. */
+struct teefilter;
+struct teefilter *teefilter_new(int id);
+/* XXX: could add limit to this if needed */
+
+/* gunzipfilter is a stream filter module that is
+ * capable of decompressing gzip files as described by RFC 1952 (GZIP file
+ * format specification), using zlib to undo the deflate compression 
+ * algorithm. */
+struct gunzipfilter;
+struct gunzipfilter *gunzipfilter_new(unsigned int bufsize);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/summarise.h b/src/include/summarise.h
new file mode 100644 (file)
index 0000000..d99d0b5
--- /dev/null
@@ -0,0 +1,57 @@
+/* summarise.h declares methods for creating a textual summary of a document
+ * based on query terms
+ *
+ * written jyiannis 2004-05-18
+ *
+ */
+
+#ifndef SUMMARISE_H
+#define SUMMARISE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "index.h"
+
+enum summarise_ret {
+    SUMMARISE_OK = 0,       /* success */
+
+    SUMMARISE_ERR = -1,     /* unexpected error */
+    SUMMARISE_EIO = -2,     /* IO error */
+    SUMMARISE_ENOMEM = -3   /* couldn't obtain sufficient memory */
+};
+
+struct query;
+struct summarise;
+
+/* initialise a text summary object, to summarise documents from the given 
+ * index */
+struct summarise *summarise_new(struct index *idx);
+
+/* delete a text summary object */
+void summarise_delete(struct summarise *sum);
+
+/* structure to represent the results of summarisation */
+struct summary {
+    char *summary;              /* buffer for summary */
+    unsigned int summary_len;   /* length of buffer for summary */
+    char *title;                /* buffer for document title */
+    unsigned int title_len;     /* length of buffer for document title */
+};
+
+/* create a textual summary of document number docno, biased toward the given
+ * query.  The summary and title are written into result, with the type of
+ * summary dictated by type (plain gives a plaintext summary, capitalise has
+ * query words capitalised, html has query words bolded and html-significant
+ * characters html-escaped). */
+enum summarise_ret summarise(struct summarise *sum, unsigned long int docno,
+  const struct query *query, enum index_summary_type type,
+  struct summary *result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/sunos/firstinclude.h b/src/include/sunos/firstinclude.h
new file mode 100644 (file)
index 0000000..5606c61
--- /dev/null
@@ -0,0 +1,31 @@
+/* sunos/firstinclude.h defines feature macros to allow us to use the
+ * functions we want (primarily POSIX, but a few other bits and pieces
+ * too) on Solaris
+ *
+ * written nml 2003-04-24
+ *
+ */
+
+#ifndef FIRSTINCLUDE_H
+#define FIRSTINCLUDE_H
+
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64           /* large file support */
+#endif
+#define __EXTENSIONS__
+#define _POSIX_SOURCE                  
+#define _POSIX_C_SOURCE 199309L
+
+/* indicate what the directory separator character is for this OS */
+#define OS_SEPARATOR '/'
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "config.h"
+
+/* declare "don't break me" flag for win32 compatibility */
+#define O_BINARY 0
+
+#endif
+
diff --git a/src/include/svnversion.h b/src/include/svnversion.h
new file mode 100644 (file)
index 0000000..2783ff5
--- /dev/null
@@ -0,0 +1 @@
+#define SVNVERSION "2255:2359M"
diff --git a/src/include/test.h b/src/include/test.h
new file mode 100644 (file)
index 0000000..2417e81
--- /dev/null
@@ -0,0 +1,34 @@
+/* test.h declares a basic test harness structure (that is compatible
+ * with the automake test suite stuff that we're currently using)
+ *
+ * written nml 2003-10-14
+ *
+ */
+
+#ifndef TEST_H
+#define TEST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+/* automake understands a return code of 77 to mean that the test doesn't 
+ * count */
+#define EXIT_DOESNT_COUNT 77
+
+/* test a module using the contents of fp.  fp can be NULL if no
+ * matching file is found.  argc and argv are the normal parameters
+ * received by the executing program.  Individual unit tests are responsible for
+ * implementing this function to test whatever it is they have to test.  Return
+ * value is taken as an indication of success, with EXIT_DOESNT_COUNT indicating
+ * that the test case result should be ignored. */
+int test_file(FILE *fp, int argc, char **argv);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/testutils.h b/src/include/testutils.h
new file mode 100644 (file)
index 0000000..fca6130
--- /dev/null
@@ -0,0 +1,83 @@
+/* various utility functions and objects for the regression tests.
+ *
+ * XXX these functions are oriented towards quickly writing standalone
+ * test programs, and should _not_ be used in a production system.
+ * In particular, the ones with names ending "_or_die" will abort on
+ * failure.
+ *
+ * written wew 2004-10-12
+ *
+ */
+
+#ifndef TESTUTILS_H
+#define TESTUTILS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "lcrand.h"
+
+/* Random number generation. */
+
+extern struct lcrand * tu_rand;
+
+void tu_init_rand_or_die(unsigned seed);
+
+unsigned int tu_rand_limit(unsigned limit);
+
+double tu_rand_double_limit(double limit);
+
+/* Input data. */
+
+#define TU_SAMPLE_DATA_LEN (2u * 1024u * 1024u)
+
+extern char tu_sample_data[];
+
+extern int tu_sample_data_inited;
+
+void tu_sample_data_rand_init();
+
+int tu_sample_data_file_init(const char * fname);
+
+char * tu_get_rand_data(unsigned len);
+
+char * tu_get_rand_data_rand_len(unsigned max_len, unsigned * len);
+
+/* Storing sample data. */
+
+struct tu_data_element {
+    char * data;
+    unsigned len;
+};
+
+struct tu_data_elements {
+    struct tu_data_element * elements;
+    unsigned num_elements;
+    struct tu_data_elements * next;
+};
+
+struct tu_data_elements_list {
+    struct tu_data_elements * head;
+    struct tu_data_elements * tail;
+};
+
+struct tu_data_elements * tu_generate_elements_or_die(unsigned num_elements,
+  unsigned max_len);
+
+struct tu_data_elements * tu_generate_null_elements_or_die(unsigned
+  num_elements);
+
+void tu_delete_elements(struct tu_data_elements * elements);
+
+void tu_add_elements_to_list(struct tu_data_elements_list * list,
+  struct tu_data_elements * elements);
+
+#define TU_DATA_ELEMENTS_EMPTY_LIST { NULL, NULL }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/timings.h b/src/include/timings.h
new file mode 100644 (file)
index 0000000..2efbd7a
--- /dev/null
@@ -0,0 +1,44 @@
+/* timings.h includes tools for getting timings
+ *
+ * written nml 2004-04-04
+ *
+ */
+
+#ifndef TIMINGS_H
+#define TIMINGS_H
+
+#include "def.h"
+
+#ifndef WIN32
+#include <sys/time.h>
+#endif
+
+/* unfortunately, windows doesn't have the same simple timing functions as
+ * pretty much anything else.  For the moment we'll just disable the timing
+ * macros on windows */
+
+#if defined(TIME_BUILD) && !defined(WIN32)
+
+#define TIMINGS_DECL() struct timeval timings_now, timings_then;              \
+                       unsigned long int timings_diff   
+
+#define TIMINGS_START() gettimeofday(&timings_then, NULL)
+
+#define TIMINGS_END(name)                                                     \
+    gettimeofday(&timings_now, NULL);                                         \
+    timings_diff = timings_now.tv_sec - timings_then.tv_sec;                  \
+    printf("%s time: %02i:%02i:%02i (%lu seconds, %lu millis)\n", name,       \
+      (int) timings_diff / 60 / 60, ((int) (timings_diff) / 60) % 60,         \
+      ((int) timings_diff) % 60, timings_diff,                                \
+      timings_now.tv_usec - timings_then.tv_usec + timings_diff * 1000000)
+
+#else
+
+#define TIMINGS_DECL() while (0)
+#define TIMINGS_START() while (0)
+#define TIMINGS_END(name) while (0)
+
+#endif
+
+#endif
+
diff --git a/src/include/trec_eval.h b/src/include/trec_eval.h
new file mode 100644 (file)
index 0000000..0050aba
--- /dev/null
@@ -0,0 +1,166 @@
+/* trec_eval.h is an interface to perform trec_eval calculations
+ * programmatically.  It is based upon the trec_eval program (7.0beta)
+ * available from ftp://ftp.cs.cornell.edu/pub/smart.  trec_eval.c
+ * contains code copyright Chris Buckley and Gerard Salton.
+ *
+ * written bodob, nml 2004-10-10
+ *
+ */
+
+#ifndef TRECEVAL_H
+#define TRECEVAL_H
+
+#ifdef _cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+struct treceval_qrels;
+struct treceval;
+
+/* structure to hold evaluated results */
+struct treceval_results {
+    unsigned int queries;               /* number of queries this result
+                                           is over */
+    unsigned int retrieved;             /* number of retrieved documents */
+    unsigned int relevant;              /* number of all relevant
+                                           documents in collection */
+    unsigned int relevant_retrieved;    /* relevant documents retrieved */
+    float interpolated_rp[11];          /* interpolated recall-precision
+                                           at 11 points, in ascending
+                                           order of position */
+    float average_precision;            /* average precision measure */
+    float precision_at[9];              /* precision at 9 recall points:
+                                           5, 10, 15, 20, 30, 100, 200,
+                                           500, 1000 */
+    float rprecision;                   /* r-precision value */
+};
+
+/* enumerated type used for statistics below */
+typedef enum {
+    NO_DIFF = 0, 
+    REJECTED = 1, 
+    OUT_OF_RANGE = 2, 
+    NOT_REJECTED = 3
+} treceval_hypothesis;
+
+/* enumerated type used for selecting one tailed or two tailed test */
+typedef enum {
+    ONE_TAILED = 0,
+    TWO_TAILED = 1
+} treceval_statistics_tailedness;
+
+struct treceval_statistics {
+    unsigned int sample_size;           /* keep track of how many
+                                           queries were evaluated in
+                                           order to calculate the
+                                           statistics */
+    treceval_statistics_tailedness tailedness; /* keeps track whether
+                                           one or two tail test was
+                                           performed */
+    struct {
+        unsigned int improved;          /* this many queries have been
+                                           improved */
+        unsigned int degraded;          /* this many queries have been
+                                           degraded */
+        treceval_hypothesis hypothesis; /* hypothesis was (not) rejected
+                                           ... */
+        float confidence;               /* ... with this confidence */
+        float z_score;                  /* the confidence level at which
+                                           the hypothesis has been
+                                           rejected/accepted */
+        float actual_confidence;        /* the "exact" confidence ... */
+        char sign;                      /* equal or smaller thant the
+                                           value shown */
+    } stats[11];
+};
+
+/* initialises an new treceval: sets memory aside for raw results;
+ * returns a pointer to a new struct treceval which needs to be freed by
+ * a call to the next function after useage */
+struct treceval *treceval_new();
+
+/* releases all memory and points *trecResults to NULL;
+ * expects a pointer to a pointer of a treceval structure for which
+ * memory was allocated on the heap */
+void treceval_delete(struct treceval **raw_results);
+
+/* fetches relevance judgements for later evaluation of results;
+ * accepts a file name to a qrels file;
+ * returns a pointer to a structure that contains a hash table and
+ * auxiliary information needed for judging results; structure returned
+ * needs to be freed by a later call to the following function */
+struct treceval_qrels *treceval_qrels_new(const char *qrels_file_name);
+
+/* releases all memory and points *qrels to NULL;
+ * expects a pointer to a pointer to a qrels structure */
+void treceval_qrels_delete(struct treceval_qrels **qrels);
+
+/* adds a new trec tuple (query_id, trec document number, accumulator
+ * Score) to the raw results;
+ * accepts a query ID, trec document number, a similarity score of the
+ * document to the query and a pointer to a relevance information
+ * structure;
+ * returns currently 1 if successful */
+int treceval_add_result(struct treceval *raw_results, 
+  const unsigned int query_id, const char *trec_document_number, 
+  const float score);
+
+/* results for a particular query_id are evaluated;
+ * accepts a query ID, a pointer to a results structure, a pointer to a
+ * qrels structure and a pointer to a structure containing the raw
+ * results;
+ * returns 0 in case there are no raw results entered for that
+ *            particular query or there are no relevance judgements
+ *            available for that query;
+ *         1 if results were evaluated and placed in the structure of
+ *           which a pointer was passed in */
+int treceval_evaluate_query(const unsigned int query_id,
+  struct treceval_results *evaluated_results,
+  const struct treceval_qrels *qrels,
+  const struct treceval *raw_results);
+
+/* all results are evaluated
+ * accepts a a pointer to a results structure, a pointer to a qrels
+ * structure and a pointer to a structure containing raw results;
+ * returns currently 1 */
+int treceval_evaluate(const struct treceval *raw_results,
+  const struct treceval_qrels *qrels,
+  struct treceval_results *evaluated_results);
+
+/* printing results
+ * accepts a pointer to an array of evaluated results (or a pointer to a
+ * pointer of a single evaluated result), the number of elements in the
+ * array and a file descriptor (such as stdout, stderr) to which the
+ * result is to be printed */
+void treceval_print_results(struct treceval_results *evaluated_results,
+  const unsigned int number_of_results, FILE *output, int interpolated);
+
+/* calculate statistics between 2 runs over all those queries for which
+ * at least one of the runs has an entry;
+ * accepts pointers to two structures containing raw results, a pointer
+ * to a strucuter in which the results of the statistics will be placed
+ * and a pointer to relevance judgements;
+ * returns 0 in case either of the raw results structures contains no
+ *           tuples, or
+ *         1 upon success */
+int treceval_stats_calculate(const struct treceval *one,
+  const struct treceval *two, struct treceval_statistics *stats,
+  const struct treceval_qrels *qrels,
+  treceval_statistics_tailedness tailedness);
+
+/* print statistics
+ * accepts a pointer to a statistics structure and a file descriptor to
+ * which the output should be written, and whether to print out those
+ * seemingly-useless interpolated statistics;
+ * returns 1 on success, 0 in case the statistics haven't been
+ * calculated (ie the structure is empty or corrupted) */
+int treceval_stats_print(const struct treceval_statistics *stats,
+  FILE *output);
+
+#ifdef _cplusplus
+}
+#endif
+
+#endif
diff --git a/src/include/uri.h b/src/include/uri.h
new file mode 100644 (file)
index 0000000..f2f89c0
--- /dev/null
@@ -0,0 +1,153 @@
+/* uri.h defines a set of methods for parsing and working with Uniform
+ * Resource Identifiers (as defined in RFC 3896).
+ *
+ * Before attempting to work with this interface, you probably need to know a
+ * little about URI's.  A URI is a string that points to a resource.  It can
+ * have a number of components, being the scheme, authority, path, query and
+ * fragment.  For example:
+ *
+ *    http://nml:xxx@blah.com:80/stuff/morestuff?queryparams#fragment
+ *    ^--^   ^-----------------^^--------------^ ^---------^ ^------^
+ *      |            |             |                  |         |
+ *     scheme    authority       path               query    fragment
+ *
+ * Note that the path contains the first / after the authority, but the query
+ * and fragment don't contain ? and # respectively.  The situation is
+ * complicated by a number of things.  Firstly, URI's don't have to contain all
+ * of these components.  Not one single component is actually required in a 
+ * URI, so you can't assume that you're going to get them.
+ * Secondly, the authority can be further broken down into
+ * either an (optional) userinfo field (nml:xxx in the example), hostname or
+ * IPv4 address or IPv6 address (surrounded by square brackets) and (optional)
+ * port number (preceded by a colon).  
+ *
+ * Thanks to the large number of people who use incorrect URI's in real life,
+ * the parser makes a number of deviations from the RFC's.  
+ *   - square brackets are allowed in the path (this is a misinterpretation of
+ *     RFC 2732) (including opaque path components)
+ *   - backslashes are accepted and treated like forward slashes in all cases
+ *     (thanks windows users!)
+ *   - pipes (|) are accepted in path components (including opaque ones),
+ *     queries and fragments (apparently we have netscape to thank for this)
+ *
+ * all of these 'features' can be disabled by defining URI_STRICT when 
+ * compiling uri.c
+ *
+ * written nml 2003-06-02
+ *
+ */
+
+#ifndef URI_H
+#define URI_H
+
+enum uri_ret {
+    URI_OK = 0,               /* operation succeeded */
+
+    URI_ERR = -1,             /* unexpected error */
+    URI_PARSE_ERR = -2,       /* parsing error */
+    URI_CHAR_ERR = -3,        /* illegal character in input (an important 
+                               * subset of parsing error) */
+    URI_MEM_ERR = -4          /* can't allocate memory */
+};
+
+/* enumeration of the different parts of a URI, see top comment for detail */
+enum uri_part {
+    URI_PART_SCHEME = (1 << 0),
+    URI_PART_USERINFO = (1 << 1),
+    URI_PART_HOST = (1 << 2),
+    URI_PART_PORT = (1 << 3),
+    URI_PART_PATH = (1 << 4),
+    URI_PART_QUERY = (1 << 5),
+    URI_PART_FRAGMENT = (1 << 6)
+};
+
+/* each component, each seperator */
+struct uri_parsed {
+    unsigned int scheme_len;     /* length of scheme component */
+    unsigned int userinfo_len;   /* length of userinfo component */
+    unsigned int host_len;       /* length of host component */
+    unsigned int port_len;       /* length of port component */
+    unsigned int path_len;       /* length of path component */
+    unsigned int query_len;      /* length of query component */
+    unsigned int frag_len;       /* length of fragment component */
+
+    int seps;                    /* track which seperators have occurred 
+                                  * (note that just because a component has 
+                                  * zero length, doesn't mean that it's 
+                                  * seperator hasn't occurred) */
+    int flags;                   /* track some properties of the uri */
+};
+
+/* parse the given uri, of length uri_len, and fill in the given parse 
+ * structure on successful return */
+enum uri_ret uri_parse(const char *uri, unsigned int uri_len, 
+  struct uri_parsed *parse);
+
+/* normalise a URI, overwriting the existing data.  uri_len should be set to 
+ * the length of the uri on input,
+ * and will be set to the (never longer) new length of the uri upon successful
+ * return.  The parse structure will also be updated to be appropriate for the
+ * new uri.  Normalisation consists of:
+ *
+ *   - lowercasing the hostname and scheme
+ *   - removing superfluous separators 
+ *   - removing superfluous encoded characters
+ *   - changing '\' to '/' (slightly non-standard)
+ *   - removing standard ports
+ *   - removing leading zeros from ports
+ *   - modifying a path of '/' to the empty path (slightly non-standard)
+ *   - removing '.' and '..' segments from the path
+ *   - translating repeated slashes into single slashes (i.e. '//' -> '/')
+ *
+ */
+enum uri_ret uri_normalise(char *uri, struct uri_parsed *parse);
+#define uri_normalize uri_normalise
+
+/* normalise a path (remove '.' and '..' segments).  path_len should be set to
+ * the length of the uri when passed in, and will be set to the correct (never
+ * longer) length upon successful return) */
+enum uri_ret uri_path_normalise(char *path, unsigned int *path_len);
+#define uri_path_normalize uri_path_normalise
+
+/* extract the selected part of the given uri (with the parse structure filled
+ * in using uri_parse).  Result will be written into dst, up to a limit of
+ * dst_max_len chars, with the untruncated length of the total result written
+ * into dst_len on successful return. */
+enum uri_ret uri_part_decode(const char *uri, const struct uri_parsed *parse, 
+  enum uri_part part, 
+  char *dst, unsigned int dst_max_len, unsigned int *dst_len);
+
+/* return the length of the URI */
+unsigned int uri_length(const struct uri_parsed *parse);
+
+/* whether uri is relative (true) or absolute (false) */
+int uri_relative(const struct uri_parsed *parse);
+
+/* whether uri is hierarchical */
+int uri_hierarchical(const struct uri_parsed *parse);
+
+/* append 'end' uri to 'base' uri, altering the base uri in the process.  
+ * base character array is expected to have sufficient space to hold 
+ * the resultant uri (in other words, it should be of size
+ * uri_append_length(...) or greater).  On success, base will be the 
+ * well-formed resultant uri, on error it probably contains rubbish. */
+enum uri_ret uri_append(char *base, struct uri_parsed *base_parse,
+  const char *end, const struct uri_parsed *end_parse);
+
+/* method to indicate the potential length of a combined uri created by
+ * appending */
+unsigned int uri_append_length(char *base, struct uri_parsed *base_parse,
+  const char *end, const struct uri_parsed *end_parse);
+
+/* append path 'end' to path 'base', altering base in the process.
+ * base character array is expected to have sufficient space to hold 
+ * the resultant path (in other words, it should be of size
+ * uri_path_append_length(...) or greater).  base will then be the 
+ * well-formed resultant path, no errors are possible. */
+void uri_path_append(char *base, unsigned int *base_len, 
+  const char *end, unsigned int end_len, int forward, int back);
+unsigned int uri_path_append_length(char *base, unsigned int base_len, 
+  const char *end, unsigned int end_len, int forward, int back);
+
+#endif
+
diff --git a/src/include/vec.h b/src/include/vec.h
new file mode 100644 (file)
index 0000000..03a5aec
--- /dev/null
@@ -0,0 +1,120 @@
+/* vec.h declares an interface to create and access bytevectors, which
+ * can be dynamically read from, written to and expanded.
+ *
+ * If you don't know what a variable-byte integer encoding scheme is,
+ * you should read Williams and Zobel, Compressing Integers for Fast
+ * File Access (http://www.seg.rmit.edu.au/research/download.php?manuscript=5)
+ *
+ * based very closely on the old vec.[ch] written by Hugh Williams
+ *
+ * updated nml 2002-02-28 
+ *
+ */
+
+#ifndef VEC_H
+#define VEC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <limits.h>
+#include "zstdint.h"
+
+struct vec {
+    char *pos;            /* next read/write memory location */
+    char *end;            /* one past the end of valid read/write range */
+};
+
+/* macro and function to get the length remaining in a vector 
+ * (undefined if v->pos > v->end) */
+#define VEC_LEN(v) \
+  (assert((v)->pos <= (v)->end), (unsigned int) ((v)->end - (v)->pos))
+unsigned int vec_len(struct vec *v);
+
+/* macro to return maximum number of bytes in a vbyte on this platform */
+#if (UINT_MAX == 4294967295U)
+#define VEC_VBYTE_MAX 5
+#else
+/* assume 64-bit */
+#define VEC_VBYTE_MAX 10
+#endif
+
+/* read a vbyte encoded number from the vector v, placing the result in n.  The
+ * number of bytes read is returned on success, 0 on failure (failure can only
+ * occur because of overflow or because the vector ended too soon.  
+ * If VEC_LEN(v) >= vec_vbyte_len(LUINT_MAX) on failure, then overflow 
+ * occurred, otherwise insufficient space was provided).  */
+unsigned int vec_vbyte_read(struct vec *v, unsigned long int *n);
+
+/* write a vbyte encoded number n to vector v.  Returns number of bytes written
+ * or 0 on failure.  Failure can only occur if insufficient space remains in the
+ * vector. */
+unsigned int vec_vbyte_write(struct vec *v, unsigned long int n);
+
+/* scan over num vbyte numbers in vector v.  Returns how many numbers were
+ * successfully scanned over.  This number can only be shorted than the number
+ * requested due to insufficient space in the vector or overflow while reading
+ * one of the numbers. */
+unsigned int vec_vbyte_scan(struct vec *v, unsigned int num, 
+  unsigned int *bytes);
+
+/* read and write arrays of integers.  both functions return the number of
+ * integers read/written, with the number of bytes used written into bytes */
+unsigned int vec_vbyte_arr_write(struct vec *v, unsigned long int *arr, 
+  unsigned int arrlen, unsigned int *bytes);
+unsigned int vec_vbyte_arr_read(struct vec *v, unsigned long int *arr,
+  unsigned int arrlen, unsigned int *bytes);
+
+/* returns the length of a number as a vbyte (in bytes) */
+unsigned int vec_vbyte_len(unsigned long int n);
+
+/* read n bytes from vector v, writing them into dst.  Returns number of bytes
+ * read with short reads being caused by not enough data in the vector */
+unsigned int vec_byte_read(struct vec *v, char *dst, unsigned int n);
+
+/* write n bytes to vector v, reading them from src.  Returns number of bytes
+ * written with short reads being caused by not enough space in the vector */
+unsigned int vec_byte_write(struct vec *v, char *src, unsigned int n);
+
+/* scan over n bytes in vector v.  Returns number of bytes scanned over, with
+ * short scans being caused by not enough data in the vector */
+unsigned int vec_byte_scan(struct vec *v, unsigned int n);
+
+/* alternative versions of the above function for alternative data-types */
+
+unsigned int vec_int_arr_read(struct vec *v, unsigned int *arr, 
+  unsigned int arrlen, unsigned int *bytes);
+unsigned int vec_int_arr_write(struct vec *v, unsigned int *arr, 
+  unsigned int arrlen, unsigned int *bytes);
+unsigned int vec_maxint_arr_read(struct vec *v, uintmax_t *arr, 
+  unsigned int arrlen, unsigned int *bytes);
+unsigned int vec_maxint_arr_write(struct vec *v, uintmax_t *arr, 
+  unsigned int arrlen, unsigned int *bytes);
+
+/* IEEE standard specifies that single-precision floating point numbers have 23
+ * bits of mantissa, making that the maximum precision for storing floats */
+#define VEC_FLT_FULL_PRECISION 23
+
+/* the float read/write functions require you to specify the precision with
+ * which floating point numbers are stored.  You will be required to supply the
+ * same precision to read as you did to write.  The current implementation
+ * rounds the precision (given in bits) to an integral number of bytes,
+ * including a sign bit.  Thus 7, 15, 23 are sensible values for precision. */
+unsigned int vec_flt_read(struct vec *v, float *flt, unsigned int precision);
+unsigned int vec_flt_write(struct vec *v, float flt, unsigned int precision);
+unsigned int vec_flt_arr_read(struct vec *v, float *arr, unsigned int arrlen,
+  unsigned int precision, unsigned int *bytes);
+unsigned int vec_flt_arr_write(struct vec *v, float *arr, unsigned int arrlen,
+  unsigned int precision, unsigned int *bytes);
+
+/* note that we don't have double operations because they're typically overkill
+ * compared to floats, and that it's difficult to manipulate 64-bit 
+ * quantities to read/write them */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/vocab.h b/src/include/vocab.h
new file mode 100644 (file)
index 0000000..df06792
--- /dev/null
@@ -0,0 +1,146 @@
+/* vocab.h contains the definition of the structure stored in the
+ * vocabulary for each of the terms.  It replaces (though largely keeping the
+ * same information) the old hashtable representation.  The vocabulary
+ * will actually be stored compressed in a b-tree, this module also
+ * offers functions to de/compress vocabulary entries
+ *
+ * written nml 2003-02-09
+ *
+ */
+
+#ifndef VOCAB_H
+#define VOCAB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <errno.h>
+
+/* note that _decode and _encode assume that the following enums can fit in a
+ * certain number of bits, so you'll have to change them if you add entries */
+
+/* different locations that a vector can be stored */
+enum vocab_locations {
+    VOCAB_LOCATION_VOCAB = 0,          /* inline, after the entry */
+    VOCAB_LOCATION_FILE = 1            /* standalone, in the heap files */
+};
+
+/* cardinality of attributes (arbitrary info) bits (note that they can both be
+ * on at one time) */
+enum vocab_attributes {
+    VOCAB_ATTRIBUTES_NONE = 0,         /* no attributes */
+    VOCAB_ATTRIBUTES_PERLIST = 1,      /* attributes 1:1 with list */
+    VOCAB_ATTRIBUTES_PEROCC = (1 << 1) /* attributes 1:1 with occurrances 
+                                        * (1:N with list) */
+};
+
+/* different types of vectors that we deal with */
+enum vocab_vtype {
+    VOCAB_VTYPE_DOC = 0,               /* standard document order,
+                                        * f_t: <d, f_dt> */
+    VOCAB_VTYPE_DOCWP = 1,             /* document ordered, with word 
+                                        * positions,
+                                        * f_t: <d, f_dt, (offset)> */
+    VOCAB_VTYPE_IMPACT = 2             /* impact ordered 
+                                        * f_t: <blocksize, impact (d, f_dt)> */
+
+    /* other possibilities are: access ordered, access ordered with word 
+     * positions, frequency ordered, page rank ordered, 
+     * page rank ordered with word positions, a list of documents to delete, 
+     * some kind of meta-vector to contain vocab vector if it becomes too large.
+     * (note that orderings can only (sensibly) have word positions if 
+     * they're a global ordering (same for all terms), which only document, 
+     * access and page rank are) */
+};
+
+/* structure representing an individual vector */
+struct vocab_vector {
+    enum vocab_attributes attr;
+    unsigned int attribute;
+
+    enum vocab_vtype type;
+
+    /* these entries are common to all vector types */
+    unsigned long int size;    /* size of stored vector */
+
+    union {
+        struct {
+            unsigned long int docs;    /* number of documents term occurs in */
+            unsigned long int occurs;  /* total number of times term occurrs */
+            unsigned long int last;    /* last docno in vector */
+        } doc;
+
+        struct {
+            unsigned long int docs;    /* number of documents term occurs in */
+            unsigned long int occurs;  /* total number of times term occurrs */
+            unsigned long int last;    /* last docno in vector */
+        } docwp;
+
+        struct {
+            unsigned long int docs;    /* number of documents term occurs in */
+            unsigned long int occurs;  /* total number of times term occurrs */
+            unsigned long int last;    /* last docno in vector */
+        } impact;
+    } header;
+
+    enum vocab_locations location;     /* location */
+    union {
+        /* VOCAB entries are the last section of bytes in each entry */
+        struct {
+            void *vec;                 /* pointer to vector in given memory */
+        } vocab;
+
+        /* struct for entries in location FILE */
+        struct {
+            unsigned int capacity;     /* how much space is there */
+            unsigned int fileno;       /* number of file its in */
+            unsigned long int offset;  /* offset it's at */
+        } file;
+    } loc;
+};
+
+/* return values that below functions can return */
+enum vocab_ret {
+    VOCAB_ENOSPC = -ENOSPC,            /* vector didn't contain a full vocab 
+                                        * entry */
+    VOCAB_EOVERFLOW = -EOVERFLOW,      /* overflow while reading a value */
+    VOCAB_EINVAL = -EINVAL,            /* invalid vocab entry */
+    VOCAB_OK = 0,                      /* success */
+    VOCAB_END = 1                      /* no further entries to read */
+};
+
+struct vec;
+
+/* decodes a vocab vector from a (contiguous) series of bytes.  Returns _END if
+ * no further vectors follow, _ERR if the bytes don't make sense and _OK if a
+ * vector was successfully read.  Note that decode skips over location VOCAB
+ * bytes (at end) without reading them. */
+enum vocab_ret vocab_decode(struct vocab_vector *vocab, struct vec *v);
+
+/* encodes a vocab vector into a (contiguous) series of bytes.  Returns _ERR 
+ * there isn't enough space and _OK if the operation was successful.  No other
+ * errors should be possible.  Note that location VOCAB bytes (at end) are 
+ * skipped over without writing. (this function should probably encode them into
+ * the vector given the vector pointer in the vocab structure, but that assumes
+ * that the vocab vector is contiguous in memory). */
+enum vocab_ret vocab_encode(struct vocab_vector *vocab, struct vec *v);
+
+/* returns the length in bytes of a vocab vector */
+unsigned int vocab_len(struct vocab_vector *vocab);
+
+/* returns the number of docs from a vocab vector */
+unsigned long int vocab_docs(struct vocab_vector *vocab);
+
+/* returns the number of occurences from a vocab vector */
+unsigned long int vocab_occurs(struct vocab_vector *vocab);
+
+/* returns the last docnum from a vocab vector */
+unsigned long int vocab_last(struct vocab_vector *vocab);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/include/win32/config.h b/src/include/win32/config.h
new file mode 100644 (file)
index 0000000..e378d14
--- /dev/null
@@ -0,0 +1,77 @@
+/* Define to 1 if you have the <inttypes.h> header file. 
+#undef HAVE_INTTYPES_H */
+
+/* Define to 1 if you have the <stdint.h> header file. 
+#undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <unistd.h> header file. 
+#undef HAVE_UNISTD_H 1 */
+
+/* Name of package */
+#define PACKAGE "zettair"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "zettair@cs.rmit.edu.au"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "zettair"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "zettair 0.6.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "zettair"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.6.0"
+
+/* Version number of package */
+#define VERSION "0.6.0"
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+#define uint8_t unsigned char
+#define uint16_t unsigned short int
+#define uint32_t unsigned long int
+#define uint64_t __int64  /* win32 doesn't seem to have uint64_t :o( */
+#define uintmax_t __int64  /* win32 doesn't seem to have uint64_t :o( */
+#define uint_fast32_t unsigned long int
+
+/* define floating point functions */
+#ifndef sqrtf 
+#define sqrtf sqrt
+#endif 
+#ifndef logf 
+#define logf log
+#endif 
+#ifndef ldexpf 
+#define ldexpf ldexp
+#endif 
+#ifndef frexpf 
+#define frexpf frexp
+#endif 
+
+/* XXX: win32 doesn't have eoverflow :o( */
+#define EOVERFLOW EINVAL
+
+#define STDOUT_FILENO _fileno(stdout)
+
+/* FIXME: (horrible hack) windows doesn't have sysconf, so just use 4096.  I
+ * don't want to spend time buggering around with abstracting this facility ATM
+ * */
+#define sysconf(_SC_PAGESIZE) 4096
+
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+
+#define getcwd(x,y) _getcwd(x, y)
+#define read(x,y,z) _read(x,y,z)
+#define write(x,y,z) _write(x,y,z)
+#define isatty(x) _isatty(x)
+#define lseek(x,y,z) _lseek(x,y,z)
+
diff --git a/src/include/win32/firstinclude.h b/src/include/win32/firstinclude.h
new file mode 100644 (file)
index 0000000..fda0756
--- /dev/null
@@ -0,0 +1,37 @@
+/* win32/firstinclude.h defines macros to hack basic POSIX stuff so that it\r
+ * works on win32\r
+ *\r
+ * written nml 2004-07-14\r
+ *\r
+ */\r
+\r
+#ifndef FIRSTINCLUDE_H\r
+#define FIRSTINCLUDE_H\r
+\r
+#ifndef _FILE_OFFSET_BITS\r
+#define _FILE_OFFSET_BITS 64           /* large file support */\r
+#endif\r
+#define _BSD_SOURCE                    /* for snprintf */\r
+#define _POSIX_SOURCE                  /* for lots of stuff */\r
+#define _POSIX_C_SOURCE 199309L\r
+\r
+#include "config.h"\r
+\r
+#include <direct.h>\r
+#include <io.h>\r
+\r
+#define OS_SEPARATOR '\\'\r
+\r
+typedef int ssize_t; \r
+typedef long int off_t; \r
+\r
+/* dummy timeval struct to make things compile */\r
+struct timeval {\r
+    long int tv_sec;\r
+    long int tv_usec;\r
+}; \r
+\r
+int gettimeofday(struct timeval *tp, void *vp);\r
+\r
+#endif\r
+\r
diff --git a/src/index.c b/src/index.c
new file mode 100644 (file)
index 0000000..dde5202
--- /dev/null
@@ -0,0 +1,1839 @@
+/* index.c implements high level operations for a simple, non-distributed 
+ * search engine index
+ *
+ * some operations have been moved to index_search.c and index_update.c
+ * to keep each file within reasonable bounds
+ *
+ * written nml 2003-04-14
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "_index.h"
+#include "index.h"
+
+#include "_mem.h"
+
+#include "def.h"
+#include "error.h"
+#include "fdset.h"
+#include "freemap.h"
+#include "docmap.h"
+#include "getmaxfsize.h"
+#include "iobtree.h"
+#include "str.h"
+#include "stream.h"
+#include "stem.h"
+#include "summarise.h"
+#include "timings.h"
+#include "makeindex.h"
+#include "mem.h"
+#include "mime.h"
+#include "postings.h"
+#include "pyramid.h"
+#include "psettings.h"
+#include "stop.h"
+#include "vec.h"
+#include "vocab.h"
+#include "zvalgrind.h"
+#include "impact_build.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Version number for index format.  This gets incremented every time
+   a change is made to the format of the on-disk index. */
+#define INDEX_FILE_FORMAT_VERSION 0x3141592e
+
+const char *index_doctype_names[] = {"" /* err */, "html", "trec", "inex"};
+
+/* function to return the stemming function used by an index */
+void (*index_stemmer(struct index *idx))(void *, char *) {
+    if ((idx->flags & INDEX_STEMMED_LIGHT) == INDEX_STEMMED_LIGHT) {
+        return (void (*)(void *, char *)) stem_light; 
+    } else if (idx->flags & INDEX_STEMMED_PORTERS) {
+        return (void (*)(void *, char *)) stem_porters; 
+    } else if (idx->flags & INDEX_STEMMED_EDS) {
+        return (void (*)(void *, char *)) stem_eds; 
+    } else {
+        return NULL;
+    }
+}
+
+/* internal function to atomically perform a read */
+ssize_t index_atomic_read(int fd, void *buf, unsigned int size) {
+    unsigned int rlen,
+                 len = size;
+    char *pos = buf;
+
+    while (len && ((rlen = read(fd, pos, len)) > 0)) {
+        pos += rlen;
+        len -= rlen;
+    }
+
+    if (len) {
+        return -1;
+    } else {
+        return size;
+    }
+}
+
+/* internal function to atomically perform a write */
+ssize_t index_atomic_write(int fd, void *buf, unsigned int size) {
+    unsigned int wlen,
+                 len = size;
+    char *pos = buf;
+
+    while (len && ((wlen = write(fd, pos, len)) != -1)) {
+        pos += wlen;
+        len -= wlen;
+    }
+
+    if (len) {
+        return -1;
+    } else {
+        return size;
+    }
+}
+
+#define INDEX_HEADER ("\035\170" PACKAGE)    /* 1dx package_name */
+
+#define FAIL()                                                                \
+    if (1) {                                                                  \
+        assert(!CRASH);                                                       \
+        free(buf);                                                            \
+        fclose(fp);                                                           \
+        return 0;                                                             \
+    } else
+
+#define READ_MEMBER(fp, member, sizetype)                                     \
+    /* note that we have to transfer to a tmp variable after we ntoh into a   \
+     * second tmp variable to ensure that the ntoh is on two variables of the \
+     * correct size.  This prevents bugs on bigendian architectures. */       \
+    if (fread(&tmp_##sizetype, sizeof(sizetype), 1, fp)) {                    \
+        mem_ntoh(&tmp_tmp_##sizetype, &tmp_##sizetype, sizeof(sizetype));     \
+        member = tmp_tmp_##sizetype;                                          \
+    } else if (1) {                                                           \
+        FAIL();                                                               \
+    } else
+
+#define READ_DOUBLE(fp, member)                                               \
+    if (1) {                                                                  \
+        READ_MEMBER(fp, mantissa, uint32_t);                                  \
+        READ_MEMBER(fp, exponent, uint32_t);                                  \
+        member = ldexp(((double) mantissa) / UINT32_MAX, exponent);           \
+    } else
+
+static int index_params_read(struct index *idx, 
+  unsigned int *root_fileno, unsigned long int *root_offset, 
+  unsigned int *terms, 
+  unsigned int *vfileno, unsigned long int *voffset, unsigned int *vsize,
+  int ignore_version) {
+    FILE *fp;
+    char *buf;
+    unsigned int bufsize = FILENAME_MAX;
+    uint32_t tmp_uint32_t,
+             tmp_tmp_uint32_t;
+    uint8_t tmp_uint8_t,
+            tmp_tmp_uint8_t;
+    uint32_t mantissa;
+    int exponent;
+    unsigned long int tmp,
+                      tmplen;
+    unsigned int size;
+    uint32_t file_format_version;
+    char filename[FILENAME_MAX + 1];
+
+    if (bufsize < storagep_size()) {
+        bufsize = storagep_size();
+    }
+
+    /* note that i had an alternative method of doing this using fdopen(), 
+     * except that had funny behaviour on OS X (?) */
+    if ((buf = malloc(bufsize))
+      && (fdset_name(idx->fd, idx->param_type, 0, filename, FILENAME_MAX, 
+          &size, &exponent) == FDSET_OK)
+      && (((filename[size] = '\0'), fp = fopen(filename, "rb"))
+        /* blech, hack around times when too many fd's are open in fdset */
+        || (((errno == EMFILE) || (errno == ENFILE)) 
+          && (fdset_close(idx->fd) == FDSET_OK)
+          && (fp = fopen(filename, "rb"))))) {
+        /* open succeeded */
+
+        /* get signature bytes from the start */
+        assert(str_len(INDEX_HEADER) < FILENAME_MAX);
+        if (fread(buf, 1, str_len(INDEX_HEADER), fp) < str_len(INDEX_HEADER)) {
+            FAIL();
+        }
+        if (str_ncmp(buf, INDEX_HEADER, str_len(INDEX_HEADER))) {
+            ERROR1("index header not found at head of params buffer: "
+              "looking for '%s'", INDEX_HEADER);
+            FAIL();
+        }
+
+        READ_MEMBER(fp, file_format_version, uint32_t);
+        if (file_format_version != INDEX_FILE_FORMAT_VERSION) {
+            ERROR2("wrong index file format version: index file has version "
+              "0x%08x, executable has version 0x%08x", file_format_version,
+              INDEX_FILE_FORMAT_VERSION);
+            if (!ignore_version) {
+                FAIL();
+            }
+        }
+        READ_MEMBER(fp, idx->flags, uint8_t);
+
+        READ_MEMBER(fp, idx->repos, uint32_t);
+        READ_MEMBER(fp, idx->vectors, uint32_t);
+        READ_MEMBER(fp, idx->vocabs, uint32_t);
+        READ_MEMBER(fp, idx->repos_pos, uint32_t);
+        if (!idx->vectors || !idx->vocabs) {
+            ERROR2("0 length vectors (%u) or vocabs (%u) in params load", 
+              idx->vectors, idx->vocabs);
+            FAIL();
+        }
+
+        READ_MEMBER(fp, idx->stats.terms_high, uint32_t);
+        READ_MEMBER(fp, idx->stats.terms_low, uint32_t);
+        READ_MEMBER(fp, idx->stats.updates, uint32_t);
+        READ_DOUBLE(fp, idx->stats.avg_weight);
+        READ_DOUBLE(fp, idx->stats.avg_length);
+        READ_DOUBLE(fp, idx->impact_stats.avg_f_t);
+        READ_DOUBLE(fp, idx->impact_stats.slope);
+        READ_MEMBER(fp, idx->impact_stats.quant_bits, uint32_t);
+        READ_DOUBLE(fp, idx->impact_stats.w_qt_min);
+        READ_DOUBLE(fp, idx->impact_stats.w_qt_max);
+        READ_MEMBER(fp, idx->doc_order_vectors, uint32_t);
+        READ_MEMBER(fp, idx->doc_order_word_pos_vectors, uint32_t);
+        READ_MEMBER(fp, idx->impact_vectors, uint32_t);
+
+        READ_MEMBER(fp, *root_fileno, uint32_t);
+        READ_MEMBER(fp, *root_offset, uint32_t);
+
+        READ_MEMBER(fp, *terms, uint32_t);
+
+        /* read structured params */
+        if (fread(buf, storagep_size(), 1, fp)) {
+            storagep_read(&idx->storage, buf);
+        } else {
+            FAIL();
+        }
+
+        /* retrieve index config name */
+        idx->params.config = NULL;
+        READ_MEMBER(fp, tmp, uint32_t);
+        if (tmp && (idx->params.config = malloc(tmp + 1))) {
+            if (fread(idx->params.config, tmp, 1, fp)) {
+                idx->params.config[tmp] = '\0';
+            } else {
+                FAIL();
+            }
+        } else if (tmp) {
+            ERROR("allocating config buffer");
+            FAIL();
+        }
+
+        /* retrieve index repository names */
+        while (fread(&tmp_uint32_t, sizeof(uint32_t), 1, fp)) {
+            MEM_NTOH(&tmp, &tmp_uint32_t, sizeof(uint32_t));
+            READ_MEMBER(fp, tmplen, uint32_t);
+            if ((tmplen < bufsize) && fread(buf, tmplen, 1, fp)
+              && fdset_set_fd_name(idx->fd, idx->repos_type, tmp, buf, tmplen, 
+                0) == FDSET_OK) {
+
+                /* succeeded, do nothing */
+            } else {
+                FAIL();
+            }
+        }
+
+        if (feof(fp)) {
+            free(buf);
+            fclose(fp);
+            return 1;
+        } else {
+            assert(!CRASH);
+            FAIL();
+        }
+    } else {
+        if (buf) {
+            free(buf);
+        }
+        return 0;
+    }
+}
+#undef FAIL
+
+#define FAIL()                                                                \
+    free(buf);                                                                \
+    fclose(fp);                                                               \
+    return 0
+
+#define WRITE_MEMBER(fp, member, sizetype)                                    \
+    /* note that we have to transfer to a tmp variable before we hton into a  \
+     * second tmp variable to ensure that the hton is on two variables of the \
+     * correct size.  This prevents bugs on bigendian architectures. */       \
+    tmp_tmp_##sizetype = (sizetype) member;                                   \
+    mem_hton(&tmp_##sizetype, &tmp_tmp_##sizetype, sizeof(sizetype));         \
+    VALGRIND_CHECK_READABLE(&tmp_##sizetype, sizeof(sizetype));               \
+    if (!fwrite(&tmp_##sizetype, sizeof(sizetype), 1, fp)) {                  \
+        FAIL();                                                               \
+    } else
+
+#define WRITE_DOUBLE(ptr, val)                                                \
+    mantissa = (unsigned long int) (UINT32_MAX * frexp(val, &exponent));      \
+    WRITE_MEMBER(ptr, mantissa, uint32_t);                                    \
+    WRITE_MEMBER(ptr, exponent, uint32_t)
+
+static int index_params_write(struct index *idx, 
+  unsigned int root_fileno, unsigned long int root_offset, 
+  unsigned int terms) {
+    FILE *fp = NULL;
+    char *buf;
+    uint32_t tmp_uint32_t,
+             tmp_tmp_uint32_t;
+    uint8_t tmp_uint8_t,
+            tmp_tmp_uint8_t;
+    uint32_t mantissa;
+    int exponent,
+        writeable;
+    unsigned int i;
+    char filename[FILENAME_MAX + 1];
+
+    if ((buf = malloc(storagep_size()))
+      && (fdset_name(idx->fd, idx->param_type, 0, filename, FILENAME_MAX, 
+          &i, &exponent) == FDSET_OK)
+      && (((filename[i] = '\0'), fp = fopen(filename, "wb"))
+        /* blech, hack around times when too many fd's are open in fdset */
+        || (((errno == EMFILE) || (errno == ENFILE)) 
+          && (fdset_close(idx->fd) == FDSET_OK)
+          && (fp = fopen(filename, "wb"))))
+      /* write in signature bytes */
+      && fwrite(INDEX_HEADER, str_len(INDEX_HEADER), 1, fp)) {
+        /* open succeeded */
+
+        i = INDEX_FILE_FORMAT_VERSION;
+        WRITE_MEMBER(fp, i, uint32_t);
+        WRITE_MEMBER(fp, idx->flags, uint8_t);
+
+        WRITE_MEMBER(fp, idx->repos, uint32_t);
+        WRITE_MEMBER(fp, idx->vectors, uint32_t);
+        WRITE_MEMBER(fp, idx->vocabs, uint32_t);
+        WRITE_MEMBER(fp, idx->repos_pos, uint32_t);
+
+        WRITE_MEMBER(fp, idx->stats.terms_high, uint32_t);
+        WRITE_MEMBER(fp, idx->stats.terms_low, uint32_t);
+        WRITE_MEMBER(fp, idx->stats.updates, uint32_t);
+
+        WRITE_DOUBLE(fp, idx->stats.avg_weight);
+        WRITE_DOUBLE(fp, idx->stats.avg_length);
+
+        WRITE_DOUBLE(fp, idx->impact_stats.avg_f_t);
+        WRITE_DOUBLE(fp, idx->impact_stats.slope);
+        WRITE_MEMBER(fp, idx->impact_stats.quant_bits, uint32_t);
+        WRITE_DOUBLE(fp, idx->impact_stats.w_qt_min);
+        WRITE_DOUBLE(fp, idx->impact_stats.w_qt_max);
+
+        WRITE_MEMBER(fp, idx->doc_order_vectors, uint32_t);
+        WRITE_MEMBER(fp, idx->doc_order_word_pos_vectors, uint32_t);
+        WRITE_MEMBER(fp, idx->impact_vectors, uint32_t);
+
+        WRITE_MEMBER(fp, root_fileno, uint32_t);
+        WRITE_MEMBER(fp, root_offset, uint32_t);
+
+        WRITE_MEMBER(fp, terms, uint32_t);
+
+        storagep_write(&idx->storage, buf);
+        if (!fwrite(buf, storagep_size(), 1, fp)) {
+            FAIL();
+        }
+
+        /* write config filename */
+        if (idx->params.config) {
+            i = str_len(idx->params.config);
+        } else {
+            i = 0;
+        }
+        WRITE_MEMBER(fp, i, uint32_t);
+        if (i && !fwrite(idx->params.config, i, 1, fp)) {
+            FAIL();
+        }
+
+        /* write set repository names */
+        for (i = 0; i < idx->repos; i++) {
+            int set;
+            unsigned int len;
+
+            if ((fdset_isset(idx->fd, idx->repos_type, i, &set) != FDSET_OK) 
+              || (fdset_name(idx->fd, idx->repos_type, i, filename, 
+                FILENAME_MAX, &len, &writeable))) {
+
+                assert(!CRASH);
+                FAIL();
+            }
+
+            if (set) {
+                WRITE_MEMBER(fp, i, uint32_t);
+                WRITE_MEMBER(fp, len, uint32_t);
+                if (!fwrite(filename, len, 1, fp)) {
+                    FAIL();
+                }
+            }
+        }
+
+        free(buf);
+        fclose(fp);
+        return 1;
+    } else {
+        assert(!CRASH);
+        if (buf) {
+            free(buf);
+            if (fp) {
+                fclose(fp);
+            }
+        }
+        return 0;
+    }
+}
+#undef FAIL
+
+int index_commit_superblock(struct index *idx) {
+    void *buf = NULL;
+    unsigned int root_fileno = 0,
+                 btree_size = 0;
+    unsigned long int root_offset = 0;
+    int ret = 1;
+    enum docmap_ret dm_ret;
+
+    if (idx->vocab) {
+        iobtree_root(idx->vocab, &root_fileno, &root_offset);
+        btree_size = iobtree_size(idx->vocab);
+    }
+
+    if (!ret 
+      /* XXX: note that we don't try to flush btree if its NULL, so that the
+       * (somewhat external) build process can use this function */
+      || (idx->vocab && !iobtree_flush(idx->vocab))) {
+        assert(!CRASH);
+        return 0;
+    }
+
+    /* write docmap to disk */
+    dm_ret = docmap_save(idx->map);
+    if (dm_ret != DOCMAP_OK) {
+        ERROR1("saving docmap: return value is '%d'", dm_ret);
+        if (buf) {
+            free(buf);
+            buf = NULL;
+        }
+        assert(!CRASH);
+        return 0;
+    }
+
+    /* write parameters to disk */
+    if (index_params_write(idx, root_fileno, root_offset, btree_size)) {
+        /* write succeeded */
+    } else {
+        assert(!CRASH);
+        return 0;
+    }
+    return 1;
+}
+
+static int index_set_fd_types(struct index *idx, const char * name) {
+    if (fdset_create_new_type(idx->fd, name, PARAMSUF, 1 /* write */,
+          &idx->param_type) != FDSET_OK
+      || fdset_create_new_type(idx->fd, name, VECTORSUF, 1,
+          &idx->index_type) != FDSET_OK
+      || fdset_create_new_type(idx->fd, name, REPOSSUF, 1, 
+          &idx->repos_type) != FDSET_OK
+      || fdset_create_new_type(idx->fd, name, VOCABSUF, 1, 
+          &idx->vocab_type) != FDSET_OK
+      || fdset_create_new_type(idx->fd, name, DOCMAPSUF, 1, 
+          &idx->docmap_type) != FDSET_OK
+      || fdset_create_new_type(idx->fd, name, "vtmp", 1, 
+          &idx->vtmp_type) != FDSET_OK
+      || fdset_create_new_type(idx->fd, name, "tmp", 1, 
+          &idx->tmp_type) != FDSET_OK) {
+        return -1;
+    }
+    return 0;
+}
+
+struct index *index_new(const char *name, const char *config, 
+  unsigned int memory, int opts, struct index_new_opt *opt) {
+    struct index *idx;
+    int fd = -1;
+    int retval;
+    int bigendian = 0;
+    enum docmap_ret dm_ret;
+    FILE *fp;
+
+#ifdef WORDS_BIGENDIAN
+    bigendian = 1;
+#endif
+
+    if (opts & INDEX_NEW_ENDIAN) {
+        bigendian = opt->bigendian;
+    }
+
+    /* note that we don't initialise a vocab here, because there is nothing to
+     * search.  It should be initialised at construction time */
+
+    /* XXX: first section here shared with index_load: factorise
+       into common init function. */
+
+    if (!(idx = malloc(sizeof(*idx)))) {
+        ERROR("allocating memory for index object");
+        return NULL;
+    }
+
+    /* set all pointers to NULL so we know what to free on failure */
+    idx->flags = 0;
+    idx->fd = NULL;
+    idx->vocab = NULL;
+    idx->map = NULL;
+    idx->post = NULL;
+    idx->settings = NULL;
+    idx->repos = 0;
+    idx->vectors = 0;
+    idx->vocabs = 0;
+    idx->merger = NULL;
+    idx->sum = NULL;
+    idx->istop = NULL;
+    idx->qstop = NULL;
+    idx->params.config = NULL;
+    idx->params.tblsize = TABLESIZE;
+    idx->params.parsebuf = PARSE_BUFFER;
+    idx->impact_stats.avg_f_t = 0;
+    idx->impact_stats.slope = 0;
+    idx->impact_stats.quant_bits = 0;
+    idx->impact_stats.w_qt_min = 0;
+    idx->impact_stats.w_qt_max = 0;
+    idx->doc_order_vectors = 0;
+    idx->doc_order_word_pos_vectors = 1;
+    idx->impact_vectors = 0;
+    
+    /* initialise stemming algorithm if requested */
+    if (opts & INDEX_NEW_STEM) {
+        if ((opt->stemmer == INDEX_STEM_PORTERS) 
+          && (idx->stem 
+            = stem_cache_new(stem_porters, NULL, 200))) {
+            idx->flags |= INDEX_STEMMED_PORTERS;
+        } else if ((opt->stemmer == INDEX_STEM_EDS)) {
+            idx->flags |= INDEX_STEMMED_EDS;
+            idx->stem = NULL;
+        } else if ((opt->stemmer == INDEX_STEM_LIGHT)) {
+            idx->flags |= INDEX_STEMMED_LIGHT;
+            idx->stem = NULL;
+        } else {
+            /* unknown stemming algorithm or couldn't initialise stemmer */
+            ERROR("initialising stemming algorithm");
+            index_rm(idx);
+            index_delete(idx);
+            return NULL;
+        }
+    } else {
+        idx->stem = NULL;
+    }
+
+    if (opts & INDEX_NEW_STOP) {
+        idx->istop 
+          = stop_new_file(index_stemmer(idx), idx->stem, opt->stop_file);
+        if (idx->istop == NULL) {
+            ERROR1("loading stop file %s", opt->stop_file);
+            index_rm(idx);
+            index_delete(idx);
+            return NULL;
+        }
+    } else {
+        idx->istop = NULL;
+    }
+
+    if (opts & INDEX_NEW_QSTOP) {
+        if (!(opt->qstop_file 
+            && (idx->qstop 
+              = stop_new_file(index_stemmer(idx), idx->stem, opt->qstop_file)))
+          && !(!opt->qstop_file
+            && (idx->qstop 
+              = stop_new_default(index_stemmer(idx), idx->stem)))) {
+
+            ERROR1("loading query stop file %s", 
+              opt->qstop_file ? opt->qstop_file : "(default)");
+            index_rm(idx);
+            index_delete(idx);
+            return NULL;
+        }
+    }
+
+    if (opts & INDEX_NEW_TABLESIZE) {
+        idx->params.tblsize = opt->tablesize;
+    }
+    if (opts & INDEX_NEW_PARSEBUF) {
+        idx->params.parsebuf = opt->parsebuf;
+    }
+
+    if ((idx->fd = fdset_new(0644, 1)) == NULL) {
+        ERROR("creating fdset for new index");
+        index_delete(idx);
+        return NULL;
+    }
+
+    if (index_set_fd_types(idx, name) < 0) {
+        ERROR("setting fdset type names");
+        index_delete(idx);
+        return NULL;
+    }
+
+    /* ensure we assigned different types */
+    assert(idx->index_type != idx->tmp_type);
+    assert(idx->repos_type != idx->tmp_type);
+    assert(idx->index_type != idx->repos_type);
+
+    if ((fd = fdset_create(idx->fd, idx->index_type, 0)) < 0) { 
+        ERROR("creating the new index file");
+        index_delete(idx);
+        return NULL;
+    } 
+
+    /* get/apply parameters */
+    if (storagep_defaults(&idx->storage, fd) < 0) {
+        ERROR("determining maximum file size");
+        index_rm(idx);
+        index_delete(idx);
+        return NULL;
+    }
+    idx->storage.bigendian = bigendian; 
+    retval = fdset_unpin(idx->fd, idx->index_type, 0, fd);
+    assert(retval == FDSET_OK);
+    fd = -1;
+
+    /* process storage-related options */
+    if (opts & INDEX_NEW_MAXFILESIZE) {
+        idx->storage.max_filesize = opt->maxfilesize;
+    }
+    if (opts & INDEX_NEW_VOCAB) {
+        idx->storage.vocab_lsize = opt->vocab_size;
+    }
+
+    idx->params.memory = memory;
+    if (config) {
+        if ((idx->params.config = str_dup(config)) == NULL) {
+            ERROR1("duplicating config file name '%s'", config);
+            index_rm(idx);
+            index_delete(idx);
+            return NULL;
+        }
+    }
+
+    if ((idx->map = docmap_new(idx->fd, idx->docmap_type, 
+        idx->storage.pagesize,
+        0, idx->storage.max_filesize, 0, &dm_ret)) == NULL) {
+
+        ERROR1("creating docmap: error code '%d'", dm_ret);
+        index_rm(idx);
+        index_delete(idx);
+        return NULL;
+    }
+    if (!(idx->post = postings_new(idx->params.tblsize, index_stemmer(idx), 
+        idx->stem, idx->istop))) {
+
+        ERROR("creating postings");
+        index_rm(idx);
+        index_delete(idx);
+        return NULL;
+    }
+    if (idx->params.config) {
+        if ((fp = fopen((const char *) idx->params.config, "rb"))
+          && (idx->settings = psettings_read(fp, PSETTINGS_ATTR_INDEX))) {
+            fclose(fp);
+        } else {
+            if (fp) {
+                fclose(fp);
+            }
+            ERROR1("loading parser settings from '%s'", idx->params.config);
+            index_rm(idx);
+            index_delete(idx);
+            return NULL;
+        }
+    } else if (!(idx->settings 
+      = psettings_new_default(PSETTINGS_ATTR_INDEX))) {
+        ERROR("loading default parser settings");
+        index_rm(idx);
+        index_delete(idx);
+        return NULL;
+    }
+
+    if ((idx->merger 
+      = pyramid_new(idx->fd, idx->tmp_type, idx->index_type, idx->vocab_type,
+          PYRAMID_WIDTH, &idx->storage, NULL, NULL)) 
+        == NULL) {
+
+        ERROR("creating merger pyramid");
+        index_rm(idx);
+        index_delete(idx);
+        return NULL;
+    }
+    if ((idx->sum = summarise_new(idx)) == NULL) {
+        ERROR("creating summarisation object");
+        index_rm(idx);
+        index_delete(idx);
+        return NULL;
+    }
+
+    idx->flags |= INDEX_SOURCE;
+
+    idx->vectors = 0;
+    idx->repos = 0;
+    idx->repos_pos = 0;
+    idx->stats.updates = 0;
+    idx->stats.terms_high = 0;
+    idx->stats.terms_low = 0;
+    idx->stats.avg_length = 0.0;
+    idx->stats.avg_weight = 0.0;
+
+    return idx;
+}
+
+struct index *index_load(const char *name, unsigned int memory, int opts, 
+  struct index_load_opt *opt) {
+    struct index *idx = NULL;
+    void *buf = NULL;
+    unsigned int fd_fileno = -1,
+                 root_fileno,
+                 terms,
+                 vfileno,
+                 vsize;
+    unsigned long int voffset,
+                      root_offset;
+    enum docmap_ret dm_ret;
+    enum docmap_cache dm_cache = DOCMAP_CACHE_WORDS | DOCMAP_CACHE_TRECNO;
+    FILE *fp;
+
+    if (!(idx = malloc(sizeof(*idx)))) {
+        ERROR("allocating memory for index object");
+        return NULL;
+    }
+
+    /* set all pointers to NULL so we know what to free on failure */
+    idx->fd = NULL; 
+    idx->vocab = NULL; 
+    idx->map = NULL; 
+    idx->post = NULL;
+    idx->settings = NULL; 
+    idx->istop = NULL; 
+    idx->qstop = NULL; 
+    idx->sum = NULL; 
+    idx->repos = 0; 
+    idx->vectors = 0; 
+    idx->merger = NULL; 
+    idx->params.config = NULL;
+    idx->params.tblsize = TABLESIZE;
+    idx->params.parsebuf = PARSE_BUFFER;
+    idx->stem = NULL;
+
+    if (!(idx->fd = fdset_new(0644, 1))) {
+        ERROR("creating fdset for index");
+        index_delete(idx);
+        return NULL;
+    }
+    /* need to initialise a fdset before getting parameters */
+    if (index_set_fd_types(idx, name) < 0) {
+        ERROR("setting fdset type names");
+        index_delete(idx);
+        return NULL;
+    }
+
+    fd_fileno = 0;
+
+    /* get parameters from disk */
+    if (!(index_params_read(idx, &root_fileno, &root_offset, &terms, 
+          &vfileno, &voffset, &vsize,
+          opts & INDEX_LOAD_IGNORE_VERSION))) {
+        /* function prints error */
+        index_delete(idx);
+        free(buf);
+        return NULL;
+    }
+    assert(idx->vocabs);
+    idx->params.memory = memory;
+
+    /* process storage-related options */
+    if (opts & INDEX_LOAD_VOCAB) {
+        idx->storage.vocab_lsize = opt->vocab_size;
+    }
+    if (opts & INDEX_LOAD_MAXFLIST) {
+        idx->storage.file_lsize = opt->maxflist_size;
+    }
+    if (opts & INDEX_LOAD_TABLESIZE) {
+        idx->params.tblsize = opt->tablesize;
+    }
+    if (opts & INDEX_LOAD_PARSEBUF) {
+        idx->params.parsebuf = opt->parsebuf;
+    }
+    if (opts & INDEX_LOAD_DOCMAP_CACHE) {
+        dm_cache = opt->docmap_cache;
+    }
+
+    /* initialise stemming algorithm if required */
+    if (idx->flags & INDEX_STEMMED) {
+        /* XXX: note that we currently assume porters stemmer */
+        if ((idx->flags & INDEX_STEMMED_LIGHT) == INDEX_STEMMED_LIGHT) {
+            idx->stem = NULL;
+        } else if ((idx->flags & INDEX_STEMMED_PORTERS) 
+          && (idx->stem = stem_cache_new(stem_porters, NULL, 200))) {
+            /* succeeded, do nothing */
+        } else if (idx->flags & INDEX_STEMMED_EDS) {
+            idx->stem = NULL;
+        } else {
+            /* couldn't initialise stemmer */
+            index_delete(idx);
+            return NULL;
+        }
+    } else {
+        idx->stem = NULL;
+    }
+
+    if (opts & INDEX_LOAD_QSTOP) {
+        if (!(opt->qstop_file 
+            && (idx->qstop 
+              = stop_new_file(index_stemmer(idx), idx->stem, opt->qstop_file)))
+          && !(!opt->qstop_file
+            && (idx->qstop 
+              = stop_new_default(index_stemmer(idx), idx->stem)))) {
+
+            ERROR1("loading query stop file %s", 
+              opt->qstop_file ? opt->qstop_file : "(default)");
+            index_rm(idx);
+            index_delete(idx);
+            return NULL;
+        }
+    }
+
+    /* read the docmap off of disk */
+    if ((idx->map = docmap_load(idx->fd, idx->docmap_type, 
+          idx->storage.pagesize, 0, idx->storage.max_filesize, 
+          dm_cache, &dm_ret)) 
+      == NULL) {
+
+        ERROR1("loading docmap: error is '%s'", docmap_strerror(dm_ret));
+        index_delete(idx);
+        return NULL;
+    }
+
+    /* now initialise the rest of the members */
+    if (!(idx->post = postings_new(idx->params.tblsize, index_stemmer(idx), 
+        idx->stem, NULL))) {
+
+        ERROR("creating postings");
+        index_delete(idx);
+        return NULL;
+    }
+
+    if (idx->params.config) {
+        if ((fp = fopen((const char *) idx->params.config, "rb"))
+          && (idx->settings = psettings_read(fp, PSETTINGS_ATTR_INDEX))) {
+            fclose(fp);
+        } else {
+            if (fp) {
+                fclose(fp);
+            }
+            ERROR1("loading parser settings from %s", idx->params.config);
+            index_delete(idx);
+            return NULL;
+        }
+    } else if (!(idx->settings 
+      = psettings_new_default(PSETTINGS_ATTR_INDEX))) {
+        ERROR("loading default parser settings");
+        index_delete(idx);
+        return NULL;
+    }
+
+    if ((idx->vocab = iobtree_load_quick(idx->storage.pagesize, 
+            idx->storage.btleaf_strategy, idx->storage.btnode_strategy, 
+            NULL, idx->fd, idx->vocab_type, root_fileno, 
+            root_offset, terms)) == NULL) {
+        ERROR("quick-loading btree");
+        index_delete(idx);
+        return NULL;
+    }
+    if ((idx->sum = summarise_new(idx)) == NULL) {
+        ERROR("creating summarisation object");
+        index_rm(idx);
+        index_delete(idx);
+        return NULL;
+    }
+
+    return idx;
+}
+
+int index_rm(struct index *idx) {
+    char buf[FILENAME_MAX + 1];
+    unsigned int i,
+                 len;
+    int write;
+    int error = 0;
+    int last_errno = 0;
+
+    fdset_unlink(idx->fd, idx->param_type, 0);
+
+    for (i = 0; i < idx->repos; i++) {
+        if ((fdset_name(idx->fd, idx->repos_type, i, buf, FILENAME_MAX, &len, 
+            &write) == FDSET_OK) && (len <= FILENAME_MAX) && (write)) {
+            if (unlink((char *) buf) < 0) {
+                ERROR1("Error trying to unlink repository file %s", buf);
+                error = 1;
+                last_errno = errno;
+            }
+        }
+    }
+
+    for (i = 0; i < idx->vocabs; i++) {
+        if (fdset_unlink(idx->fd, idx->vocab_type, i) != FDSET_OK) {
+            ERROR1("Error trying to unlink vocab file %u", i);
+            error = 1;
+            last_errno = errno;
+        }
+    }
+
+    for (i = 0; fdset_unlink(idx->fd, idx->docmap_type, i) == FDSET_OK; i++) ;
+
+    /* index_new creates a single vector file to find out maximum file
+       size, but this doesn't get added to idx->vectors until actually
+       used in the final merge.  So even if idx->vectors is 0, we still
+       attempt to delete the first index file, and don't stress if it
+       doesn't work. */
+    for (i = 0; i < idx->vectors || i == 0; i++) {
+        if ((fdset_name(idx->fd, idx->index_type, i, buf, FILENAME_MAX, &len, 
+            &write) == FDSET_OK) && (len <= FILENAME_MAX) && (write)) {
+            if (unlink((char *) buf) < 0) {
+                if (i == 0 && idx->vectors == 0 && errno == ENOENT) {
+                    errno = 0;
+                } else {
+                    ERROR1("Error trying to unlink index file %s", buf);
+                    error = 1;
+                    last_errno = errno;
+                }
+            }
+        }
+    }
+    
+    /* NB: we rely on sections of code that use temporary files to
+       remove them in case of failure.  Of course, this won't work
+       for signal handlers... */
+
+    if (error)
+        return (errno ? -errno : -EINVAL);
+    else
+        return 0;
+}
+
+int index_expensive_stats(const struct index *idx, 
+  struct index_expensive_stats *stats) {
+    unsigned int state[3] = {0, 0, 0};
+    void *data;
+    unsigned int datalen,
+                 tmp,
+                 terms;
+    struct vocab_vector vv;
+    const char *term;
+
+    stats->avg_weight = idx->stats.avg_weight;
+    if (docmap_avg_words(idx->map, &stats->avg_words) != DOCMAP_OK) {
+        return 0;
+    }
+    stats->avg_length = idx->stats.avg_length;
+
+    stats->vocab_pages = iobtree_pages(idx->vocab, &stats->vocab_leaves, NULL);
+    stats->pagesize = iobtree_pagesize(idx->vocab);
+
+    /* iterate over all vocabulary items to get counts of list sizes */
+    stats->vectors = stats->vectors_files 
+      = stats->vectors_vocab = stats->allocated_files = 0;
+    stats->vocab_info = 0;
+    stats->vocab_structure = 0;
+    terms = 0;
+    while ((term 
+      = iobtree_next_term(idx->vocab, state, &tmp, &data, &datalen))) {
+        unsigned int bytes;
+        unsigned int info;
+        struct vec v;
+        enum vocab_ret vret;
+
+        terms++;
+        v.pos = data;
+        v.end = v.pos + datalen;
+
+        while ((vret = vocab_decode(&vv, &v)) == VOCAB_OK) {
+            bytes = vocab_len(&vv);
+            assert(bytes);
+            stats->vectors += vv.size;
+            info = vec_vbyte_len(vv.header.doc.docs) 
+              + vec_vbyte_len(vv.header.doc.occurs) 
+              + vec_vbyte_len(vv.header.doc.last) + vec_vbyte_len(vv.size);
+            stats->vocab_info += vec_vbyte_len(tmp) + tmp + info;
+            assert(bytes > info);
+            stats->vocab_structure += bytes - info;
+
+            switch (vv.location) {
+            case VOCAB_LOCATION_VOCAB: 
+                stats->vectors_vocab += vv.size; 
+                break;
+
+            case VOCAB_LOCATION_FILE: 
+                stats->vectors_files += vv.size; 
+                stats->allocated_files += vv.loc.file.capacity; 
+                break;
+
+            default: assert(0);
+            }
+        }
+
+        if (vret != VOCAB_END) {
+            return 0;
+        }
+    }
+    assert(terms == iobtree_size(idx->vocab));
+
+    return 1;
+}
+
+int index_stats(const struct index *idx, struct index_stats *stats) {
+    stats->terms_high = idx->stats.terms_high;
+    stats->terms_low = idx->stats.terms_low;
+    stats->dterms = iobtree_size(idx->vocab);
+    stats->docs = docmap_entries(idx->map);
+    stats->maxtermlen = idx->storage.max_termlen;
+
+    stats->vocab_listsize = idx->storage.vocab_lsize;
+
+    stats->updates = idx->stats.updates;
+    stats->tablesize = idx->params.tblsize;
+    stats->parsebuf = idx->params.parsebuf;
+    
+    stats->doc_order_vectors = idx->doc_order_vectors;
+    stats->doc_order_word_pos_vectors = idx->doc_order_word_pos_vectors;
+    stats->impact_vectors = idx->impact_vectors;
+    stats->sorted = idx->flags & INDEX_SORTED;
+
+    return 1;
+}
+
+enum stream_ret index_stream_read(struct stream *instream, int fd, 
+  char *buf, unsigned int bufsize) {
+    enum stream_ret sret;
+    ssize_t readlen;
+
+    do {
+        sret = stream(instream);
+        switch (sret) {
+        case STREAM_OK:
+        case STREAM_END:
+            return sret;
+            break;
+
+        case STREAM_INPUT:
+            instream->next_in = buf;
+            if ((readlen = read(fd, buf, bufsize)) > 0) {
+                instream->avail_in = readlen;
+            } else if (!readlen) {
+                stream_flush(instream, STREAM_FLUSH_FINISH);
+            } else {
+                return STREAM_EINVAL;
+            }
+            break;
+
+        default:
+            return sret;
+        }
+    } while (1);
+}
+
+unsigned int index_retrieve(const struct index *idx, unsigned long int docno,
+  unsigned long int dst_offset, void *dst, unsigned int dstsize) {
+    off_t offset,
+          curroffset;
+    unsigned int source,
+                 bytes, 
+                 rlen,
+                 readb;
+    enum docmap_flag flags;
+    enum mime_types type;
+    int fd;
+    struct stream *instream = NULL;
+    struct stream_filter *gunzipfilter = NULL;
+    char *buf = NULL,
+         *cdst = dst;
+
+    if (!dstsize) {
+        return 0;
+    }
+
+    if (docmap_get_location(idx->map, docno, &source, &offset, &bytes,
+          &type, &flags) == DOCMAP_OK) {
+
+        if (dst_offset >= bytes) {
+            return 0;
+        }
+
+        if (dst_offset + dstsize >= bytes) {
+            dstsize = bytes - dst_offset;
+        }
+
+        if (flags & DOCMAP_COMPRESSED) {
+            /* read from compressed repository */
+            if ((fd = fdset_pin(idx->fd, idx->repos_type, source, 0, SEEK_SET))
+              && (instream = stream_new()) 
+              && (gunzipfilter 
+                = (struct stream_filter *) gunzipfilter_new(BUFSIZ))
+              && (buf = malloc(BUFSIZ))) {
+                /* read compressed repository until we get to where we're 
+                 * after */
+                stream_filter_push(instream, gunzipfilter);
+
+                for (curroffset = 0; 
+                  curroffset + instream->avail_out < offset + dst_offset; ) {
+
+                    curroffset += instream->avail_out;
+                    if (index_stream_read(instream, fd, buf, BUFSIZ) 
+                      != STREAM_OK) {
+                        /* error */
+                        fdset_unpin(idx->fd, idx->repos_type, source, fd);
+                        stream_delete(instream);
+                        free(buf);
+                        return 0;
+                    }
+                }
+
+                /* ok, should now be at required position */
+                if (curroffset + instream->avail_out 
+                  >= offset + dst_offset + dstsize) {
+                    /* whole of required portion is in buffer */
+                    memcpy(dst, 
+                      instream->curr_out + offset + dst_offset - curroffset, 
+                      dstsize);
+                    fdset_unpin(idx->fd, idx->repos_type, source, fd);
+                    stream_delete(instream);
+                    free(buf);
+                    return dstsize;
+                } else {
+                    unsigned int lcloffset = offset + dst_offset - curroffset;
+
+                    /* whole of required portion isn't available, copy first
+                     * chunk */
+                    readb = instream->avail_out - lcloffset;
+                    memcpy(dst, instream->curr_out + lcloffset, readb);
+                    curroffset += readb;
+                }
+
+                /* move to next chunk */
+                if (index_stream_read(instream, fd, buf, BUFSIZ) 
+                  != STREAM_OK) {
+                    /* error */
+                    fdset_unpin(idx->fd, idx->repos_type, source, fd);
+                    stream_delete(instream);
+                    free(buf);
+                    return 0;
+                }
+
+                /* copy entire bufferloads */
+                while (readb + instream->avail_out < dstsize) {
+                    memcpy(cdst + readb, instream->curr_out, 
+                      instream->avail_out);
+                    readb += instream->avail_out;
+
+                    /* move to next chunk */
+                    if (index_stream_read(instream, fd, buf, BUFSIZ) 
+                      != STREAM_OK) {
+                        /* error */
+                        fdset_unpin(idx->fd, idx->repos_type, source, fd);
+                        stream_delete(instream);
+                        free(buf);
+                        return 0;
+                    }
+                }
+
+                /* copy last chunk in */
+                memcpy(cdst + readb, instream->curr_out, dstsize - readb);
+                fdset_unpin(idx->fd, idx->repos_type, source, fd);
+                stream_delete(instream);
+                free(buf);
+                return dstsize;
+            } else {
+                if (fd >= 0) {
+                    fdset_unpin(idx->fd, idx->repos_type, source, fd);
+                }
+                if (instream) {
+                    stream_delete(instream);
+                }
+                if (gunzipfilter) {
+                    gunzipfilter->deletefn(gunzipfilter);
+                }
+                if (buf) {
+                    free(buf);
+                }
+            }
+        } else {
+            /* read from regular repository */
+            if ((fd = fdset_pin(idx->fd, idx->repos_type, source, 
+              offset + dst_offset, SEEK_SET)) >= 0) {
+                rlen = read(fd, dst, dstsize);
+                fdset_unpin(idx->fd, idx->repos_type, source, fd);
+                return rlen;
+            }
+        }
+    }
+
+    return -1;
+}
+
+int index_load_stoplist(struct index *idx, void *src, 
+  unsigned int (*fillbuf)(void *src, void *buf, unsigned int len)) {
+    /* FIXME */
+    fprintf(stderr, "load_stoplist called, but unimplemented\n");
+    return 0;
+}
+
+void index_delete(struct index *idx) {
+    /* first, save the docmap */
+    if (idx->map) {
+        docmap_save(idx->map);  /* XXX: should be in index_commit()? */
+        docmap_delete(idx->map);
+        idx->map = NULL;
+    }
+
+    if (idx->sum) {
+        summarise_delete(idx->sum);
+        idx->sum = NULL;
+    }
+
+    if (idx->merger) {
+        pyramid_delete(idx->merger);
+        idx->merger = NULL;
+    }
+
+    if (idx->vocab) {
+        iobtree_delete(idx->vocab);
+        idx->vocab = NULL;
+    }
+
+    if (idx->fd) {
+        if (fdset_pinned(idx->fd)) {
+            fprintf(stderr, "warning: exiting with %u pinned fds\n", 
+              fdset_pinned(idx->fd));
+        }
+        fdset_delete(idx->fd);
+        idx->fd = NULL;
+    }
+
+    if (idx->settings) {
+        psettings_delete(idx->settings);
+        idx->settings = NULL;
+    }
+
+    if (idx->post) {
+        postings_delete(idx->post);
+        idx->post = NULL;
+    }
+
+    if (idx->params.config) {
+        free(idx->params.config);
+        idx->params.config = NULL;
+    }
+
+    if (idx->stem) {
+        stem_cache_delete(idx->stem);
+        idx->stem = NULL;
+    }
+    if (idx->istop) {
+        stop_delete(idx->istop);
+        idx->istop = NULL;
+    }
+    if (idx->qstop) {
+        stop_delete(idx->qstop);
+        idx->qstop = NULL;
+    }
+
+    free(idx);
+}
+
+int index_retrieve_doc_aux(const struct index *idx, 
+  unsigned long int docno, char * aux_buf, unsigned int aux_buf_len,
+  unsigned int *aux_len) {
+    enum docmap_ret dm_ret;
+
+    dm_ret = docmap_get_trecno(idx->map, docno, aux_buf, aux_buf_len, aux_len);
+    return dm_ret == DOCMAP_OK;
+}
+
+unsigned int index_retrieve_doc_bytes(const struct index *idx,
+  unsigned long int docno) {
+    enum docmap_ret dm_ret;
+    unsigned int bytes;
+
+    dm_ret = docmap_get_bytes(idx->map, docno, &bytes);
+    if (dm_ret != DOCMAP_OK)
+        return UINT_MAX;
+    else
+        return bytes;
+}
+
+int index_add(struct index *idx, const char *file, const char *mimetype,
+  unsigned long int *docno, unsigned int *docs, 
+  unsigned int opts, struct index_add_opt *opt, 
+  unsigned int commitopts, struct index_commit_opt *commitopt) {
+    void *parsebuf = NULL, 
+         *dumpbuf = NULL;
+    struct makeindex mispace,
+                     *mi = NULL;
+    int infd = -1,
+        outfd;
+    off_t bytes_read = 0,
+          last_pos = 0,
+          curr_pos = 0;
+    unsigned int i,
+                 multiple_compression = 0;
+    ssize_t readlen;
+    enum makeindex_ret miret;
+    unsigned int accbuf = idx->params.memory,
+                 accdoc = 0,
+                 dumpbufsz = DUMP_BUFFER;
+    struct stream *instream = NULL;
+    enum stream_ret sret;
+    struct stream_filter *filter = NULL;
+    enum docmap_ret dm_ret;
+    unsigned long int docno_out;
+    const char *aux_docno;
+    enum mime_types mtype,
+                    comptype;
+    enum docmap_flag flags = DOCMAP_NO_FLAGS;
+
+    TIMINGS_DECL();
+
+    TIMINGS_START();
+
+    if (opts & INDEX_ADD_ACCBUF) {
+        accbuf = opt->accbuf;
+    }
+    if (opts & INDEX_ADD_ACCDOC) {
+        accdoc = opt->accdoc;
+    }
+    if (commitopts & INDEX_COMMIT_DUMPBUF) {
+        dumpbufsz = commitopt->dumpbuf;
+    }
+
+#define FAIL()                                                                \
+    if (1) {                                                                  \
+        assert(!CRASH);                                                       \
+        if (instream) {                                                       \
+            stream_delete(instream);                                          \
+        }                                                                     \
+        if (filter) {                                                         \
+            filter->deletefn(filter);                                         \
+        }                                                                     \
+        if (mi) {                                                             \
+            makeindex_delete(mi);                                             \
+        }                                                                     \
+        if (dumpbuf) {                                                        \
+            free(dumpbuf);                                                    \
+        }                                                                     \
+        if (parsebuf) {                                                       \
+            free(parsebuf);                                                   \
+        }                                                                     \
+        if (infd >= 0) {                                                      \
+            fdset_unpin(idx->fd, idx->repos_type, idx->repos, infd);          \
+        }                                                                     \
+        return 0;                                                             \
+    } else
+
+    if ((parsebuf = malloc(idx->params.parsebuf)) 
+      && (fdset_set_fd_name(idx->fd, idx->repos_type, idx->repos, file,
+          str_len(file), 0) == FDSET_OK)
+      && ((infd = fdset_pin(idx->fd, idx->repos_type, idx->repos, 0, 
+          SEEK_SET)) >= 0)
+      && (instream = stream_new())
+      && (filter = (struct stream_filter *) detectfilter_new(BUFSIZ, 0))) {
+        int ret;
+
+        /* push detection filter onto stream to auto-detect gzip encoding */
+        stream_filter_push(instream, filter);
+        filter = NULL;
+        /* read first chunk of document via stream */
+        do {
+            sret = stream(instream);
+
+            switch (sret) {
+            case STREAM_OK:
+                bytes_read += instream->avail_out;
+                break;
+
+            case STREAM_END:
+                /* reached eof */
+                sret = STREAM_OK;
+                break;
+
+            case STREAM_INPUT:
+                assert(instream->avail_in == 0);
+                instream->next_in = parsebuf;
+                if ((readlen = read(infd, parsebuf, idx->params.parsebuf)) 
+                  > 0) {
+                    instream->avail_in = (unsigned int) readlen;
+                } else if (!readlen) {
+                    /* flush stream */
+                    stream_flush(instream, STREAM_FLUSH_FINISH);
+                } else {
+                    FAIL();
+                }
+                break;
+
+            default:
+                /* error of some type */
+                FAIL();
+            }
+        } while (sret != STREAM_OK);
+
+        /* figure out what compression was detected */
+        comptype = MIME_TYPE_UNKNOWN_UNKNOWN;
+        multiple_compression = 0;
+        for (i = stream_filters(instream) - 1; i != -1; i--) {
+            const char *id;
+
+            if (stream_filter(instream, i, &id) == STREAM_OK) {
+                if (!str_cmp(id, "gunzip")) {
+                    if (comptype == MIME_TYPE_UNKNOWN_UNKNOWN) {
+                        multiple_compression = 1;
+                    }
+                    flags = DOCMAP_COMPRESSED;
+                    comptype = MIME_TYPE_APPLICATION_X_GZIP;
+                }
+            } else {
+                assert("can't get here" && 0);
+                FAIL();
+            }
+        }
+
+        /* now detect the type of file if necessary */
+        if (mimetype) {
+            if ((mtype = mime_type(mimetype)) == MIME_TYPE_UNKNOWN_UNKNOWN) {
+                ERROR1("failed to extract MIME type from '%s'", mimetype);
+                FAIL();
+            }
+        } else {
+            /* detect from the start of the file */
+            mtype = mime_content_guess(instream->curr_out, instream->avail_out);
+        }
+        opt->detected_type = mime_string(mtype);
+
+        /* can now initialise makeindex module */
+        if (((miret = makeindex_new(&mispace, idx->settings, 
+            idx->storage.max_termlen, mtype)) == MAKEINDEX_OK)) {
+            mi = &mispace;
+            *docno = mi->docs = docmap_entries(idx->map);
+            mi->post = idx->post;
+            *docs = 0;
+            mi->next_in = instream->curr_out;
+            mi->avail_in = instream->avail_out;
+        } else {
+            FAIL();
+        }
+
+        if (!psettings_self_id(idx->settings, mtype)) {
+            /* set docno within makeindex object */
+            makeindex_append_docno(mi, "file://");
+            makeindex_append_docno(mi, file);
+        }
+
+        do {
+            switch ((miret = makeindex(mi))) {
+            case MAKEINDEX_ENDDOC:
+                assert(!postings_needs_update(idx->post));
+
+                /* add document to the docmap */
+
+                /* XXX: + (mi->avail_in == 0) is needed to push pos 
+                 * over '>' in end tag.  This is dodgy because we 
+                 * may not have actually received an end tag (can 
+                 * get EOF instead) and the end tag may be formatted
+                 * other than just </doc>.  Proper solution is to
+                 * make the parser explicitly return end tags, so
+                 * you know when the end tag has finished */
+                curr_pos = bytes_read - mi->avail_in 
+                  - makeindex_buffered(mi) + (mi->avail_in != 0);
+
+                (*docs)++;
+                aux_docno = makeindex_docno(mi);
+                mtype = makeindex_type(mi);
+                dm_ret = docmap_add(idx->map, idx->repos, last_pos, 
+                  curr_pos - last_pos, flags, 
+                  mi->stats.terms, mi->stats.distinct, 
+                  mi->stats.weight, aux_docno, strlen(aux_docno), mtype,
+                  &docno_out);
+                if (dm_ret != DOCMAP_OK) {
+                    ERROR1("error on docmap_add: %s", 
+                      docmap_strerror(dm_ret));
+                    FAIL();
+                }
+                assert(docno_out == mi->docs - 1);
+                last_pos = curr_pos;
+
+                /* check if we need to dump the postings */
+                if ((postings_memsize(idx->post) >= accbuf) 
+                  && (postings_documents(idx->post) >= accdoc)) {
+
+                    TIMINGS_END("parsing");
+                    TIMINGS_START();
+
+                    if (!(idx->flags & INDEX_BUILT)
+                        /* index is in construction, add to merger pyramid */
+                      && (dumpbuf || (dumpbuf = malloc(dumpbufsz)))
+                      && ((outfd = pyramid_pin_next(idx->merger)) >= 0)
+                      && (postings_dump(idx->post, dumpbuf, dumpbufsz, outfd))
+                      && (pyramid_unpin_next(idx->merger, outfd) == PYRAMID_OK)
+                      && (pyramid_add_file(idx->merger, 1, dumpbuf, dumpbufsz)
+                        == PYRAMID_OK)) {
+                        /* do nothing, dumping succeeded */
+
+                    } else if ((idx->flags & INDEX_BUILT) 
+                      /* need to do an update */
+                      && index_commit_internal(idx, commitopts, commitopt, 
+                          opts & ~INDEX_ADD_FLUSH, opt)) {
+
+                        /* update succeeded */
+                    } else {
+                        /* error */
+                        FAIL();
+                    }
+                    TIMINGS_END("dumping");
+                    TIMINGS_START();
+                }
+                break;
+
+            case MAKEINDEX_EOF:
+                /* check if we need to commit changes */
+                if (opts & INDEX_ADD_FLUSH) {
+                    TIMINGS_END("parsing");
+                    TIMINGS_START();
+
+                    if (!(idx->flags & INDEX_BUILT)
+                        /* index is in construction, add to merger pyramid */
+                      && (dumpbuf || (dumpbuf = malloc(dumpbufsz)))
+                      && ((outfd = pyramid_pin_next(idx->merger)) >= 0)
+                      && (postings_dump(idx->post, dumpbuf, dumpbufsz, outfd))
+                      && (pyramid_unpin_next(idx->merger, outfd) == PYRAMID_OK)
+                      && (pyramid_add_file(idx->merger, 1, dumpbuf, dumpbufsz)
+                        == PYRAMID_OK)) {
+                        /* do nothing, dumping succeeded */
+                    } else if ((idx->flags & INDEX_BUILT) 
+                      /* need to do an update */
+                      && index_commit_internal(idx, commitopts, commitopt, 
+                          opts & ~INDEX_ADD_FLUSH, opt)) {
+
+                        /* update succeeded */
+                    } else {
+                        /* error */
+                        FAIL();
+                    }
+                    TIMINGS_END("dumping");
+                    TIMINGS_START();
+                }
+                break;
+            case MAKEINDEX_INPUT:
+                /* read next chunk via stream */
+                assert(mi->avail_in == 0);
+                do {
+                    sret = stream(instream);
+
+                    switch (sret) {
+                    case STREAM_OK:
+                        mi->next_in = instream->curr_out;
+                        mi->avail_in = instream->avail_out;
+                        bytes_read += instream->avail_out;
+                        break;
+
+                    case STREAM_END:
+                        /* reached eof */
+                        makeindex_eof(mi);
+                        sret = STREAM_OK;
+                        break;
+
+                    case STREAM_INPUT:
+                        assert(instream->avail_in == 0);
+                        instream->next_in = parsebuf;
+                        if ((readlen 
+                          = read(infd, parsebuf, idx->params.parsebuf)) > 0) {
+                            instream->avail_in = (unsigned int) readlen;
+                        } else if (!readlen) {
+                            /* flush stream */
+                            stream_flush(instream, STREAM_FLUSH_FINISH);
+                        } else {
+                            FAIL();
+                        }
+                        break;
+
+                    default:
+                        /* error of some type */
+                        FAIL();
+                    }
+                } while (sret != STREAM_OK);
+                break;
+
+            default:
+                /* error */
+                FAIL();
+            }
+        } while (miret != MAKEINDEX_EOF);
+
+        ret = fdset_unpin(idx->fd, idx->repos_type, idx->repos, infd);
+        assert(ret == FDSET_OK);
+        free(parsebuf);
+        if (dumpbuf) {
+            free(dumpbuf);
+        }
+        assert(mi->docs == docmap_entries(idx->map));
+        makeindex_delete(mi);
+        stream_delete(instream);
+        idx->repos++;
+
+        return 1;
+    } else {
+        FAIL();
+    }
+#undef FAIL
+}
+
+int index_construct(struct index *idx, int opts, struct index_commit_opt *opt) {
+    void *dumpbuf;
+    unsigned int dumpbufsz = idx->params.memory;
+    int outfd;
+    unsigned int root_fileno;
+    unsigned long int root_offset,
+                      dterms;
+
+    if (opts & INDEX_COMMIT_DUMPBUF) {
+        dumpbufsz = opt->dumpbuf;
+    }
+
+    /* can allocate all of our memory to construction */
+    if (!(dumpbuf = malloc(dumpbufsz)) && !(errno = 0) 
+      && (dumpbufsz = DUMP_BUFFER) && !(dumpbuf = malloc(dumpbufsz))) {
+        assert(!CRASH);
+        return 0;
+    }
+
+    /* perform last dump if necessary */
+    assert(!postings_needs_update(idx->post));
+    if (postings_size(idx->post)) {
+        if (((outfd = pyramid_pin_next(idx->merger)) >= 0) 
+          && postings_dump(idx->post, dumpbuf, dumpbufsz, outfd)
+          && (pyramid_unpin_next(idx->merger, outfd) == PYRAMID_OK)
+          && (pyramid_add_file(idx->merger, 0, dumpbuf, dumpbufsz) 
+            == PYRAMID_OK)) {
+            /* dumping succeeded */
+        } else {
+            /* fail */
+            assert(!CRASH);
+            free(dumpbuf);
+            return 0;
+        }
+    }
+
+    if (docmap_entries(idx->map) == 0) {
+        ERROR("no documents found!  Perhaps the input was empty, or "
+          "not in the expected format?");
+        free(dumpbuf);
+        return 0;
+    }
+
+    /* perform final merge */
+
+    if ((pyramid_merge(idx->merger, &idx->vectors, &idx->vocabs, &dterms, 
+        &idx->stats.terms_high, &idx->stats.terms_low, &root_fileno, 
+        &root_offset, dumpbuf, dumpbufsz) == PYRAMID_OK)
+      && (idx->vocab = iobtree_load_quick(idx->storage.pagesize, 
+          idx->storage.btleaf_strategy, idx->storage.btnode_strategy, 
+          NULL, idx->fd, idx->vocab_type, root_fileno, root_offset, dterms))) {
+
+        /* succeeded, cleanup */
+        pyramid_delete(idx->merger);
+        idx->merger = NULL;
+        idx->flags |= INDEX_BUILT;
+        idx->flags |= INDEX_SORTED;
+        free(dumpbuf);
+        return 1;
+    } else {
+        /* fail */
+        assert(!CRASH);
+        free(dumpbuf);
+        return 0;
+    }
+}
+
+/* small internal function to update stats during commit */
+static int stat_update(struct index *idx) {
+    unsigned int terms = postings_total_terms(idx->post);
+
+    if (idx->stats.terms_low + terms < idx->stats.terms_low) {
+        idx->stats.terms_high++;
+    }
+    idx->stats.terms_low += terms;
+
+    if (docmap_avg_weight(idx->map, &idx->stats.avg_weight) != DOCMAP_OK 
+      || docmap_avg_bytes(idx->map, &idx->stats.avg_length) != DOCMAP_OK)
+        return 0;
+    return 1;
+}
+
+int index_commit_internal(struct index *idx, 
+  unsigned int opts, struct index_commit_opt *opt, 
+  unsigned int addopts, struct index_add_opt *addopt) {
+
+    if (docmap_avg_weight(idx->map, &idx->stats.avg_weight) != DOCMAP_OK 
+      || docmap_avg_bytes(idx->map, &idx->stats.avg_length) != DOCMAP_OK)
+        return 0;
+
+    if (!(idx->flags & INDEX_BUILT)
+        /* index is in construction, add to merger pyramid */
+      && (idx->vocab == NULL)
+      && index_construct(idx, opts, opt)
+      && index_commit_superblock(idx)) {
+
+        /* construction succeeded */
+        return 1;
+
+    } else if ((idx->flags & INDEX_BUILT)
+      /* need to remerge index */
+      && index_remerge(idx, opts, opt)
+      && stat_update(idx)
+      && index_commit_superblock(idx)) {
+        assert(idx->flags & INDEX_SORTED);
+
+        /* succeeded, clear accumulated postings */
+        postings_clear(idx->post);
+        idx->stats.updates++;
+        return 1;
+
+    } else {
+        /* some sort of failure */
+        assert(!CRASH);
+        return 0;
+    }
+}
+
+int index_commit(struct index *idx, 
+  unsigned int opts, struct index_commit_opt *opt, 
+  unsigned int addopts, struct index_add_opt *addopt) {
+    int ret,
+        altered = 0;
+    enum impact_ret impact_ret;
+
+    ret = index_commit_internal(idx, opts, opt, addopts, addopt);
+
+    /* check to make sure that we haven't swapped tmp type for index type 
+     * during updates (this is a bit of a hack :o( ), and swap them around 
+     * if we have */
+    if (ret && (idx->index_type > idx->tmp_type)) {
+        char srcfile[FILENAME_MAX + 1];
+        char dstfile[FILENAME_MAX + 1];
+        unsigned int i,
+                     len;
+        int write;
+
+        /* unfortunately, with the current state of filesystems, no matter
+         * what we do we can't make moving a set of files atomic (if there is 
+         * more than one), so if we fail somewhere in this code we'd probably 
+         * have to rebuild the index from scratch */
+        for (i = 0; i < idx->vectors; i++) {
+            /* this is also not portable to win32, need to use different move
+             * semantics there */
+            if ((fdset_name(idx->fd, idx->tmp_type, i, dstfile, FILENAME_MAX, 
+                &len, &write) == FDSET_OK)
+              && (fdset_name(idx->fd, idx->index_type, i, srcfile, FILENAME_MAX,
+                &len, &write) == FDSET_OK)
+
+              /* perform move */
+              && (unlink(dstfile), 1)        /* don't care if this fails */
+              && (rename(srcfile, dstfile) == 0)) {
+                /* move succeeded */
+            } else {
+                /* everything is potentially very screwed up */
+                assert(!CRASH);
+                return 0;
+            }
+        }
+
+        /* swap types */
+        len = idx->tmp_type;
+        idx->tmp_type = idx->index_type;
+        idx->index_type = len;
+        altered = 1;
+    }
+
+    assert(idx->vocabs);
+    assert(idx->vectors);
+    /* do the same for vocab types */
+    if (ret && (idx->vocab_type > idx->vtmp_type)) {
+        char srcfile[FILENAME_MAX + 1];
+        char dstfile[FILENAME_MAX + 1];
+        unsigned int i,
+                     len;
+        int write;
+
+        /* unfortunately, with the current state of filesystems, no matter
+         * what we do we can't make moving a set of files atomic (if there is 
+         * more than one), so if we fail somewhere in this code we'd probably 
+         * have to rebuild the index from scratch */
+        for (i = 0; i < idx->vocabs; i++) {
+            /* this is also not portable to win32, need to use different move
+             * semantics there */
+            if ((fdset_name(idx->fd, idx->vtmp_type, i, dstfile, FILENAME_MAX, 
+                &len, &write) == FDSET_OK)
+              && (fdset_name(idx->fd, idx->vocab_type, i, srcfile, FILENAME_MAX,
+                &len, &write) == FDSET_OK)
+
+              /* perform move */
+              && (unlink(dstfile), 1)        /* don't care if this fails */
+              && (rename(srcfile, dstfile) == 0)) {
+                /* move succeeded */
+            } else {
+                /* everything is potentially very screwed up */
+                assert(!CRASH);
+                return 0;
+            }
+        }
+
+        /* swap types */
+        len = idx->vtmp_type;
+        idx->vtmp_type = idx->vocab_type;
+        idx->vocab_type = len;
+        altered = 1;
+    }
+   
+    /* add impact ordered vectors to index if requested */
+    if (opts & INDEX_COMMIT_ANH_IMPACTS) {
+        impact_ret = impact_order_index(idx);
+        altered = 1;
+        if (impact_ret != IMPACT_OK) {
+            ERROR("creating impact vectors");
+            return 0;
+        }
+    }    
+
+    /* recommit superblock */
+    if (altered && index_commit_superblock(idx)) {
+        /* succeeded */
+    } else if (altered) {
+        assert(!CRASH);
+        return 0;
+    }
+
+    return ret;
+}
+
diff --git a/src/index_querybuild.c b/src/index_querybuild.c
new file mode 100644 (file)
index 0000000..dad83bc
--- /dev/null
@@ -0,0 +1,617 @@
+/* index_querybuild implements a function to build a query structure
+ * from a query string.  This turned out to be surprisingly difficult,
+ * as it turns out to be an optimisation problem when trying to select
+ * words from the query.
+ *
+ * written nml 2003-06-02 (moved from index_search.c 2003-09-23)
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "index_querybuild.h"
+
+#include "_index.h"
+
+#include "def.h"
+#include "iobtree.h" 
+#include "queryparse.h" 
+#include "str.h" 
+#include "stem.h" 
+#include "stop.h" 
+#include "vec.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef MT_ZET
+#include <pthread.h>
+
+static pthread_mutex_t vocab_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+#endif /* MT_ZET */
+
+/* maximum length of an in-vocab vector. */
+#define MAX_VOCAB_VECTOR_LEN 4096
+
+/**
+ *  Non-synchronized version of get_vocab_vector, i.e. we
+ *  assume that, in a multi-threaded environment, the caller
+ *  has already performed any necessary synchronisation.
+ */
+static int get_vocab_vector_locked(struct iobtree * vocab, 
+  struct vocab_vector * entry_out, const char * term, unsigned int term_len,
+  char * vec_buf, int vec_buf_len, int impact) {
+    void * ve_data = NULL;
+    unsigned int veclen = 0;
+    struct vec v;
+
+    ve_data = iobtree_find(vocab, term, term_len, 0, &veclen);
+    if (!ve_data)
+        return 0;
+    v.pos = ve_data;
+    v.end = v.pos + veclen;
+    if (!impact) {
+        /* select first non-impact-ordered vector */
+        do {
+            if (vocab_decode(entry_out, &v) != VOCAB_OK) {
+                return -1; 
+            }
+        } while (entry_out->type == VOCAB_VTYPE_IMPACT);
+    } else {
+        /* select first impact-ordered vector */
+        do {
+            if (vocab_decode(entry_out, &v) != VOCAB_OK) {
+                return -1; 
+            }
+        } while (entry_out->type != VOCAB_VTYPE_IMPACT);
+    }
+    if (entry_out->location == VOCAB_LOCATION_VOCAB) {
+        assert(entry_out->size <= (unsigned int) vec_buf_len);
+        memcpy(vec_buf, entry_out->loc.vocab.vec, entry_out->size);
+        entry_out->loc.vocab.vec = vec_buf;
+    }
+    return 1;
+}
+
+/**
+ *  Extract a vocab entry from a btree.
+ *
+ *  This function is synchronised on the vocab_mutex mutex.
+ *  At the end of this call, the vocab entry is completely
+ *  independent form the btree.
+ *
+ *  @param vec_buf buffer to store vector if the vocab entry
+ *  has an in-vocab vector.  entry_out->loc.vocab.vec will be
+ *  made to point to this.  You need to copy this before
+ *  reusing the vector if you want to retain it.
+ *
+ *  @return 0 if the term does not exist in the vocab 
+ *  (entry_out will be unchanged); 1 if the term exists in
+ *  the vocab (entry_out will hold the vocab entry for the
+ *  term); < 0 on error.
+ */
+static int get_vocab_vector(struct iobtree * vocab, 
+  struct vocab_vector * entry_out, const char * term, unsigned int term_len,
+  char * vec_buf, int vec_buf_len, int impact) {
+    int retval = 0;
+#ifdef MT_ZET
+    pthread_mutex_lock(&vocab_mutex);
+#endif /* MT_ZET */
+    retval = get_vocab_vector_locked(vocab, entry_out, term, term_len,
+      vec_buf, vec_buf_len, impact);
+#ifdef MT_ZET
+    pthread_mutex_unlock(&vocab_mutex);
+#endif /* MT_ZET */
+    return retval;
+}
+
+/* internal function to append a new word to a conjunct */
+static int conjunct_append(struct query *query, 
+  struct conjunct *conj, struct vocab_vector * sve,
+  const char *term, unsigned int termlen, unsigned int *maxterms) {
+    struct term *currterm;
+
+    /* OPTIMISE: search existing AND conjunct for word */
+
+    /* we're building a new phrase */
+    if (query->terms < *maxterms) {
+        /* iterate to the end of the phrase */
+        for (currterm = &conj->term; currterm->next;
+          currterm = currterm->next) ;
+
+        /* add next word on */
+        (*maxterms)--;
+        currterm = currterm->next = &query->term[*maxterms].term;
+        if (!(currterm->term = str_ndup(term, termlen))) {
+            return 0;
+        }
+        memcpy(&currterm->vocab, sve, sizeof(*sve));
+
+        /* allocate memory for vector part of vector */
+        if (currterm->vocab.location == VOCAB_LOCATION_VOCAB) {
+            if ((currterm->vecmem = malloc(currterm->vocab.size))) {
+                memcpy(currterm->vecmem, 
+                  currterm->vocab.loc.vocab.vec, currterm->vocab.size);
+            } else {
+                free(currterm->term);
+                return 0;
+            }
+        } else {
+            currterm->vecmem = NULL;
+        }
+        currterm->next = NULL;
+        conj->terms++;
+    }
+    /* else we need to steal slots (OPTIMIZE) */
+
+    return 1;
+}
+
+static struct conjunct *conjunct_find(struct query *query,
+  struct vocab_vector *sve, const char *term, unsigned int termlen,
+  int type) {
+    unsigned int i;
+    for (i = 0; i < query->terms; i++) {
+        if ((query->term[i].type == type) 
+          && (sve->size == query->term[i].term.vocab.size)
+          && (sve->location == query->term[i].term.vocab.location)
+          && (((sve->location == VOCAB_LOCATION_VOCAB) 
+              && (query->term[i].term.term) 
+              && !str_ncmp(term, query->term[i].term.term, termlen))
+            || ((sve->location == VOCAB_LOCATION_FILE) 
+              && (sve->loc.file.fileno 
+                == query->term[i].term.vocab.loc.file.fileno)
+              && (sve->loc.file.offset 
+                == query->term[i].term.vocab.loc.file.offset)))) {
+
+            return &query->term[i];
+        }
+    }
+    return NULL;
+}
+
+/* internal function to copy a word into a new conjunct */
+static struct conjunct *conjunct_add(struct query *query, 
+  struct vocab_vector * sve, const char *term, 
+  unsigned int termlen, int type, unsigned int *maxterms) {
+    struct conjunct *ret = NULL;
+
+    ret = conjunct_find(query, sve, term, termlen, type);
+
+    if (ret != NULL) {
+        ret->f_qt++;
+    } else {
+        /* couldn't find a match, might have to insert the word */
+        if (query->terms < *maxterms) {
+            ret = &query->term[query->terms];
+            ret->type = type;
+            ret->f_qt = 1;
+            ret->f_t = sve->header.docwp.docs;
+            ret->F_t = sve->header.docwp.occurs;
+            ret->term.next = NULL;
+            ret->vecmem = NULL;
+            ret->terms = 1;
+            ret->sloppiness = 0;
+            ret->cutoff = 0;
+            query->terms++;
+            if (!(ret->term.term = str_ndup(term, termlen))) {
+                query->terms--;
+                ret = NULL;
+            }
+            memcpy(&ret->term.vocab, sve, sizeof(*sve));
+            /* allocate memory for vector part of vector */
+            if (ret->term.vocab.location == VOCAB_LOCATION_VOCAB) {
+                if ((ret->term.vecmem = malloc(sve->size))) {
+                    memcpy(ret->term.vecmem, sve->loc.vocab.vec, sve->size);
+                } else {
+                    free(ret->term.term);
+                    return 0;
+                }
+            } else {
+                ret->term.vecmem = NULL;
+            }
+        }
+        /* else we might have to steal a slot (OPTIMIZE) */
+    }
+
+    return ret;
+}
+
+/* internal function to copy a conjunction and add an new word onto the end of 
+ * it (convenience function) */
+static struct conjunct *conjunct_copy(struct query *query, 
+  struct conjunct *conj, unsigned int matches, struct vocab_vector * sve,
+  const char *term, unsigned int termlen, unsigned int *maxterms) {
+    struct conjunct *ret = NULL,
+                    *next;
+    struct term *currterm,
+                *nextterm;
+
+    if (!matches) {
+        return NULL;
+    }
+
+    /* copy head of non-matching phrase */
+    if (query->terms < *maxterms) {
+        ret = next = &query->term[query->terms++];
+        memcpy(&next->term.vocab, &conj->term.vocab, sizeof(conj->term.vocab));
+        if (!(next->term.term = str_dup(conj->term.term))) {
+            /* FIXME: need to cleanup properly here */
+            return NULL;
+        }
+
+        /* allocate memory for vector part of vector */
+        if (next->term.vocab.location == VOCAB_LOCATION_VOCAB) {
+            if ((next->term.vecmem = malloc(conj->term.vocab.size))) {
+                memcpy(next->term.vecmem, conj->term.vecmem, 
+                  conj->term.vocab.size);
+            } else {
+                free(next->term.term);
+                return NULL;
+            }
+        }
+
+        next->term.next = NULL;
+        next->terms = 1;
+        next->f_qt = 1;
+        next->type = conj->type;
+        matches--;
+
+        nextterm = &next->term;
+        currterm = conj->term.next;
+        while ((query->terms < *maxterms) && matches) {
+            (*maxterms)--;
+            matches--;
+            nextterm->next = &query->term[*maxterms].term;
+            nextterm = nextterm->next;
+            memcpy(&nextterm->vocab, &currterm->vocab, sizeof(currterm->vocab));
+            if (!(nextterm->term = str_dup(currterm->term))) {
+                /* FIXME: need to cleanup properly here */
+                return NULL;
+            }
+
+            /* allocate memory for vector part of vector */
+            if (nextterm->vocab.location == VOCAB_LOCATION_VOCAB) {
+                if ((nextterm->vecmem = malloc(currterm->vocab.size))) {
+                    memcpy(nextterm->vecmem, currterm->vecmem, 
+                      currterm->vocab.size);
+                } else {
+                    free(nextterm->term);
+                    return NULL;
+                }
+            }
+            next->terms++;
+        }
+        nextterm->next = NULL;
+
+        /* append new term to phrase */
+        if ((query->terms < *maxterms) && sve) {
+            /* add next word on */
+            (*maxterms)--;
+            currterm = nextterm->next = &query->term[*maxterms].term;
+            if (!(currterm->term = str_ndup(term, termlen))) {
+                /* FIXME: need to cleanup properly here */
+                return NULL;
+            }
+            memcpy(&currterm->vocab, sve, sizeof(*sve));
+            /* allocate memory for vector part of vector */
+            if (currterm->vocab.location == VOCAB_LOCATION_VOCAB) {
+                if ((currterm->vecmem = malloc(currterm->vocab.size))) {
+                    memcpy(currterm->vecmem, currterm->vocab.loc.vocab.vec,
+                      currterm->vocab.size);
+                } else {
+                    free(nextterm->term);
+                    return NULL;
+                }
+            }
+            currterm->next = NULL;
+            next->terms++;
+        }
+    }
+    /* else we need to steal slots (OPTIMIZE) */
+
+    return ret;
+}
+
+/* internal function to construct a query structure from a given string (query)
+ * of length len.  At most maxterms will be read from the query. */ 
+unsigned int index_querybuild(struct index *idx, struct query *query, 
+  const char *querystr, unsigned int len, unsigned int maxterms, 
+  unsigned int maxtermlen, int impacts) {
+    struct queryparse *qp;           /* structure to parse the query */
+    struct conjunct *current = NULL; /* pointer to a current conjunction */
+    char word[TERMLEN_MAX + 1];      /* buffer to hold words */
+    unsigned int i,                  /* counter */
+                 wordlen,            /* length of word */
+                 words = 0,          /* number of words parsed */
+                 currmatch = 0;      /* number of matches against current 
+                                      * entry */
+                 /* veclen; */
+    int state = CONJUNCT_TYPE_WORD,  /* state variable, can take on values 
+                                      * from conjunct types enum */
+        stopped = 0;                 /* whether the last word was stopped */
+    /* void *ve;  */                 /* compressed vocabulary entry for a 
+                                      * word */
+    enum queryparse_ret parse_ret;   /* value returned by parser */
+    /* last modifier seen; also, are we in a modifier */
+    enum { MODIFIER_NONE, MODIFIER_SLOPPY, MODIFIER_CUTOFF } modifier 
+      = MODIFIER_NONE;
+    void (*stem)(void *, char *) = index_stemmer(idx);
+
+    assert(maxtermlen <= TERMLEN_MAX);
+    if (!(qp 
+      = queryparse_new(maxtermlen, querystr, len))) {
+        return 0;
+    }
+
+    query->terms = 0;
+
+    /* This bit of code builds a structure that represents a query from an
+     * array, where the array of words will be filled from 0 upwards, and
+     * conjunctions that require a linked list of words (phrase, AND) take
+     * additional words from the end of the array. */
+
+    do {
+        struct vocab_vector entry;
+        int retval;
+        char vec_buf[MAX_VOCAB_VECTOR_LEN];
+        parse_ret = queryparse_parse(qp, word, &wordlen);
+        switch (parse_ret) {
+        case QUERYPARSE_WORD_EXCLUDE:
+            /* this functionality not included yet, just ignore the word for 
+             * now */
+
+            /* look up word in vocab */
+            /* ve = hFetch(word, idx->vocab, NULL); */
+
+            /* OPTIMIZE: search existing conjunctions for word and remove 
+             * them */
+
+            /* FIXME: stop word */
+            /* if (ve) {
+                conjunct_add(query, ve, CONJUNCT_TYPE_EXCLUDE, 
+                  &maxterms);
+            } */
+
+            current = NULL;   /* this can't be the start of a conjunction */
+            words++;
+            break;
+
+        case QUERYPARSE_WORD_NOSTOP:
+        case QUERYPARSE_WORD:
+            if (modifier != MODIFIER_NONE) {
+                /* this is not a query term, but an argument to a modifier */
+                switch (modifier) {
+                case MODIFIER_SLOPPY:
+                    if (query->terms > 0)
+                        query->term[query->terms - 1].sloppiness = atoi(word);
+                    break;
+
+                case MODIFIER_CUTOFF:
+                    if (query->terms > 0)
+                        query->term[query->terms - 1].cutoff = atoi(word);
+                    break;
+
+                default:
+                    /* FIXME WARN */
+                    break;
+                }
+                break;
+            }
+            /* look up word in vocab */
+            /* FIXME: word needs to be looked up in in-memory postings as 
+             * well */
+            if (stem) {
+                word[wordlen] = '\0';
+                stem(idx->stem, word);
+                wordlen = str_len(word);
+            }
+            retval = get_vocab_vector(idx->vocab, &entry, word, wordlen,
+              vec_buf, sizeof(vec_buf), impacts);
+            if (retval < 0) {
+                return 0;
+            } else if (retval == 0) {
+                stopped = 0;   /* so we know that this term wasn't stopped */
+                currmatch = 1; /* so that we know that phrases have started */
+                if (current && (state == CONJUNCT_TYPE_AND)) {
+                    /* need to remove current conjunction, as it contains a word
+                     * that isn't in the collection */
+                    if (current->f_qt > 1) {
+                        current->f_qt--;
+                    } else {
+                        state = CONJUNCT_TYPE_WORD;   /* stop AND condition */
+                        maxterms += current->terms - 1;
+                        query->terms--;
+                    }
+                } else if (current && (state == CONJUNCT_TYPE_PHRASE)) {
+                    /* same, except phrase continues until end-phrase */
+                    if (current->f_qt > 1) {
+                        current->f_qt--;
+                    } else {
+                        maxterms += current->terms - 1;
+                        query->terms--;
+                    }
+                }
+                current = NULL;
+            } else if (state == CONJUNCT_TYPE_PHRASE) {
+                /* OPTIMIZE: check word against excluded terms */
+                struct term *currterm;
+
+                /* processing a phrase */
+                if (!currmatch) {
+                    /* first word in phrase, match or add a conjunction */
+                    current = conjunct_add(query, &entry,
+                      /* ve, veclen,  */
+                      word, wordlen, 
+                      CONJUNCT_TYPE_PHRASE, &maxterms);
+                    currmatch = 1;
+                } else if (current && (current->f_qt > 1)) {
+                    /* we're matching an existing phrase */
+                    /* iterate to next term we need to match */
+                    for (i = 0, currterm = &current->term; i < currmatch; 
+                      i++, currterm = currterm->next) ;
+
+                    if (currterm && !str_cmp(currterm->term, word)) {
+                        /* matched */
+                        currmatch++;
+                    } else {
+                        /* didn't match, copy non-matching phrase */
+                        current->f_qt--;
+                        current = conjunct_copy(query, current, currmatch, 
+                          &entry, word, wordlen, &maxterms);
+                        currmatch++;
+                    }
+                } else if (current) {
+                    /* we're building a new phrase, add next word on */
+                    conjunct_append(query, current, 
+                      &entry,
+                     /* ve, veclen, */
+                      word, wordlen, 
+                      &maxterms);
+                    currmatch++;
+                }
+                /* otherwise we're ignoring this phrase (because it contains a
+                 * word thats not in the vocab) */
+
+            } else if (state == CONJUNCT_TYPE_AND) {
+                /* we are constructing an AND conjunction */
+
+                /* FIXME: stop word 
+                stopped = 1;
+                current = NULL; */
+
+                /* OPTIMIZE: check word against excluded terms */
+
+                if (current) {
+                    if ((current->type == CONJUNCT_TYPE_AND) 
+                      || (current->f_qt == 1)) {
+                        /* add to current conjunct */
+                        conjunct_append(query, current, &entry,
+                          word, wordlen, &maxterms);
+                        current->type = CONJUNCT_TYPE_AND;
+                    } else {
+                        /* copy matched word to new location for AND conjunct */
+                        current->f_qt--;
+                        current = conjunct_copy(query, current, 1, &entry,
+                          word, wordlen, &maxterms);
+                        current->type = CONJUNCT_TYPE_AND;
+                    }
+                } else if (stopped) { 
+                    /* first word(s) in conjunct was stopped, so start a new
+                     * one */
+                    current = conjunct_add(query, &entry, word, wordlen,
+                      CONJUNCT_TYPE_WORD, &maxterms);
+                }
+
+                state = CONJUNCT_TYPE_WORD;   /* stop AND condition */
+            } else if (state == CONJUNCT_TYPE_WORD) {
+                /* its a single word */
+                stopped = 0;
+                if (parse_ret != QUERYPARSE_WORD_NOSTOP) {
+                    word[wordlen] = '\0';
+                    if (idx->qstop 
+                      && stop_stop(idx->qstop, word) == STOP_STOPPED) {
+                        /* it is a stopword */
+                        stopped = 1;
+                        current = NULL;
+                    }
+                }
+
+                if (!stopped) {
+                    current = conjunct_add(query, &entry,
+                      /* ve, veclen, */
+                      word, wordlen,
+                      CONJUNCT_TYPE_WORD, &maxterms);
+                    currmatch = 1;
+                }
+            }
+
+            words++;
+            break;
+
+        case QUERYPARSE_OR:
+            state = CONJUNCT_TYPE_WORD;  /* or is the default mode anyway */
+            break;
+
+        case QUERYPARSE_AND:
+            state = CONJUNCT_TYPE_AND;
+            break;
+
+        case QUERYPARSE_START_PHRASE: 
+            /* phrase starts */
+            state = CONJUNCT_TYPE_PHRASE;
+            current = NULL;
+            currmatch = 0;
+            break;
+
+        case QUERYPARSE_END_PHRASE:
+            if (current && (current->terms != currmatch)) {
+                /* partial match, need to copy phrase */
+                current->f_qt--;
+                current = conjunct_copy(query, current, currmatch, NULL,
+                  NULL, 0, &maxterms);
+            }
+
+            /* treat single-word phrases as, well, words */
+            if (current && (current->terms == 1)) {
+                struct conjunct *ret;
+                /* see if this single-word occurred previously */
+                ret = conjunct_find(query, &current->term.vocab,
+                  current->term.term, str_len(current->term.term), 
+                  CONJUNCT_TYPE_WORD);
+                if (ret == NULL) {
+                    /* ok, this is the first occurence */
+                    current->type = CONJUNCT_TYPE_WORD;
+                } else {
+                    /* there was a previous occurence: increment its f_qt,
+                       and free this one */
+                    ret->f_qt++;
+                    assert(current == &query->term[query->terms - 1]);
+                    free(current->term.term);
+                    if (current->term.vocab.location == VOCAB_LOCATION_VOCAB) {
+                        free(current->term.vecmem);
+                    }
+                    query->terms--;
+                }
+            }
+            current = NULL;
+            state = CONJUNCT_TYPE_WORD;
+            break;
+
+        case QUERYPARSE_END_SENTENCE: 
+            /* we're ignoring this at the moment - it might be used later if
+             * we don't want to match phrases across sentence boundaries */
+            break;
+
+        case QUERYPARSE_END_MODIFIER: 
+            modifier = MODIFIER_NONE;
+            break;
+        case QUERYPARSE_START_MODIFIER: 
+            if (str_casecmp(word, "sloppy") == 0) 
+                modifier = MODIFIER_SLOPPY;
+            else if (str_casecmp(word, "cutoff") == 0) 
+                modifier = MODIFIER_CUTOFF;
+            else
+                /* FIXME WARN */
+                modifier = MODIFIER_NONE;
+            break;
+
+        case QUERYPARSE_EOF: break; /* this will finish the parse */
+
+        default:
+            /* unexpected return code, error */
+            queryparse_delete(qp);
+            return 0;
+        }
+    } while ((parse_ret != QUERYPARSE_EOF)
+      && (query->terms < maxterms));  /* FIXME: temporary stopping condition */
+
+    queryparse_delete(qp);
+    /* returning word count confuses errors with empty queries. */
+    /* return words; */
+    return 1;
+}
+
diff --git a/src/iobtree.c b/src/iobtree.c
new file mode 100644 (file)
index 0000000..12b4cb2
--- /dev/null
@@ -0,0 +1,2875 @@
+/* iobtree.c implements a b+tree that does IO internally.  See
+ * iobtree.h for more details.  For an introduction to b-trees see 'The
+ * Ubiquitous B-Tree' by Douglas Comer.
+ *
+ * See btbucket.h for details of the internal storage format of the btree 
+ * pages.
+ *
+ * ideas for improvement:
+ *     - write space-guarantee remove/realloc
+ *     - uniform binary search (see knuth vol 3 pg 416 under shar and sigmod
+ *       record lomet paper 'evolution of btree buckets' or something like)
+ *     - prefix b-tree
+ *         - improved prefix b-tree where we examine siblings to get better
+ *           idea of range (note that directory nodes will need sibling
+ *           pointers for this?)
+ *     - split-avoidance techniques? (redistribution, although i note that 
+ *       it probably conflicts with prefix b-tree  compression))
+ *     - bucket formats:
+ *         - frequency ordered?
+ *         - micro-indexed?
+ *         - store 4 chars of prefix of strings and use for binary search
+ *           (note that this really needs prefix b-tree to work well) and is
+ *           probably better done in native endian-ness
+ *         - break up entries into different vectors
+ *
+ * written nml 2004-01-06
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "iobtree.h"
+
+#include "_btbucket.h"
+#include "_mem.h"
+
+#include "bit.h"
+#include "bucket.h"
+#include "btbucket.h"
+#include "freemap.h"
+#include "fdset.h"
+#include "def.h"
+#include "str.h"
+#include "zstdint.h"
+#include "zvalgrind.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* we need a sentinal pointer to indicate that the pointer points at a leaf, and
+ * we can't use NULL, since that means unexplored.  So we use a pointer to the
+ * btree itself (since its invariant for the life of the btree, which most other
+ * options aren't) to indicate this */
+#define LEAF_PTR(btree) ((struct page *) btree)
+
+/* FIXME: - safe interface
+          - bucket strategy 2 for internal nodes 
+          - testing of new fns, errors on old 
+          - fix bucket_search issue 
+ */
+
+struct page_header {
+    unsigned int fileno;       /* file that this page lives at */
+    unsigned long int offset;  /* offset that this page lives at */
+    unsigned int dirsize;      /* number of spaces in directory.  Is always 
+                                * greater than or equal to number of entries 
+                                * in bucket, unless bucket is a leaf in which
+                                * case its always 0. */
+    struct page **directory;   /* pointers to pages below this page.  Each 
+                                * pointer will be NULL if unexplored, 
+                                * will point to LEAF_PTR if descendant is 
+                                * a leaf */
+    struct page *parent;       /* pointer to parent page, NULL if this is the 
+                                * root */
+    uint8_t dirty;             /* whether this page is dirty */
+};
+
+/* structure to hold an internal node in memory (split into two bits to allow
+ * easy exact allocation) */
+struct page {
+    struct page_header h;      /* memory only information */
+    char mem[1];               /* bucket image in memory (struct hack) */
+};
+
+struct iobtree {
+    struct fdset *fd;          /* file set that the btree is resident in */
+    unsigned int fdset;        /* number of the type in the fdset */
+    struct freemap *freemap;   /* map of free space */
+
+    int leaf_strategy;         /* leaf node format, see bucket.h */
+    int node_strategy;         /* internal node format, see bucket.h */
+    unsigned int pagesize;     /* size of a page */
+
+    unsigned int entries;      /* number of entries in the btree */
+
+    struct page *root;         /* pointer to root node in array */
+    struct page *leaf;         /* pointer to stored leaf */
+    struct page *tmp;          /* pointer to temporary leaf space */
+    unsigned int timestamp;    /* change version of the btree */
+    unsigned int levels;       /* number of levels in the btree */
+
+    /* address of the right-most leaf page, which we need to keep track of 
+     * to bulk-append to the btree */
+    struct {
+        unsigned int fileno;
+        unsigned long int offset;
+    } right;
+};
+
+enum page_iter_filter {
+    FILTER_NONE = 0,      /* return all pages */
+    FILTER_NODES = 1,     /* return all non-leaf pages */
+    FILTER_INMEM = 2      /* return all non-leaf pages that are in memory */
+};
+
+/* structure to support iterating over the pages in the btree (needs a stack of
+ * visited pages).  Note that despite having parent pointers, we still need a
+ * stack to iterate as we need to keep track of where we are within each 
+ * bucket, since each node has multiple entries. */
+struct page_iter {
+    struct {
+        struct page *curr;   /* page at this level */
+        unsigned int term;   /* number of terms iterated over */
+        unsigned int state;  /* iteration state */
+    } *state;
+    unsigned int size;
+    unsigned int capacity;
+};
+
+/* internal function to iterate over pages in the btree.  Returns 0 on success
+ * and -errno otherwise (1 to finish). */
+static enum iobtree_ret page_iter_next(struct iobtree *btree, 
+  struct page_iter *iter, enum page_iter_filter filter, 
+  struct page **retpage);
+
+/* internal function to print out an understandable representation of the btree
+ * below the given page */
+int iobtree_print_page(struct iobtree *btree, struct page *page, 
+  unsigned int level);
+
+/* internal function to create a new btree page and initialise things 
+ * sensibly */
+static struct page *new_page(unsigned int pagesize, struct page *parent) {
+    struct page *page;
+
+    if ((page = malloc(sizeof(struct page_header) + pagesize))) {
+        page->h.directory = NULL;
+        page->h.dirsize = 0;
+        page->h.fileno = -1;
+        page->h.offset = -1;
+        page->h.dirty = 0;
+        page->h.parent = parent;
+        return page;
+    } else {
+        return NULL;
+    }
+}
+
+/* internal function to read a btree page from disk, creating a new page to hold
+ * it if necessary */
+static struct page *read_page(struct iobtree *btree, unsigned int fileno, 
+  unsigned long int offset, struct page *givenpage, struct page *parent, 
+  enum iobtree_ret *err) {
+    int fd,
+        ret;
+    off_t prev;
+    struct page *page = givenpage;
+
+    if (!page) {
+        if ((page = new_page(btree->pagesize, NULL))) {
+            /* do nothing */
+        } else {
+            if (err) {
+                *err = IOBTREE_ENOMEM;
+            }
+            return NULL;
+        }
+    }
+
+    assert(!page->h.dirty);
+    if ((fd = fdset_pin(btree->fd, btree->fdset, fileno, 0, SEEK_CUR)) >= 0) {
+
+        /* XXX: hack to restore fd to previous location after paging in, so 
+         * that other algorithms don't have to worry about the btree seeking 
+         * fds around */
+        errno = 0;
+        if (((prev = lseek(fd, 0, SEEK_CUR)) != (off_t) -1)
+          && (lseek(fd, offset, SEEK_SET) == (off_t) offset)
+
+          && (read(fd, page->mem, btree->pagesize) == (ssize_t) btree->pagesize)
+          && (lseek(fd, prev, SEEK_SET) == prev)) {
+            if ((ret = fdset_unpin(btree->fd, btree->fdset, fileno, fd)) 
+              == FDSET_OK) {
+                page->h.fileno = fileno;
+                page->h.offset = offset;
+                page->h.dirty = 0;
+                page->h.parent = parent;
+
+                if (!BTBUCKET_LEAF(page->mem, btree->pagesize)) {
+                    unsigned int entries;
+
+                    entries = bucket_entries(BTBUCKET_BUCKET(page->mem), 
+                        btree->pagesize, btree->leaf_strategy);
+
+                    if (page->h.dirsize < entries) {
+                        void *ptr;
+
+                        if ((ptr = realloc(page->h.directory, 
+                              sizeof(*page->h.directory) * entries))) {
+                            page->h.directory = ptr;
+                            page->h.dirsize = entries;
+                        } else {
+                            if (!givenpage) {
+                                free(page);
+                            }
+                            *err = IOBTREE_ENOMEM;
+                            return NULL;
+                        }
+                    }
+
+                    BIT_ARRAY_NULL(page->h.directory, page->h.dirsize);
+                }
+
+                return page;
+            } else {
+                errno = -ret;
+            }
+        }
+    } else {
+        errno = -fd;
+    }
+
+    if (err) {
+        switch (errno) {
+        default: *err = IOBTREE_ERR;
+        case EINTR: *err = IOBTREE_EINTR;
+        case EAGAIN: *err = IOBTREE_EAGAIN;
+        case EIO: *err = IOBTREE_EIO;
+        }
+    }
+
+    return NULL;
+}
+
+/* internal function to flush a page to disk */
+static int write_page(struct iobtree *btree, struct page *page) {
+    int fd,
+        ret;
+    off_t prev;
+
+    if ((fd = fdset_pin(btree->fd, btree->fdset, page->h.fileno, 0, SEEK_CUR)) 
+        >= 0) {
+
+        /* XXX: hack to restore fd to previous location after paging in, so that
+         * other algorithms don't have to worry about the btree seeking fds
+         * around */
+        errno = 0;
+        if (((prev = lseek(fd, 0, SEEK_CUR)) != (off_t) -1)
+          && (lseek(fd, page->h.offset, SEEK_SET) == (off_t) page->h.offset)
+          && (write(fd, page->mem, btree->pagesize) 
+            == (ssize_t) btree->pagesize)
+          && (lseek(fd, prev, SEEK_SET) != (off_t) -1)) {
+
+            if ((ret = fdset_unpin(btree->fd, btree->fdset, page->h.fileno, fd))
+                == FDSET_OK) {
+
+                page->h.dirty = 0;
+                return IOBTREE_OK;
+            } else {
+                errno = -ret;
+            }
+        }
+    } else {
+        errno = -fd;
+    }
+
+    switch (errno) {
+    default: return IOBTREE_ERR;
+    case EINTR: return IOBTREE_EINTR;
+    case EAGAIN: return IOBTREE_EAGAIN;
+    case EIO: return IOBTREE_EIO;
+    }
+}
+
+/* internal function to check all invariants of the btree */
+static enum iobtree_ret iobtree_invariant(struct iobtree *btree) {
+    struct page_iter iter;
+    struct page *page;
+    enum iobtree_ret iterret,
+                     ret;
+    const char *term,
+               *pterm;
+    unsigned int termlen,
+                 ptermlen,
+                 datalen,
+                 index,
+                 entries,
+                 i,
+                 levels,
+                 side;
+    void *data;
+
+    if (!DEAR_DEBUG) {
+        return IOBTREE_OK;
+    }
+
+    /* must always have three nodes available, and the root node can't have a
+     * parent */
+    if (!btree->root || !btree->leaf || !btree->tmp || btree->root->h.parent) {
+        if (CRASH) {
+            iobtree_print_page(btree, btree->root, 0);
+        }
+        assert(!CRASH);
+        return IOBTREE_ERR;
+    }
+
+    /* leaf nodes don't have parent pointers, or directories */
+    if (btree->leaf->h.parent || btree->leaf->h.directory 
+      || btree->leaf->h.dirsize) {
+        if (CRASH) {
+            iobtree_print_page(btree, btree->root, 0);
+        }
+        assert(!CRASH);
+        return IOBTREE_ERR;
+    }
+
+    /* right-most node must be a leaf, and must be right-most */
+    page = btree->leaf;
+    if ((btree->leaf->h.fileno == btree->right.fileno 
+        && btree->leaf->h.offset == btree->right.offset) 
+      || (page = read_page(btree, btree->right.fileno, btree->right.offset, 
+        NULL, NULL, &ret))) {
+
+        unsigned int fileno;
+        unsigned long int offset;
+
+        if (!BTBUCKET_LEAF(page->mem, btree->pagesize)) {
+            if (CRASH) {
+                iobtree_print_page(btree, btree->root, 0);
+            }
+            assert(!CRASH);
+            return IOBTREE_ERR;
+        }
+
+        btbucket_sibling(page->mem, btree->pagesize, &fileno, &offset);
+        if (fileno != btree->right.fileno || offset != btree->right.offset) {
+            if (CRASH) {
+                iobtree_print_page(btree, btree->root, 0);
+            }
+            assert(!CRASH);
+            return IOBTREE_ERR;
+        }
+
+        if (page != btree->leaf) {
+            free(page);
+        }
+    }
+
+    /* number of levels should be correct.  try to iterate down left side first,
+     * then right side if that fails (we *must* have iterated down one of the
+     * two when we loaded, and all will be in memory if we created) */
+    levels = 1;
+    side = 0;
+    for (page = btree->root; 
+      (page != LEAF_PTR(btree)) 
+        && !BTBUCKET_LEAF(page->mem, btree->pagesize);) {
+
+        /* watch for infinite looping over our dummy node */
+        assert(page && page != LEAF_PTR(btree));
+
+        if (side) {
+            index = bucket_entries(BTBUCKET_BUCKET(page->mem), 
+              BTBUCKET_SIZE(page->mem, btree->pagesize), btree->node_strategy) 
+                - 1;
+        } else {
+            index = 0;
+        }
+
+        assert(page->h.directory);
+        assert(page->h.dirsize > index);
+        if (page->h.directory[index]) {
+            assert(page != page->h.directory[index]);
+            page = page->h.directory[index];
+            levels++;
+        } else {
+            assert(!side);
+
+            /* failed to iterate down left side, try again down right side */
+            side = 1;
+            levels = 1;
+            page = btree->root;
+        }
+    }
+
+    if (levels != btree->levels) {
+        assert(!CRASH);
+        return IOBTREE_ERR;
+    }
+
+    /* all other internal nodes should have parent pointers */
+    if ((iter.state = malloc(sizeof(*iter.state)))) {
+        iter.size = 1;
+        iter.capacity = 1;
+        iter.state[0].curr = btree->root;
+        iter.state[0].state = 0;
+        iter.state[0].term = 0;
+        while ((iterret = page_iter_next(btree, &iter, FILTER_INMEM, &page)) 
+          == IOBTREE_OK) {
+            assert(!BTBUCKET_LEAF(page->mem, btree->pagesize));
+
+            /* check directory and parent */
+            if (!page->h.directory 
+              || (page != btree->root && !page->h.parent)) {
+                if (CRASH) {
+                    iobtree_print_page(btree, btree->root, 0);
+                }
+                assert(!CRASH);
+                return IOBTREE_ERR;
+            }
+
+            /* check that parent doesn't have excess pointers set in the
+             * directory, and that adjacent directory entries aren't equal 
+             * (these came up for some reason) */
+            entries = bucket_entries(BTBUCKET_BUCKET(page->mem), 
+                  BTBUCKET_SIZE(page->mem, btree->pagesize), 
+                  btree->node_strategy);
+
+            /* find first non-NULL pointer */
+            for (i = 0; page->h.dirsize && i < entries && !page->h.directory[i];
+              i++) ;
+
+            if (page->h.dirsize && page->h.directory[i++] != LEAF_PTR(btree)) {
+                /* should be no leaf pointers in this directory then */
+                for (; i < entries; i++) {
+                    /* adjacent pointer check */
+                    if ((page->h.directory[i] 
+                        && (page->h.directory[i] == page->h.directory[i - 1])) 
+                      || (page->h.directory[i] == LEAF_PTR(btree))) {
+                        if (CRASH) {
+                            iobtree_print_page(btree, btree->root, 0);
+                        }
+                        assert(!CRASH);
+                        return IOBTREE_ERR;
+                    }
+                }
+            } else {
+                /* should be all leaf pointers */
+                for (; i < entries; i++) {
+                    if (page->h.directory[i]
+                      && (page->h.directory[i] != LEAF_PTR(btree))) {
+                        if (CRASH) {
+                            iobtree_print_page(btree, btree->root, 0);
+                        }
+                        assert(!CRASH);
+                        return IOBTREE_ERR;
+                    }
+                }
+            }
+
+            for (; i < page->h.dirsize; i++) {
+                /* excess pointer check */
+                if (page->h.directory[i]) {
+                    if (CRASH) {
+                        iobtree_print_page(btree, btree->root, 0);
+                    }
+                    assert(!CRASH);
+                    return IOBTREE_ERR;
+                }
+            }
+
+            /* check that parent has current node listed as a child */
+            if (page->h.parent 
+              /* get first term from bucket to search parent with */
+              && (term = bucket_term_at(BTBUCKET_BUCKET(page->mem), 
+                  BTBUCKET_SIZE(page->mem, btree->pagesize), 
+                  btree->node_strategy, 0, &termlen, &data, &datalen))) {
+
+                /* search parent */
+                bucket_search(BTBUCKET_BUCKET(page->h.parent->mem), 
+                  BTBUCKET_SIZE(page->h.parent->mem, btree->pagesize), 
+                  btree->node_strategy, term, termlen, &datalen, &index);
+
+                /* ensure the pointer we got back leads to the current node */
+                if (page->h.parent->h.directory[index] != page) {
+                    if (CRASH) {
+                        iobtree_print_page(btree, btree->root, 0);
+                    }
+                    assert(!CRASH);
+                    return IOBTREE_ERR;
+                }
+
+                /* ensure that the term in the parent node is not larger than
+                 * the first term in this node (although the fact that the
+                 * previous test passed strongly suggests that this is true) */
+                if (!(pterm 
+                    = bucket_term_at(BTBUCKET_BUCKET(page->h.parent->mem), 
+                        BTBUCKET_SIZE(page->h.parent->mem, btree->pagesize), 
+                        btree->node_strategy, index, &ptermlen, &data, 
+                        &datalen))
+                  || (str_nncmp(pterm, ptermlen, term, termlen) < 0)) {
+                    if (CRASH) {
+                        iobtree_print_page(btree, btree->root, 0);
+                    }
+                    assert(!CRASH);
+                    return IOBTREE_ERR;
+                }
+
+                /* ensure that the first term in this node is larger than the
+                 * parent entry for the left sibling, if it exists */
+                if (index) {
+                    if (!(pterm 
+                        = bucket_term_at(BTBUCKET_BUCKET(page->h.parent->mem), 
+                          BTBUCKET_SIZE(page->h.parent->mem, btree->pagesize),
+                          btree->node_strategy, index - 1, &ptermlen, &data,
+                          &datalen))
+                      || (str_nncmp(term, termlen, pterm, ptermlen) <= 0)) {
+                        if (CRASH) {
+                            iobtree_print_page(btree, btree->root, 0);
+                        }
+                        assert(!CRASH);
+                        return IOBTREE_ERR;
+                    }
+                }
+
+                /* ensure that the last term in this node is smaller than the
+                 * parent entry for right sibling, if it exists */
+                entries = bucket_entries(BTBUCKET_BUCKET(page->h.parent->mem), 
+                    BTBUCKET_SIZE(page->h.parent->mem, btree->pagesize),
+                    btree->node_strategy);  /* get entries in parent */
+                if (index + 1 < entries) {
+                    entries = bucket_entries(BTBUCKET_BUCKET(page->mem), 
+                        BTBUCKET_SIZE(page->mem, btree->pagesize),
+                        btree->node_strategy); /* get entries in child */
+
+                    /* get last entry from child */
+                    term = bucket_term_at(BTBUCKET_BUCKET(page->mem), 
+                        BTBUCKET_SIZE(page->mem, btree->pagesize), 
+                        btree->node_strategy, entries - 1, &termlen, &data, 
+                        &datalen);
+                    assert(term);
+
+                    if (!(pterm 
+                        = bucket_term_at(BTBUCKET_BUCKET(page->h.parent->mem), 
+                          BTBUCKET_SIZE(page->h.parent->mem, btree->pagesize),
+                          btree->node_strategy, index + 1, &ptermlen, 
+                          &data, &datalen))
+                      || (str_nncmp(term, termlen, pterm, ptermlen) >= 0)) {
+                        if (CRASH) {
+                            iobtree_print_page(btree, btree->root, 0);
+                        }
+                        assert(!CRASH);
+                        return IOBTREE_ERR;
+                    }
+                }
+            }
+        }
+        free(iter.state);
+
+        if (iterret != IOBTREE_ITER_FINISH) {
+            return iterret;
+        }
+    }
+
+    return IOBTREE_OK;
+}
+
+static enum iobtree_ret page_iter_next(struct iobtree *btree, 
+  struct page_iter *iter, enum page_iter_filter filter, 
+  struct page **retpage) {
+    struct page *page = NULL,
+                *nextpage;
+    const char *term;
+    void *addr;
+    unsigned int termlen, 
+                 len,
+                 fileno;
+    unsigned long int offset;
+    enum iobtree_ret ret;
+
+    while (iter->size 
+      && (page = iter->state[iter->size - 1].curr)
+      && (term = bucket_next_term(BTBUCKET_BUCKET(page->mem), 
+          BTBUCKET_SIZE(page->mem, btree->pagesize), btree->node_strategy, 
+          &iter->state[iter->size - 1].state, &termlen, &addr, &len))) {
+        iter->state[iter->size - 1].term++;
+
+        if (iter->size >= iter->capacity) {
+            void *ret = realloc(iter->state, 
+              sizeof(*iter->state) * iter->capacity * 2);
+
+            if (!ret) {
+                return IOBTREE_ENOMEM;
+            }
+
+            iter->state = ret;
+            iter->capacity *= 2;
+        }
+
+        if (BTBUCKET_LEAF(page->mem, btree->pagesize)) {
+            iter->size--;
+            if (filter == FILTER_NONE) {
+                *retpage = page;
+                return IOBTREE_OK;
+            }
+        } else {
+            nextpage = page->h.directory[iter->state[iter->size - 1].term - 1];
+            if (nextpage) {
+                if (nextpage == LEAF_PTR(btree)) {
+                    /* next is a leaf, page it in */
+                    if (filter == FILTER_NONE) {
+                        /* may need to page out current leaf */
+                        if (btree->leaf->h.dirty
+                          && ((ret = write_page(btree, btree->leaf))
+                            != IOBTREE_OK)) {
+
+                            return ret;
+                        }
+
+                        BTBUCKET_ENTRY(addr, &fileno, &offset);
+                        if (((btree->leaf->h.fileno == fileno) 
+                            && (btree->leaf->h.offset == offset)) 
+                          || read_page(btree, fileno, offset, 
+                              btree->leaf, NULL, &ret)) {
+                            *retpage = btree->leaf;
+                            return IOBTREE_OK;
+                        } else {
+                            return ret;
+                        }
+                    } else {
+                        /* we're ignoring leaves, and we know that all pages
+                         * under this one are leaves, so we break the while 
+                         * loop to immediately skip to returning this page if
+                         * appropriate */
+                        break;
+                    }
+                } else {
+                    /* next is a node, already in memory */
+                    iter->state[iter->size].curr = nextpage;
+                    iter->state[iter->size].state = 0;
+                    iter->state[iter->size++].term = 0;
+                }
+            } else if (filter != FILTER_INMEM) {
+                /* don't know what's under this page, find out */
+
+                /* may need to page out current leaf */
+                if (btree->leaf->h.dirty
+                  && ((ret = write_page(btree, btree->leaf)) != IOBTREE_OK)) {
+                    return ret;
+                }
+
+                assert(addr);
+                BTBUCKET_ENTRY(addr, &fileno, &offset);
+                if (((btree->leaf->h.fileno == fileno) 
+                    && (btree->leaf->h.offset == offset)) 
+                  || read_page(btree, fileno, offset, btree->leaf, NULL, 
+                      &ret)) {
+
+                    if (BTBUCKET_LEAF(btree->leaf->mem, btree->pagesize)) {
+                        page->h.directory[iter->state[iter->size - 1].term - 1] 
+                          = LEAF_PTR(btree);
+                        if (filter == FILTER_NONE) {
+                            *retpage = btree->leaf;
+                            return IOBTREE_OK;
+                        } else {
+                            /* we're ignoring leaves, and we know that all 
+                             * pages under this one are leaves, so we break 
+                             * the while loop to immediately skip to returning 
+                             * this page if appropriate */
+                            break;
+                        }
+                    } else {
+                        page->h.directory[iter->state[iter->size - 1].term - 1] 
+                          = btree->leaf;
+                        iter->state[iter->size].curr = btree->leaf;
+                        iter->state[iter->size].curr->h.parent = page;
+                        iter->state[iter->size].state = 0;
+                        iter->state[iter->size++].term = 0;
+
+                        /* have used leaf as something else, need to replace it
+                         * with a new node */
+                        if (!(btree->leaf = new_page(btree->pagesize, NULL))) {
+                            return IOBTREE_ENOMEM;
+                        }
+                    }
+                } else {
+                    return ret;
+                }
+            }
+        }
+    }
+    if (iter->size && page) {
+        iter->size--;
+        if (!BTBUCKET_LEAF(page->mem, btree->pagesize) 
+          || (filter == FILTER_NONE)) {
+            *retpage = page;
+            return IOBTREE_OK;
+        }
+    }
+
+    return IOBTREE_ITER_FINISH;
+}
+
+int iobtree_clear(struct iobtree *btree) {
+    unsigned int tmp;
+    enum iobtree_ret iterret;
+
+    if (btree->root) {
+        struct page_iter iter;
+        struct page *page;
+
+        /* need to free the pages in the btree by iterating over them */
+
+        if (!(iter.state = malloc(sizeof(*iter.state)))) {
+            return 0;
+        }
+
+        iter.size = 1;
+        iter.capacity = 1;
+        iter.state[0].curr = btree->root;
+        iter.state[0].state = 0;
+        iter.state[0].term = 0;
+
+        while ((iterret = page_iter_next(btree, &iter, FILTER_NONE, &page)) 
+          == IOBTREE_OK) {
+            freemap_free(btree->freemap, page->h.fileno, page->h.offset, 
+              btree->pagesize);
+
+            /* only free internal nodes */
+            if (!BTBUCKET_LEAF(page->mem, btree->pagesize)) {
+                free(page);
+            }
+        }
+        free(iter.state);
+
+        if (iterret != IOBTREE_ITER_FINISH) {
+            assert(!CRASH);
+            return 0;
+        }
+    }
+
+    btree->entries = 0;
+
+    /* allocate root node */
+    if ((btree->root = new_page(btree->pagesize, NULL))
+      && freemap_malloc(btree->freemap, &btree->root->h.fileno, 
+          &btree->root->h.offset, &btree->pagesize, FREEMAP_OPT_EXACT)) {
+        btree->root->h.dirty = 1;
+    } else {
+        assert(!CRASH);
+        if (btree->root) {
+            free(btree->root);
+            btree->root = NULL;
+        }
+        return 0;
+    }
+
+    /* initialise it */
+    tmp = 0;
+    btbucket_new(btree->root->mem, btree->pagesize, btree->root->h.fileno, 
+      btree->root->h.offset, 1, NULL, &tmp);
+    bucket_new(BTBUCKET_BUCKET(btree->root->mem), 
+      BTBUCKET_SIZE(btree->root->mem, btree->pagesize), btree->leaf_strategy);
+    btree->leaf = btree->root;
+    btree->right.fileno = btree->root->h.fileno;
+    btree->right.offset = btree->root->h.offset;
+
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+    return 1;
+}
+
+struct iobtree *iobtree_new(unsigned int pagesize, int leaf_strategy, 
+  int node_strategy, struct freemap *freemap, struct fdset *fds, 
+  unsigned int fdset_type) {
+    struct iobtree *btree = NULL;
+
+    if ((pagesize <= 65535) && (btree = malloc(sizeof(*btree))) 
+      && (btree->tmp = new_page(pagesize, NULL))) {
+        btree->fd = fds;
+        btree->fdset = fdset_type;
+        btree->freemap = freemap;
+        btree->leaf_strategy = leaf_strategy;
+        btree->node_strategy = node_strategy;
+        btree->pagesize = pagesize;
+        btree->timestamp = 0;
+        btree->levels = 1;
+
+        btree->root = btree->leaf = NULL;
+
+        if (iobtree_clear(btree)) {
+            /* succeed, check invariant (we use it outside of an assert to
+             * ensure that its used at least once when NDEBUG is on) */
+            if (iobtree_invariant(btree) != IOBTREE_OK) {
+                assert(iobtree_invariant(btree) == IOBTREE_OK);
+                iobtree_delete(btree);
+                return NULL;
+            }
+        } else {
+            free(btree->tmp);
+            free(btree);
+            btree = NULL;
+        }
+    } else if (btree) {
+        free(btree);
+        btree = NULL;
+    }
+    
+    return btree;
+}
+
+static struct iobtree *iobtree_load_int(unsigned int pagesize, 
+  int leaf_strategy, int node_strategy, struct freemap *freemap, 
+  struct fdset *fds, unsigned int fdset_type, unsigned int root_fileno, 
+  unsigned long int root_offset, unsigned long int entries) {
+    struct iobtree *btree = NULL;
+
+    if ((pagesize <= 65535) && (btree = malloc(sizeof(*btree)))
+      && ((btree->fd = fds), (btree->fdset = fdset_type), 
+        (btree->leaf_strategy = leaf_strategy), 
+        (btree->node_strategy = node_strategy), 
+        (btree->pagesize = pagesize))
+      && (btree->root 
+        = read_page(btree, root_fileno, root_offset, NULL, NULL, NULL))
+      && (btree->tmp = new_page(pagesize, NULL))) {
+
+        if (!BTBUCKET_LEAF(btree->root->mem, btree->pagesize)) {
+            if ((btree->leaf = new_page(pagesize, NULL))) {
+                /* succeeded, do nothing */
+            } else {
+                free(btree->root);
+                free(btree->tmp);
+                free(btree);
+                return NULL;
+            }
+        } else {
+            btree->leaf = btree->root;
+        }
+        btree->freemap = freemap;
+        btree->entries = entries;
+        btree->timestamp = 0;
+    } else if (btree) {
+        if (btree->root) {
+            if (btree->leaf) {
+                free(btree->leaf);
+            }
+            free(btree->root);
+        }
+        free(btree);
+        btree = NULL;
+    }
+    
+    return btree;
+}
+
+struct iobtree *iobtree_load_quick(unsigned int pagesize, int leaf_strategy,
+  int node_strategy, struct freemap *freemap, struct fdset *fds, 
+  unsigned int fdset_type, unsigned int root_fileno, 
+  unsigned long int root_offset, unsigned long int entries) {
+    struct iobtree *btree;
+    struct page *curr;
+    void *addr = NULL;
+    enum iobtree_ret ret;
+    unsigned int termlen,
+                 len;
+
+    btree = iobtree_load_int(pagesize, leaf_strategy, node_strategy, freemap, 
+        fds, fdset_type, root_fileno, root_offset, entries);
+
+    if (btree) {
+        /* calculate the number of levels and find the right-most leaf by
+         * traversing down the right side of the tree */
+        btree->levels = 1;
+        for (curr = btree->root; !BTBUCKET_LEAF(curr->mem, btree->pagesize); ) {
+            /* watch for infinite looping over our dummy node */
+            assert(curr && curr != LEAF_PTR(btree));
+
+            entries = bucket_entries(BTBUCKET_BUCKET(curr->mem), 
+              BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->node_strategy);
+
+            assert(entries);
+            assert(curr->h.directory);
+            assert(curr->h.dirsize >= entries);
+            if (curr->h.directory[entries - 1] 
+              && curr->h.directory[entries - 1] != LEAF_PTR(btree)) {
+                /* internal node below */
+                assert(curr != curr->h.directory[entries - 1]);
+                curr = curr->h.directory[entries - 1];
+                continue;
+            }
+
+            /* get addr */
+            bucket_term_at(BTBUCKET_BUCKET(curr->mem), 
+              BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->node_strategy,
+              entries - 1, &termlen, &addr, &len);
+            BTBUCKET_ENTRY(addr, &btree->right.fileno, &btree->right.offset);
+
+            assert(!btree->leaf->h.dirty);
+
+            if (read_page(btree, btree->right.fileno, btree->right.offset, 
+                btree->leaf, NULL, &ret)) {
+
+                /* either it is a leaf node, or we didn't know */
+                if (BTBUCKET_LEAF(btree->leaf->mem, btree->pagesize)) {
+                    curr->h.directory[entries - 1] = LEAF_PTR(btree);
+                    curr = btree->leaf;
+                } else {
+                    /* ensure parent is set */
+                    curr->h.directory[entries - 1] = btree->leaf;
+                    btree->leaf->h.parent = curr;
+                    curr = btree->leaf;
+                    /* have read a non-leaf into leaf page, replace it */
+                    if (!(btree->leaf
+                      = new_page(btree->pagesize, NULL))) {
+                        iobtree_delete(btree);
+                        return NULL;
+                    }
+                }
+            } else {
+                assert(ret != IOBTREE_OK);
+                assert(!CRASH);
+                return NULL;
+            }
+            btree->levels++;
+        }
+
+        /* curr now points to the right-most leaf in the tree, and levels should
+         * be correct */
+        assert(BTBUCKET_LEAF(curr->mem, btree->pagesize));
+        btree->right.fileno = curr->h.fileno;
+        btree->right.offset = curr->h.offset;
+        assert(iobtree_invariant(btree) == IOBTREE_OK);
+    }
+
+    return btree;
+}
+
+struct iobtree *iobtree_load(unsigned int pagesize, int leaf_strategy,
+  int node_strategy, struct freemap *freemap, struct fdset *fds, 
+  unsigned int fdset_type, unsigned int root_fileno, 
+  unsigned long int root_offset) {
+    struct iobtree *btree;
+    enum iobtree_ret iterret;
+
+    if ((btree = iobtree_load_int(pagesize, leaf_strategy, node_strategy, 
+        freemap, fds, fdset_type, root_fileno, root_offset, 0))) {
+
+        /* have to iterate over pages to calculate stats and remove pages
+         * from the freemap */
+        struct page_iter iter;
+        struct page *page;
+        unsigned int fileno;
+        unsigned long int offset;
+
+        /* need to allocate pages from freemap */
+        if (!(iter.state = malloc(sizeof(*iter.state)))) {
+            return 0;
+        }
+
+        iter.size = 1;
+        iter.capacity = 1;
+        iter.state[0].curr = btree->root;
+        iter.state[0].state = 0;
+        iter.state[0].term = 0;
+
+        while ((iterret = page_iter_next(btree, &iter, FILTER_NONE, &page)) 
+          == IOBTREE_OK) {
+            if (!freemap_malloc(btree->freemap, &fileno, &offset, 
+              &btree->pagesize, FREEMAP_OPT_EXACT | FREEMAP_OPT_LOCATION, 
+              page->h.fileno, page->h.offset)) {
+                assert(!CRASH);
+                iobtree_delete(btree);
+                if (iter.state) {
+                    free(iter.state);
+                }
+                return NULL;
+            }
+            if (BTBUCKET_LEAF(page->mem, btree->pagesize)) {
+                btree->entries += bucket_entries(BTBUCKET_BUCKET(page->mem),
+                    BTBUCKET_SIZE(page->mem, btree->pagesize), 
+                    btree->leaf_strategy);
+
+                /* end page should be the right-most in the tree (note that we
+                 * can't put this outside the page_iter loop because the loop
+                 * goes over non-leaf pages too */
+                btree->right.fileno = page->h.fileno;
+                btree->right.offset = page->h.offset;
+            }
+        }
+
+        free(iter.state);
+
+        /* calculate the number of levels, by traversing down the left side of
+         * the b-tree, where we are guaranteed to have just explored */
+        btree->levels = 1;
+        if (!BTBUCKET_LEAF(btree->root->mem, btree->pagesize)) {
+            btree->levels++;  /* for the leaf level */
+            for (page = btree->root; 
+              page->h.dirsize && page->h.directory[0] != LEAF_PTR(btree); 
+              btree->levels++, page = page->h.directory[0]) {
+                assert(page->h.directory && page->h.dirsize 
+                  && page->h.directory[0]);
+            }
+        }
+
+        if (iterret != IOBTREE_ITER_FINISH) {
+            assert(!CRASH);
+            iobtree_delete(btree);
+            return NULL;
+        }
+        assert(iobtree_invariant(btree) == IOBTREE_OK);
+    }
+    
+    return btree;
+}
+
+int iobtree_flush(struct iobtree *btree) {
+    struct page_iter iter;
+    struct page *page;
+    unsigned int fileno = -1;
+    int fd = -1;
+    enum iobtree_ret iterret;
+
+    /* need to allocate pages from freemap */
+    if (!(iter.state = malloc(sizeof(*iter.state)))) {
+        return 0;
+    }
+
+    iter.size = 1;
+    iter.capacity = 1;
+    iter.state[0].curr = btree->root;
+    iter.state[0].state = 0;
+    iter.state[0].term = 0;
+
+    while ((iterret = page_iter_next(btree, &iter, FILTER_INMEM, &page)) 
+      == IOBTREE_OK) {
+        if (page->h.dirty) {
+            /* pin the correct fd */
+            if ((fileno != page->h.fileno)) {
+                if (fd != -1) {
+                    fdset_unpin(btree->fd, btree->fdset, fileno, fd);
+                }
+
+                if ((fd = fdset_pin(btree->fd, btree->fdset, 
+                    page->h.fileno, 0, SEEK_CUR)) >= 0) {
+
+                    fileno = page->h.fileno;
+                } else {
+                    return 0;
+                }
+            }
+
+            if ((lseek(fd, page->h.offset, SEEK_SET) != (off_t) -1) 
+              && (write(fd, page->mem, btree->pagesize) 
+                == (ssize_t) btree->pagesize)) {
+
+                page->h.dirty = 0;
+            } else {
+                return 0;
+            }
+        }
+    }
+
+    free(iter.state);
+
+    if (iterret != IOBTREE_ITER_FINISH) {
+        assert(!CRASH);
+        return 0;
+    }
+
+    if (btree->leaf->h.dirty) {
+        if ((fileno != btree->leaf->h.fileno)) {
+            if (fd != -1) {
+                fdset_unpin(btree->fd, btree->fdset, fileno, fd);
+            }
+
+            if ((fd = fdset_pin(btree->fd, btree->fdset, 
+                btree->leaf->h.fileno, 0, SEEK_CUR)) >= 0) {
+
+                fileno = btree->leaf->h.fileno;
+            } else {
+                return 0;
+            }
+        }
+
+        if ((lseek(fd, btree->leaf->h.offset, SEEK_SET) != (off_t) -1) 
+          && (write(fd, btree->leaf->mem, btree->pagesize) 
+            == (ssize_t) btree->pagesize)) {
+
+            btree->leaf->h.dirty = 0;
+        } else {
+            return 0;
+        }
+    }
+
+    if (btree->root->h.dirty) {
+        if ((fileno != btree->root->h.fileno)) {
+            if (fd != -1) {
+                fdset_unpin(btree->fd, btree->fdset, fileno, fd);
+            }
+
+            if ((fd = fdset_pin(btree->fd, btree->fdset, 
+                btree->root->h.fileno, 0, SEEK_CUR)) >= 0) {
+
+                fileno = btree->root->h.fileno;
+            } else {
+                return 0;
+            }
+        }
+
+        if ((lseek(fd, btree->root->h.offset, SEEK_SET) != (off_t) -1) 
+          && (write(fd, btree->root->mem, btree->pagesize) 
+            == (ssize_t) btree->pagesize)) {
+
+            btree->root->h.dirty = 0;
+        } else {
+            return 0;
+        }
+    }
+
+    if (fd >= 0) {
+        fdset_unpin(btree->fd, btree->fdset, fileno, fd);
+    }
+
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+    return 1;
+}
+
+void iobtree_delete(struct iobtree *btree) {
+    struct page_iter iter;
+    struct page *page;
+    enum iobtree_ret iterret;
+
+    /* need to iterate over in-memory pages, freeing them */
+    if (!(iter.state = malloc(sizeof(*iter.state)))) {
+        return;
+    }
+
+    iter.size = 1;
+    iter.capacity = 1;
+    iter.state[0].curr = btree->root;
+    iter.state[0].state = 0;
+    iter.state[0].term = 0;
+
+    while ((iterret = page_iter_next(btree, &iter, FILTER_INMEM, &page)) 
+      == IOBTREE_OK) {
+        assert(page->h.directory);
+        assert(!BTBUCKET_LEAF(page->mem, btree->pagesize));
+        if (page != btree->leaf) {
+            free(page->h.directory);
+            free(page);
+        }
+    }
+
+    free(iter.state);
+
+    if (iterret != IOBTREE_ITER_FINISH) {
+        assert(!CRASH);
+    }
+
+    assert(!btree->leaf->h.directory);
+    assert(!btree->tmp->h.directory);
+    free(btree->leaf);
+    free(btree->tmp);
+    free(btree);
+    return;
+}
+static enum iobtree_ret traverse(struct iobtree *btree, const char *term, 
+  unsigned int termlen, struct page *start, struct page **page, 
+  struct page **parent) {
+    struct page *curr,
+                *prev = NULL;
+    unsigned int veclen,
+                 fileno,
+                 index;
+    unsigned long int offset;
+    void *addr;
+    enum iobtree_ret ret;
+
+    for (curr = start; !BTBUCKET_LEAF(curr->mem, btree->pagesize); ) {
+        /* watch for infinite looping over our dummy node */
+        assert(curr && curr != LEAF_PTR(btree));
+
+        prev = curr;
+
+        if ((addr = bucket_search(BTBUCKET_BUCKET(curr->mem),
+            BTBUCKET_SIZE(curr->mem, btree->pagesize),
+            btree->node_strategy, term, termlen, &veclen, &index))) {
+
+            assert(curr->h.directory);
+            assert(curr->h.dirsize > index);
+            if (curr->h.directory[index] 
+              && curr->h.directory[index] != LEAF_PTR(btree)) {
+                /* internal node below */
+                assert(curr != curr->h.directory[index]);
+                curr = curr->h.directory[index];
+                continue;
+            }
+
+            BTBUCKET_ENTRY(addr, &fileno, &offset);
+
+            if (((btree->leaf->h.fileno == fileno)
+                && (btree->leaf->h.offset == offset))
+              || ((!btree->leaf->h.dirty
+                  || ((ret = write_page(btree, btree->leaf)) == IOBTREE_OK))
+                && read_page(btree, fileno, offset, btree->leaf, NULL, 
+                    &ret))) {
+
+                /* either it is a leaf node, or we didn't know */
+                if (BTBUCKET_LEAF(btree->leaf->mem, btree->pagesize)) {
+                    curr->h.directory[index] = LEAF_PTR(btree);
+                    curr = btree->leaf;
+                    break;
+                } else {
+                    /* ensure parent is set */
+                    curr->h.directory[index] = btree->leaf;
+                    btree->leaf->h.parent = curr;
+                    curr = btree->leaf;
+                    /* have read a non-leaf into leaf page, replace it */
+                    if (!(btree->leaf
+                      = new_page(btree->pagesize, NULL))) {
+                        return IOBTREE_ENOMEM;
+                    }
+                }
+            } else {
+                assert(ret != IOBTREE_OK);
+                assert(!CRASH);
+                return ret;
+            }
+        } else {
+            /* shouldn't get here, something has gone badly wrong */
+            assert(!CRASH);
+            return IOBTREE_ERR;
+        }
+    }
+
+    if (page) {
+        *page = curr;
+    }
+    if (parent) {
+        *parent = prev;
+    }
+    return IOBTREE_OK;
+}
+
+enum split_fn {
+    SPLIT_ALLOC,
+    SPLIT_REALLOC,
+    SPLIT_APPEND
+};
+
+/* internal function to split a leaf node and propagate split back up the 
+ * tree */
+static enum iobtree_ret split_nodes(struct iobtree *btree, const char *term, 
+  unsigned int termlen, unsigned int fileno, unsigned long int offset, 
+  struct page *curr, enum split_fn fn) {
+    void *ret;                          /* return value from bucket ops */
+    int toobig,                         /* whether requested op would overflow 
+                                         * an empty bucket */
+        leftcmp;                        /* whether additional term goes in 
+                                         * left bucket or not */
+    unsigned int entries,               /* number of entries in bucket */
+                 index,                 /* index bucket ops occurred at */
+                 termno;                /* termno of term we're inserting */
+    struct page *newpage = NULL,        /* pointer to new page structure */
+                *prev;                  /* pointer to page below current 
+                                         * level */
+
+    if (fn == SPLIT_REALLOC) {
+        /* we don't care about the difference between alloc and realloc 
+         * any more */
+        fn = SPLIT_ALLOC;
+    }
+
+    prev = LEAF_PTR(btree);
+
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+
+    while (curr) {
+        /* attempt to insert into current bucket */
+        assert(!BTBUCKET_LEAF(curr->mem, btree->pagesize));
+
+        if (fn == SPLIT_ALLOC) {
+            ret = bucket_alloc(BTBUCKET_BUCKET(curr->mem), 
+                BTBUCKET_SIZE(curr->mem, btree->pagesize),  
+                btree->node_strategy, term, termlen, BTBUCKET_ENTRY_SIZE(), 
+                &toobig, &index);
+        } else {
+            assert(fn == SPLIT_APPEND);
+            ret = bucket_append(BTBUCKET_BUCKET(curr->mem), 
+                BTBUCKET_SIZE(curr->mem, btree->pagesize),  
+                btree->node_strategy, term, termlen, BTBUCKET_ENTRY_SIZE(), 
+                &toobig);
+            index = bucket_entries(BTBUCKET_BUCKET(curr->mem), 
+                BTBUCKET_SIZE(curr->mem, btree->pagesize),  
+                btree->node_strategy) - 1;
+        }
+
+        if (ret) {
+            /* increase directory size if necessary */
+            entries = bucket_entries(BTBUCKET_BUCKET(curr->mem), 
+                BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+                btree->node_strategy);
+            if (curr->h.dirsize < entries) {
+                void *ptr;
+                unsigned int newsize;
+                newsize = curr->h.dirsize + BIT_DIV2(curr->h.dirsize, 1);
+                if ((ptr = realloc(curr->h.directory, 
+                    newsize * sizeof(*curr->h.directory)))) {
+
+                    curr->h.directory = ptr;
+                    BIT_ARRAY_NULL(&curr->h.directory[curr->h.dirsize], 
+                      newsize - curr->h.dirsize);
+                    curr->h.dirsize = newsize;
+                } else {
+                    return IOBTREE_ENOMEM;
+                }
+            }
+
+            /* fix dir entry */
+            assert(!index || (prev == LEAF_PTR(btree))
+              || curr->h.directory[index - 1] != prev);
+            memmove(&curr->h.directory[index + 1], &curr->h.directory[index], 
+              sizeof(*curr->h.directory) * (entries - index - 1));
+            curr->h.directory[index] = prev;
+
+            /* insertion succeeded, copy reference in and finish */
+            BTBUCKET_SET_ENTRY(ret, fileno, offset);
+            curr->h.dirty = 1;
+            assert(iobtree_invariant(btree) == IOBTREE_OK);
+            return IOBTREE_OK;
+        } else if (toobig) {
+            assert(0);
+            return IOBTREE_ERR;
+        }
+        /* allocate a new node */
+        if ((newpage = new_page(btree->pagesize, curr->h.parent))) {
+            if (freemap_malloc(btree->freemap, &newpage->h.fileno, 
+              &newpage->h.offset, &btree->pagesize, FREEMAP_OPT_EXACT)) {
+
+                termno = 0;
+                btbucket_new(newpage->mem, btree->pagesize, 0, 0, 0, NULL, 
+                  &termno);
+            } else {
+                if (newpage) {
+                    free(newpage);
+                }
+                assert(0);
+                return IOBTREE_ERR;
+            }
+        } else {
+            return IOBTREE_ENOMEM;
+        }
+
+        if (fn == SPLIT_APPEND) {
+            /* XXX: when we allow bucket fill specification we should still 
+             * fill to failure and then split the bucket afterward.  
+             * With a little modification this could give us shortest term 
+             * selection for free. */
+
+            termno = bucket_entries(BTBUCKET_BUCKET(curr->mem), 
+                BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+                btree->leaf_strategy);
+            leftcmp = 0;
+        } else {
+            /* find split point */
+            termno = bucket_find_split_entry(BTBUCKET_BUCKET(curr->mem), 
+                BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->node_strategy,
+                0 /* XXX: provide range */, 
+                term, termlen, termlen + BTBUCKET_ENTRY_SIZE(), &leftcmp);
+        }
+        newpage->h.dirsize = curr->h.dirsize;
+
+        /* assign a directory to newpage and split the node */
+        if ((newpage->h.directory 
+            = malloc(sizeof(*newpage->h.directory) * newpage->h.dirsize))
+          && bucket_split(BTBUCKET_BUCKET(curr->mem), 
+            BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+            BTBUCKET_BUCKET(newpage->mem),
+            BTBUCKET_SIZE(newpage->mem, btree->pagesize), btree->node_strategy,
+            termno)) {
+
+            unsigned int i;
+
+            /* it split successfully */
+
+            curr->h.dirty = 1;
+            newpage->h.dirty = 1;
+            newpage->h.parent = curr->h.parent;
+
+            /* fix up directories */
+            memcpy(newpage->h.directory, &curr->h.directory[termno], 
+              (newpage->h.dirsize - termno) * sizeof(*curr->h.directory));
+
+            /* fix up parent pointers from moved sub-pages */
+            for (i = 0; i < newpage->h.dirsize - termno; i++) {
+                if (newpage->h.directory[i]) {
+                    if (newpage->h.directory[i] != LEAF_PTR(btree)) {
+                        newpage->h.directory[i]->h.parent = newpage;
+                    }
+                }
+            }
+
+            /* set unused pointers to NULL */
+            BIT_ARRAY_NULL(&curr->h.directory[termno], 
+              newpage->h.dirsize - termno);
+            BIT_ARRAY_NULL(&newpage->h.directory[newpage->h.dirsize - termno], 
+              termno);
+
+            /* insert new entry */
+            if ((!leftcmp
+              /* allocate to right bucket */
+              && (ret = bucket_alloc(BTBUCKET_BUCKET(newpage->mem),
+                BTBUCKET_SIZE(newpage->mem, btree->pagesize), 
+                btree->node_strategy, term, termlen, BTBUCKET_ENTRY_SIZE(), 
+                &toobig, &index)))
+
+              /* allocate to left bucket */
+              || (leftcmp 
+                && ((ret = bucket_alloc(BTBUCKET_BUCKET(curr->mem),
+                    BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+                    btree->node_strategy, term, termlen, BTBUCKET_ENTRY_SIZE(),
+                    &toobig, &index))))) {
+
+                unsigned int veclen;
+                struct page *tmppage;
+
+                if (leftcmp) {
+                    tmppage = curr;
+                    entries = termno;
+                } else {
+                    tmppage = newpage;
+                    entries = newpage->h.dirsize - termno;
+                }
+
+                /* fix dir entry, set page for next iteration */
+                memmove(&tmppage->h.directory[index + 1], 
+                  &tmppage->h.directory[index], 
+                  sizeof(*tmppage->h.directory) * (entries - index));
+                tmppage->h.directory[index] = prev;
+
+                /* ensure parent is correct, previously set value can be out 
+                 * of date by now */
+                if (prev != LEAF_PTR(btree)) {
+                    prev->h.parent = tmppage; 
+                }
+
+                prev = newpage;      /* set up prev for next iteration */
+
+                /* copy pointer in */
+                BTBUCKET_SET_ENTRY(ret, fileno, offset);
+
+                /* succeeded, retrieve splitting key (first in right-hand 
+                 * bucket) */
+                termno = 0;
+                term = bucket_next_term(BTBUCKET_BUCKET(newpage->mem),
+                    BTBUCKET_SIZE(newpage->mem, btree->pagesize), 
+                    btree->node_strategy, &termno, &termlen, &ret, &veclen);
+                assert(bucket_entries(BTBUCKET_BUCKET(newpage->mem),
+                    BTBUCKET_SIZE(newpage->mem, btree->pagesize), 
+                    btree->node_strategy));
+                assert(term);
+                fileno = newpage->h.fileno;
+                offset = newpage->h.offset;
+            } else {
+                /* shouldn't get here, something has gone badly wrong */
+                assert(!toobig);
+                assert(0);
+                return IOBTREE_ERR;
+            }
+        } else {
+            if (newpage->h.directory) {
+                free(newpage->h.directory);
+            }
+            /* it didn't split, this either means that theres one (big) entry 
+             * or that something is wrong */
+            assert(0);
+            return IOBTREE_ERR;
+        }
+        
+        curr = curr->h.parent;
+    }
+
+    /* recursive splitting of nodes has finished, we need to add a new root 
+     * node (old one has already been split into newpage and prev) */
+    assert(prev == btree->root || prev == LEAF_PTR(btree) || prev == newpage);
+
+    /* allocate new page */
+    if (!((curr = new_page(btree->pagesize, NULL))
+      && (curr->h.dirsize = newpage ? newpage->h.dirsize : 8)
+      && (curr->h.directory = malloc(sizeof(*curr->h.directory) 
+          * (curr->h.dirsize))))) {
+        if (curr) {
+            free(curr);
+        }
+        return IOBTREE_ENOMEM;
+    }
+    /* place it on the disk */
+    if (freemap_malloc(btree->freemap, &curr->h.fileno, &curr->h.offset, 
+          &btree->pagesize, FREEMAP_OPT_EXACT)) {
+
+        /* initialise it */
+        BIT_ARRAY_NULL(curr->h.directory, curr->h.dirsize);
+
+        termno = 0;
+        btbucket_new(curr->mem, btree->pagesize, 0, 0, 0, NULL, &termno);
+        bucket_new(BTBUCKET_BUCKET(curr->mem),
+            BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+            btree->node_strategy);
+    } else {
+        assert(!CRASH);
+        if (curr) {
+            if (curr->h.directory) {
+                free(curr->h.directory);
+            }
+            free(curr);
+        }
+        return IOBTREE_ERR;
+    }
+
+    /* insert NULL and and new entry to the new root node */
+    if ((ret = bucket_alloc(BTBUCKET_BUCKET(curr->mem), 
+        BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->node_strategy, 
+        "", 0, BTBUCKET_ENTRY_SIZE(), &toobig, &index))) {
+
+        assert(index == 0);
+
+        /* enter reference to previous root node */
+        BTBUCKET_SET_ENTRY(ret, btree->root->h.fileno, 
+          btree->root->h.offset);
+
+        if ((ret = bucket_alloc(BTBUCKET_BUCKET(curr->mem), 
+            BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->node_strategy,
+            term, termlen, BTBUCKET_ENTRY_SIZE(), &toobig, &index))) {
+
+            assert(index == 1);
+
+            /* fix dir entries */
+            if (newpage) {
+                assert(!BTBUCKET_LEAF(curr->mem, btree->pagesize)
+                  && !BTBUCKET_LEAF(newpage->mem, btree->pagesize));
+
+                /* push new root over internal nodes, reference them 
+                 * correctly */
+                curr->h.directory[1] = newpage;
+                newpage->h.parent = curr;
+
+                curr->h.directory[0] = btree->root; 
+                btree->root->h.parent = curr;
+            } else {
+                assert(BTBUCKET_LEAF(btree->root->mem, btree->pagesize));
+
+                /* push new root over leaves, mark them as such */
+                curr->h.directory[0] = LEAF_PTR(btree);
+                curr->h.directory[1] = LEAF_PTR(btree);
+            }
+
+            /* enter reference to new node */
+            BTBUCKET_SET_ENTRY(ret, fileno, offset);
+
+            /* mark new root node */
+            btree->root = curr;
+            btree->root->h.dirty = 1;
+            btree->levels++;
+
+            assert(!BTBUCKET_LEAF(btree->root->mem, btree->pagesize));
+            assert(iobtree_invariant(btree) == IOBTREE_OK);
+            return IOBTREE_OK;
+        }
+    }
+
+    /* something failed */
+    assert(0);
+    return IOBTREE_ERR;
+}
+
+/* internal function to split a leaf node, then use split_nodes to recursively
+ * push the split up the tree */
+static void *split_leaf(struct iobtree *btree, struct page *curr, 
+  struct page *parent, const char *term, unsigned int termlen, 
+  unsigned int newsize, enum split_fn fn, enum iobtree_ret *err) {
+    struct page *newpage;                /* current node in cache */
+    unsigned int index,                  /* index bucket ops occur at */
+                 termno,                 /* term number to split at */
+                 fileno,                 /* file number of page */
+                 oldsize;                /* size of old allocation for term */
+    unsigned long int offset;            /* offset of page */
+    int leftcmp,                         /* whether term being changed goes in 
+                                          * right or left bucket */
+        toobig;                          /* whether allocations are too big 
+                                          * for a bucket */
+    void *ret;                           /* return value */
+    enum iobtree_ret iobret;
+
+    assert(BTBUCKET_LEAF(curr->mem, btree->pagesize));
+
+    /* allocate a new node */
+    if ((newpage = btree->tmp)
+      && ((newpage->h.parent = NULL), 1)
+      && freemap_malloc(btree->freemap, &newpage->h.fileno, &newpage->h.offset,
+          &btree->pagesize, FREEMAP_OPT_EXACT)) {
+        unsigned int tmp;
+
+        /* copy sibling pointer from current node if its not a reference to the
+         * current node */
+        btbucket_sibling(curr->mem, btree->pagesize, &fileno, &offset);
+        if ((offset == curr->h.offset) && (fileno == curr->h.fileno)) {
+            /* reference to current node (ending pointer chain), copy reference
+             * to new node into new node to terminate chain */
+            fileno = newpage->h.fileno;
+            offset = newpage->h.offset;
+        }
+
+        tmp = 0;
+        btbucket_new(newpage->mem, btree->pagesize, fileno, offset, 1, NULL, 
+            &tmp);
+    } else {
+        if (newpage) {
+            if (newpage->h.directory) {
+                free(newpage->h.directory);
+            }
+        }
+        return NULL;
+    }
+
+    if (fn == SPLIT_REALLOC) {
+        /* find out how large the allocation currently is (have to do this 
+         * so that we can pass correct stats to find_split_entry) */
+        if (!bucket_find(BTBUCKET_BUCKET(curr->mem), 
+          BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+          btree->leaf_strategy, term, termlen, &oldsize, &index)) {
+            /* term wasn't allocated in the first place */
+            assert(0);
+            if (err) {
+                *err = IOBTREE_ERR;
+            }
+            return NULL;
+        }
+
+        /* we do a little bit of buggering around with oldsize so that size 
+         * arg to bucket_find_split_entry is newsize - oldsize for 
+         * reallocation, and newsize + termlen for allocation */
+        oldsize += termlen;
+    } else {
+        oldsize = 0;
+    }
+
+    if (fn == SPLIT_APPEND) {
+        /* XXX: when we allow bucket fill specification we should still fill to
+         * failure and then split the bucket afterward.  With a little 
+         * modification this could give us shortest term selection for free. */
+
+        termno = bucket_entries(BTBUCKET_BUCKET(curr->mem), 
+            BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->leaf_strategy);
+        leftcmp = 0;
+    } else {
+        /* find split point (note that the vector and the size of the term are
+         * additional data here, since we're adding a term) */
+        termno = bucket_find_split_entry(BTBUCKET_BUCKET(curr->mem), 
+            BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->leaf_strategy, 
+            0 /* XXX: provide range */, 
+            term, termlen, newsize + termlen - oldsize, &leftcmp);
+    }
+
+    /* split the node */
+    assert(curr == btree->leaf);
+    assert(newpage == btree->tmp);
+    if (bucket_split(BTBUCKET_BUCKET(curr->mem), 
+        BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+        BTBUCKET_BUCKET(newpage->mem),
+        BTBUCKET_SIZE(newpage->mem, btree->pagesize), btree->leaf_strategy, 
+        termno)) {
+
+        newpage->h.dirty = 1;
+        curr->h.dirty = 1;
+
+        /* it split successfully */
+
+        /* encode new sibling pointer */
+        btbucket_set_sibling(curr->mem, btree->pagesize, newpage->h.fileno, 
+          newpage->h.offset);
+
+        /* insert/realloc new entry */
+        if ((!leftcmp
+          /* (re)allocate to right bucket */
+          && (((fn == SPLIT_REALLOC)
+              && (ret = bucket_realloc(BTBUCKET_BUCKET(newpage->mem), 
+                BTBUCKET_SIZE(newpage->mem, btree->pagesize), 
+                btree->leaf_strategy, term, termlen, newsize, &toobig)))
+
+            || ((fn == SPLIT_ALLOC) 
+              && (ret = bucket_alloc(BTBUCKET_BUCKET(newpage->mem), 
+                  BTBUCKET_SIZE(newpage->mem, btree->pagesize), 
+                  btree->leaf_strategy, term, termlen, newsize, &toobig, 
+                  &index)))
+
+            || ((fn == SPLIT_APPEND) 
+              && (ret = bucket_append(BTBUCKET_BUCKET(newpage->mem), 
+                  BTBUCKET_SIZE(newpage->mem, btree->pagesize), 
+                  btree->leaf_strategy, term, termlen, newsize, &toobig)))))
+
+          /* (re)allocate to left bucket */
+          || (leftcmp 
+            && (((fn == SPLIT_REALLOC)
+              && (ret = bucket_realloc(BTBUCKET_BUCKET(curr->mem), 
+                  BTBUCKET_SIZE(curr->mem, btree->pagesize),
+                  btree->leaf_strategy, term, termlen, newsize, &toobig)))
+
+              || ((fn == SPLIT_ALLOC)
+                && (ret = bucket_alloc(BTBUCKET_BUCKET(curr->mem), 
+                    BTBUCKET_SIZE(curr->mem, btree->pagesize),
+                    btree->leaf_strategy, term, termlen, newsize, &toobig, 
+                    &index)))
+
+              || ((fn == SPLIT_APPEND)
+                && (ret = bucket_append(BTBUCKET_BUCKET(curr->mem), 
+                    BTBUCKET_SIZE(curr->mem, btree->pagesize),
+                    btree->leaf_strategy, term, termlen, newsize, 
+                    &toobig)))))) {
+
+            /* succeeded, retrieve splitting key (first in right-hand 
+             * bucket) */
+            unsigned int veclen,
+                         state = 0;
+            void *tmp;
+
+            term = bucket_next_term(BTBUCKET_BUCKET(newpage->mem), 
+                BTBUCKET_SIZE(newpage->mem, btree->pagesize), 
+                btree->leaf_strategy, &state, &termlen, &tmp, &veclen);
+            assert(term);
+        } else {
+            /* shouldn't get here, something has gone badly wrong */
+            assert(!toobig);
+            assert(0);
+            if (err) {
+                *err = IOBTREE_ERR;
+            }
+            return NULL;
+        }
+    } else {
+        /* it didn't split, this either means that theres one (big) entry 
+         * or that something is wrong */
+        /* FIXME: get rid of allocated node */
+        assert(0);
+        if (err) {
+            *err = IOBTREE_ERR;
+        }
+        return NULL;
+    }
+
+    /* get parent node if it wasn't provided */
+    if (!parent && (btree->root != btree->leaf)) {
+        if ((iobret 
+            = traverse(btree, term, termlen, btree->root, NULL, &parent) )
+          != IOBTREE_OK) {
+            assert(0);
+            if (err) {
+                *err = iobret;
+            }
+            return NULL;
+        }
+    }
+
+    assert(curr == btree->leaf);
+    assert(newpage == btree->tmp);
+
+    /* adjust right-most entry in the btree if required */
+    if ((btree->right.fileno == btree->leaf->h.fileno) 
+      && (btree->right.offset == btree->leaf->h.offset)) {
+        btree->right.fileno = newpage->h.fileno;
+        btree->right.offset = newpage->h.offset;
+    }
+
+    /* ensure that the page with the term in it ends up at btree->leaf.  Note
+     * that this doesn't affect which page is pointed at by newpage */
+    if (!leftcmp) {
+        /* swap the two pages over */
+        curr = btree->tmp;
+        btree->tmp = btree->leaf;
+        btree->leaf = curr;
+    }
+
+    /* need to recursively split buckets until it accepts the given 
+     * allocation */
+    if (((iobret = write_page(btree, btree->tmp)) == IOBTREE_OK)
+      && ((iobret = split_nodes(btree, term, termlen, newpage->h.fileno, 
+        newpage->h.offset, parent, fn)) == IOBTREE_OK)) {
+
+        btree->entries++;
+        return ret;
+    } else {
+        /* XXX: we're pretty screwed here, split partially failed */
+        assert(0);
+        if (err) {
+            *err = iobret;
+        }
+        return NULL;
+    }
+}
+
+void *iobtree_alloc(struct iobtree *btree, const char *term, 
+  unsigned int termlen, unsigned int size, int *toobig) {
+    void *ret;                        /* return value */
+    unsigned int index;               /* index bucket ops occur at */
+    struct page *curr,                /* current node in cache */
+                *parent;              /* curr's parent node */
+
+    btree->timestamp++;               /* update timestamp */
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+
+    /* reject anything > 1/4 bucketsize */
+    if (termlen + size > BIT_DIV2(btree->pagesize, 2)) {
+        *toobig = 1;
+        return NULL;
+    }
+
+    /* traverse down the internal nodes */
+    if (traverse(btree, term, termlen, btree->root, &curr, &parent) 
+      != IOBTREE_OK) {
+        return NULL;
+    }
+
+    /* ok, have reached leaf node, now try to allocate space from it */
+    assert(curr == btree->leaf);
+    if ((ret = bucket_alloc(BTBUCKET_BUCKET(curr->mem), 
+        BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->leaf_strategy, term, 
+        termlen, size, toobig, &index))) {
+
+        /* allocation succeeded, return new space */
+        btree->entries++;
+        curr->h.dirty = 1;
+
+        assert(iobtree_invariant(btree) == IOBTREE_OK);
+        return ret;
+    }
+    assert(!*toobig); /* should never be too big, we limit them to 1/4 of a 
+                       * bucket */
+
+    return split_leaf(btree, curr, parent, term, termlen, size, 
+      SPLIT_ALLOC, NULL);
+}
+
+void *iobtree_realloc(struct iobtree *btree, const char *term, 
+  unsigned int termlen, unsigned int newsize, int *toobig) {
+    void *ret;                        /* return value */
+    struct page *curr,                /* current node in cache */
+                *parent;              /* curr's parent node */
+
+    btree->timestamp++;               /* update timestamp */
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+
+    /* reject anything > 1/4 bucketsize */
+    if (termlen + newsize > BIT_DIV2(btree->pagesize, 2)) {
+        *toobig = 1;
+        return NULL;
+    }
+
+    /* traverse down the internal nodes */
+    if (traverse(btree, term, termlen, btree->root, &curr, &parent) 
+      != IOBTREE_OK) {
+        return NULL;
+    }
+
+    /* ok, have reached leaf node, now try to reallocate space in it */
+    if ((ret = bucket_realloc(BTBUCKET_BUCKET(curr->mem), 
+        BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->leaf_strategy, term, 
+        termlen, newsize, toobig))) {
+
+        /* XXX: should check if reallocation shrinks bucket too far and perform
+         * merge like remove */
+
+        /* allocation succeeded, return new space */
+        curr->h.dirty = 1;
+
+        if (!ret) {
+            assert(!CRASH);
+        }
+        assert(iobtree_invariant(btree) == IOBTREE_OK);
+        return ret;
+    }
+    assert(!*toobig); /* should never be too big, we limit them to 1/4 of a 
+                       * bucket */
+
+    return split_leaf(btree, curr, parent, term, termlen, newsize, 
+      SPLIT_REALLOC, NULL);
+}
+
+/* XXX: implement b-tree removal with space guarantee at some stage */
+int iobtree_remove(struct iobtree *btree, const char *term, 
+  unsigned int termlen) {
+    struct page *curr;                /* current node in cache */
+
+    btree->timestamp++;               /* update timestamp */
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+
+    /* traverse down the internal nodes */
+    if (traverse(btree, term, termlen, btree->root, &curr, NULL) 
+      != IOBTREE_OK) {
+        return 0;
+    }
+
+    if (bucket_remove(BTBUCKET_BUCKET(curr->mem), 
+        BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->leaf_strategy, term, 
+        termlen)) {
+
+        curr->h.dirty = 1;
+        assert(iobtree_invariant(btree) == IOBTREE_OK);
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+void *iobtree_find(struct iobtree *btree, const char *term, 
+  unsigned int termlen, int write, unsigned int *veclen) {
+    struct page *curr;
+    unsigned int index;
+
+    /* traverse down the internal nodes */
+    if (traverse(btree, term, termlen, btree->root, &curr, NULL) 
+      != IOBTREE_OK) {
+        return NULL;
+    }
+
+    /* record last access for caching algorithm */
+    curr->h.dirty |= write;
+
+    /* now just need to search the leaf node for the entry */
+    return bucket_find(BTBUCKET_BUCKET(curr->mem), 
+        BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->leaf_strategy, term, 
+        termlen, veclen, &index);
+}
+
+void *iobtree_append(struct iobtree *btree, const char *term,
+  unsigned int termlen, unsigned int size, int *toobig) {
+    struct page *parent;
+    enum iobtree_ret ret;
+    void *addr;
+    unsigned int index;
+
+    btree->timestamp++;               /* update timestamp */
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+
+    /* reject anything > 1/4 bucketsize */
+    if (termlen + size > BIT_DIV2(btree->pagesize, 2)) {
+        *toobig = 1;
+        return NULL;
+    }
+
+    /* ensure right-most page is loaded */
+    if (((btree->leaf->h.fileno == btree->right.fileno)
+        && (btree->leaf->h.offset == btree->right.offset))
+      || ((!btree->leaf->h.dirty
+          || ((ret = write_page(btree, btree->leaf)) == IOBTREE_OK))
+        && read_page(btree, btree->right.fileno, btree->right.offset, 
+            btree->leaf, NULL, &ret))) {
+
+        if (DEAR_DEBUG) {
+            /* ensure that the term we're inserting really is larger than the
+             * ones already here */
+
+            unsigned int prevtermlen,
+                         len;
+            const char *prevterm;
+
+            if ((prevterm = bucket_term_at(BTBUCKET_BUCKET(btree->leaf->mem), 
+                BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), 
+                btree->leaf_strategy, 0, &prevtermlen, &addr, &len))) {
+
+                assert(str_nncmp(prevterm, prevtermlen, term, termlen) < 0);
+            }
+        }
+
+        /* insert into right-most page */
+        if ((addr = bucket_alloc(BTBUCKET_BUCKET(btree->leaf->mem), 
+            BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), 
+            btree->leaf_strategy, term, termlen, size, toobig, &index))) {
+
+            /* successfully inserted */
+            btree->leaf->h.dirty = 1;
+            btree->entries++;
+            return addr;
+        }
+        assert(!*toobig);
+
+        /* XXX: when we allow bucket fill specification we should still fill to
+         * failure and then split the bucket afterward.  With a little 
+         * modification this could give us shortest term selection for free. */
+
+        /* get parent node */
+        if ((ret = traverse(btree, term, termlen, btree->root, NULL, &parent))
+          != IOBTREE_OK) {
+            assert(!CRASH);
+            return NULL;
+        }
+
+        return split_leaf(btree, btree->leaf, parent, term, termlen, size, 
+          SPLIT_APPEND, NULL);
+    } else {
+        assert(!CRASH);
+        return NULL;
+    }
+}
+
+const char *iobtree_next_term(struct iobtree *btree, 
+  unsigned int *state, unsigned int *termlen, void **data, unsigned int *len) {
+    const char *ret = NULL;
+    struct page *curr;
+    unsigned long int offset;
+
+    if (!(state[0] || state[1] || state[2])) {
+        /* traverse down the internal nodes */
+        if (traverse(btree, "", 0, btree->root, &curr, NULL) 
+          != IOBTREE_OK) {
+            return NULL;
+        }
+
+        state[0] = curr->h.fileno;
+        state[1] = curr->h.offset;
+    } else {
+        /* page in leaf if necessary */
+        curr = btree->leaf;
+        if (((btree->leaf->h.fileno == state[0]) 
+            && (btree->leaf->h.offset == state[1])) 
+          || ((!btree->leaf->h.dirty
+              || (write_page(btree, btree->leaf) == IOBTREE_OK))
+            /* note that we don't necessarily know what the parent is now,
+             * because we haven't necessarily traversed downward to find it */
+            && read_page(btree, state[0], state[1], btree->leaf, NULL, NULL))) {
+            curr = btree->leaf;
+        } else {
+            return NULL;
+        }
+    }
+    assert(curr);
+    assert(curr == btree->leaf);
+    assert(BTBUCKET_LEAF(curr->mem, btree->pagesize));
+
+    while (curr
+      && !(ret = bucket_next_term(BTBUCKET_BUCKET(curr->mem), 
+          BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+          btree->leaf_strategy, &state[2], termlen, data, len))) {
+
+        /* ran out of terms in that bucket, go to next one */
+        btbucket_sibling(curr->mem, btree->pagesize, &state[0], &offset);
+        state[1] = offset;  /* XXX: hack around long int/int mismatch */
+
+        if ((state[0] == curr->h.fileno) && (state[1] == curr->h.offset)) {
+            /* self pointer indicates the end of the btree */
+            return NULL;
+        }
+
+        /* page in leaf */
+        assert(curr == btree->leaf);
+        if ((!btree->leaf->h.dirty
+            || (write_page(btree, btree->leaf) == IOBTREE_OK))
+          /* note that we don't necessarily know what the parent is now,
+           * because we haven't necessarily traversed downward to find it */
+          && read_page(btree, state[0], state[1], curr, NULL, NULL)) {
+            state[2] = 0;
+        } else {
+            return NULL;
+        }
+    }
+
+    return ret;
+}
+
+struct iobtree_iter {
+    struct iobtree *btree;
+    unsigned long int offset;
+    unsigned int fileno;
+    unsigned int entries;
+    unsigned int index;
+    unsigned int timestamp;
+};
+
+enum iobtree_ret iobtree_iter_invariant(struct iobtree_iter *iter) {
+    struct iobtree *btree = iter->btree;
+
+    if (!DEAR_DEBUG) {
+        return IOBTREE_OK;
+    }
+
+    if (btree->leaf->h.fileno != iter->fileno
+      || btree->leaf->h.offset != iter->offset) {
+        /* page in the leaf we're on */
+        if ((!btree->leaf->h.dirty
+            || (write_page(btree, btree->leaf) == IOBTREE_OK))
+          && read_page(btree, iter->fileno, iter->offset, btree->leaf, 
+              NULL, NULL)) {
+            /* successfully read node, do nothing */
+        } else {
+            return IOBTREE_OK;   /* its ok to fail in _invariant */
+        }
+    }
+
+    /* bucket must be a leaf */
+    if (!BTBUCKET_LEAF(btree->leaf, btree->pagesize)) {
+        assert(!CRASH);
+        return IOBTREE_ERR;
+    }
+
+    /* cached number of iterations should be correct */
+    if (iter->entries != bucket_entries(BTBUCKET_BUCKET(btree->leaf->mem), 
+        BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), 
+        btree->leaf_strategy)) {
+
+        assert(!CRASH);
+        return IOBTREE_ERR;
+    }
+
+    /* the index should be in the range [0, entries] */
+    if (iter->index > iter->entries) {
+        assert(!CRASH);
+        return IOBTREE_ERR;
+    }
+
+    /* the timestamp should indicate that all modifications have been made
+     * through this iterator */
+    if (iter->timestamp != iter->btree->timestamp) {
+        assert(!CRASH);
+        return IOBTREE_ERR;
+    }
+
+    return IOBTREE_OK;
+}
+
+/* function to search a bucket for an entry equal to or next greater than given
+ * target.  This should probably be made part of the bucket interface to make it
+ * more efficient at some stage */
+static void *locate(void *bucketmem, unsigned int bucketsize, int strategy, 
+  const char *term, unsigned int termlen, unsigned int *veclen, 
+  unsigned int *idx) {
+    int cmp;
+    void *data;
+    unsigned int currtermlen = 0,
+                 datalen,
+                 entries;
+    void *curr = bucket_search(bucketmem, bucketsize, strategy,
+        term, termlen, veclen, idx);
+    const char *currterm = bucket_term_at(bucketmem, bucketsize,
+        strategy, *idx, &currtermlen, &data, &datalen);
+
+    if ((cmp = str_nncmp(currterm, currtermlen, term, termlen)) >= 0) {
+        /* have found our entry, stop */
+        return curr;
+    }
+    assert(cmp < 0);
+
+    entries = bucket_entries(bucketmem, bucketsize, strategy);
+
+    if (*idx == entries - 1) {
+        /* not in this bucket */
+        return NULL;
+    } else {
+        /* advance to next term and return that */
+        (*idx)++;
+        currterm 
+          = bucket_term_at(bucketmem, bucketsize, strategy, *idx, &currtermlen, 
+            &data, veclen);
+        assert(currterm);
+        return data;
+    }
+}
+
+struct iobtree_iter *iobtree_iter_new(struct iobtree *btree, 
+  const char *term, unsigned int termlen) {
+    struct page *curr;
+    struct iobtree_iter *iter = NULL;
+    unsigned int index,
+                 datalen;
+
+    if (traverse(btree, term, termlen, btree->root, &curr, NULL) 
+      == IOBTREE_OK) {
+
+        /* find index in found bucket */
+        locate(BTBUCKET_BUCKET(curr->mem), 
+            BTBUCKET_SIZE(curr->mem, btree->pagesize), btree->leaf_strategy,
+            term, termlen, &datalen, &index);
+
+        if ((iter = malloc(sizeof(*iter)))) {
+            iter->btree = btree;
+            iter->fileno = curr->h.fileno;
+            iter->offset = curr->h.offset;
+            iter->index = index;
+            iter->timestamp = btree->timestamp;
+
+            /* skip empty buckets */
+            while (!(iter->entries = bucket_entries(BTBUCKET_BUCKET(curr->mem), 
+                BTBUCKET_SIZE(curr->mem, btree->pagesize), 
+                btree->leaf_strategy))) {
+
+                btbucket_sibling(curr->mem, btree->pagesize, &iter->fileno, 
+                  &iter->offset);
+
+                if (iter->fileno == btree->leaf->h.fileno 
+                  && iter->offset == btree->leaf->h.offset) {
+                    /* off the end of the last page, without finding a 
+                     * non-empty bucket */
+                    return iter;
+                } else if ((!btree->leaf->h.dirty
+                    || (write_page(btree, btree->leaf) == IOBTREE_OK))
+                  && read_page(btree, iter->fileno, iter->offset, btree->leaf, 
+                      NULL, NULL)) {
+                    /* successfully read node, do nothing */
+                } else {
+                    assert(0);
+                    free(iter);
+                    return NULL;
+                }
+            }
+        }
+    }
+
+    assert(!iter || iobtree_iter_invariant(iter) == IOBTREE_OK);
+    return iter;
+}
+
+void iobtree_iter_delete(struct iobtree_iter *iter) {
+    free(iter);
+    return;
+}
+
+enum iobtree_ret iobtree_iter_curr(struct iobtree_iter *iter,
+  char *termbuf, unsigned int termbuflen, unsigned int *termlen, 
+  unsigned int *datalen) {
+    struct iobtree *btree = iter->btree;
+    const char *term;
+    unsigned int tlen,
+                 dlen;
+    void *data;
+    enum iobtree_ret ret;
+
+    assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+
+    if (btree->leaf->h.fileno != iter->fileno
+      || btree->leaf->h.offset != iter->offset) {
+        /* page in the leaf we're on */
+        if ((!btree->leaf->h.dirty
+            || ((ret = write_page(btree, btree->leaf)) == IOBTREE_OK))
+          && read_page(btree, iter->fileno, iter->offset, btree->leaf, 
+              NULL, &ret)) {
+            /* successfully read node, do nothing */
+        } else {
+            return ret;
+        }
+    }
+
+    /* iterate across leaf nodes until we hit the next entry */
+    while ((iter->index >= iter->entries) 
+      || !(term = bucket_term_at(BTBUCKET_BUCKET(btree->leaf->mem), 
+        BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize),
+        btree->leaf_strategy, iter->index, &tlen, &data, &dlen))) {
+
+        unsigned int prev_fileno = iter->fileno;
+        unsigned long int prev_offset = iter->offset;
+
+        btbucket_sibling(btree->leaf->mem, btree->pagesize, &iter->fileno, 
+          &iter->offset);
+
+        if (iter->fileno == prev_fileno 
+          && iter->offset == prev_offset) {
+            /* end of iteration */
+            assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+            return IOBTREE_ITER_FINISH;
+        } else if ((!btree->leaf->h.dirty
+            || ((ret = write_page(btree, btree->leaf)) == IOBTREE_OK))
+          && read_page(btree, iter->fileno, iter->offset, btree->leaf, NULL, 
+              &ret)) {
+            /* successfully read node, do nothing */
+        } else {
+            return ret;
+        }
+
+        iter->index = 0;
+        iter->entries 
+          = bucket_entries(BTBUCKET_BUCKET(btree->leaf->mem), 
+            BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), 
+            btree->leaf_strategy);
+    }
+
+    if (tlen > termbuflen) {
+        memcpy(termbuf, term, termbuflen);
+    } else {
+        memcpy(termbuf, term, tlen);
+    }
+
+    *termlen = tlen;
+    *datalen = dlen;
+    assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+    return IOBTREE_OK;
+}
+
+enum iobtree_ret iobtree_iter_next(struct iobtree_iter *iter, 
+  char *termbuf, unsigned int termbuflen, unsigned int *termlen,
+  const char *seekterm, unsigned int seektermlen) {
+    struct iobtree *btree = iter->btree;
+    enum iobtree_ret ret;
+
+    /* load current leaf if necessary */
+    if (btree->leaf->h.fileno != iter->fileno
+      || btree->leaf->h.offset != iter->offset) {
+        /* page in the leaf we're on */
+        if ((!btree->leaf->h.dirty
+            || ((ret = write_page(btree, btree->leaf)) == IOBTREE_OK))
+          && read_page(btree, iter->fileno, iter->offset, btree->leaf, NULL, 
+              &ret)) {
+            /* successfully read node, do nothing */
+        } else {
+            return ret;
+        }
+    }
+
+    if (seektermlen) {
+        unsigned int entries,
+                     currtermlen,
+                     datalen,
+                     index;
+        const char *currterm;
+        void *data;
+        struct page *parent;
+        enum iobtree_ret ret;
+        int cmp;
+
+        /* finger search toward selected location.  Finger searching was
+         * originally (i believe) proposed in 'A new representation for linear
+         * lists', Guibas, McCreight, Plass, Roberts.  The idea is that to
+         * traverse from a leaf node to a new location in the tree, the
+         * (theoretically) optimal way to do this is to ascend until we reach a
+         * node that contains a range of keys including the one we want.  
+         * We can then descend to the exact location we want */
+
+        /* search current node */
+        index = iter->entries - 1;
+        currterm = locate(BTBUCKET_BUCKET(btree->leaf->mem), 
+            BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize),
+            btree->leaf_strategy, seekterm, seektermlen, &datalen, &index);
+        assert(currterm || (index == iter->entries - 1));
+
+        if (currterm) {
+            /* have found our entry, stop */
+            iter->index = index;
+            assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+            return IOBTREE_OK;
+        }
+
+        /* have to move to the next bucket, get a pointer to the parent node 
+         * (we started at a leaf, so we don't this currently), which we'll 
+         * need below */
+        if ((ret = traverse(btree, seekterm, seektermlen, btree->root, NULL, 
+            &parent)) != IOBTREE_OK) {
+
+            return ret;
+        }
+        if (cmp < 0) {
+            /* seekterm is (probably - it could just be absent) greater than 
+             * our current bucket's boundaries.  Ascend, looking at right-most 
+             * pointers until we encounter the range we want */
+            while ((entries = bucket_entries(BTBUCKET_BUCKET(parent->mem), 
+                BTBUCKET_SIZE(parent->mem, btree->pagesize), 
+                btree->node_strategy))
+              && (currterm = bucket_term_at(BTBUCKET_BUCKET(parent->mem), 
+                  BTBUCKET_SIZE(parent->mem, btree->pagesize), 
+                  btree->node_strategy, entries - 1, &currtermlen, &data, 
+                  &datalen))
+              && (str_nncmp(currterm, currtermlen, seekterm, seektermlen) < 0)
+              /* stop when we reach root node */
+              && (parent->h.parent && (parent = parent->h.parent))) ;
+        } else {
+            assert(cmp > 0);
+
+            /* seekterm is (probably - it could just be absent) less than our 
+             * current bucket's boundaries.  Ascend, looking at left-most 
+             * pointers until we encounter the range we want */
+            while ((currterm = bucket_term_at(BTBUCKET_BUCKET(parent->mem), 
+                  BTBUCKET_SIZE(parent->mem, btree->pagesize), 
+                  btree->node_strategy, 0, &currtermlen, &data, 
+                  &datalen))
+              && (str_nncmp(currterm, currtermlen, seekterm, seektermlen) > 0)
+              && (parent = parent->h.parent)) ;
+
+        }
+
+        assert(parent);  /* shouldn't have iterated off the top of the tree in 
+                          * either case */
+        assert(entries); /* shouldn't have an empty internal node */
+
+        /* now descend down to appropriate leaf (note that we traverse starting
+         * at the parent we just found) */
+        if ((ret = traverse(btree, seekterm, seektermlen, parent, NULL, NULL))
+          != IOBTREE_OK) {
+            return ret;
+        }
+
+        iter->fileno = btree->leaf->h.fileno;
+        iter->offset = btree->leaf->h.offset;
+        iter->entries = bucket_entries(BTBUCKET_BUCKET(btree->leaf->mem), 
+            BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), 
+            btree->leaf_strategy);
+
+        /* find the seek term in the bucket we just found */
+        currterm = locate(BTBUCKET_BUCKET(btree->leaf->mem), 
+            BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize),
+            btree->leaf_strategy, seekterm, seektermlen, &datalen, 
+            &iter->index);
+
+        /* FIXME: what happens if this bucket doesn't contain an item greater
+         * than the seekterm? */
+
+        assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+        return IOBTREE_OK; 
+    } else {
+        /* just increment to next term */
+        if (iter->index >= iter->entries) {
+            do {
+                unsigned int prev_fileno = iter->fileno;
+                unsigned long int prev_offset = iter->offset;
+
+                btbucket_sibling(btree->leaf->mem, btree->pagesize, 
+                  &iter->fileno, &iter->offset);
+
+                if (iter->fileno == prev_fileno 
+                  && iter->offset == prev_offset) {
+                    /* end of iteration */
+                    assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+                    return IOBTREE_ITER_FINISH;
+                } else if ((!btree->leaf->h.dirty
+                    || ((ret = write_page(btree, btree->leaf)) == IOBTREE_OK))
+                  && read_page(btree, iter->fileno, iter->offset, btree->leaf, 
+                      NULL, &ret)) {
+                    /* successfully read node, do nothing */
+                } else {
+                    return ret;
+                }
+
+                iter->index = 0;
+
+                iter->entries 
+                  = bucket_entries(BTBUCKET_BUCKET(btree->leaf->mem), 
+                    BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), 
+                    btree->leaf_strategy);
+            } while (iter->index >= iter->entries);
+        } else {
+            iter->index++;
+        }
+        assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+        return IOBTREE_OK;
+    }
+}
+
+void *iobtree_iter_alloc(struct iobtree_iter *iter,
+  const char *term, unsigned int termlen, unsigned int size, int *toobig) {
+    struct iobtree *btree = iter->btree;
+    void *ret;
+    unsigned int tmp;
+
+    btree->timestamp++;               /* update timestamp */
+    iter->timestamp++;                /* update iteration timestamp */
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+    assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+
+    /* reject anything > 1/4 bucketsize */
+    if (termlen + size > BIT_DIV2(btree->pagesize, 2)) {
+        *toobig = 1;
+        return NULL;
+    }
+
+    /* navigate to the correct bucket (this is necessary in some form even in 
+     * the most trivial implementation of this function, because we require the
+     * ability to insert before the current item, and we may have already
+     * iterated to the next bucket) */
+    if (iobtree_iter_next(iter, NULL, 0, &tmp, term, termlen) != IOBTREE_OK) {
+        return NULL;
+    }
+
+    if ((ret = bucket_alloc(BTBUCKET_BUCKET(btree->leaf->mem), 
+        BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), btree->leaf_strategy, 
+        term, termlen, size, toobig, &iter->index))) {
+
+        /* allocation succeeded, return new space */
+        btree->entries++;
+        iter->entries++;
+        btree->leaf->h.dirty = 1;
+
+        assert(iobtree_invariant(btree) == IOBTREE_OK);
+        assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+        return ret;
+    }
+    assert(!*toobig); /* should never be too big, we limit them to 1/4 of a 
+                       * bucket */
+
+    ret = split_leaf(btree, btree->leaf, NULL, term, termlen, size, 
+      SPLIT_ALLOC, NULL);
+
+    /* ensure we end up at the right bucket, which is guaranteed to be in
+     * btree->leaf */
+    iter->fileno = btree->leaf->h.fileno;
+    iter->offset = btree->leaf->h.offset;
+    iter->entries = bucket_entries(BTBUCKET_BUCKET(btree->leaf->mem), 
+                    BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), 
+                    btree->leaf_strategy);
+
+    locate(BTBUCKET_BUCKET(btree->leaf->mem), 
+        BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize),
+        btree->leaf_strategy, term, termlen, &tmp, &iter->index);
+
+    assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+    return ret;
+}
+
+void *iobtree_iter_realloc(struct iobtree_iter *iter, 
+  unsigned int newsize, int *toobig) {
+    struct iobtree *btree = iter->btree;
+    const char *term;
+    unsigned int termlen = 0,
+                 datalen;
+    void *data,
+         *ret;
+
+    btree->timestamp++;               /* update timestamp */
+    iter->timestamp++;                /* update iteration timestamp */
+    assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+    assert(iobtree_invariant(btree) == IOBTREE_OK);
+
+    /* reject anything > 1/4 bucketsize */
+    if (termlen + newsize > BIT_DIV2(btree->pagesize, 2)) {
+        *toobig = 1;
+        return NULL;
+    }
+
+    if ((ret = bucket_realloc_at(BTBUCKET_BUCKET(btree->leaf->mem), 
+        BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), btree->leaf_strategy, 
+        iter->index, newsize, toobig))) {
+
+        /* allocation succeeded, return new space */
+        btree->leaf->h.dirty = 1;
+        assert(iobtree_invariant(btree) == IOBTREE_OK);
+        assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+        return ret;
+    }
+    assert(!*toobig); /* should never be too big, we limit them to 1/4 of a 
+                       * bucket */
+
+    if ((term = bucket_term_at(BTBUCKET_BUCKET(btree->leaf->mem), 
+        BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), btree->leaf_strategy, 
+        iter->index, &termlen, &data, &datalen))) {
+
+        ret = split_leaf(btree, btree->leaf, NULL, term, termlen, 
+            newsize, SPLIT_REALLOC, NULL);
+    } else {
+        return NULL;
+    }
+
+    /* ensure we end up at the right bucket, which is guaranteed to be in
+     * btree->leaf */
+    iter->fileno = btree->leaf->h.fileno;
+    iter->offset = btree->leaf->h.offset;
+    iter->entries = bucket_entries(BTBUCKET_BUCKET(btree->leaf->mem), 
+                    BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize), 
+                    btree->leaf_strategy);
+
+    locate(BTBUCKET_BUCKET(btree->leaf->mem), 
+        BTBUCKET_SIZE(btree->leaf->mem, btree->pagesize),
+        btree->leaf_strategy, term, termlen, &datalen, &iter->index);
+
+    assert(iobtree_iter_invariant(iter) == IOBTREE_OK);
+    return ret;
+}
+
+/* internal function to return the number of leaves and nodes (and total pages
+ * if you add them up) */
+static int iobtree_page_stats(struct iobtree *btree, unsigned int *leaves, 
+  unsigned int *nodes) {
+    struct page_iter iter;
+    struct page *page;
+    enum iobtree_ret iterret;
+
+    *leaves = *nodes = 0;
+
+    if (!(iter.state = malloc(sizeof(*iter.state)))) {
+        return 0;
+    }
+
+    iter.size = 1;
+    iter.capacity = 1;
+    iter.state[0].curr = btree->root;
+    iter.state[0].state = 0;
+    iter.state[0].term = 0;
+
+    while ((iterret = page_iter_next(btree, &iter, FILTER_NONE, &page)) 
+      == IOBTREE_OK) {
+        if (BTBUCKET_LEAF(btree->root->mem, btree->pagesize)) {
+            (*leaves)++;
+        } else {
+            (*nodes)++;
+        }
+    }
+
+    free(iter.state);
+
+    if (iterret == IOBTREE_ITER_FINISH) {
+        return 1;
+    } else {
+        assert(!CRASH);
+        return 0;
+    }
+}
+
+unsigned int iobtree_size(struct iobtree *btree) {
+    return btree->entries;
+}
+
+unsigned long int iobtree_overhead(struct iobtree *btree) {
+    /* FIXME: handle errors */
+    unsigned int leaves,
+                 nodes;
+    unsigned long int overhead;
+    unsigned int state[3] = {0, 0, 0};
+    const char *term;
+    unsigned int termlen,
+                 len;
+    void *data;
+
+    iobtree_page_stats(btree, &leaves, &nodes);
+
+    overhead = (nodes + leaves) * btree->pagesize;
+
+    while ((term = iobtree_next_term(btree, state, &termlen, &data, &len))) {
+        overhead -= len + termlen;
+    }
+
+    return overhead;
+}
+
+unsigned long int iobtree_space(struct iobtree *btree) {
+    /* FIXME: handle errors */
+    unsigned int leaves,
+                 nodes;
+
+    iobtree_page_stats(btree, &leaves, &nodes);
+
+    return (nodes + leaves);
+}
+
+unsigned long int iobtree_utilised(struct iobtree *btree) {
+    unsigned int state[3] = {0, 0, 0};
+    unsigned long int utilised = 0;
+    const char *term;
+    unsigned int termlen,
+                 len;
+    void *data;
+
+    while ((term = iobtree_next_term(btree, state, &termlen, &data, &len))) {
+        utilised += len;
+    }
+
+    return utilised;
+}
+
+void iobtree_root(struct iobtree *btree, unsigned int *fileno, 
+  unsigned long int *offset) {
+    *fileno = btree->root->h.fileno;
+    *offset = btree->root->h.offset;
+}
+
+#include <stdio.h>
+
+/* internal/debugging function to print a directory bucket.  Returns true on
+ * success, 0 on failure. */
+int iobtree_print_page(struct iobtree *btree, struct page *page, 
+  unsigned int level) {
+    unsigned int i,
+                 state = 0,
+                 len,
+                 veclen,
+                 fileno;
+    const char *term;
+    void *data;
+    unsigned long int offset;
+    struct page *child;
+
+    for (i = 0; i < level * 3; i++) {
+        putc(' ', stdout);
+    }
+    printf("%u %lu (%u entries at %p, parent %p): ", page->h.fileno, 
+      page->h.offset, bucket_entries(BTBUCKET_BUCKET(page->mem), 
+        BTBUCKET_SIZE(page->mem, btree->pagesize), 
+        btbucket_leaf(page->mem, btree->pagesize) 
+          ? btree->leaf_strategy : btree->node_strategy), (void *) page, 
+      (void *) page->h.parent);
+
+    if (BTBUCKET_LEAF(page->mem, btree->pagesize)) {
+        state = 0;
+        while ((term = bucket_next_term(BTBUCKET_BUCKET(page->mem), 
+            BTBUCKET_SIZE(page->mem, btree->pagesize), btree->node_strategy, 
+            &state, &len, &data, &veclen))) {
+
+            putc('\'', stdout);
+            for (i = 0; i < len; i++) {
+                putc(term[i], stdout);
+            }
+            printf("' (size %u), ", veclen);
+        }
+
+        btbucket_sibling(page->mem, btree->pagesize, &fileno, &offset);
+
+        printf("-> %u %lu\n", fileno, offset);
+        return 1;
+    }
+
+    state = 0;
+    while ((term = bucket_next_term(BTBUCKET_BUCKET(page->mem), 
+        BTBUCKET_SIZE(page->mem, btree->pagesize), btree->node_strategy, 
+        &state, &len, &data, &veclen))) {
+
+        assert(veclen == BTBUCKET_ENTRY_SIZE());
+        BTBUCKET_ENTRY(data, &fileno, &offset);
+        assert((page->h.fileno != fileno) || (page->h.offset != offset));
+
+        putc('\'', stdout);
+        for (i = 0; i < len; i++) {
+            putc(term[i], stdout);
+        }
+        printf("' (node %u %lu), ", fileno, offset);
+    }
+    putc('\n', stdout);
+
+    child = new_page(btree->pagesize, NULL);
+    assert(child);
+    state = 0;
+    while ((term = bucket_next_term(BTBUCKET_BUCKET(page->mem), 
+        BTBUCKET_SIZE(page->mem, btree->pagesize), btree->node_strategy, 
+        &state, &len, &data, &veclen))) {
+        
+        assert(veclen == BTBUCKET_ENTRY_SIZE());
+        BTBUCKET_ENTRY(data, &fileno, &offset);
+        assert((page->h.fileno != fileno) || (page->h.offset != offset));
+
+        if (page->h.directory && page->h.directory[state - 1] 
+          && (page->h.directory[state - 1] != LEAF_PTR(btree))) {
+            if (iobtree_print_page(btree, page->h.directory[state - 1], 
+                level + 1)) {
+
+            } else {
+                assert(!CRASH);
+                return 0;
+            }
+        } else if ((fileno == btree->leaf->h.fileno) 
+          && (offset == btree->leaf->h.offset)) {
+            if (iobtree_print_page(btree, btree->leaf, level + 1)) {
+
+            } else {
+                assert(!CRASH);
+                return 0;
+            }
+        } else {
+            if (read_page(btree, fileno, offset, child, NULL, NULL) 
+              && iobtree_print_page(btree, child, level + 1)) {
+
+            } else {
+                assert(!CRASH);
+                return 0;
+            }
+        }
+    }
+    free(child);
+
+    return 1;
+}
+
+int iobtree_print_index(struct iobtree *btree) {
+    return iobtree_print_page(btree, btree->root, 0);
+}
+
+int iobtree_print_btree(struct iobtree *btree) {
+    struct page_iter iter;
+    struct page *page;
+    int ret;
+
+    /* need to print the pages in the btree by iterating over them */
+
+    if (!(iter.state = malloc(sizeof(*iter.state)))) {
+        return 0;
+    }
+
+    iter.size = 1;
+    iter.capacity = 1;
+    iter.state[0].curr = btree->root;
+    iter.state[0].state = 0;
+    iter.state[0].term = 0;
+
+    page = btree->root;
+
+    while ((ret = page_iter_next(btree, &iter, FILTER_NONE, &page)) 
+      == IOBTREE_OK) {
+        printf("page %u %lu level %u %s\n", page->h.fileno, page->h.offset, 
+          iter.size, BTBUCKET_LEAF(page->mem, btree->pagesize) ? "leaf": "");
+    }
+
+    free(iter.state);
+
+    if (ret == IOBTREE_ITER_FINISH) {
+        return 1;
+    } else {
+        assert(!CRASH);
+        return 0;
+    }
+}
+
+unsigned int iobtree_pages(struct iobtree *btree, unsigned int *leaves, 
+  unsigned int *nodes) {
+    struct page_iter iter;
+    struct page *page;
+    unsigned int l = 0,
+                 n = 0,
+                 p = 0;
+    enum iobtree_ret iterret;
+
+    /* need to iterate over pages in the index */
+
+    if (!(iter.state = malloc(sizeof(*iter.state)))) {
+        return 0;
+    }
+
+    iter.size = 1;
+    iter.capacity = 1;
+    iter.state[0].curr = btree->root;
+    iter.state[0].state = 0;
+    iter.state[0].term = 0;
+
+    page = btree->root;
+
+    while ((iterret = page_iter_next(btree, &iter, FILTER_NONE, &page)) 
+      == IOBTREE_OK) {
+        p++;
+        if (BTBUCKET_LEAF(page->mem, btree->pagesize)) {
+            l++;
+        } else {
+            n++;
+        }
+    }
+
+    free(iter.state);
+
+    if (iterret == IOBTREE_ITER_FINISH) {
+        if (leaves) {
+            *leaves = l;
+        }
+        if (nodes) {
+            *nodes = n;
+        }
+        return p;
+    } else {
+        assert(!CRASH);
+        return 0;
+    }
+}
+
+unsigned int iobtree_pagesize(struct iobtree *btree) {
+    return btree->pagesize;
+}
+
+unsigned int iobtree_levels(struct iobtree *btree) {
+    return btree->levels;
+}
+
diff --git a/src/lcrand.c b/src/lcrand.c
new file mode 100644 (file)
index 0000000..715c93f
--- /dev/null
@@ -0,0 +1,93 @@
+/* lcrand.c implements a simple linear congruential psuedo-random
+ * number generator.  See lcrand.h for more detail.
+ *
+ * written nml 2004-08-27
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "lcrand.h"
+
+#include "zstdint.h"
+
+#include <stdlib.h>
+
+struct lcrand {
+    unsigned int a;
+    unsigned int b;
+    uint32_t state;
+    uint32_t seed;
+};
+
+struct lcrand *lcrand_new(unsigned int seed) {
+    struct lcrand *prng;
+
+    if ((prng = malloc(sizeof(*prng)))) {
+        /* recommended by numerical recipes in c */
+        prng->a = 1664525;
+        prng->b = 1013904223;
+        prng->state = prng->seed = seed;
+    }
+
+    return prng;
+}
+
+struct lcrand *lcrand_new_custom(unsigned int seed, unsigned int a, 
+  unsigned int b) {
+    struct lcrand *prng;
+
+    if ((prng = malloc(sizeof(*prng)))) {
+        prng->a = a;
+        prng->b = b;
+        prng->state = prng->seed = seed;
+    }
+
+    return prng;
+}
+
+void lcrand_delete(struct lcrand *prng) {
+    free(prng);
+}
+
+unsigned int lcrand(struct lcrand *prng) {
+    return prng->state = prng->a * prng->state + prng->b;
+}
+
+unsigned int lcrand_limit(struct lcrand *prng, unsigned int limit) {
+    return (unsigned) ((double) limit * lcrand(prng)/(LCRAND_MAX + 1.0));
+}
+
+unsigned int lcrand_seed(struct lcrand *prng) {
+    return prng->seed;
+}
+
+#ifdef LCRAND_TEST
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+int main(int argc, char **argv) {
+    struct lcrand *rand;
+    unsigned int num,
+                 i;
+
+    if ((rand = lcrand_new((num = time(NULL))))) {
+        printf("seed = %u\n", num);
+
+        for (i = 0; i < 100; i++) {
+            num = lcrand(rand);
+            printf("%u\n", num);
+        }
+
+        lcrand_delete(rand);
+        return EXIT_SUCCESS;
+    } else {
+        fprintf(stderr, "failed to initialise lcrand PRNG\n");
+        return EXIT_SUCCESS;
+    }
+}
+
+#endif
+
diff --git a/src/libtextcodec/crc.c b/src/libtextcodec/crc.c
new file mode 100644 (file)
index 0000000..eb25c93
--- /dev/null
@@ -0,0 +1,81 @@
+/* crc.c implements the common cyclic redundancy checksum algorithm.  The
+ * implementation below was adapted from the code presented in RFC 1952 
+ * (gzip file format specification, in the appendix).
+ *
+ * written nml 2004-08-26
+ *
+ */
+
+#include "crc.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+struct crc {
+    unsigned int *table;       /* lookup table */
+    uint32_t sum;              /* checksum */
+};
+
+static unsigned int *crc_table() {
+    static unsigned int table[256];
+    static int initialised = 0;
+
+    if (!initialised) {
+        unsigned int i,
+                     j,
+                     c;
+
+        for (i = 0; i < 256; i++) {
+            c = i;
+            for (j = 0; j < 8; j++) {
+                if (c & 1) {
+                    c = 0xedb88320U ^ (c >> 1);
+                } else {
+                    c = c >> 1;
+                }
+            }
+            table[i] = c;
+        }
+        initialised = 1;
+    } 
+
+    return table;
+}
+
+struct crc *crc_new() {
+    struct crc *crc;
+
+    assert(sizeof(unsigned int) >= 4);
+
+    if ((crc = malloc(sizeof(*crc)))) {
+        crc->table = crc_table();
+        crc->sum = 0;
+    }
+
+    return crc;
+}
+
+void crc_reinit(struct crc *crc) {
+    crc->sum = 0;
+}
+
+uint32_t crc_sum(struct crc *crc) {
+    return crc->sum;
+}
+
+void crc_delete(struct crc *crc) {
+    free(crc);
+}
+
+void crc(struct crc *crc, const void *next_in, unsigned int avail_in) {
+    const unsigned char *buf = next_in;
+    unsigned int i;
+    uint32_t sum = crc->sum ^ 0xffffffffU;
+
+    for (i = 0; i < avail_in; i++) {
+        sum = crc->table[(sum ^ buf[i]) & 0xffU] ^ (sum >> 8);
+    }
+
+    crc->sum = sum ^ 0xffffffffU;
+}
+
diff --git a/src/libtextcodec/detectfilter.c b/src/libtextcodec/detectfilter.c
new file mode 100644 (file)
index 0000000..12a3079
--- /dev/null
@@ -0,0 +1,141 @@
+/* detectfilter.c implements a stream filter (see stream.h) that
+ * detects encodings on the text stream and transparently inserts modules to 
+ * undo them.  It currently only supports gzip, but this concept is
+ * applicable to just about anything that can be hueristically detected
+ * and dealt with.
+ *
+ * detectfilter.c doesn't have a header file because the only publicly 
+ * accessible method is the constructor, which is declared in stream.h
+ *
+ * XXX: it would be really cool to use a run-time trie to do all of
+ * this, so that we could dynamically configure the detectfilter to do
+ * things.  Would also be nice if we built this file from something
+ * like /etc/magic
+ *
+ * written nml 2004-08-23
+ *
+ */
+
+#include "stream.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+struct detectfilter {
+    struct stream_filter filter; /* stream filter object (needs to be first) */
+    unsigned int bufsize;        /* buffer size detected filters get initialised 
+                                  * with */
+    unsigned int limited;        /* whether we're limited in the number of 
+                                  * filters we can detect */
+    unsigned int limit;          /* if we're limited, what the current limit 
+                                  * is */
+};
+
+#define MIN_INPUT 2
+
+static enum stream_ret detectfilter_filter(struct stream_filter *filter, 
+  enum stream_flush flush) {
+    struct detectfilter *state = (void *) filter;
+    char *ptr = filter->next_in;
+    unsigned int len = filter->avail_in;
+
+    if (filter->avail_in < MIN_INPUT) {
+        /* if (flush == STREAM_FLUSH_NONE) {
+             * FIXME: insert a collection filter component before us to relieve
+             * the need to buffer/unbuffer *
+            if ((filter->out.insert.insert 
+              = (void *) collectorfilter_new(MIN_INPUT, MIN_INPUT))) {
+                filter->out.insert.after = 0;
+                return STREAM_INSERT;
+            } else {
+                return STREAM_ENOMEM;
+            }
+        } else { */
+
+        if (!filter->avail_in) {
+            return STREAM_INPUT;
+        } else {
+            /* have to delete this module to obey the flush command */
+            filter->out.delet.after = 0;
+            return STREAM_DELETE;
+        }
+    }
+
+    /* delete this filter if we've hit our limit */
+    if (state->limited && !state->limit) {
+        filter->out.delet.after = 0;
+        return STREAM_DELETE;
+    }
+
+    /* below this point we know we have as much input as we need */
+
+    assert(filter->avail_in >= MIN_INPUT);
+
+    len--;
+    switch (*ptr++) {
+    case '\037': 
+        /* matched gzip encoding first byte, continue below */
+        break;
+
+    default: 
+        /* no match, delete this module (note that we don't update
+         * next_in/avail_in, so original input now goes to next filter) */
+        filter->out.delet.after = 0;
+        return STREAM_DELETE;
+    }
+
+    len--;
+    switch (*ptr++) {
+    case '\213': 
+        /* matched both gzip magic bytes, now insert a gzip decoding
+         * module into the stream before this module and repeat */
+        if ((filter->out.insert.insert 
+          = (void *) gunzipfilter_new(state->bufsize))) {
+            state->limit--;
+            filter->out.insert.after = 0;
+            return STREAM_INSERT;
+        } else {
+            return STREAM_ENOMEM;
+        }
+        break;
+
+    default: 
+        /* no match, delete this module (note that we don't update
+         * next_in/avail_in, so original input now goes to next filter) */
+        filter->out.delet.after = 0;
+        return STREAM_DELETE;
+    }
+}
+
+static enum stream_ret detectfilter_delete(struct stream_filter *filter) {
+    free(filter);
+    return STREAM_OK;
+}
+
+static const char *detectfilter_id(struct stream_filter *filter) {
+    return "detect";
+}
+
+struct detectfilter *detectfilter_new(unsigned int bufsize, 
+  unsigned int limit) {
+    struct detectfilter *filter;
+
+    /* ensure bufsize is greater than MIN_INPUT so that subsequent detections
+     * work */
+    if (bufsize < MIN_INPUT) {
+        bufsize = MIN_INPUT;
+    } 
+
+    if ((filter = malloc(sizeof(*filter)))) {
+        filter->bufsize = bufsize;
+        filter->limited = filter->limit = limit;
+        filter->filter.filter = detectfilter_filter;
+        filter->filter.deletefn = detectfilter_delete;
+        filter->filter.idfn = detectfilter_id;
+        assert((void *) &filter->filter == (void *) filter);
+        return filter;
+    } else {
+        return NULL;
+    }
+}
+
diff --git a/src/libtextcodec/gunzipfilter.c b/src/libtextcodec/gunzipfilter.c
new file mode 100644 (file)
index 0000000..c183db9
--- /dev/null
@@ -0,0 +1,612 @@
+/* gunzipfilter.c implements a stream filter module (see stream.h) that
+ * decompresses files created by the gzip utility, as described in RFC 1952.
+ * The zlib library is used to actually decompress the data, this module merely
+ * parses the miscellaneous junk in the header and figures out which bits
+ * constitute data and verifies that the data matches checksum and recorded
+ * size. 
+ *
+ * As of 1.2.x the zlib library also performs this functionality.  It was a bit
+ * of a tough choice as to whether to duplicate it, since 1.2.x is not
+ * widespread yet, but in the end i decided to make this code as widely-usable
+ * as possible and duplicate the functionality.
+ *
+ * A good extension to this bit of code would be to be able to decompress data
+ * in zlib format, and raw deflate format (requires a bit of buggering around
+ * with states).  Also nice would be to check header checksum and possibly to
+ * provide access to the extra header data.
+ *
+ * written nml 2004-08-26
+ *
+ */
+
+/* FIXME: there are periods in this state machine (search for FIXME, commented
+ * out assert) where the input position is not correct */
+
+#include "stream.h"
+
+#include "crc.h"
+#include "def.h"
+#include "str.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <zlib.h>
+
+enum gunzipfilter_states {
+    STATE_ERR = -1,
+
+    STATE_CM,
+    STATE_DECOMPRESS,
+    STATE_DECOMPRESS_DECOMP,
+    STATE_DECOMPRESS_DECOMP8,
+    STATE_DECOMPRESS_POST8,
+    STATE_END,
+    STATE_END_FLUSH,
+    STATE_END_CHECK,
+    STATE_EXTRA,
+    STATE_EXTRA_SECOND,
+    STATE_EXTRA_VAR,
+    STATE_FLG,
+    STATE_HCRC,
+    STATE_HCRC_SECOND,
+    STATE_ID2,
+    STATE_MTIME,
+    STATE_MTIME_FOURTH,
+    STATE_MTIME_SECOND,
+    STATE_MTIME_THIRD,
+    STATE_OS,
+    STATE_START,
+    STATE_STRING,
+    STATE_XFL
+};
+
+/* flags that can be in a gzip header, straight from the RFC */
+enum gunzipfilter_flags {
+    FLAG_FTEXT = (1 << 0),
+    FLAG_FHCRC = (1 << 1),
+    FLAG_FEXTRA = (1 << 2),
+    FLAG_FNAME = (1 << 3),
+    FLAG_FCOMMENT = (1 << 4)
+};
+
+struct gunzipfilter {
+    struct stream_filter filter;     /* filter object (must be first) */
+    z_stream zstate;                 /* zlib state */
+    unsigned int len;                /* length of various things */
+    unsigned int bufsize;            /* size of allocated buffer */
+    enum gunzipfilter_states state;  /* state of decompression */
+    struct crc *crc;                 /* running checksum */
+    unsigned char prebuf[8];         /* buffer for last 8 bytes */
+    unsigned char flags;             /* remaining flags from gzip header 
+                                      * (bitfield composed of items from 
+                                      * enum gunzipfilter_flags) */
+    char buf[1];                     /* allocated buffer (not 
+                                      * necessarily of length one, via struct 
+                                      * hack) */
+};
+
+static const char *gunzipfilter_id(struct stream_filter *filter) {
+    return "gunzip";
+}
+
+static enum stream_ret gunzipfilter_filter(struct stream_filter *filter, 
+  enum stream_flush flush) {
+    struct gunzipfilter *state = (void *) filter;
+    unsigned int tmp;
+
+    assert(filter->idfn(filter) == gunzipfilter_id(filter));
+
+    /* jump to correct state */
+    switch (state->state) {
+    case STATE_CM: goto cm_label;
+    case STATE_DECOMPRESS: goto decompress_label;
+    case STATE_DECOMPRESS_DECOMP: goto decompress_decomp_label;
+    case STATE_DECOMPRESS_DECOMP8: goto decompress_decomp8_label;
+    case STATE_DECOMPRESS_POST8: goto decompress_post8_label;
+    case STATE_END: goto end_label;
+    case STATE_END_FLUSH: goto end_flush_label;
+    case STATE_END_CHECK: goto end_check_label;
+    case STATE_EXTRA: goto extra_label;
+    case STATE_EXTRA_SECOND: goto extra_second_label;
+    case STATE_EXTRA_VAR: goto extra_var_label;
+    case STATE_FLG: goto flg_label;
+    case STATE_HCRC: goto hcrc_label;
+    case STATE_HCRC_SECOND: goto hcrc_second_label;
+    case STATE_ID2: goto id2_label;
+    case STATE_MTIME: goto mtime_label;
+    case STATE_MTIME_FOURTH: goto mtime_fourth_label;
+    case STATE_MTIME_SECOND: goto mtime_second_label;
+    case STATE_MTIME_THIRD: goto mtime_third_label;
+    case STATE_OS: goto os_label;
+    case STATE_START: goto start_label;
+    case STATE_STRING: goto string_label;
+    case STATE_XFL: goto xfl_label;
+    default: assert(!CRASH); goto err_label;
+    }
+
+/* reading ID1 byte, which must be \037 */
+start_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        if (*filter->next_in++ != '\037') {
+            assert(!CRASH);
+            goto err_label;
+        }
+    } else {
+        state->state = STATE_START;
+        return STREAM_INPUT;
+    }
+
+    goto id2_label;
+
+/* reading ID2 byte, which must be \213 */
+id2_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        if (*filter->next_in++ != '\213') {
+            assert(!CRASH);
+            goto err_label;
+        }
+    } else {
+        state->state = STATE_ID2;
+        return STREAM_INPUT;
+    }
+
+    goto cm_label;
+
+/* reading compression method (CM) byte, which must be 8 */
+cm_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        if (*filter->next_in++ != 8) {
+            assert(!CRASH);
+            goto err_label;
+        }
+    } else {
+        state->state = STATE_CM;
+        return STREAM_INPUT;
+    }
+
+    goto flg_label;
+
+/* read flag byte */
+flg_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        state->flags = *filter->next_in++;
+    } else {
+        state->state = STATE_FLG;
+        return STREAM_INPUT;
+    }
+
+    goto mtime_label;
+
+/* ignore the 4-byte, little-endian modification time */
+mtime_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        filter->next_in++;
+    } else {
+        state->state = STATE_MTIME;
+        return STREAM_INPUT;
+    }
+    goto mtime_second_label;
+mtime_second_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        filter->next_in++;
+    } else {
+        state->state = STATE_MTIME_SECOND;
+        return STREAM_INPUT;
+    }
+    goto mtime_third_label;
+mtime_third_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        filter->next_in++;
+    } else {
+        state->state = STATE_MTIME_THIRD;
+        return STREAM_INPUT;
+    }
+    goto mtime_fourth_label;
+mtime_fourth_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        filter->next_in++;
+    } else {
+        state->state = STATE_MTIME_FOURTH;
+        return STREAM_INPUT;
+    }
+    goto xfl_label;
+
+/* ignore the extra flags byte */
+xfl_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        filter->next_in++;
+    } else {
+        state->state = STATE_XFL;
+        return STREAM_INPUT;
+    }
+    goto os_label;
+
+/* ignore the operating system (OS) indication byte */
+os_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        filter->next_in++;
+    } else {
+        state->state = STATE_OS;
+        return STREAM_INPUT;
+    }
+
+    goto flag_switch_label;
+
+/* figure out, based on flags, where to go next */
+flag_switch_label:
+    if (state->flags & FLAG_FHCRC) {
+        state->flags &= ~FLAG_FHCRC;
+        goto hcrc_label;
+    } else if (state->flags & FLAG_FEXTRA) {
+        state->flags &= ~FLAG_FEXTRA;
+        goto extra_label;
+    } else if (state->flags & FLAG_FNAME) {
+        state->flags &= ~FLAG_FNAME;
+        goto string_label;
+    } else if (state->flags & FLAG_FCOMMENT) {
+        state->flags &= ~FLAG_FCOMMENT;
+        goto string_label;
+    } else if (state->flags & FLAG_FTEXT) {
+        state->flags &= ~FLAG_FTEXT;
+        /* don't care about FTEXT */
+        goto flag_switch_label;
+    } else if (state->flags) {
+        /* got a flag we don't understand */
+        assert(!CRASH);
+        goto err_label;
+    } else {
+        state->len = 0;
+        goto decompress_label;
+    }
+
+/* ignore two bytes (XXX: implement header checksum at some stage)*/
+hcrc_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        filter->next_in++;
+    } else {
+        state->state = STATE_HCRC;
+        return STREAM_INPUT;
+    }
+
+    goto hcrc_second_label;
+
+/* ignore second byte of header CRC */
+hcrc_second_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        filter->next_in++;
+    } else {
+        state->state = STATE_HCRC_SECOND;
+        return STREAM_INPUT;
+    }
+
+    goto flag_switch_label;
+
+/* ignore string bytes, finished by '\0' */
+string_label:
+    while (filter->avail_in) {
+        filter->avail_in--;
+        if (*filter->next_in++ == '\0') {
+            goto flag_switch_label;
+        }
+    }
+
+    state->state = STATE_STRING;
+    return STREAM_INPUT;
+
+/* read extra field length */
+extra_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        state->len = *filter->next_in++;
+    } else {
+        state->state = STATE_EXTRA;
+        return STREAM_INPUT;
+    }
+
+    goto extra_second_label;
+
+/* read second byte of extra field length */
+extra_second_label:
+    if (filter->avail_in) {
+        filter->avail_in--;
+        state->len += *filter->next_in++ << 8;
+    } else {
+        state->state = STATE_EXTRA_SECOND;
+        return STREAM_INPUT;
+    }
+
+    goto extra_second_label;
+
+/* ignore contents of extra field */
+extra_var_label:
+    while (filter->avail_in && state->len) {
+        filter->avail_in--;
+        state->len--;
+        filter->next_in++;
+    }
+
+    if (state->len) {
+        state->state = STATE_EXTRA_VAR;
+        return STREAM_INPUT;
+    } else {
+        goto flag_switch_label;
+    }
+
+/* decompressing data, buffering 8 bytes that may be the end of the stream */
+decompress_label:
+    if (state->len + filter->avail_in >= 8) {
+        memcpy(&state->prebuf[state->len], filter->next_in, 8 - state->len);
+        filter->avail_in -= (8 - state->len);
+        filter->next_in += (8 - state->len);
+        /* buffer filled, start decompressing data */
+        goto decompress_post8_label;
+    } else if (flush & STREAM_FLUSH_FINISH) {
+        /* ended prematurely */
+        assert(!CRASH);
+        goto err_label;
+    } else if (flush) {
+        assert("don't know other flush values" && 0);
+    } else {
+        memcpy(&state->prebuf[state->len], filter->next_in, filter->avail_in);
+        filter->next_in += filter->avail_in;
+        state->len += filter->avail_in;
+        filter->avail_in = 0;
+        state->state = STATE_DECOMPRESS;
+        return STREAM_INPUT;
+    }
+
+/* decompressing data, after we have received at least 8 bytes */
+decompress_post8_label:
+    assert(!state->zstate.avail_in);
+    state->zstate.next_in = state->prebuf;
+    if (filter->avail_in >= 8) {
+        state->zstate.avail_in = 8;
+    } else if (filter->avail_in) {
+        state->zstate.avail_in = filter->avail_in;
+    } else if (flush & STREAM_FLUSH_FINISH) {
+        /* stream has ended */
+        goto end_flush_label;
+    } else if (flush) {
+        assert("don't know other flush values" && 0);
+        goto err_label;
+    } else {
+        state->state = STATE_DECOMPRESS_POST8;
+        return STREAM_INPUT;
+    }
+    goto decompress_decomp8_label;
+
+/* decompress the 8 previously buffered characters */
+decompress_decomp8_label:
+    if (((tmp = inflate(&state->zstate, Z_NO_FLUSH)) == Z_OK) 
+      || (tmp == Z_BUF_ERROR)) {
+        if (state->zstate.avail_out) {
+            assert(!state->zstate.avail_in);
+            if (filter->avail_in > 8) {
+                /* have enough data to perform full decompression */
+
+                /* fill prebuf up with data from the end of the buffer */
+                memcpy(state->prebuf, filter->next_in + filter->avail_in - 8, 
+                  8);
+
+                state->zstate.next_in = ((unsigned char *) filter->next_in);
+                state->zstate.avail_in = filter->avail_in - 8;
+                filter->next_in = NULL;
+                filter->avail_in = 0;
+                goto decompress_decomp_label;
+            } else {
+                /* just fiddle the data into the prebuf buffer and go back for 
+                 * more */
+                memmove(state->prebuf, &state->prebuf[filter->avail_in], 
+                  8 - filter->avail_in);
+                memcpy(&state->prebuf[8 - filter->avail_in], filter->next_in, 
+                  filter->avail_in);
+                filter->next_in = NULL;
+                filter->avail_in = 0;
+                goto decompress_post8_label;
+            }
+        } else {
+            /* didn't finish inflating */
+            state->zstate.next_out 
+              = ((unsigned char *) state) + sizeof(*state);
+            filter->out.ok.curr_out = (char *) state->zstate.next_out;
+            filter->out.ok.avail_out = state->zstate.avail_out 
+              = state->bufsize;
+            state->state = STATE_DECOMPRESS_DECOMP8;
+            crc(state->crc, filter->out.ok.curr_out, filter->out.ok.avail_out);
+            /* FIXME: assert(!filter->avail_in);*/
+            return STREAM_OK;
+        }
+    } else {
+        assert(!CRASH);
+        goto err_label;
+    }
+    assert("can't get here" && 0);
+
+/* decompress stuff straight from the stream */
+decompress_decomp_label:
+    switch ((tmp = inflate(&state->zstate, Z_NO_FLUSH))) {
+
+    case Z_BUF_ERROR:
+    case Z_OK:
+        if (state->zstate.avail_out) {
+            /* decompressed available data, start again */
+            goto decompress_post8_label;
+        } else {
+            /* didn't finish inflating */
+            state->zstate.next_out 
+              = ((unsigned char *) state) + sizeof(*state);
+            filter->out.ok.curr_out = (char *) state->zstate.next_out;
+            filter->out.ok.avail_out = state->zstate.avail_out 
+              = state->bufsize;
+            state->state = STATE_DECOMPRESS_DECOMP;
+            crc(state->crc, filter->out.ok.curr_out, filter->out.ok.avail_out);
+            return STREAM_OK;
+        }
+        break;
+
+    default: 
+        assert(!CRASH);
+        goto err_label;
+    }
+    assert("can't get here" && 0);
+
+end_flush_label:
+    /* flush zlib */
+    switch ((tmp = inflate(&state->zstate, Z_FULL_FLUSH))) {
+    case Z_OK:
+    case Z_BUF_ERROR:
+        /* check if we have some output */
+        if (state->zstate.avail_out != state->bufsize) {
+            state->zstate.next_out 
+              = ((unsigned char *) state) + sizeof(*state);
+            filter->out.ok.curr_out = (char *) state->zstate.next_out;
+            filter->out.ok.avail_out = state->bufsize - state->zstate.avail_out;
+            state->zstate.avail_out = state->bufsize;
+            state->state = STATE_END_FLUSH;
+            crc(state->crc, filter->out.ok.curr_out, filter->out.ok.avail_out);
+            return STREAM_OK;
+        } else {
+            goto end_check_label;
+        }
+        break;
+
+    default: 
+        assert(!CRASH);
+        goto err_label;
+    }
+
+end_check_label:
+    /* stream has ended, prebuf should now contain:
+     *   0   1   2   3   4   5   6   7
+     * +---+---+---+---+---+---+---+---+
+     * |     CRC32     |     ISIZE     |
+     * +---+---+---+---+---+---+---+---+
+     * 
+     * with CRC and ISIZE both being 4-byte integers, least significant
+     * byte first */
+    tmp = state->prebuf[0];
+    tmp += state->prebuf[1] << 8;
+    tmp += state->prebuf[2] << 16;
+    tmp += state->prebuf[3] << 24;
+
+    /* tmp is now crc */
+    if (tmp != crc_sum(state->crc)) {
+        /* checksum failed */
+        return STREAM_EINVAL;
+    }
+
+    tmp = state->prebuf[4];
+    tmp += state->prebuf[5] << 8;
+    tmp += state->prebuf[6] << 16;
+    tmp += state->prebuf[7] << 24;
+
+    /* tmp is now isize */
+    if (tmp != state->zstate.total_out) {
+        /* size comparison failed */
+        return STREAM_EINVAL;
+    }
+
+/* this section commented out becuase it failed (for no apparent reason) on a
+ * machine with zlib 1.1.4, and doesn't really add anything (crc checks data
+ * consistency) */
+#if 0
+    /* provide calculated adler32 checksum to zlib and finish.  Note that the 
+     * adler32 checksum is provided MOST significant byte first, which is 
+     * inconsistent with the rest of the zlib stuff. */
+    state->prebuf[3] = state->zstate.adler & 0xff;
+    state->prebuf[2] = (state->zstate.adler >> 8) & 0xff;
+    state->prebuf[1] = (state->zstate.adler >> 16) & 0xff;
+    state->prebuf[0] = (state->zstate.adler >> 24) & 0xff;
+    assert(!state->zstate.avail_in);
+    state->zstate.next_in = state->prebuf;
+    state->zstate.avail_in = 4;
+    switch ((tmp = inflate(&state->zstate, Z_FINISH))) {
+    case Z_STREAM_END:
+        /* stream has ended, zlib is happy */
+        goto end_label;
+
+    default: 
+        assert(!CRASH);
+        goto err_label;
+    }
+    assert("can't get here" && 0);
+#endif
+
+    goto end_label;
+
+end_label:
+    filter->out.delet.after = 0;
+    state->state = STATE_ERR;          /* shouldn't re-enter this function, 
+                                        * because we're about to... */
+    return STREAM_DELETE;              /* ...delete this module */
+
+err_label:
+    assert(!CRASH);
+    state->state = STATE_ERR;
+    return STREAM_EINVAL;
+}
+
+static enum stream_ret gunzipfilter_delete(struct stream_filter *filter) {
+    struct gunzipfilter *state = (void *) filter;
+
+    assert(filter->idfn(filter) == gunzipfilter_id(filter));
+
+    inflateEnd(&state->zstate);
+    crc_delete(state->crc);
+
+    free(filter);
+    return STREAM_OK;
+}
+
+struct gunzipfilter *gunzipfilter_new(unsigned int bufsize) {
+    struct gunzipfilter *state;
+    unsigned char *header = (unsigned char *) "\x78\x01";
+    int ret;
+
+    if ((state = malloc(sizeof(*state) + bufsize)) 
+      && (state->crc = crc_new())) {
+        state->state = STATE_START;
+        state->bufsize = bufsize + !bufsize;
+        state->filter.filter = gunzipfilter_filter;
+        state->filter.idfn = gunzipfilter_id;
+        state->filter.deletefn = gunzipfilter_delete;
+        state->zstate.zalloc = Z_NULL;
+        state->zstate.zfree = Z_NULL;
+        state->zstate.opaque = NULL;
+        state->zstate.next_out = ((unsigned char *) state) + sizeof(*state);
+        state->zstate.avail_out = bufsize;
+        /* provide a fake header to fool zlib into thinking that its
+         * decompressing zlib format data */
+        state->zstate.next_in = header;
+        state->zstate.avail_in = str_len((char *) header);
+        if (((ret = inflateInit(&state->zstate)) != Z_OK) 
+          /* zlib must read the header now */
+          || ((state->zstate.avail_in)
+            && (((ret = inflate(&state->zstate, Z_NO_FLUSH)) != Z_OK)
+              || state->zstate.avail_in))) {
+
+            crc_delete(state->crc);
+            free(state);
+            state = NULL;
+        }
+    } else if (state) {
+        free(state);
+        state = NULL;
+    }
+
+    return state;
+}
+
diff --git a/src/libtextcodec/stream.c b/src/libtextcodec/stream.c
new file mode 100644 (file)
index 0000000..02b753e
--- /dev/null
@@ -0,0 +1,495 @@
+/* stream.c implements a bunch of stuff to manipulate text in streams (FIXME)
+ *
+ * written nml 2004-08-19
+ *
+ */
+
+#include "stream.h"
+#include "def.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+/* link in stream filter doubly linked list */
+struct stream_link {
+    struct stream_link *next;          /* next in linked list */
+    struct stream_link *prev;          /* prev in linked list */
+    struct stream_filter *filter;      /* data element */
+    enum stream_flush flush;           /* what the current flush state of this 
+                                        * link is */
+};
+
+struct stream_state {
+    struct stream_link *first;         /* first in linked list */
+    struct stream_link *last;          /* last in linked list */
+
+    struct stream_link *curr;          /* filter we're currently 
+                                        * trying to get output out of */
+    unsigned int filters;              /* total number of filters */
+    enum stream_flush flush;           /* what the current flush state is */
+};
+
+/* ensure that doubly linked list makes sense */
+static int stream_invariant(struct stream *stream) {
+    struct stream_link *curr,
+                       *prev;
+    unsigned int count;
+
+    count = 0;
+    for (prev = NULL, curr = stream->state->first; curr; 
+      prev = curr, curr = curr->next) {
+        if (curr->prev != prev) {
+            assert(0);
+            return 0;
+        }
+        count++;
+    }
+
+    if (count != stream->state->filters || (prev != stream->state->last)) {
+        assert(0);
+        return 0;
+    }
+
+    count = 0;
+    for (prev = NULL, curr = stream->state->last; curr; 
+      prev = curr, curr = curr->prev) {
+        if (curr->next != prev) {
+            assert(0);
+            return 0;
+        }
+        count++;
+    }
+
+    if (count != stream->state->filters || (prev != stream->state->first)) {
+        assert(0);
+        return 0;
+    }
+
+    return 1;
+}
+
+struct stream *stream_new() {
+    struct stream *stream;
+
+    if ((stream = malloc(sizeof(*stream) + sizeof(*stream->state)))) {
+        stream->state = (void *) &stream[1];
+        stream->state->curr = stream->state->first = stream->state->last = NULL;
+        stream->state->filters = 0;
+        stream->state->flush = STREAM_FLUSH_NONE;
+        stream->next_in = NULL;
+        stream->avail_in = 0;
+        stream->curr_out = NULL;
+        stream->avail_out = 0;
+        if (!stream_invariant(stream)) {
+            free(stream);
+            return NULL;
+        }
+    }
+
+    return stream;
+}
+
+void stream_delete(struct stream *stream) {
+    struct stream_link *curr = stream->state->first, 
+                       *next;
+
+    while (curr) {
+        next = curr->next;
+        curr->filter->deletefn(curr->filter);
+        free(curr);
+        curr = next;
+    }
+
+    free(stream);
+}
+
+enum stream_ret stream_filter_push(struct stream *stream, 
+  struct stream_filter *filter) {
+    struct stream_link *link;
+
+    assert(stream_invariant(stream));
+
+    if ((link = malloc(sizeof(*link)))) {
+        link->filter = filter;
+        link->filter->next_in = stream->curr_out;
+        link->filter->avail_in = stream->avail_out;
+        if (stream->state->last) {
+            link->flush = stream->state->last->flush;
+        } else {
+            link->flush = stream->state->flush;
+        }
+        stream->curr_out = NULL;
+        stream->avail_out = 0;
+
+        /* append link to filters list */
+        link->next = NULL;
+        link->prev = stream->state->last;
+
+        if (stream->state->last) {
+            assert(stream->state->first);
+            stream->state->last->next = link;
+        } else {
+            stream->state->first = link;
+        }
+
+        stream->state->last = link;
+        stream->state->filters++;
+
+        assert(stream_invariant(stream));
+        return STREAM_OK;
+    } else {
+        return STREAM_ENOMEM;
+    }
+}
+
+enum stream_ret stream_filter_push_current(struct stream *stream, 
+  struct stream_filter *filter) {
+    struct stream_link *link;
+
+    assert(stream_invariant(stream));
+
+    /* have to have a current module to push in front of */
+    if (!stream->state->curr) {
+        return STREAM_EINVAL;
+    }
+
+    if ((link = malloc(sizeof(*link)))) {
+        link->filter = filter;
+        link->filter->next_in = stream->state->curr->filter->next_in;
+        link->filter->avail_in = stream->state->curr->filter->avail_in;
+
+        if (stream->state->curr->prev) {
+            link->flush = stream->state->curr->prev->flush;
+        } else {
+            link->flush = stream->state->flush;
+        }
+
+        stream->state->curr->filter->next_in = NULL;
+        stream->state->curr->filter->avail_in = 0;
+
+        link->next = stream->state->curr;
+        link->prev = stream->state->curr->prev;
+        if (stream->state->curr->prev) {
+            stream->state->curr->prev = link;
+        } else {
+            stream->state->first = link;
+        }
+        stream->state->curr->prev = link;
+
+        stream->state->filters++;
+
+        assert(stream_invariant(stream));
+        return STREAM_OK;
+    } else {
+        return STREAM_ENOMEM;
+    }
+}
+
+enum stream_ret stream_flush(struct stream *stream, enum stream_flush flush) {
+    if (stream->state->flush != STREAM_FLUSH_FINISH) {
+        /* XXX: note last input value ala bzlib? (to prevent them slipping more
+         * input onto the stream after its finished) */
+        stream->state->flush = flush;
+        return STREAM_OK;
+    } else {
+        return STREAM_EINVAL;
+    }
+}
+
+unsigned int stream_filters(struct stream *stream) {
+    return stream->state->filters;
+}
+
+enum stream_ret stream_filter(struct stream *stream, unsigned int pos, 
+  const char **id) {
+    if (pos < stream->state->filters) {
+        struct stream_link *curr;
+
+        /* iterate to specified filter */
+        for (curr = stream->state->first; pos; pos--, curr = curr->next) {
+            assert(curr);
+        }
+
+        assert(curr);
+
+        *id = curr->filter->idfn(curr->filter);
+        return STREAM_OK;
+    } else {
+        return STREAM_EEXIST;
+    }
+}
+
+enum stream_ret stream(struct stream *stream) {
+    struct stream_link *curr = stream->state->curr;
+    enum stream_ret ret;
+    void *ptr;
+    unsigned int len;
+
+    /* need to get some more input */
+
+    do {
+        while (curr) {
+            /* synchronise current into the state, so that if filter() calls a
+             * stateful stream function it will be correct */
+            stream->state->curr = curr;
+
+            switch ((ret = curr->filter->filter(curr->filter, 
+                curr->flush))) {
+
+            case STREAM_OK:
+                /* call succeeded, propagate result back down chain */
+                if (curr->filter->out.ok.avail_out) {
+                    if (curr->next) {
+                        curr->next->filter->next_in 
+                          = curr->filter->out.ok.curr_out;
+                        curr->next->filter->avail_in 
+                          = curr->filter->out.ok.avail_out;
+
+                        /* propagate flush value if current has used all of its
+                         * input.  Technically we should propagate all of the
+                         * time, but this would mean that filters that aren't
+                         * capable of processing all of their input at once
+                         * (e.g. a HTML filter that returns entity references in
+                         * a seperate buffer than normal text) have problems
+                         * (either have to play buffer games to process all text
+                         * at once, or risk having flush spuriously propagated
+                         * beyond them) */
+                        if (!curr->filter->avail_in) {
+                            curr->next->flush = curr->flush;
+                        }
+                        curr = curr->next;
+                    } else {
+                        /* reached end of chain */
+                        stream->curr_out = curr->filter->out.ok.curr_out;
+                        stream->avail_out = curr->filter->out.ok.avail_out;
+                        stream->state->curr = stream->state->last;
+                        return STREAM_OK;
+                    }
+
+                    if (!curr->prev) {
+                        /* first filter, update input position so that it 
+                         * remains current */
+                        stream->next_in = curr->filter->next_in;
+                        stream->avail_in = curr->filter->avail_in;
+                    }
+                }  
+                /* otherwise got 0 length return, need to call again.  Note that
+                 * there is some danger of infinite looping if the one component
+                 * continually returns STREAM_OK with 0 length returned. */
+                break;
+
+            case STREAM_INPUT:
+                /* propagate flush value forward through the chain */
+                if (curr->next) {
+                    curr->next->flush = curr->flush;
+                }
+
+                if (curr->flush == STREAM_FLUSH_FINISH) {
+                    /* flushing, propagate forward */
+                    curr = curr->next;
+                } else {
+                    /* more input needed, propagate backward to get it */
+                    curr = curr->prev;
+                }
+                break;
+
+            case STREAM_INSERT:
+                /* need to insert a new filter */
+                assert(stream_invariant(stream));
+                if ((stream->state->curr 
+                  = malloc(sizeof(*stream->state->curr)))) {
+                    stream->state->curr->filter 
+                      = curr->filter->out.insert.insert;
+                } else {
+                    stream->state->curr = curr;
+                    return STREAM_ENOMEM;
+                }
+
+                if (curr->filter->out.insert.after) {
+                    /* after this filter */
+                    stream->state->curr->filter->next_in = NULL;
+                    stream->state->curr->filter->avail_in = 0;
+                    stream->state->curr->flush = STREAM_FLUSH_NONE;
+
+                    stream->state->curr->prev = curr;
+                    stream->state->curr->next = curr->next;
+                    if (curr->next) {
+                        /* next shouldn't have any input, because we've 
+                         * iterated past it to get more */
+                        assert(!curr->filter->avail_in);  
+                        curr->next->prev = stream->state->curr;
+                    } else {
+                        stream->state->last = stream->state->curr;
+                    }
+                    curr->next = stream->state->curr;
+
+                    /* have to iterate to next filter, in case it wants to 
+                     * inject anything into the stream */
+                    curr = curr->next; 
+                } else {
+                    /* before this filter */
+
+                    /* new filter gets input leftover for this filter */
+                    stream->state->curr->filter->next_in 
+                      = curr->filter->next_in;
+                    stream->state->curr->filter->avail_in 
+                      = curr->filter->avail_in;
+                    stream->state->curr->flush = STREAM_FLUSH_NONE;
+
+                    /* also reset current filter's flush state, as it needs to
+                     * accept new input from previous filter and be flushed
+                     * again */
+                    curr->flush = STREAM_FLUSH_NONE;
+
+                    curr->filter->next_in = NULL;
+                    curr->filter->avail_in = 0;
+
+                    stream->state->curr->next = curr;
+                    stream->state->curr->prev = curr->prev;
+                    if (curr->prev) {
+                        curr->prev->next = stream->state->curr;
+                    } else {
+                        stream->state->first = stream->state->curr;
+                    }
+                    curr->prev = stream->state->curr;
+
+                    /* stay on current filter, in case it wants to produce
+                     * anything now (even though its got no input left) */
+                }
+                stream->state->filters++;
+                assert(stream_invariant(stream));
+                break;
+
+            case STREAM_DELETE:
+                /* need to delete a filter */
+                assert(stream_invariant(stream));
+                if (curr->filter->out.delet.after) {
+                    /* delete filter immediately after this one */
+
+                    /* ensure that there is a next filter, and that it either
+                     * doesn't have a subsequent filter, or that the filter
+                     * after that doesn't have stored input from the current
+                     * filter */
+                    if (curr->next 
+                      && (!curr->next->next 
+                        || !curr->next->next->filter->avail_in)) {
+
+                        /* iterate to next filter, and let code below do the
+                         * work */
+                        curr = curr->next;
+                    } else {
+                        if (curr->next) {
+                            assert("trying to delete filter another filter "
+                              "is trying to read from" && 0);
+                        } else {
+                            assert("trying to delete non-existant next filter" 
+                              && 0);
+                        }
+                        stream->state->curr = curr;
+                        return STREAM_EINVAL;
+                    }
+                } 
+
+                /* delete current filter */
+                ptr = curr->filter->next_in;
+                len = curr->filter->avail_in;
+
+                if (curr->prev) {
+                    curr->prev->next = curr->next;
+                } else {
+                    stream->state->first = curr->next;
+                }
+
+                if (curr->next) {
+                    /* next filter gets the input that was meant for this
+                     * filter */
+                    curr->next->filter->next_in = curr->filter->next_in;
+                    curr->next->filter->avail_in = curr->filter->avail_in;
+                    curr->next->prev = curr->prev;
+                    curr->next->flush = curr->flush;
+
+                    /* delete the filter */
+                    stream->state->curr = curr->next;
+                    stream->state->filters--;
+                    assert(stream_invariant(stream));
+                    curr->filter->deletefn(curr->filter);
+                    free(curr);
+                    curr = stream->state->curr;
+
+                } else {
+                    stream->state->curr = stream->state->last = curr->prev;
+                    stream->curr_out = ptr;
+                    stream->avail_out = len;
+
+                    /* delete the filter, using previous as next starting point
+                     * (since we have no next) */
+                    stream->state->curr = curr->prev;
+                    stream->state->filters--;
+                    assert(stream_invariant(stream));
+                    curr->filter->deletefn(curr->filter);
+                    free(curr);
+                    curr = stream->state->curr;
+
+                    if (stream->avail_out) {
+                        return STREAM_OK;
+                    }
+                }
+                break;
+
+            case STREAM_OOB:
+                stream->state->curr = curr;
+                stream->curr_out = curr->filter->out.oob.curr_out;
+                stream->avail_out = curr->filter->out.oob.avail_out;
+                stream->id = curr->filter->out.oob.id;
+                return STREAM_OOB;
+
+            default:
+                /* error, find out what number this module is and stuff that 
+                 * into id */
+                for (stream->id = 0; curr; (curr = curr->prev), stream->id++) ;
+                stream->id--;
+                stream->state->curr = curr;
+                assert(!CRASH);
+                return ret;
+            }
+        }
+
+        /* need input from the outside */
+        if (stream->avail_in) {
+            if (stream->state->first) {
+                /* pass input into first filter */
+                curr = stream->state->first;
+                curr->filter->next_in = stream->next_in;
+                curr->filter->avail_in = stream->avail_in;
+                stream->avail_in = 0;
+                stream->next_in = NULL;
+                curr->flush = stream->state->flush;
+                if (stream->state->flush != STREAM_FLUSH_FINISH) {
+                    stream->state->flush = STREAM_FLUSH_NONE;
+                }
+            } else {
+                /* pass input directly to output */
+                stream->state->curr = stream->state->first;
+                stream->curr_out = stream->next_in;
+                stream->avail_out = stream->avail_in;
+                stream->next_in = NULL;
+                stream->avail_in = 0;
+                return STREAM_OK;
+            }
+        } else if (stream->state->flush != STREAM_FLUSH_FINISH) {
+            stream->state->curr = NULL;
+            return STREAM_INPUT;
+        } else if (!stream->state->first 
+          || (stream->state->first && stream->state->last->flush)) {
+            /* no filters, or last filter has been flushed, we have finished */
+            assert(curr == NULL);
+            stream->state->curr = curr;
+            return STREAM_END;
+        } else {
+            /* propagate flush back down chain */
+            curr = stream->state->first;
+            curr->flush = stream->state->flush;
+        }
+    } while (1);
+}
+
diff --git a/src/makeindex.c b/src/makeindex.c
new file mode 100644 (file)
index 0000000..c81b7f8
--- /dev/null
@@ -0,0 +1,707 @@
+/* makeindex.c implements methods to create indexes from different types of
+ * documents.
+ *
+ * written nml 2003-03-27
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "def.h"
+#include "makeindex.h"
+#include "mlparse.h"
+#include "postings.h"
+#include "pyramid.h"
+#include "psettings.h"
+#include "str.h"
+#include "timings.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+enum makeindex_states {
+    STATE_ERR = -1,                        /* an unexpected error occurred */
+    STATE_START = 0,                       /* start state */
+    STATE_ON = 1,                          /* indexing terms */
+    STATE_CONT = 2,                        /* ignoring the end of long terms */
+    STATE_OFF = 3,                         /* not indexing terms */
+    STATE_BINARY_CHECK = 4,                /* checking for binary content */
+    STATE_IGNORE = 5,                      /* ignoring content */
+    STATE_ID = 6,                          /* reading document id */
+    STATE_OFFEND = 7,                      /* not processing anything until we 
+                                            * hit the required end tag */
+    STATE_ENDDOC = 8,                      /* just finished a document */
+    STATE_EOF = 9                          /* finished file */
+};
+
+/* structure to hold internal state */
+struct makeindex_state {
+    enum makeindex_states state;          /* current state */
+    struct mlparse mlparser;              /* parser for HTML, TREC, INEX */
+    struct psettings *settings;           /* parser settings */
+    unsigned int termno;                  /* number of terms in doc thus far */
+    char *term;                           /* current term */
+    char *endtag;                         /* endtag we're looking for in 
+                                           * OFFEND mode */
+    char *docno;                          /* current document number */
+    unsigned int docno_size;              /* size of docno field */
+    unsigned int docno_pos;               /* position in docno field */
+    unsigned int maxtermlen;              /* maximum term length */
+    int eof;                              /* whether we've hit end of file */
+    unsigned int stack;                   /* stack of on/off states we've been 
+                                           * through */
+    enum mime_types type;                 /* mime type of file */
+    enum mime_types doctype;              /* mime type of last document (note 
+                                           * that this can be different than 
+                                           * file type) */
+    struct psettings_type *ptype;         /* pointer to parser settings for 
+                                           * type */
+};
+
+enum makeindex_ret makeindex_new(struct makeindex *mi, 
+  struct psettings *settings, unsigned int termlen, enum mime_types type) {
+    enum makeindex_ret ret;
+
+    if (settings && (mi->state = malloc(sizeof(*mi->state))) 
+      && (mi->state->term = malloc(termlen + 1))
+      && (mi->state->endtag = malloc(termlen + 1))
+      && (mi->state->docno = malloc(termlen + 1))
+      && mlparse_new(&mi->state->mlparser, termlen, LOOKAHEAD)) {
+        mi->state->settings = settings;
+        mi->state->maxtermlen = termlen;
+        mi->state->docno_size = termlen;
+        if ((ret = makeindex_renew(mi, type)) == MAKEINDEX_OK) {
+            return MAKEINDEX_OK;
+        } else {
+            makeindex_delete(mi);
+            return ret;
+        }
+    } else {
+        if (mi->state) {
+            if (mi->state->term) {
+                if (mi->state->endtag) {
+                    if (mi->state->docno) {
+                        free(mi->state->docno);
+                    }
+                    free(mi->state->endtag);
+                }
+                free(mi->state->term);
+            }
+            free(mi->state);
+        }
+        return MAKEINDEX_ERR;
+    }
+}
+
+enum makeindex_ret makeindex_renew(struct makeindex *mi, enum mime_types type) {
+    /* get the correct set of tags from the parser settings */
+    if (psettings_type_tags(mi->state->settings, type, &mi->state->ptype) 
+      != PSETTINGS_OK) {
+        if (psettings_type_default(mi->state->settings, type, 
+              psettings_default(mi->state->settings)) != PSETTINGS_OK 
+          || psettings_type_tags(mi->state->settings, type, &mi->state->ptype) 
+            != PSETTINGS_OK) {
+
+            /* failed to get ptype pointer */
+            assert("can't get here" && 0);
+            return MAKEINDEX_ERR;
+        }
+    }
+
+    mi->state->type = type;
+    mi->state->state = STATE_START;
+    mi->state->termno = 0;
+    mi->state->eof = 0;
+    mi->state->stack = 0;
+    mi->state->docno_pos = 0;
+    mlparse_reinit(&mi->state->mlparser);
+    return MAKEINDEX_OK;
+}
+
+void makeindex_delete(struct makeindex *mi) {
+    mlparse_delete(&mi->state->mlparser);
+    free(mi->state->term);
+    free(mi->state->endtag);
+    free(mi->state->docno);
+    free(mi->state);
+    mi->state = NULL;
+    return;
+}
+
+unsigned int makeindex_buffered(const struct makeindex *mi) {
+    return mlparse_buffered(&mi->state->mlparser);
+}
+
+void makeindex_eof(struct makeindex *mi) {
+    mi->state->eof = 1;
+    return;
+}
+
+enum mime_types makeindex_type(const struct makeindex *mi) {
+    return mi->state->doctype;
+}
+
+const char *makeindex_docno(const struct makeindex *mi) {
+    return mi->state->docno;
+}
+
+int makeindex_append_docno(struct makeindex *mi, const char *docno) {
+    unsigned int len = str_len(docno);
+
+    while (mi->state->docno_pos + len + 1 > mi->state->docno_size) {
+        void *ptr = realloc(mi->state->docno, mi->state->docno_size * 2);
+
+        if (ptr) {
+            mi->state->docno = ptr;
+            mi->state->docno_size *= 2;
+        } else {
+            return MAKEINDEX_ERR;
+        }
+    }
+
+    memcpy(mi->state->docno + mi->state->docno_pos, docno, len + 1);
+    mi->state->docno_pos += len;
+    return MAKEINDEX_OK;
+}
+
+int makeindex_set_docno(struct makeindex *mi, const char *docno) {
+    mi->state->docno[0] = '\0';
+    mi->state->docno_pos = 0;
+    return makeindex_append_docno(mi, docno);
+}
+
+/* badword indicates whether the passed word is probably the first word of a
+ * binary file which should be ignored in the context of TREC collections.  This
+ * is necessary thanks to some of the crap that got into the TREC collections
+ * like wt10g. */
+static int badword(const char *word, unsigned int len, const char *buf, 
+  unsigned int buflen, enum mime_types *mime) {
+    unsigned int i;
+
+    /* i should change badword just to get the state (not buf, buflen), 
+     * so we can check parser buffer and then main buffer properly, but this
+     * works ok... */
+
+    /* wt10g also has a MacBinary file in it, which appears to be very hard to
+     * test for in this framework */
+
+    if (len >= 4) {
+        /* test for JPEG (unfortunately the word often breaks before we get to
+         * EXIF or JFIF, so just test for magic bytes) */
+        if ((word[0] == (char) 0xff) && (word[1] == (char) 0xd8) 
+          && (word[2] == (char) 0xff) && (word[3] == (char) 0xe0)) {
+            *mime = MIME_TYPE_IMAGE_JPEG;
+            return 1;
+        }
+    }
+
+    if (len >= 6) {
+        /* test for GIF */
+        if (!str_ncmp(word, "GIF8", 4) && ((word[4] == '9') || (word[4] == '7'))
+          && (word[5] == 'a')) {
+            *mime = MIME_TYPE_IMAGE_GIF;
+            return 1;
+        }
+    }
+
+    if (len >= 4) {
+        /* test for MS word (badly) */
+        if ((word[0] == (char) 0xd0) && (word[1] == (char) 0xcf) 
+          && (word[2] == (char) 0x11) && (word[3] == (char) 0xe0)) {
+            /* XXX: not strictly true, its just an OLE document, but most of 
+             * them are MS word docs anyway.  Testing for MS word requires 
+             * looking further into the document, so we won't be doing that 
+             * here. */
+            *mime = MIME_TYPE_APPLICATION_MSWORD;
+            return 1;
+        }
+
+        if (len == 2) {
+            if ((word[0] == (char) 0x31) && (word[1] == (char) 0xbe) 
+              && buflen && (buf[0] == '\0')) {
+                /* more MS word stuff :o( */
+                *mime = MIME_TYPE_APPLICATION_MSWORD;
+                return 1;
+            } else if ((word[0] == (char) 0xfe) && (word[1] == '7') 
+              && buflen && (buf[0] == '\0')) {
+                /* office document */
+                *mime = MIME_TYPE_APPLICATION_MSWORD;
+                return 1;
+            }
+        }
+    }
+
+    /* test for wordperfect files */
+    if (len >= 4) {
+        if ((word[0] == (char) 0xff) && (word[1] == 'W') && (word[2] == 'P') 
+          && (word[3] == 'C')) {
+            *mime = MIME_TYPE_APPLICATION_WORDPERFECT5_1;
+            return 1;
+        }
+    }
+
+    /* test for postscript files */
+    if (len >= 2) {
+        if ((word[0] == '%') && (word[1] == '!')) {
+            *mime = MIME_TYPE_APPLICATION_POSTSCRIPT;
+            return 1;
+        }
+    }
+
+    /* test for PDF files */
+    if (len >= 5) {
+        if ((word[0] == '%') && (word[1] == 'P') && (word[2] == 'D') 
+          && (word[3] == 'F') && (word[4] == '-')) {
+            *mime = MIME_TYPE_APPLICATION_PDF;
+            return 1;
+        }
+    }
+
+    if (buflen && (*buf == '\0')) {
+        /* tar format has 100 byte name at start, '\0' padded.  We'll check for
+         * at most 50 - len '\0''s, since we don't know how much has been 
+         * stripped from the filename */
+        for (i = 0; (len < 50) && (i < 50 - len) && (i < buflen); i++) {
+            if (buf[i] != '\0') {
+                break;
+            }
+        }
+
+        assert(i);
+        if (((i == 50 - len) || (i == buflen)) && (buf[i - 1] == '\0')) {
+            /* looks like a tar archive */
+            *mime = MIME_TYPE_APPLICATION_X_TAR;
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+/* macro to return from parsing, updating the parsing position as we do */
+#define RETURN(val, state_)                                                   \
+    mi->state->state = state_;                                                \
+    mi->next_in = mi->state->mlparser.next_in;                                \
+    mi->avail_in = mi->state->mlparser.avail_in;                              \
+assert(val != MAKEINDEX_ERR);\
+    return val
+
+#define CASE_COMMENT()                                                        \
+         MLPARSE_COMMENT | MLPARSE_END:                                       \
+    case MLPARSE_COMMENT:                                                     \
+        if (ret & MLPARSE_END) {                                              \
+            /* end of a comment, treat as special tag */                      \
+            termlen = str_len("/sgmlcomment");                                \
+            assert(mi->state->maxtermlen > termlen);                          \
+            str_cpy(mi->state->term, "/sgmlcomment");                         \
+        } else if (1) {                                                       \
+            /* start of a comment, treat as special tag */                    \
+            termlen = str_len("sgmlcomment");                                 \
+            assert(mi->state->maxtermlen > termlen);                          \
+            str_cpy(mi->state->term, "sgmlcomment");                          \
+        } else
+/* macro to handle reception of tags and pseudo-tags, since it is all very 
+ * repetitive. */
+#define PROCESS_TAG(state_)                                                   \
+    if (1) {                                                                  \
+        int currstate = (state_ == STATE_ON || state_ == STATE_START          \
+            || state_ == STATE_CONT || (state_ == STATE_BINARY_CHECK)         \
+            || (state_ == STATE_ID)) ? 1 : 0;                                 \
+                                                                              \
+        /* lookup tag to see whether it changes our state (ignoring flow      \
+         * attribute) */                                                      \
+        assert(termlen <= mi->state->maxtermlen);                             \
+        mi->state->term[termlen] = '\0';                                      \
+        attr = psettings_type_find(mi->state->settings, mi->state->ptype,     \
+            mi->state->term);                                                 \
+        if (attr & PSETTINGS_ATTR_INDEX || attr & PSETTINGS_ATTR_TITLE) {     \
+            /* continue in on state */                                        \
+            mi->state->stack <<= 1;                                           \
+            mi->state->stack |= !currstate;                                   \
+            goto on_label;                                                    \
+        } else if (!(attr & ~PSETTINGS_ATTR_FLOW)) {                          \
+            /* don't index */                                                 \
+            mi->state->stack <<= 1;                                           \
+            mi->state->stack |= !currstate;                                   \
+            goto off_label;                                                   \
+        } else if (attr & PSETTINGS_ATTR_DOCEND) {                            \
+            mi->state->stack = 0;                                             \
+            if (postings_update(mi->post, &mi->stats)) {                      \
+                RETURN(MAKEINDEX_ENDDOC, STATE_ENDDOC);                       \
+            } else {                                                          \
+                RETURN(MAKEINDEX_ERR, STATE_ERR);                             \
+            }                                                                 \
+        } else if (attr & PSETTINGS_ATTR_ID) {                                \
+            mi->state->docno_pos = 0;                                         \
+            goto id_label;                                                    \
+        } else if (attr & PSETTINGS_ATTR_CHECKBIN) {                          \
+            /* need to check for a binary document */                         \
+            goto binary_check_label;                                          \
+        } else if (attr & PSETTINGS_ATTR_POP) {                               \
+            if (mi->state->stack & 1) {                                       \
+                mi->state->stack >>= 1;                                       \
+                goto off_label;                                               \
+            } else {                                                          \
+                /* note that on is 0 so that if stack underflows then         \
+                 * indexing is turned on, not off */                          \
+                mi->state->stack >>= 1;                                       \
+                goto on_label;                                                \
+            }                                                                 \
+        } else if (attr & PSETTINGS_ATTR_OFF_END) {                           \
+            /* ignore everything until we hit the end tag we're after */      \
+            if (mi->state->term[0] != '/') {                                  \
+                mi->state->endtag[0] = '/';                                   \
+                mi->state->endtag[1] = '\0';                                  \
+            } else {                                                          \
+                mi->state->endtag[0] = '\0';                                  \
+            }                                                                 \
+            str_lcat(mi->state->endtag, mi->state->term,                      \
+              mi->state->maxtermlen);                                         \
+            str_tolower(mi->state->endtag);                                   \
+            goto ignore_label;                                                \
+        } else {                                                              \
+            /* noop, don't do anything */                                     \
+            assert(attr & PSETTINGS_ATTR_NOOP);                               \
+        }                                                                     \
+    } else
+
+/* macro to handle reception of MLPARSE_INPUT in each state.  state_ is the
+ * state variable to allow return to this state */
+#define CASE_INPUT(state_)                                                    \
+         MLPARSE_INPUT:                                                       \
+        /* need more input */                                                 \
+        if (mi->state->eof) {                                                 \
+            mlparse_eof(&mi->state->mlparser);                                \
+        } else {                                                              \
+            RETURN(MAKEINDEX_INPUT, state_);                                  \
+        }                                                                     \
+        break
+
+/* macro to handle reception of MLPARSE_EOF in each state.  first specifies
+ * whether anything has been read from this document, in which case ENDDOC is
+ * returned, else EOF is returned immediately */
+#define CASE_EOF(first)                                                       \
+         MLPARSE_EOF:                                                         \
+        /* we aren't expecting eof until we cause it by calling               \
+         * mlparse_eof */                                                     \
+        assert(mi->state->eof);                                               \
+        if (first) {                                                          \
+            RETURN(MAKEINDEX_EOF, STATE_START);                               \
+        } else {                                                              \
+            if (postings_update(mi->post, &mi->stats)) {                      \
+                RETURN(MAKEINDEX_ENDDOC, STATE_EOF);                          \
+            } else {                                                          \
+                RETURN(MAKEINDEX_ERR, STATE_ERR);                             \
+            }                                                                 \
+        }                                                                     \
+        break;
+
+#define CASE_ERR()                                                            \
+         MLPARSE_ERR:                                                         \
+        /* unexpected error */                                                \
+        assert(0);                                                            \
+        RETURN(MAKEINDEX_ERR, STATE_ERR);                                     \
+        break
+
+enum makeindex_ret makeindex(struct makeindex *mi) {
+    unsigned int termlen,
+                 tmp;
+    enum mlparse_ret ret;
+    enum psettings_attr attr;
+    enum mime_types mime;
+
+    mi->state->mlparser.next_in = mi->next_in;
+    mi->state->mlparser.avail_in = mi->avail_in;
+
+    /* jump to the correct state */
+    switch (mi->state->state) {
+    case STATE_START: goto start_label;
+    case STATE_ID: goto id_label;
+    case STATE_ON: goto on_label;
+    case STATE_CONT: goto cont_label;
+    case STATE_OFF: goto off_label;
+    case STATE_EOF: goto eof_label;
+    case STATE_BINARY_CHECK: goto binary_check_label;
+    case STATE_IGNORE: goto ignore_label;
+    case STATE_ENDDOC: goto enddoc_label;
+    default: RETURN(MAKEINDEX_ERR, STATE_ERR);
+    };
+
+/* start state is just the on state, except that we haven't gotten anything in
+ * this document yet, and so we to call postings_adddoc if we get anything */
+start_label:
+    /* reset termno, as we're about to start a new document */
+    mi->state->termno = 0;
+    mi->state->doctype = mi->state->type;
+    while (1) {
+        ret = mlparse_parse(&mi->state->mlparser, mi->state->term, &termlen, 1);
+        switch (ret) {
+        default:
+            /* indicate to the postings that the document has started */
+            postings_adddoc(mi->post, mi->docs++);
+            /* complete hack, transfer to on state and complete processing */
+            goto on_middle;
+
+        case CASE_INPUT(STATE_START);
+        case CASE_ERR();
+        case CASE_EOF(1);  /* note 1 indicates that this is the start state */
+        }
+    }
+
+/* on state, add received words to the index and look for tags/comments that
+ * alter our state */
+on_label:
+    while (1) {
+        ret = mlparse_parse(&mi->state->mlparser, mi->state->term, &termlen, 1);
+        assert(ret != MLPARSE_WHITESPACE);
+
+/* complete hack, but we'd like to jump to this point from binary_check_label
+ * and first_label to avoid duplicating code */
+on_middle:
+
+        switch (ret) {
+        case MLPARSE_WORD:
+        case MLPARSE_END | MLPARSE_WORD:
+            /* got a regular word, add it to the postings */
+            assert(termlen <= mi->state->maxtermlen);
+            mi->state->term[termlen] = '\0';
+            if (postings_addword(mi->post, mi->state->term, 
+              mi->state->termno++)) {
+                if (ret & MLPARSE_END) {
+                    /* increment termno so phrases don't match */
+                    mi->state->termno++;
+                }
+            } else {
+                RETURN(MAKEINDEX_ERR, STATE_ERR);
+            }
+            break;
+
+        case MLPARSE_CONT | MLPARSE_WORD:
+            /* got a long word, don't add it to the postings */
+            assert(termlen <= mi->state->maxtermlen);
+            /* increment termno so phrases don't match over long word */
+            mi->state->termno++;
+            goto cont_label;
+
+        /* things we ignore */
+        case MLPARSE_PARAM:
+        case MLPARSE_CONT | MLPARSE_PARAM:
+        case MLPARSE_END | MLPARSE_PARAM:
+        case MLPARSE_CONT | MLPARSE_PARAMVAL:
+        case MLPARSE_END | MLPARSE_PARAMVAL:
+        case MLPARSE_PARAMVAL:
+        case MLPARSE_CDATA:
+        case MLPARSE_END | MLPARSE_CDATA:
+            break;
+
+        case CASE_COMMENT();  /* fallthrough to tag processing */
+        case MLPARSE_CONT | MLPARSE_TAG: case MLPARSE_TAG: 
+            PROCESS_TAG(STATE_ON);
+            break;
+
+        case CASE_INPUT(STATE_ON);
+        case CASE_EOF(0);
+        default:
+        case CASE_ERR();
+        }
+    }
+
+/* cont state, in the middle of a long word, ignore everything until it ends */
+cont_label:
+    while (1) {
+        ret = mlparse_parse(&mi->state->mlparser, mi->state->term, &termlen, 1);
+
+        /* ignore everything except tags, errors and end comments */
+        switch (ret) {
+        case MLPARSE_CONT | MLPARSE_WORD:
+            /* ignore */
+            break;
+
+        case MLPARSE_END | MLPARSE_WORD:
+        case MLPARSE_WORD:
+            /* got a sensible sized word, ignoring ends */
+            goto on_label;
+            break;
+
+        case CASE_INPUT(STATE_CONT);
+        case CASE_EOF(0);
+
+        default:
+            /* error, shouldn't get anything but a word here fallthrough */
+        case CASE_ERR();
+        }
+    }
+
+/* off state, ignoring all words, just waiting for a tag/end comment that may
+ * alter our state */
+off_label:
+    while (1) {
+        ret = mlparse_parse(&mi->state->mlparser, mi->state->term, &termlen, 1);
+
+        /* ignore everything except tags, errors and end comments */
+        switch (ret) {
+        default:
+            /* ignore */
+            break;
+
+        case MLPARSE_CONT | MLPARSE_WHITESPACE:
+        case MLPARSE_WHITESPACE:
+            /* not expecting whitespace, fallthrough to error */
+        case CASE_ERR();
+
+        case CASE_COMMENT();  /* fallthrough to tag processing */
+        case MLPARSE_CONT | MLPARSE_TAG: case MLPARSE_TAG: 
+            PROCESS_TAG(STATE_OFF);
+            break;
+
+        case CASE_EOF(0);
+        case CASE_INPUT(STATE_OFF);
+        }
+    }
+
+/* parsing the docno of this document */
+id_label:
+    while (1) {
+        /* note NO STRIPPING so that we get the full, unaltered docno */
+        ret = mlparse_parse(&mi->state->mlparser, mi->state->term, &termlen, 0);
+
+        switch (ret) {
+        case MLPARSE_END | MLPARSE_WORD:
+        case MLPARSE_WORD:
+        case MLPARSE_CONT | MLPARSE_WORD:
+            mi->state->term[termlen] = '\0';
+            if (makeindex_append_docno(mi, mi->state->term) != MAKEINDEX_OK) {
+                RETURN(MAKEINDEX_ERR, STATE_ERR);
+            }
+            break;
+
+        case MLPARSE_CONT | MLPARSE_WHITESPACE:
+        case MLPARSE_WHITESPACE:
+            mi->state->term[termlen] = '\0';
+            if (mi->state->docno_pos 
+              && makeindex_append_docno(mi, mi->state->term) != MAKEINDEX_OK) {
+                RETURN(MAKEINDEX_ERR, STATE_ERR);
+            }
+            break;
+
+        case MLPARSE_PARAM:
+        case MLPARSE_CONT | MLPARSE_PARAM:
+        case MLPARSE_END | MLPARSE_PARAM:
+        case MLPARSE_CONT | MLPARSE_PARAMVAL:
+        case MLPARSE_END | MLPARSE_PARAMVAL:
+        case MLPARSE_PARAMVAL:
+        case MLPARSE_CDATA:
+        case MLPARSE_END | MLPARSE_CDATA:
+            /* ignore these */
+            break;
+
+        case CASE_COMMENT();  /* fallthrough to tag processing */
+        case MLPARSE_CONT | MLPARSE_TAG: case MLPARSE_TAG: 
+            mi->state->term[termlen] = '\0';
+            str_tolower(mi->state->term);
+            /* strip whitespace from the end of the docno */
+            while (mi->state->docno_pos 
+              && isspace(mi->state->docno[mi->state->docno_pos - 1])) {
+                mi->state->docno[--mi->state->docno_pos] = '\0';
+            }
+            PROCESS_TAG(STATE_ID);
+            break;
+
+        case CASE_INPUT(STATE_ID);
+        case CASE_EOF(0);
+        default: /* fallthrough to error */
+        case CASE_ERR();
+        }
+    }
+
+/* just received the end of a document.  Get rid of the previous document number
+ * and go to start_label to start the new document.  Note that this has to be a
+ * seperate state as non-self-identifying documents never have this happen */
+enddoc_label:
+    mi->state->docno[0] = '\0';
+    goto start_label;
+
+binary_check_label:
+    while (1) {
+        ret = mlparse_parse(&mi->state->mlparser, mi->state->term, 
+          &termlen, 0);
+
+        switch (ret) {
+        case MLPARSE_WORD:
+        case MLPARSE_WORD | MLPARSE_END:
+            mi->state->term[termlen] = '\0';
+            if (((tmp = mlparse_buffered(&mi->state->mlparser))
+                && badword(mi->state->term, termlen, 
+                  mlparse_buffer(&mi->state->mlparser), tmp, &mime)) 
+              || (!tmp && badword(mi->state->term, termlen, 
+                mi->state->mlparser.next_in, mi->state->mlparser.avail_in, 
+                  &mime))) {
+
+                /* looks like binary crap, ignore until we hit the end of the
+                 * file */
+                mi->state->doctype = mime;
+                mi->state->endtag[0] = '\0';
+                goto ignore_label;
+            } else {
+                termlen -= str_strip(mi->state->term);
+                mi->state->term[termlen] = '\0';
+                str_tolower(mi->state->term);
+                if (termlen) {
+                    /* total hack: resume normal processing */
+                    goto on_middle;
+                }
+            }
+            break;
+
+        case MLPARSE_WORD | MLPARSE_CONT:
+        case MLPARSE_WHITESPACE:
+        case MLPARSE_WHITESPACE | MLPARSE_CONT:
+            /* ignore */
+            break;
+
+        default:
+            /* total hack: resume normal processing */
+            mi->state->term[termlen] = '\0';
+            str_tolower(mi->state->term);
+            goto on_middle;
+
+        case CASE_INPUT(STATE_BINARY_CHECK);
+        }
+    }
+
+/* we're ignoring the rest of this document */
+ignore_label:
+    while (1) {
+        ret = mlparse_parse(&mi->state->mlparser, mi->state->term, &termlen, 1);
+        switch (ret) {
+        /* ignore pretty much everything */
+        default: /* ignore */ break;
+        case CASE_COMMENT();  /* fallthrough to tag processing */
+        case MLPARSE_CONT | MLPARSE_TAG: case MLPARSE_TAG: 
+            mi->state->term[termlen] = '\0';
+            str_tolower(mi->state->term);
+            attr = psettings_type_find(mi->state->settings, mi->state->ptype,
+                mi->state->term);
+            /* only perform normal actions if it matches the end tag we've been
+             * looking for, or if its an end of document tag */
+            if ((mi->state->endtag[0] 
+                && !str_cmp(mi->state->endtag, mi->state->term))
+              || (attr & PSETTINGS_ATTR_DOCEND)) {
+                PROCESS_TAG(STATE_IGNORE);
+            }
+            break;
+
+        case CASE_INPUT(STATE_IGNORE);
+        case CASE_EOF(0);
+        case CASE_ERR();
+        }
+    }
+
+eof_label:
+    RETURN(MAKEINDEX_EOF, STATE_EOF);
+}
+
diff --git a/src/mem.c b/src/mem.c
new file mode 100644 (file)
index 0000000..a9b0760
--- /dev/null
+++ b/src/mem.c
@@ -0,0 +1,298 @@
+/* mem.c implements functions for manipulating memory
+ *
+ * written nml 2003-09-17
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "_mem.h"
+#include "mem.h"
+#include "bit.h"
+#include "zstdint.h"
+
+#include <assert.h>
+
+unsigned long int mem_ptrdiff(const void *b1, const void *b2) {
+    return MEM_PTRDIFF(b1, b2);
+}
+
+void *mem_ptradd(const void *b, unsigned int offset) {
+    return MEM_PTRADD(b, offset);
+}
+
+unsigned long int mem_ptraddr(const void *b) {
+    return MEM_PTRADDR(b);
+}
+
+void mem_ntoh(void *dst, const void *src, unsigned int size) {
+    MEM_NTOH(dst, src, size);
+}
+
+void mem_hton(void *dst, const void *src, unsigned int size) {
+    MEM_HTON(dst, src, size);
+}
+
+MEM_ALIGN_TYPE(char)
+MEM_ALIGN_TYPE(short)
+MEM_ALIGN_TYPE(int)
+MEM_ALIGN_TYPE(long)
+MEM_ALIGN_TYPE(float)
+MEM_ALIGN_TYPE(double)
+
+typedef void *ptr;
+
+MEM_ALIGN_TYPE(ptr)
+
+unsigned int mem_align_max() {
+    return MEM_ALIGN_MAX;
+}
+
+void *mem_align(void *buf, unsigned int align) {
+    /* align should be a power of two */
+    assert(BIT_POW2(bit_log2(align)) == align);
+    return MEM_ALIGN(buf, align);
+}
+
+typedef unsigned int word_t;
+
+static struct {
+    char first;
+    word_t align;
+} algn;
+
+void *mem_cpy(void *dst0, const void *src, unsigned int len0) {
+    unsigned int align = MEM_PTRDIFF(&algn.align, &algn.first) - 1;
+    uint8_t *dst = dst0;
+    unsigned int len;
+
+    if ((src == dst) || !len0) {
+        return dst0;
+    }
+
+    if ((unsigned long int) dst < (unsigned long int) src) {
+        /* copy from start of src to end */
+
+        if ((MEM_PTRADDR(dst) & align) == (MEM_PTRADDR(src) & align)) {
+            /* they're aligned with respect to word boundary, we can do a little
+             * optimisation */
+            word_t *wdst;
+
+            /* copy the initial stuff byte by byte */
+            while (MEM_PTRADDR(dst) & align) {
+                len0--;
+                *dst++ = *((const uint8_t*) src);
+                src = ((const uint8_t *) src) + 1;
+            }
+
+            /* calculate how much can be copied in word size chunks */
+            len = len0 / sizeof(word_t);
+            len0 = len0 & sizeof(word_t);
+
+            /* copy as much as we can in word size chunks */
+            wdst = (word_t *) dst;
+            while (len--) {
+                *wdst++ = *((const word_t *) src);
+                src = ((const word_t *) src) + 1;
+            }
+            dst = (uint8_t *) wdst;
+
+            /* copy the rest byte by byte */
+            while (len0--) {
+                *dst++ = *((const uint8_t*) src);
+                src = ((const uint8_t *) src) + 1;
+            }
+        } else {
+            /* they're not aligned with respect to word boundary, do it byte by
+             * byte */
+
+            while (len0--) {
+                *dst++ = *((const uint8_t*) src);
+                src = ((const uint8_t *) src) + 1;
+            }
+        }
+    } else {
+        /* copy from end of src to start */
+
+        dst = ((uint8_t *) dst) + len0;
+        src = ((uint8_t *) src) + len0;
+
+        if ((MEM_PTRADDR(dst) & align) == (MEM_PTRADDR(src) & align)) {
+            /* they're aligned with respect to word boundary, we can do a little
+             * optimisation */
+            word_t *wdst;
+
+            /* copy the initial stuff byte by byte */
+            while (MEM_PTRADDR(dst) & align) {
+                len0--;
+                src = ((const uint8_t *) src) - 1;
+                *--dst = *((const uint8_t*) src);
+            }
+
+            /* calculate how much can be copied in word size chunks */
+            len = len0 / sizeof(word_t);
+            len0 = len0 & sizeof(word_t);
+
+            /* copy as much as we can in word size chunks */
+            wdst = (word_t *) dst;
+            while (len--) {
+                src = ((const word_t *) src) - 1;
+                *(--wdst) = *((const word_t *) src);
+            }
+            dst = (uint8_t *) wdst;
+
+            /* copy the rest byte by byte */
+            while (len0--) {
+                src = ((const uint8_t *) src) - 1;
+                *--dst = *((const uint8_t*) src);
+            }
+        } else {
+            /* they're not aligned with respect to word boundary, do it byte by
+             * byte */
+
+            while (len0--) {
+                src = ((const uint8_t *) src) - 1;
+                *--dst = *((const uint8_t *) src);
+            }
+        }
+    }
+
+    return dst0;
+}
+
+#if 0
+/*
+ * sizeof(word) MUST BE A POWER OF TWO
+ * SO THAT wmask BELOW IS ALL ONES
+ */
+typedef int word;       /* "word" used for optimal copy speed */
+
+#define wsize   sizeof(word)
+#define wmask   (wsize - 1)
+
+/*
+ * Copy a block of memory, handling overlap.
+ * This is the routine that actually implements
+ * (the portable versions of) bcopy, memcpy, and memmove.
+ */
+void *
+mem_cpy2(void *dst0, const void *src0, unsigned int length) {
+    register char *dst = dst0;
+    register const char *src = src0;
+    register unsigned int t;
+
+    if (length == 0 || dst == src)      /* nothing to do */
+        goto done;
+
+    /*
+     * Macros: loop-t-times; and loop-t-times, t>0
+     */
+#define TLOOP(s) if (t) TLOOP1(s)
+#define TLOOP1(s) do { s; } while (--t)
+
+    if ((unsigned long)dst < (unsigned long)src) {
+        /*
+         * Copy forward.
+         */
+        t = (int)src;   /* only need low bits */
+        if ((t | (int)dst) & wmask) {
+            /*
+             * Try to align operands.  This cannot be done
+             * unless the low bits match.
+             */
+            if ((t ^ (int)dst) & wmask || length < wsize)
+                t = length;
+            else
+                t = wsize - (t & wmask);
+            length -= t;
+            TLOOP1(*dst++ = *src++);
+        }
+        /*
+         * Copy whole words, then mop up any trailing bytes.
+         */
+        t = length / wsize;
+        TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize);
+        t = length & wmask;
+        TLOOP(*dst++ = *src++);
+    } else {
+        /*
+         * Copy backwards.  Otherwise essentially the same.
+         * Alignment works as before, except that it takes
+         * (t&wmask) bytes to align, not wsize-(t&wmask).
+         */
+        src += length;
+        dst += length;
+        t = (int)src;
+        if ((t | (int)dst) & wmask) {
+            if ((t ^ (int)dst) & wmask || length <= wsize)
+                t = length;
+            else
+                t &= wmask;
+            length -= t;
+            TLOOP1(*--dst = *--src);
+        }
+        t = length / wsize;
+        TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src);
+        t = length & wmask;
+        TLOOP(*--dst = *--src);
+    }
+done:
+    return (dst0);
+}
+#endif
+
+#ifdef MEM_TEST
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int argc, char **argv) {
+    char buf[BUFSIZ];
+    char buf2[BUFSIZ];
+    unsigned int loops,
+                 i;
+
+    if ((argc != 3) || !sscanf(argv[2], "%u", &loops)) {
+        printf("usage: %s [std|opt|bsd] loops\n", *argv);
+        return EXIT_FAILURE;
+    }
+
+    for (i = 0; i < BUFSIZ; i++) {
+        buf[i] = '\0';
+    }
+
+    memset(buf2, 1, BUFSIZ);
+
+    if (!strcmp("std", argv[1])) {
+        for (i = 0; i < loops; i++) {
+            snprintf(buf, BUFSIZ, "%u", i);
+            memcpy(buf2, buf, BUFSIZ);
+        }
+    } else if (!strcmp("opt", argv[1])) {
+        for (i = 0; i < loops; i++) {
+            snprintf(buf, BUFSIZ, "%u", i);
+            mem_cpy(buf2, buf, BUFSIZ);
+        }
+    } else if (!strcmp("bsd", argv[1])) {
+        for (i = 0; i < loops; i++) {
+            snprintf(buf, BUFSIZ, "%u", i);
+            mem_cpy2(buf2, buf, BUFSIZ);
+        }
+    } else {
+        printf("usage: %s [std|opt|bsd] loops\n", *argv);
+        return EXIT_FAILURE;
+    }
+
+    if (!memcmp(buf2, buf, BUFSIZ)) {
+        return EXIT_SUCCESS;
+    } else {
+        printf("failed!\n");
+        return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
diff --git a/src/merge.c b/src/merge.c
new file mode 100644 (file)
index 0000000..8292a1e
--- /dev/null
@@ -0,0 +1,1568 @@
+/* merge.c implements a final merging procedure that puts inverted
+ * lists into a vocabulary b-tree, and a set of files and an
+ * intermediate merging procedure that produces a large intermediate file from
+ * small ones
+ *
+ * A problem that this module has to solve is the difference between
+ * stream and block output, in that we want our inverted lists output
+ * as (more or less) a stream and everything else as a block.  The
+ * problem with this is that we have to know in advance where some of
+ * our writes are going to end up.  Unfortunately, the maximum file
+ * size limit means that we can't assume that everything is just going
+ * to end up in one big stream.  There are only two approaches to
+ * solve this problem: post-failure correction and prevention.  This
+ * module implements prevention (a maximum file size limit) because
+ * its simpler and works better with other limitations already in the
+ * search engines (like a maximum offset of ULONG_MAX).
+ *
+ * written nml 2003-02-11
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "merge.h"
+
+#include "def.h"
+#include "heap.h"
+#include "bit.h"
+#include "btbulk.h"
+#include "bucket.h"
+#include "btbucket.h"
+#include "storagep.h"
+#include "str.h"
+#include "vec.h"
+#include "vocab.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <limits.h>
+#include <string.h>  /* for memmove */
+#include <stdlib.h>
+
+/* this specifies the point where we are willing to perform an extra write to
+ * avoid copying this amount of extra data */
+#define WRITE_POINT (20 * 1024 * 1024)  
+/* estimate 2GBps mem bandwidth and 10ms write times gives us about 20MB
+ * tradeoff point (FIXME: experiment with me to find the best point) */
+
+/* merge states */
+enum merge_states {
+    STATE_ERR = -1,
+    STATE_START = 0,
+    STATE_FINISHED = 1,
+    STATE_READENTRY = 2,
+    STATE_READENTRY_TERM = 3,
+    STATE_READENTRY_DOCS = 4,
+    STATE_READENTRY_OCCURS = 36,
+    STATE_READENTRY_LAST = 5,
+    STATE_READENTRY_SIZE = 6,
+    STATE_READENTRY_FIRST = 7,
+    STATE_SELECT_INPUTS = 8,
+    STATE_PREFINISH = 9,
+    STATE_WRITE_END = 10,
+    STATE_ASSIGN_VOCAB = 11,
+    STATE_WRITE_VOCAB_FIRST = 12,
+    STATE_WRITE_VOCAB_VECTOR = 13,
+    STATE_WRITE_VOCAB_END = 14,
+    STATE_WRITE_FILE_FIRST = 19,
+    STATE_WRITE_FILE_VECTOR = 20,
+    STATE_WRITE_FILE_OVERALLOC = 21,
+    STATE_WRITE_FILE_END = 22,
+    STATE_WRITE_BTREE = 24,
+    STATE_FLUSH_NEWFILE = 26,
+    STATE_FLUSH_SWITCH = 27,
+    STATE_PRE_WRITEENTRY = 28,
+    STATE_WRITEENTRY = 29,
+    STATE_WRITEENTRY_TERM = 30,
+    STATE_WRITEENTRY_DOCS = 31,
+    STATE_WRITEENTRY_OCCURS = 37,
+    STATE_WRITEENTRY_LAST = 32,
+    STATE_WRITEENTRY_SIZE = 33,
+    STATE_WRITEENTRY_FIRST = 34,
+    STATE_WRITEENTRY_VECTOR = 35 
+};
+
+/* structure to represent inputs with enough information read in to
+ * determine sorting order of inputs */
+struct input {
+    struct merge_input *input;               /* user provided input that this 
+                                              * is associated with */
+    char *term;                              /* next merge term */
+    unsigned int termlen;                    /* how long the next term is */
+    unsigned int docs;                       /* number of documents next term 
+                                              * occurs in */
+    unsigned int occurs;                     /* number of times next term 
+                                              * occurs */
+    unsigned int last;                       /* last docno in the postings for 
+                                              * next term */
+    unsigned int size;                       /* size of postings for next term 
+                                              * (note: *doesn't* include size 
+                                              * of first value) */
+    unsigned int first;                      /* first docno in the postings for 
+                                              * the next term */
+};
+
+#define BUFSIZE 8
+
+/* internal state of final merge.  The difference between this and the
+ * intermediate merge is that the final merge needs to fill buckets and bulk
+ * load a btree */
+struct merge_final_state {
+    enum merge_states state;             /* state of merge */
+    enum merge_states next_state;        /* next state we'll traverse to */
+    unsigned int index;                  /* index of input we're working with */
+    unsigned int count;                  /* count of stuff we've done in state*/
+    void *addr;                          /* current writing address */
+    char buf[BUFSIZE];                   /* small buffer to hold vbytes */
+
+    struct input *input;                 /* items for heap */
+    struct input **iinput;               /* indirected input heap */
+    unsigned int inputs;                 /* number of items on input heap */
+    unsigned int finished;               /* number of inputs that have 
+                                          * finished */
+
+    void *out;                           /* internal output buffer */
+    unsigned int outsize;                /* size of internal output buffer */
+
+    struct btbulk btree;                 /* vocab, being bulk-loaded */
+
+    struct storagep *storage;            /* storage parameters */
+
+    struct vocab_vector vv;              /* vocab entry we're currently working 
+                                          * with */
+
+    void *opaque;                        /* opaque data for (de)allocation 
+                                          * functions */
+    void *(*allocfn)                     /* allocation function */
+      (void *opaque, unsigned int size);
+    void (*freefn)                       /* deallocation function */
+      (void *opaque, void *mem); 
+
+    unsigned int root_fileno;            /* final root file number */
+    unsigned long int root_offset;       /* final root offset */
+    unsigned long int dterms;            /* number of terms merged */
+    unsigned int terms_high;             /* high word of total terms */
+    unsigned int terms_low;              /* low word of total terms */
+    unsigned int prev_index;             /* index before reloading */
+};
+
+/* internal state of the intermediate merge */
+struct merge_inter_state {
+    enum merge_states state;             /* state of merge */
+    enum merge_states next_state;        /* next state we'll traverse to */
+    unsigned int index;                  /* index of input we're working with */
+    unsigned int count;                  /* count of stuff we've done in state*/
+    void *addr;                          /* current writing address */
+    char buf[BUFSIZE];                   /* small buffer to hold vbytes */
+
+    struct input *input;                 /* items for heap */
+    struct input **iinput;               /* indirected input heap */
+    unsigned int inputs;                 /* number of items on input heap */
+    unsigned int finished;               /* number of inputs that have 
+                                          * finished */
+
+    void *out;                           /* internal output buffer */
+    unsigned int outsize;                /* size of internal output buffer */
+
+    struct vocab_vector vv;              /* vocab entry we're currently working 
+                                          * with */
+
+    void *opaque;                        /* opaque data for (de)allocation 
+                                          * functions */
+    void *(*allocfn)                     /* allocation function */
+      (void *opaque, unsigned int size);
+    void (*freefn)                       /* deallocation function */
+      (void *opaque, void *mem); 
+
+    /* XXX: hack starts here :o( */
+    void *opaque_newfile;
+    void (*newfile)(void *opaque);       /* call when we need a new file */
+    unsigned long int filesize;          /* maximum size of file */
+    unsigned long int currsize;          /* size of current file */
+
+    unsigned int prev_index;             /* index before reloading */
+    unsigned int max_termlen;            /* maximum length of a term */
+};
+
+static int iinput_cmp(const void *one, const void *two) {
+    const struct input * const *iione = one,
+                       * const *iitwo = two,
+                       *ione = *iione,
+                       *itwo = *iitwo;
+    unsigned int i;
+
+    if (ione->termlen < itwo->termlen) {
+        for (i = 0; i < ione->termlen; i++) {
+            if (ione->term[i] != itwo->term[i]) {
+                return ((int) ione->term[i]) - itwo->term[i];
+            }
+        }
+
+        return -1;
+    } else if (ione->termlen > itwo->termlen) {
+        for (i = 0; i < itwo->termlen; i++) {
+            if (ione->term[i] != itwo->term[i]) {
+                return ((int) ione->term[i]) - itwo->term[i];
+            }
+        }
+
+        return 1;
+    } else {
+        assert(ione->termlen == itwo->termlen);
+        for (i = 0; i < itwo->termlen; i++) {
+            if (ione->term[i] != itwo->term[i]) {
+                return ((int) ione->term[i]) - itwo->term[i];
+            }
+        }
+
+        if (ione->first < itwo->first) {
+            return -1;
+        } else if (ione->first > itwo->first) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+}
+
+static void *merge_malloc(void *ptr, unsigned int size) {
+    return malloc(size);
+}
+
+static void merge_free(void *ptr, void *mem) {
+    free(mem);
+}
+
+int merge_final_new(struct merge_final *merger, void *opaque,
+  void *(*allocfn)(void *opaque, unsigned int size),
+  void (*freefn)(void *opaque, void *mem), struct storagep *storage,
+  void *outbuf, unsigned int outbufsz) {
+    unsigned int i,
+                 j;
+
+    if (!opaque && !allocfn && !freefn) {
+        allocfn = merge_malloc;
+        freefn = merge_free;
+    }
+
+    if ((merger->state = allocfn(opaque, sizeof(*merger->state)))
+      && (merger->state->input 
+        = allocfn(opaque, sizeof(*merger->state->input) * merger->inputs))
+      && (merger->state->iinput 
+        = allocfn(opaque, sizeof(struct input *) * merger->inputs))
+      && (btbulk_new(storage->pagesize, storage->max_filesize, 
+        storage->btleaf_strategy, storage->btnode_strategy, 1.0, 
+        0, &merger->state->btree))) {
+
+        for (i = 0; i < merger->inputs; i++) {
+            merger->state->input[i].input = &merger->input[i];
+            merger->state->iinput[i] = &merger->state->input[i];
+            if (!(merger->state->input[i].term 
+              = allocfn(opaque, storage->max_termlen + 1))) {
+                for (j = 0; j + 1 < i; j++) {
+                    freefn(opaque, merger->state->input[i].term);
+                }
+                freefn(opaque, merger->state->input);
+                freefn(opaque, merger->state);
+                return MERGE_ERR;
+            }
+        }
+        merger->state->inputs = merger->inputs;
+        merger->state->finished = 0;
+        merger->state->storage = storage;
+
+        merger->state->vv.attr = VOCAB_ATTRIBUTES_NONE;
+        merger->state->vv.type = VOCAB_VTYPE_DOCWP;
+
+        assert(storage->max_filesize > storage->pagesize);
+
+        merger->state->opaque = opaque;
+        merger->state->freefn = freefn;
+        merger->state->allocfn = allocfn;
+
+        merger->state->state = STATE_START;
+        merger->state->next_state = STATE_ERR;
+        merger->state->index = 0;
+
+        merger->out.buf_out = merger->state->out = outbuf;
+        merger->out.size_out = 0;
+        merger->state->outsize = outbufsz;
+        merger->out.fileno_out = 0;
+        merger->out.offset_out = 0;
+        
+        merger->out_btree.buf_out = NULL;
+        merger->out_btree.size_out = 0;
+        merger->out_btree.fileno_out = 0;
+        merger->out_btree.offset_out = 0;
+
+        merger->state->dterms = 0;
+        merger->state->terms_high = 0;
+        merger->state->terms_low = 0;
+
+        return MERGE_OK;
+    } else {
+        if (merger->state) {
+            if (merger->state->input) {
+                if (merger->state->iinput) {
+                    freefn(opaque, merger->state->iinput);
+                }
+                freefn(opaque, merger->state->input);
+            }
+            freefn(opaque, merger->state);
+        }
+        return MERGE_ERR;
+    }
+}
+
+int merge_inter_new(struct merge_inter *merger, void *opaque,
+  void *(*allocfn)(void *opaque, unsigned int size),
+  void (*freefn)(void *opaque, void *mem), 
+  void *outbuf, unsigned int outbufsz, unsigned int max_termlen,
+  void *opaque_newfile, void (*newfile)(void *opaque_newfile), 
+  unsigned long int filesize) {
+    unsigned int i,
+                 j;
+
+    if (!opaque && !allocfn && !freefn) {
+        allocfn = merge_malloc;
+        freefn = merge_free;
+    }
+
+    if ((merger->state = allocfn(opaque, sizeof(*merger->state)))
+      && (merger->state->input 
+        = allocfn(opaque, sizeof(*merger->state->input) * merger->inputs))
+      && (merger->state->iinput 
+        = allocfn(opaque, sizeof(struct input *) * merger->inputs))) {
+
+        for (i = 0; i < merger->inputs; i++) {
+            merger->state->input[i].input = &merger->input[i];
+            merger->state->iinput[i] = &merger->state->input[i];
+            if (!(merger->state->input[i].term 
+              = allocfn(opaque, max_termlen + 1))) {
+                for (j = 0; j + 1 < i; j++) {
+                    freefn(opaque, merger->state->input[i].term);
+                }
+                freefn(opaque, merger->state->input);
+                freefn(opaque, merger->state);
+                return MERGE_ERR;
+            }
+        }
+        merger->state->inputs = merger->inputs;
+        merger->state->finished = 0;
+
+        merger->state->opaque = opaque;
+        merger->state->freefn = freefn;
+        merger->state->allocfn = allocfn;
+
+        merger->state->next_state = STATE_ERR;
+        merger->state->state = STATE_START;
+        merger->state->index = 0;
+
+        merger->buf_out = merger->state->out = outbuf;
+        merger->size_out = 0;
+        merger->state->outsize = outbufsz;
+
+        merger->state->filesize = filesize;
+        merger->state->newfile = newfile;
+        merger->state->opaque_newfile = opaque_newfile;
+
+        merger->state->currsize = 0;
+        merger->state->max_termlen = max_termlen;
+
+        return MERGE_OK;
+    } else {
+        if (merger->state) {
+            if (merger->state->input) {
+                freefn(opaque, merger->state->input);
+            }
+            freefn(opaque, merger->state);
+        }
+        return MERGE_ERR;
+    }
+}
+
+int merge_final_finish(struct merge_final *merger, unsigned int *root_fileno, 
+  unsigned long int *root_offset, unsigned long int *dterms, 
+  unsigned int *terms_high, unsigned int *terms_low) {
+    if (merger->state->state == STATE_FINISHED) {
+        *root_fileno = merger->state->root_fileno;
+        *root_offset = merger->state->root_offset;
+        *dterms = merger->state->dterms;
+        *terms_high = merger->state->terms_high;
+        *terms_low = merger->state->terms_low;
+        return MERGE_OK;
+    } else {
+        return MERGE_ERR;
+    }
+}
+
+void merge_inter_delete(struct merge_inter *merger) {
+    unsigned int i;
+    for (i = 0; i < merger->inputs; i++) {
+        merger->state->freefn(merger->state->opaque, 
+          merger->state->input[i].term);
+    }
+
+    merger->state->freefn(merger->state->opaque, merger->state->iinput);
+    merger->state->freefn(merger->state->opaque, merger->state->input);
+    merger->state->freefn(merger->state->opaque, merger->state);
+    return;
+}
+
+void merge_final_delete(struct merge_final *merger) {
+
+    unsigned int i;
+    for (i = 0; i < merger->inputs; i++) {
+        merger->state->freefn(merger->state->opaque, 
+          merger->state->input[i].term);
+    }
+
+    btbulk_delete(&merger->state->btree);
+
+    merger->state->freefn(merger->state->opaque, merger->state->iinput);
+    merger->state->freefn(merger->state->opaque, merger->state->input);
+    merger->state->freefn(merger->state->opaque, merger->state);
+    return;
+}
+
+/* a few macros to help us out in the state machines */
+
+/* macro to jump to state specified by enum.  Note that we can't use seperate
+ * JUMP statements for merge_final and merge_inter because the common macros
+ * (GETVBYTE, PUTVBYTE) need to JUMP */
+#define JUMP(state)                                                           \
+    switch (state) {                                                          \
+    case STATE_START: goto start_label;                                       \
+    case STATE_FINISHED: goto finished_label;                                 \
+    case STATE_READENTRY: goto readentry_label;                               \
+    case STATE_READENTRY_TERM: goto readentry_term_label;                     \
+    case STATE_READENTRY_DOCS: goto readentry_docs_label;                     \
+    case STATE_READENTRY_OCCURS: goto readentry_occurs_label;                 \
+    case STATE_READENTRY_LAST: goto readentry_last_label;                     \
+    case STATE_READENTRY_SIZE: goto readentry_size_label;                     \
+    case STATE_READENTRY_FIRST: goto readentry_first_label;                   \
+    case STATE_SELECT_INPUTS: goto select_inputs_label;                       \
+    case STATE_PREFINISH: goto prefinish_label;                               \
+    case STATE_WRITE_END: goto write_end_label;                               \
+    case STATE_ASSIGN_VOCAB: goto assign_vocab_label;                         \
+    case STATE_WRITE_VOCAB_FIRST: goto write_vocab_first_label;               \
+    case STATE_WRITE_VOCAB_VECTOR: goto write_vocab_vector_label;             \
+    case STATE_WRITE_VOCAB_END: goto write_vocab_end_label;                   \
+    case STATE_WRITE_FILE_FIRST: goto write_file_first_label;                 \
+    case STATE_WRITE_FILE_VECTOR: goto write_file_vector_label;               \
+    case STATE_WRITE_FILE_OVERALLOC: goto write_file_overalloc_label;         \
+    case STATE_WRITE_FILE_END: goto write_file_end_label;                     \
+    case STATE_WRITE_BTREE: goto write_btree_label;                           \
+    case STATE_FLUSH_NEWFILE: goto flush_newfile_label;                       \
+    case STATE_FLUSH_SWITCH: goto flush_switch_label;                         \
+    case STATE_PRE_WRITEENTRY: goto pre_writeentry_label;                     \
+    case STATE_WRITEENTRY: goto writeentry_label;                             \
+    case STATE_WRITEENTRY_TERM: goto writeentry_term_label;                   \
+    case STATE_WRITEENTRY_DOCS: goto writeentry_docs_label;                   \
+    case STATE_WRITEENTRY_OCCURS: goto writeentry_occurs_label;               \
+    case STATE_WRITEENTRY_LAST: goto writeentry_last_label;                   \
+    case STATE_WRITEENTRY_SIZE: goto writeentry_size_label;                   \
+    case STATE_WRITEENTRY_FIRST: goto writeentry_first_label;                 \
+    case STATE_WRITEENTRY_VECTOR: goto writeentry_vector_label;               \
+    default: goto err_label;                                                  \
+    }
+
+/* macro to get a vbyte from an input stream, even if its split across
+ * read boundaries */
+#define GETVBYTE(var, state_, finish_state)                                   \
+    if (!merger->state->count) {                                              \
+        vec.pos = input->input->next_in;                                      \
+        vec.end = vec.pos + input->input->avail_in;                           \
+    } else {                                                                  \
+        /* fill buffer */                                                     \
+        vec.pos = merger->state->buf;                                         \
+        if (input->input->avail_in + merger->state->count > BUFSIZE) {        \
+            memcpy(&merger->state->buf[merger->state->count],                 \
+              input->input->next_in, BUFSIZE - merger->state->count);         \
+            vec.end = vec.pos + BUFSIZE;                                      \
+        } else {                                                              \
+            memcpy(&merger->state->buf[merger->state->count],                 \
+              input->input->next_in,                                          \
+              input->input->avail_in - merger->state->count);                 \
+            vec.end = vec.pos + input->input->avail_in + merger->state->count;\
+        }                                                                     \
+    }                                                                         \
+                                                                              \
+    if ((len = vec_vbyte_read(&vec, &tmp))) {                                 \
+        /* we should always use all of the buffer, because we                 \
+         * shouldn't have buffered if not necessary */                        \
+        assert(len > merger->state->count);                                   \
+        input->input->next_in += len - merger->state->count;                  \
+        input->input->avail_in -= len - merger->state->count;                 \
+        (var) = tmp;                                                          \
+    } else if (1) {                                                           \
+        /* read failed, have to buffer (shouldn't happen after buffering a    \
+         * first time) */                                                     \
+        assert(merger->state->count == 0);                                    \
+        assert(input->input->avail_in < BUFSIZE);                             \
+                                                                              \
+        /* need to buffer input and ask for more */                           \
+        memcpy(merger->state->buf, input->input->next_in,                     \
+          input->input->avail_in);                                            \
+        merger->state->count = input->input->avail_in;                        \
+        input->input->next_in += input->input->avail_in;                      \
+        input->input->avail_in = 0;                                           \
+        *index = merger->state->iinput[merger->state->index]                  \
+          - merger->state->input;                                             \
+        *next_read = 0;                                                       \
+        merger->state->state = (state_);                                      \
+        return MERGE_INPUT;                                                   \
+    } else 
+
+/* macro to put a vbyte to the output stream, flushing if necessary */
+#define PUTVBYTE(var, state_)                                                 \
+    if (vec_vbyte_len(var) <= merger->state->outsize - merger->out.size_out) {\
+        vec.pos = merger->out.buf_out + merger->out.size_out;                 \
+        vec.end = vec.pos + (merger->state->outsize - merger->out.size_out);  \
+                                                                              \
+        len = vec_vbyte_write(&vec, var);                                     \
+        assert(len);                                                          \
+        merger->out.size_out += len;                                          \
+    } else if (1) {                                                           \
+        merger->state->state = state_;                                        \
+        return MERGE_OUTPUT;                                                  \
+    } else
+
+/* the final merge state machine is a bit tricky, it proceeds something like 
+ * this:
+ *
+ * - read entry(ies)
+ * - select lowest input(s)
+ *   - if going to files
+ *     - for each input in lowest set
+ *       - write to file 
+ *       - reload if not last and proceed to next
+ *   - write vocab entry using last term
+ *   - for each input left in lowest set
+ *     - write to vocab if applicable
+ *     - reload and proceed to next
+ *
+ * the prime complication here is that we need to write the vocab entry 
+ * *after* we write to the files because otherwise the vocab entry 
+ * might change (and hence change its length) after we've allocated space for 
+ * it.  However, when we put the entry in the vocab, we need to write it after
+ * the vocab entry :o( */
+
+int merge_final(struct merge_final *merger, unsigned int *index, 
+  unsigned int *next_read) {
+    unsigned long int tmp;
+    unsigned int i,
+                 len;
+    struct vec vec = {NULL, 0};
+    struct input *input = merger->state->iinput[merger->state->index],
+                 *smallest,
+                 *next,
+                 **tmpinput;
+    int ret;
+
+    /* jump to correct state */
+    JUMP(merger->state->state);
+
+start_label:
+    /* need to read the first entry from each of the inputs */
+    if (merger->state->index < merger->state->inputs) {
+        input = merger->state->iinput[merger->state->index];
+        merger->state->count = 0;
+        merger->state->next_state = STATE_START;
+        goto readentry_label;
+    }
+
+    /* heapify inputs */
+    heap_heapify(merger->state->iinput, merger->state->inputs, 
+      sizeof(*merger->state->iinput), iinput_cmp);
+
+    goto select_inputs_label;
+
+readentry_label:
+    GETVBYTE(input->termlen, STATE_READENTRY, merger->state->next_state); 
+
+    assert(input->termlen <= merger->state->storage->max_termlen);
+    assert(input->termlen);
+
+    /* fallthrough to readentry_term_label */
+    merger->state->count = 0;
+readentry_term_label:
+    if (input->input->avail_in >= input->termlen - merger->state->count) {
+        len = input->termlen - merger->state->count;
+        memcpy(&input->term[merger->state->count], input->input->next_in, len);
+        input->term[input->termlen] = '\0';
+        input->input->next_in += len;
+        input->input->avail_in -= len;
+    } else {
+        len = input->input->avail_in;
+        memcpy(&input->term[merger->state->count], input->input->next_in, len);
+        input->input->next_in += len;
+        input->input->avail_in = 0;
+        merger->state->count += len;
+        merger->state->state = STATE_READENTRY_TERM;
+        *index = merger->state->iinput[merger->state->index]
+          - merger->state->input;
+        *next_read = input->termlen - len;
+        return MERGE_INPUT;
+    }
+
+    /* shouldn't contain control characters (they're a pretty sure sign we're 
+     * reading postings instead) */
+    for (i = 0; i < input->termlen; i++) {
+        assert(!iscntrl(input->term[i]));
+    }
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_docs_label */
+readentry_docs_label:
+    GETVBYTE(input->docs, STATE_READENTRY_DOCS, STATE_ERR);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_occurs_label */
+readentry_occurs_label:
+    GETVBYTE(input->occurs, STATE_READENTRY_OCCURS, STATE_ERR);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_last_label */
+readentry_last_label:
+    GETVBYTE(input->last, STATE_READENTRY_LAST, STATE_ERR);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_size_label */
+readentry_size_label:
+    GETVBYTE(input->size, STATE_READENTRY_SIZE, STATE_ERR);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_first_label */
+readentry_first_label:
+    GETVBYTE(input->first, STATE_READENTRY_FIRST, STATE_ERR);
+    input->size -= len;      /* subtract length of first value from size */
+    merger->state->index++;
+
+    /* jump to next state */
+    JUMP(merger->state->next_state);
+
+select_inputs_label:
+    /* select the smallest inputs from the heap */
+
+    assert(merger->state->inputs == merger->inputs - merger->state->finished);
+    while ((tmpinput = heap_pop(merger->state->iinput, 
+        &merger->state->inputs, sizeof(*merger->state->iinput), iinput_cmp))) {
+        smallest = *tmpinput;
+
+        /* keep popping things off of stack until we get to an entry
+         * that has a different term or run out of items */
+        while (merger->state->inputs 
+          && (next = *((struct input **) heap_peek(merger->state->iinput, 
+            merger->state->inputs, sizeof(*merger->state->iinput))))
+          && (smallest->termlen == next->termlen) 
+          && !str_ncmp(smallest->term, next->term, smallest->termlen)
+          && heap_pop(merger->state->iinput, &merger->state->inputs, 
+              sizeof(*merger->state->iinput), iinput_cmp)) ;
+
+        /* we now have the (merger->inputs -
+         * merger->state->finished - merger->state->inputs) elements
+         * at the back of merger->state->input array that need to be written to
+         * the file, in reverse order of occurrance */
+
+        merger->state->index = merger->state->inputs;
+
+        /* swap the order of occurrance (have to do this because when we insert
+         * them back onto the heap they will be absorbed in this order).
+         * note that if len is odd middle element is already correct */
+        len = merger->inputs - merger->state->finished - merger->state->index;
+        tmp = len / 2;  /* only need to swap first half of array */
+        for (i = 0; i < tmp; i++) {
+            void *el = merger->state->iinput[merger->state->index + i];
+            merger->state->iinput[merger->state->index + i] 
+              = merger->state->iinput[merger->state->index + len - (i + 1)];
+            merger->state->iinput[merger->state->index + len - (i + 1)] = el;
+        }
+
+        /* form a vocabulary entry for this term */
+        input = merger->state->iinput[merger->state->index];
+        merger->state->vv.header.doc.docs = input->docs;
+        merger->state->vv.header.doc.occurs = input->occurs;
+        merger->state->vv.size = input->size + vec_vbyte_len(input->first);
+
+        /* loop over the rest of the entries, altering first entry to have 
+         * correct delta-encoded value with respect to previous entry */
+        for (i = 1; i < len; i++) {
+            input = merger->state->iinput[i + merger->state->index];
+
+            /* make sure that they're correctly ordered */
+            assert(input->termlen 
+              == merger->state->iinput[merger->state->index]->termlen);
+            assert(!str_ncmp(input->term, 
+              merger->state->iinput[merger->state->index]->term, 
+              input->termlen));
+            assert((input->first 
+                > merger->state->iinput[i + merger->state->index - 1]->first));
+            assert(input->last 
+                > merger->state->iinput[i + merger->state->index - 1]->last);
+            assert(input->first 
+                > merger->state->iinput[i + merger->state->index - 1]->last);
+
+            input->first 
+              -= merger->state->iinput[i + merger->state->index - 1]->last + 1;
+            merger->state->vv.header.doc.docs += input->docs;
+            merger->state->vv.header.doc.occurs += input->occurs;
+            merger->state->vv.size += input->size + vec_vbyte_len(input->first);
+        }
+
+        merger->state->vv.header.doc.last 
+          = merger->state->iinput[merger->state->index + len - 1]->last;
+
+        input = merger->state->iinput[merger->state->index];
+
+        /* keep the term stats up to date */
+        merger->state->dterms++;
+        if (merger->state->terms_low + merger->state->vv.header.doc.occurs 
+          < merger->state->terms_low) {
+            merger->state->terms_high++;
+        }
+        merger->state->terms_low += merger->state->vv.header.doc.occurs;
+
+        assert(merger->out.offset_out 
+          <= merger->state->storage->max_filesize - merger->out.size_out);
+        if (merger->state->vv.size < merger->state->storage->vocab_lsize) {
+            merger->state->vv.location = VOCAB_LOCATION_VOCAB;
+            goto assign_vocab_label;
+
+        /* check if file output will overflow current file */
+        } else if ((merger->state->vv.loc.file.capacity 
+            = merger->state->vv.size)
+          > merger->state->storage->max_filesize - merger->out.offset_out 
+            - merger->out.size_out) {
+
+            merger->state->vv.location = VOCAB_LOCATION_FILE;
+            merger->state->vv.loc.file.fileno = merger->out.fileno_out + 1;
+            merger->state->vv.loc.file.offset = 0;
+            merger->state->next_state = STATE_WRITE_FILE_FIRST;
+            merger->state->state = STATE_FLUSH_NEWFILE;
+            return MERGE_OUTPUT;
+        } else {
+            /* won't exceed current file, just write it */
+            merger->state->vv.location = VOCAB_LOCATION_FILE;
+            merger->state->vv.loc.file.fileno = merger->out.fileno_out;
+            merger->state->vv.loc.file.offset 
+              = merger->out.offset_out + merger->out.size_out;
+            goto write_file_first_label;
+        }
+    }
+
+    goto prefinish_label;
+
+prefinish_label:
+    /* write out btree buckets */
+    do {
+        merger->state->btree.fileno = merger->out_btree.fileno_out;
+        merger->state->btree.offset = merger->out_btree.offset_out;
+
+        switch ((ret = btbulk_finalise(&merger->state->btree, 
+          &merger->state->root_fileno, &merger->state->root_offset))) {
+        case BTBULK_FINISH:
+        case BTBULK_OK:
+            /* finished, do nothing */
+            ret = BTBULK_FINISH;
+            break;
+
+        case BTBULK_FLUSH:
+            /* need to start a new file */
+            merger->state->next_state = STATE_PREFINISH;
+            merger->state->state = STATE_FLUSH_NEWFILE;
+            return MERGE_OUTPUT;
+
+        case BTBULK_WRITE:
+            /* need to write bucket to output */
+
+            merger->state->count = 0;
+            merger->state->next_state = STATE_PREFINISH;
+            goto write_btree_label;
+            break;
+
+        default:
+            assert(!CRASH);
+            goto err_label;
+        }
+    } while (ret != BTBULK_FINISH);
+
+    /* merge finished */
+    goto finished_label;
+
+write_btree_label:
+    /* watch for filesize limit */
+    if (merger->out_btree.offset_out 
+      > merger->state->storage->max_filesize 
+        - merger->state->storage->pagesize) {
+
+        merger->out_btree.fileno_out++;
+        merger->out_btree.offset_out = 0;
+    }
+
+    merger->out_btree.buf_out = merger->state->btree.output.write.next_out;
+    merger->out_btree.size_out = merger->state->btree.output.write.avail_out;
+    merger->state->state = merger->state->next_state;
+    return MERGE_OUTPUT_BTREE;
+
+write_end_label:
+    /* finished reading the entry, check to see if we need to put it
+     * back on the heap */
+    if (merger->state->prev_index != merger->state->index) {
+        /* it didn't finish, put it back on the heap */
+        void *heapret;
+
+        heapret = heap_insert(merger->state->iinput, &merger->state->inputs, 
+            sizeof(*merger->state->iinput), iinput_cmp, 
+            &merger->state->iinput[merger->state->prev_index]);
+    }
+
+    /* finished, select next input */
+    assert(merger->state->index == merger->inputs - merger->state->finished);
+    goto select_inputs_label;
+
+assign_vocab_label:
+    /* write an entry into the vocab */
+    merger->state->btree.term = input->term;
+    merger->state->btree.termlen = input->termlen;
+    merger->state->btree.datasize = vocab_len(&merger->state->vv);
+
+    do {
+        merger->state->btree.fileno = merger->out_btree.fileno_out;
+        merger->state->btree.offset = merger->out_btree.offset_out;
+
+        switch ((ret = btbulk_insert(&merger->state->btree))) {
+        case BTBULK_OK:
+            /* finished, do nothing */
+            break;
+
+        case BTBULK_FLUSH:
+            /* need to start a new file */
+            merger->state->next_state = STATE_ASSIGN_VOCAB;
+            merger->state->state = STATE_FLUSH_NEWFILE;
+            return MERGE_OUTPUT;
+
+        case BTBULK_WRITE:
+            /* need to write bucket to output */
+
+            merger->state->count = 0;
+            merger->state->next_state = STATE_ASSIGN_VOCAB;
+            goto write_btree_label;
+            break;
+
+        default:
+            assert(!CRASH);
+            goto err_label;
+        }
+    } while (ret != BTBULK_OK);
+
+    vec.pos = merger->state->btree.output.ok.data;
+    vec.end = vec.pos + merger->state->btree.datasize;
+    vocab_encode(&merger->state->vv, &vec);
+    assert(!VEC_LEN(&vec));
+
+    if (merger->state->vv.location == VOCAB_LOCATION_VOCAB) {
+        /* a bit hacky, if the destination is the vocab we still need to write
+         * it, otherwise we proceed straight to getting the next input. */
+        merger->state->addr = (char *) merger->state->btree.output.ok.data 
+          + vocab_len(&merger->state->vv) - merger->state->vv.size;
+        goto write_vocab_first_label;
+    }
+
+    /* reload or finish input */
+    merger->state->next_state = STATE_WRITE_END;
+    /* save index in prev_index so we can tell if it finished or
+     * continues in write_end_label */
+    merger->state->prev_index = merger->state->index;
+    merger->state->count = 0;
+    goto readentry_label;
+
+write_vocab_first_label:
+    /* write first entry out from input entry into vocab */
+    vec.pos = merger->state->addr;
+    vec.end = vec.pos + merger->state->storage->pagesize;
+
+    /* note: first is already re-encoded, and size doesn't include size of 
+     * first value */
+    vec_vbyte_write(&vec, input->first);
+    merger->state->count = 0;
+
+    merger->state->addr = vec.pos;
+
+    /* fallthrough to write_vocab_vector_label */
+
+write_vocab_vector_label:
+    /* write rest of vector out from input entry into allocated space
+     * (in vocab).  We don't have to worry about running out
+     * of output space since we allocated enough in advance. */
+    if (input->input->avail_in + merger->state->count >= input->size) {
+        len = input->size - merger->state->count;
+        memcpy(merger->state->addr, input->input->next_in, len);
+        merger->state->addr = ((char *) merger->state->addr) + len;
+        input->input->next_in += len;
+        input->input->avail_in -= len;
+    } else {
+        memcpy(merger->state->addr, input->input->next_in, 
+          input->input->avail_in);
+        merger->state->addr = ((char *) merger->state->addr) 
+          + input->input->avail_in;
+        input->input->next_in += input->input->avail_in;
+        merger->state->count += input->input->avail_in;
+        input->input->avail_in = 0;
+        merger->state->state = STATE_WRITE_VOCAB_VECTOR;
+        *index = merger->state->iinput[merger->state->index]
+          - merger->state->input;
+        *next_read = input->size - merger->state->count;
+        return MERGE_INPUT;
+    }
+
+    /* reload or finish input */
+    merger->state->next_state = STATE_WRITE_VOCAB_END;
+    /* save index in prev_index so we can tell if it finished or
+     * continues in write_vocab_end_label */
+    merger->state->prev_index = merger->state->index;
+    merger->state->count = 0;
+    goto readentry_label;
+
+write_vocab_end_label:
+    /* finished reading the entry, check to see if we need to put it
+     * back on the heap */
+    if (merger->state->prev_index != merger->state->index) {
+        /* it didn't finish, put it back on the heap */
+        void *heapret;
+
+        heapret = heap_insert(merger->state->iinput, &merger->state->inputs, 
+            sizeof(*merger->state->iinput), iinput_cmp, 
+            &merger->state->iinput[merger->state->prev_index]);
+    }
+
+    if (merger->state->index < merger->inputs - merger->state->finished) {
+        /* need to write another vector into the vocab entry */
+        input = merger->state->iinput[merger->state->index];
+        goto write_vocab_first_label;
+    } else {
+        /* finished, select next input */
+        goto select_inputs_label;
+    }
+
+write_file_first_label:
+    /* write the first value from an input into the output stream */
+    PUTVBYTE(input->first, STATE_WRITE_FILE_FIRST);
+
+    merger->state->count = 0;
+    /* fallthrough to write_file_vector_label */
+
+write_file_vector_label:
+    len = merger->state->outsize - merger->out.size_out;
+    /* have to write the rest of the vector to file output stream */
+    if ((input->input->avail_in > WRITE_POINT) 
+      && (input->size - merger->state->count > WRITE_POINT)) {
+        /* we're transferring such a large amount of data that we should just
+         * move the reference for input to output and let another write occur */
+
+        /* flush the output if necessary */
+        if (merger->out.size_out) {
+            merger->state->state = STATE_WRITE_FILE_VECTOR;
+            return MERGE_OUTPUT;
+        }
+
+        /* figure out how much stuff we can transfer out via this method */
+        len = (input->input->avail_in 
+              > input->size - merger->state->count) 
+            ? input->size - merger->state->count 
+            : input->input->avail_in;
+
+        assert(len > WRITE_POINT);
+
+        /* connect up the internal buffer to the output */
+        merger->out.buf_out = input->input->next_in;
+        merger->out.size_out = len;
+        merger->state->count += len;
+        input->input->next_in += len;
+        input->input->avail_in -= len;
+
+        /* arrange for it to be switched back out on return */
+        merger->state->state = STATE_FLUSH_SWITCH;
+        merger->state->next_state = STATE_WRITE_FILE_VECTOR;
+        return MERGE_OUTPUT;
+    } else if ((input->input->avail_in 
+        >= input->size - merger->state->count)
+      && (len >= input->size - merger->state->count)) {
+        /* can just copy the entire vector from in to out */
+        memcpy(&merger->out.buf_out[merger->out.size_out], 
+          input->input->next_in, input->size - merger->state->count);
+        input->input->next_in += input->size - merger->state->count;
+        input->input->avail_in -= input->size - merger->state->count;
+        merger->out.size_out += input->size - merger->state->count;
+    } else if (len > input->input->avail_in) {
+        /* in is the limiting factor */
+        memcpy(&merger->out.buf_out[merger->out.size_out], 
+          input->input->next_in, input->input->avail_in);
+        merger->state->count += input->input->avail_in;
+        input->input->next_in += input->input->avail_in;
+        merger->out.size_out += input->input->avail_in;
+        input->input->avail_in = 0;
+        merger->state->state = STATE_WRITE_FILE_VECTOR;
+        *index = merger->state->iinput[merger->state->index]
+          - merger->state->input;
+        *next_read = input->size - merger->state->count;
+        return MERGE_INPUT;
+    } else {
+        /* out is the limiting factor */
+        memcpy(&merger->out.buf_out[merger->out.size_out], 
+          input->input->next_in, len);
+        merger->state->count += len;
+        input->input->next_in += len;
+        input->input->avail_in -= len;
+        merger->out.size_out += len;
+        merger->state->state = STATE_WRITE_FILE_VECTOR;
+        return MERGE_OUTPUT;
+    }
+
+    /* if its the last entry, write overallocation entry */
+    if (merger->state->index + 1 < merger->inputs - merger->state->finished) {
+        /* reload or finish input */
+        merger->state->next_state = STATE_WRITE_FILE_END;
+        /* save index in prev_index so we can tell if it finished or
+         * continues in write_vocab_end_label */
+        merger->state->prev_index = merger->state->index;
+        merger->state->count = 0;
+        goto readentry_label;
+    } else {
+        /* calculate how much overallocation we need to write out */
+        merger->state->count = merger->state->vv.loc.file.capacity 
+            - merger->state->vv.size;
+    }
+    /* fallthrough to write_file_overalloc_label */
+
+write_file_overalloc_label:
+    /* need to write out extra space to accomodate overallocation scheme */
+    len = merger->state->outsize - merger->out.size_out;
+    if (merger->state->count && (len >= merger->state->count)) {
+        /* can output directly */
+        memset(&merger->out.buf_out[merger->out.size_out], 0, 
+          merger->state->count);
+        merger->out.size_out += merger->state->count;
+    } else if (merger->state->count) {
+        memset(&merger->out.buf_out[merger->out.size_out], 0, len);
+        merger->out.size_out = merger->state->outsize;
+        merger->state->count -= len;
+        merger->state->state = STATE_WRITE_FILE_OVERALLOC;
+        return MERGE_OUTPUT;
+    }
+
+    /* finished, write vocab entry */
+    goto assign_vocab_label;
+
+write_file_end_label:
+    /* finished reading the entry, check to see if we need to put it
+     * back on the heap */
+    if (merger->state->prev_index != merger->state->index) {
+        /* it didn't finish, put it back on the heap */
+        void *heapret;
+
+        heapret = heap_insert(merger->state->iinput, &merger->state->inputs, 
+            sizeof(*merger->state->iinput), iinput_cmp, 
+            &merger->state->iinput[merger->state->prev_index]);
+        input = merger->state->iinput[merger->state->index];
+    }
+    goto write_file_first_label;
+
+flush_newfile_label:
+    /* the output has been flushed and we're starting a new file */
+    merger->out.fileno_out++;
+    merger->out.offset_out = 0;
+    JUMP(merger->state->next_state);
+
+flush_switch_label:
+    /* the output has been flushed and we need to place the original output
+     * buffer back onto the output */
+    merger->out.buf_out = merger->state->out;
+    merger->out.size_out = 0;
+    JUMP(merger->state->next_state);
+
+finished_label:
+    merger->state->state = STATE_FINISHED;
+    if (merger->out.size_out) {
+        return MERGE_OUTPUT;
+    } else {
+        return MERGE_OK;
+    }
+
+/* labels that don't exist in this state machine */
+pre_writeentry_label:
+writeentry_label:
+writeentry_term_label:
+writeentry_docs_label:
+writeentry_occurs_label:
+writeentry_last_label:
+writeentry_size_label:
+writeentry_first_label:
+writeentry_vector_label:
+    /* fallthrough to err_label */
+    assert(!CRASH);
+
+err_label:
+    assert(!CRASH);
+    merger->state->state = STATE_ERR;
+    return MERGE_ERR;
+}
+
+int merge_final_input_finish(struct merge_final *merger, unsigned int input) {
+    switch (merger->state->state) {
+    case STATE_READENTRY:
+        if (input 
+          == (unsigned int) (merger->state->iinput[merger->state->index]
+            - merger->state->input)) {
+
+            /* input has finished and needs to be removed from the stack */
+            memmove(&merger->state->iinput[merger->state->index],
+              &merger->state->iinput[merger->state->index + 1],
+              sizeof(*merger->state->iinput)
+                * (merger->inputs - merger->state->index - 1));
+            merger->state->finished++;
+
+            /* finished this entry while priming it (zero length file) 
+             * XXX: should probably be handled more elegantly, but this is
+             * simplest */
+            if (merger->state->next_state == STATE_START) {
+                merger->state->inputs--;
+            }
+
+            merger->state->state = merger->state->next_state;
+            return MERGE_OK;
+        }
+        /* fallthrough */
+        assert(!CRASH);
+
+    default:
+        assert(!CRASH);
+        merger->state->state = STATE_ERR;
+        return MERGE_ERR;
+    }
+}
+
+/* variation on previous putvbyte macro */
+#undef PUTVBYTE
+#define PUTVBYTE(var, state_)                                                 \
+    if (vec_vbyte_len(var) <= merger->state->outsize - merger->size_out) {    \
+        vec.pos = merger->buf_out + merger->size_out;                         \
+        vec.end = vec.pos + (merger->state->outsize - merger->size_out);      \
+                                                                              \
+        len = vec_vbyte_write(&vec, var);                                     \
+                                                                              \
+        merger->size_out += len;                                              \
+    } else if (1) {                                                           \
+        merger->state->state = state_;                                        \
+        return MERGE_OUTPUT;                                                  \
+    } else
+
+int merge_inter(struct merge_inter *merger, unsigned int *index, 
+  unsigned int *next_read) {
+    unsigned long int tmp;
+    unsigned int i,
+                 len;
+    struct vec vec = {NULL, 0};
+    struct input *input = merger->state->iinput[merger->state->index],
+                 *smallest,
+                 *next,
+                 **tmpinput;
+
+    /* jump to correct state */
+    JUMP(merger->state->state);
+
+start_label:
+    /* need to read the first entry from each of the inputs */
+    merger->state->next_state = STATE_START;
+    if (merger->state->index < merger->state->inputs) {
+        input = merger->state->iinput[merger->state->index];
+        merger->state->count = 0;
+        goto readentry_label;
+    }
+
+    /* heapify inputs */
+    heap_heapify(merger->state->iinput, merger->state->inputs, 
+      sizeof(*merger->state->iinput), iinput_cmp);
+
+    merger->state->count = 0;
+    goto select_inputs_label;
+
+readentry_label:
+    GETVBYTE(input->termlen, STATE_READENTRY, merger->state->next_state);
+
+    assert(input->termlen <= merger->state->max_termlen);
+    assert(input->termlen);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_term_label */
+readentry_term_label:
+    if (input->input->avail_in >= input->termlen - merger->state->count) {
+        len = input->termlen - merger->state->count;
+        memcpy(&input->term[merger->state->count], input->input->next_in, len);
+        input->term[input->termlen] = '\0';
+        input->input->next_in += len;
+        input->input->avail_in -= len;
+    } else {
+        len = input->input->avail_in;
+        memcpy(&input->term[merger->state->count], input->input->next_in, len);
+        input->input->next_in += len;
+        input->input->avail_in = 0;
+        merger->state->count += len;
+        merger->state->state = STATE_READENTRY_TERM;
+        *index = merger->state->iinput[merger->state->index]
+          - merger->state->input;
+        *next_read = input->termlen - len;
+        return MERGE_INPUT;
+    }
+
+    /* shouldn't contain control characters (they're a pretty sure sign we're 
+     * reading postings instead) */
+    for (i = 0; i < input->termlen; i++) {
+        assert(!iscntrl(input->term[i]));
+    }
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_docs_label */
+readentry_docs_label:
+    GETVBYTE(input->docs, STATE_READENTRY_DOCS, STATE_ERR);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_occurs_label */
+
+readentry_occurs_label:
+    GETVBYTE(input->occurs, STATE_READENTRY_OCCURS, STATE_ERR);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_last_label */
+readentry_last_label:
+    GETVBYTE(input->last, STATE_READENTRY_LAST, STATE_ERR);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_size_label */
+readentry_size_label:
+    GETVBYTE(input->size, STATE_READENTRY_SIZE, STATE_ERR);
+
+    merger->state->count = 0;
+    /* fallthrough to readentry_first_label */
+readentry_first_label:
+    GETVBYTE(input->first, STATE_READENTRY_FIRST, STATE_ERR);
+    input->size -= len;      /* subtract length of first value from size */
+    merger->state->index++;
+
+    /* jump to next state */
+    JUMP(merger->state->next_state);
+
+select_inputs_label:
+    /* select the smallest inputs from the heap */
+
+    assert(merger->state->inputs == merger->inputs - merger->state->finished);
+    while ((tmpinput = heap_pop(merger->state->iinput, 
+        &merger->state->inputs, sizeof(*merger->state->iinput), iinput_cmp))) {
+        smallest = *tmpinput;
+
+        assert(smallest->termlen 
+          && (str_len(smallest->term) == smallest->termlen));
+
+        /* keep popping things off of stack until we get to an entry
+         * that has a different term or run out of items */
+        while (merger->state->inputs 
+          && (next = *((struct input **) heap_peek(merger->state->iinput, 
+              merger->state->inputs, sizeof(*merger->state->iinput))))
+          && (smallest->termlen == next->termlen) 
+          && !str_ncmp(smallest->term, next->term, smallest->termlen)
+          && heap_pop(merger->state->iinput, &merger->state->inputs, 
+              sizeof(*merger->state->iinput), iinput_cmp)) ;
+
+        /* we now have the (merger->inputs -
+         * merger->state->finished - merger->state->inputs) elements
+         * at the back of merger->state->input array that need to be written to
+         * the file, in reverse order of occurrance */
+
+        merger->state->index = merger->state->inputs;
+
+        /* swap the order of occurrance (have to do this because when we insert
+         * them back onto the heap they will be absorbed in this order).
+         * note that if len is odd middle element is already correct */
+        len = merger->inputs - merger->state->finished - merger->state->index;
+        tmp = len / 2; 
+        for (i = 0; i < tmp; i++) {
+            void *tmp = merger->state->iinput[merger->state->index + i];
+            merger->state->iinput[merger->state->index + i] 
+              = merger->state->iinput[merger->state->index + len - (i + 1)];
+            merger->state->iinput[merger->state->index + len - (i + 1)] = tmp;
+        }
+
+        /* form a vocabulary entry for this term */
+        input = merger->state->iinput[merger->state->index];
+        merger->state->vv.header.doc.docs = input->docs;
+        merger->state->vv.header.doc.occurs = input->occurs;
+        merger->state->vv.size = input->size + vec_vbyte_len(input->first);
+
+        /* loop over the rest of the entries, altering first entry to have 
+         * correct delta-encoded value with respect to previous entry */
+        for (i = 1; i < len; i++) {
+            input = merger->state->iinput[i + merger->state->index];
+
+            /* make sure that they're correctly ordered */
+            assert(input->termlen 
+              == merger->state->iinput[merger->state->index]->termlen);
+            assert(!str_ncmp(input->term, 
+              merger->state->iinput[merger->state->index]->term, 
+              input->termlen));
+            assert((input->first 
+                > merger->state->iinput[i + merger->state->index - 1]->first));
+            assert(input->last 
+                > merger->state->iinput[i + merger->state->index - 1]->last);
+            assert(input->first 
+                > merger->state->iinput[i + merger->state->index - 1]->last);
+
+            input->first 
+              -= merger->state->iinput[i + merger->state->index - 1]->last + 1;
+            merger->state->vv.header.doc.docs += input->docs;
+            merger->state->vv.header.doc.occurs += input->occurs;
+            merger->state->vv.size += input->size + vec_vbyte_len(input->first);
+        }
+
+        merger->state->vv.header.doc.last 
+          = merger->state->iinput[merger->state->index + len - 1]->last;
+
+        input = merger->state->iinput[merger->state->index];
+
+        goto pre_writeentry_label;
+    }
+
+    /* finished */
+    goto finished_label;
+
+pre_writeentry_label:
+    /* XXX: check to make sure we're not overflowing a file.  This is a hack,
+     * because we shouldn't care about file boundaries here (but we have to for
+     * the moment) */
+    len = merger->state->vv.size + input->termlen 
+      + vec_vbyte_len(input->termlen) 
+      + vec_vbyte_len(merger->state->vv.header.doc.docs) 
+      + vec_vbyte_len(merger->state->vv.header.doc.occurs) 
+      + vec_vbyte_len(merger->state->vv.header.doc.last) 
+      + vec_vbyte_len(merger->state->vv.size);
+
+    assert(len <= merger->state->filesize);
+    assert(merger->state->currsize <= merger->state->filesize);
+    if (merger->state->currsize >= merger->state->filesize - len) {
+        if (merger->size_out) {
+            /* flush output */
+            merger->state->state = STATE_PRE_WRITEENTRY;
+            return MERGE_OUTPUT;
+        } else {
+            /* XXX: call newfile function */
+            merger->state->newfile(merger->state->opaque_newfile);
+            merger->state->currsize = len;
+        }
+    } else {
+        merger->state->currsize += len;
+    }
+
+    goto writeentry_label;
+
+writeentry_label:
+    PUTVBYTE(input->termlen, STATE_WRITEENTRY);
+
+    /* fallthrough to writeentry_term_label */
+writeentry_term_label:
+    len = merger->state->outsize - merger->size_out;
+    if (input->termlen <= len) {
+        memcpy(merger->buf_out + merger->size_out, input->term, input->termlen);
+        merger->size_out += input->termlen;
+    } else {
+        merger->state->state = STATE_WRITEENTRY_TERM;
+        return MERGE_OUTPUT;
+    }
+
+    /* fallthrough to writeentry_docs_label */
+writeentry_docs_label:
+    PUTVBYTE(merger->state->vv.header.doc.docs, STATE_WRITEENTRY_DOCS);
+
+    /* fallthrough to writeentry_occurs_label */
+writeentry_occurs_label:
+    PUTVBYTE(merger->state->vv.header.doc.occurs, STATE_WRITEENTRY_OCCURS);
+
+    /* fallthrough to writeentry_last_label */
+writeentry_last_label:
+    PUTVBYTE(merger->state->vv.header.doc.last, STATE_WRITEENTRY_LAST);
+
+    /* fallthrough to writeentry_size_label */
+writeentry_size_label:
+    PUTVBYTE(merger->state->vv.size, STATE_WRITEENTRY_SIZE);
+
+    /* fallthrough to writeentry_first_label */
+writeentry_first_label:
+    PUTVBYTE(input->first, STATE_WRITEENTRY_FIRST);
+
+    /* fallthrough to writeentry_vector_label */
+    merger->state->count = 0;
+
+writeentry_vector_label:
+    len = merger->state->outsize - merger->size_out;
+    /* have to write the rest of the vector to file output stream */
+    if ((input->input->avail_in > WRITE_POINT) 
+      && (input->size - merger->state->count > WRITE_POINT)) {
+        /* we're transferring such a large amount of data that we should just
+         * move the reference for input to output and let another write occur */
+
+        /* flush the output if necessary */
+        if (merger->size_out) {
+            merger->state->state = STATE_WRITEENTRY_VECTOR;
+            return MERGE_OUTPUT;
+        }
+
+        /* figure out how much stuff we can transfer out via this method */
+        len = (input->input->avail_in 
+              > input->size - merger->state->count) 
+            ? input->size - merger->state->count 
+            : input->input->avail_in;
+
+        assert(len > WRITE_POINT);
+
+        /* connect up the internal buffer to the output */
+        merger->buf_out = input->input->next_in;
+        merger->size_out = len;
+        merger->state->count += len;
+        input->input->next_in += len;
+        input->input->avail_in -= len;
+
+        /* arrange for it to be switched back out on return */
+        merger->state->state = STATE_FLUSH_SWITCH;
+        merger->state->next_state = STATE_WRITEENTRY_VECTOR;
+        return MERGE_OUTPUT;
+    } else if ((input->input->avail_in 
+        >= input->size - merger->state->count)
+      && (len >= input->size - merger->state->count)) {
+        /* can just copy the entire vector from in to out */
+        memcpy(&merger->buf_out[merger->size_out], input->input->next_in, 
+          input->size - merger->state->count);
+        input->input->next_in += input->size - merger->state->count;
+        input->input->avail_in -= input->size - merger->state->count;
+        merger->size_out += input->size - merger->state->count;
+    } else if (len > input->input->avail_in) {
+        /* in is the limiting factor */
+        memcpy(&merger->buf_out[merger->size_out], input->input->next_in, 
+          input->input->avail_in);
+        merger->state->count += input->input->avail_in;
+        input->input->next_in += input->input->avail_in;
+        merger->size_out += input->input->avail_in;
+        input->input->avail_in = 0;
+        merger->state->state = STATE_WRITEENTRY_VECTOR;
+        *index = merger->state->iinput[merger->state->index]
+          - merger->state->input;
+        *next_read = input->size - merger->state->count;
+        return MERGE_INPUT;
+    } else {
+        /* out is the limiting factor */
+        memcpy(&merger->buf_out[merger->size_out], input->input->next_in, len);
+        merger->state->count += len;
+        input->input->next_in += len;
+        input->input->avail_in -= len;
+        merger->size_out += len;
+        merger->state->state = STATE_WRITEENTRY_VECTOR;
+        return MERGE_OUTPUT;
+    }
+
+    /* finished copying the vector for this input, reload or finish input */
+    merger->state->next_state = STATE_WRITE_END;
+    /* save index in prev_index so we can tell if it finished or
+     * continues in write_end_label */
+    merger->state->prev_index = merger->state->index;
+    merger->state->count = 0;
+    goto readentry_label;
+
+write_end_label:
+    /* finished reading the entry, check to see if we need to put it
+     * back on the heap */
+    if (merger->state->prev_index != merger->state->index) {
+        /* it didn't finish, put it back on the heap */
+        void *heapret;
+
+        heapret = heap_insert(merger->state->iinput, &merger->state->inputs, 
+            sizeof(*merger->state->iinput), iinput_cmp, 
+            &merger->state->iinput[merger->state->prev_index]);
+    }
+
+    if (merger->state->index < merger->inputs - merger->state->finished) {
+        /* need to write another vector into the vocab entry */
+        input = merger->state->iinput[merger->state->index];
+        goto writeentry_first_label;
+    } else {
+        /* finished, select next input */
+        goto select_inputs_label;
+    }
+
+flush_switch_label:
+    /* the output has been flushed and we need to place the original output
+     * buffer back onto the output */
+    merger->buf_out = merger->state->out;
+    merger->size_out = 0;
+    JUMP(merger->state->next_state);
+
+finished_label:
+    merger->state->state = STATE_FINISHED;
+    if (merger->size_out) {
+        return MERGE_OUTPUT;
+    } else {
+        return MERGE_OK;
+    }
+
+/* labels that don't exist in this state machine */
+prefinish_label:
+assign_vocab_label:
+write_vocab_first_label:
+write_vocab_vector_label:
+write_vocab_end_label:
+write_file_first_label:
+write_file_vector_label:
+write_file_overalloc_label:
+write_file_end_label:
+write_btree_label:
+flush_newfile_label:
+    /* fallthrough to err_label */
+    assert(!CRASH);
+
+err_label:
+    assert(!CRASH);
+    merger->state->state = STATE_ERR;
+    return MERGE_ERR;
+}
+
+int merge_inter_input_finish(struct merge_inter *merger, unsigned int input) {
+    switch (merger->state->state) {
+    case STATE_READENTRY:
+        if (input 
+          == (unsigned int) (merger->state->iinput[merger->state->index]
+            - merger->state->input)) {
+
+            /* input has finished and needs to be removed from the stack */
+            memmove(&merger->state->iinput[merger->state->index],
+              &merger->state->iinput[merger->state->index + 1],
+              sizeof(*merger->state->iinput)
+                * (merger->inputs - merger->state->index - 1));
+            merger->state->finished++;
+
+            /* finished this entry while priming it (zero length file) 
+             * XXX: should probably be handled more elegantly, but this is
+             * simplest */
+            if (merger->state->next_state == STATE_START) {
+                merger->state->inputs--;
+            }
+
+            merger->state->state = merger->state->next_state;
+            return MERGE_OK;
+        }
+        /* fallthrough */
+        assert(!CRASH);
+
+    default:
+        assert(!CRASH);
+        merger->state->state = STATE_ERR;
+        return MERGE_ERR;
+    }
+}
+
diff --git a/src/metric.c b/src/metric.c
new file mode 100644 (file)
index 0000000..b5d8acc
--- /dev/null
@@ -0,0 +1,555 @@
+/* metric_template.c contains the boilerplate code and formatted comments that
+ * allow metric.py to turn metric definitions into working code.
+ * The format consists of c code interspersed by formatted comments that are
+ * expanded with definitions from the metric defintion file.  The comments must
+ * be wholly on a single line, with nothing else on the line.  Replacements:
+ *
+ *   METRIC_NAME : name of the metric 
+ *   METRIC_PRE : code for setting up things pre-accumulation
+ *   METRIC_POST : code for post-processing accumulators
+ *   METRIC_POST_PER_DOC : code for post-processing a single accumulator
+ *   METRIC_DECL : declarations needed for processing accumulators
+ *   METRIC_PER_CALL : code that doesn't depend on anything
+ *   METRIC_PER_DOC : code that depends on the document
+ *   METRIC_CONTRIB: calculate the average contribution of an f_dt value
+ *   METRIC_DEPENDS_POST : 1 if the metric has a post-processing step, 
+ *                         0 otherwise 
+ *
+ * This starting comment is replaced in the output files with the starting 
+ * comment from the metric definition file and some additional boilerplate.
+ *
+ * written nml 2005-05-20
+ */
+
+#include "firstinclude.h"
+
+#include "metric.h"
+
+#include "_index.h"
+#include "_docmap.h"
+#include "index_querybuild.h"
+
+#include "def.h"
+#include "objalloc.h"
+#include "docmap.h"
+#include "search.h"
+#include "vec.h"
+
+#include <assert.h>
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+
+static enum search_ret pre(struct index *idx, struct query *query, 
+  int opts, struct index_search_opt *opt) {
+    /* METRIC_PRE */
+    return SEARCH_OK;
+}
+
+static enum search_ret post(struct index *idx, struct query *query, 
+  struct search_acc_cons *acc, int opts, struct index_search_opt *opt) {
+    /* METRIC_POST */
+
+    while (acc) {
+        assert(acc->acc.docno < docmap_entries(idx->map));
+        /* METRIC_POST_PER_DOC */
+        acc = acc->next;
+    }
+
+    return SEARCH_OK;
+}
+
+/* macro to atomically read the next docno and f_dt from a vector 
+ * (note: i also tried a more complicated version that tested for a long vec 
+ * and used unchecked reads, but measurements showed no improvement) */
+#define NEXT_DOC(v, docno, f_dt)                                              \
+    (vec_vbyte_read(v, &docno_d)                                              \
+      && (((vec_vbyte_read(v, &f_dt) && ((docno += docno_d + 1), 1))          \
+        /* second read failed, reposition vec back to start of docno_d */     \
+        || (((v)->pos -= vec_vbyte_len(docno_d)), 0))))
+
+/* macro to scan over f_dt offsets from a vector/source */
+#define SCAN_OFFSETS(src, v, f_dt)                                            \
+    do {                                                                      \
+        unsigned int toscan = f_dt,                                           \
+                     scanned;                                                 \
+        enum search_ret sret;                                                 \
+                                                                              \
+        do {                                                                  \
+            if ((scanned = vec_vbyte_scan(v, toscan, &scanned)) == toscan) {  \
+                toscan = 0;                                                   \
+                break;                                                        \
+            } else if (scanned < toscan) {                                    \
+                toscan -= scanned;                                            \
+                /* need to read more */                                       \
+                if ((sret = src->readlist(src, VEC_LEN(v),                    \
+                    (void **) &(v)->pos, &bytes)) == SEARCH_OK) {             \
+                                                                              \
+                    (v)->end = (v)->pos + bytes;                              \
+                } else if (sret == SEARCH_FINISH) {                           \
+                    /* shouldn't end while scanning offsets */                \
+                    return SEARCH_EINVAL;                                     \
+                } else {                                                      \
+                    return sret;                                              \
+                }                                                             \
+            } else {                                                          \
+                assert("can't get here" && 0);                                \
+                return SEARCH_EINVAL;                                         \
+            }                                                                 \
+        } while (toscan);                                                     \
+    } while (0)
+static enum search_ret or_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc;
+    unsigned int accs_added = 0;   /* number of accumulators added */
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    unsigned int bytes;
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    /* METRIC_DECL */
+
+    /* METRIC_PER_CALL */
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                prevptr = &acc->next;
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+            } else {
+                struct search_acc_cons *newacc;
+                assert(!acc || docno < acc->acc.docno); 
+
+                /* allocate a new accumulator (we have reserved allocators
+                 * earlier, so this should never fail) */
+                newacc = objalloc_malloc(results->alloc, sizeof(*newacc));
+                assert(newacc);
+                newacc->next = acc;
+                acc = newacc;
+                acc->acc.docno = docno;
+                acc->acc.weight = 0.0;
+                /* METRIC_PER_DOC */
+                *prevptr = newacc;
+                accs_added++;
+            }
+            assert(acc);
+
+            /* go to next accumulator */
+            prevptr = &acc->next;
+            acc = acc->next;
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, update number of accumulators */
+            results->accs += accs_added;
+            results->total_results += accs_added;
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+static enum search_ret and_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src,
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc;
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    struct vec v = {NULL, NULL};
+    unsigned int bytes,
+                 missed = 0,       /* number of list entries that didn't match 
+                                    * an accumulator */
+                 hit = 0,          /* number of entries in both accs and list*/
+                 decoded = 0;      /* number of list entries seen */
+    enum search_ret ret;
+    float cooc_rate;               /* co-occurrance rate for list entries and 
+                                    * accumulators */
+    /* METRIC_DECL */
+
+    /* METRIC_PER_CALL */
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+
+                /* go to next accumulator */
+                acc = acc->next;
+                hit++;
+            } else {
+                missed++;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate number of results */
+
+            /* list entries now divide up into two portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            assert(missed + hit == decoded);
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            if (missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* tolerance value for thresholding estimates.  Should be >= 1.0.  Make higher
+ * for stabler, but higher memory usage, processing. */
+#define TOLERANCE 1.2
+
+/* low-ish approximation of infinity, to make counting up to it acceptable */
+#define INF 2000
+
+static enum search_ret thresh_decode(struct index *idx, struct query *query,
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, 
+  struct search_list_src *src, unsigned int postings, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc,
+                           dummy;
+    unsigned long int f_dt,           /* number of offsets for this document */
+                      docno_d;        /* d-gap */
+
+    /* initial number of accumulators */
+    unsigned int initial_accs = results->accs,
+
+                 decoded = 0,         /* number of postings decoded */
+                 thresh,              /* current discrete threshold */
+                 rethresh,            /* distance to recalculation of the 
+                                       * threshold */
+                 rethresh_dist,
+                 bytes,
+                 step,
+                 missed = 0,        /* number of list entries that didn't match 
+                                     * an accumulator */
+                 hit = 0;           /* number of entries in both accs and list*/
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    int infinite = 0;                 /* whether threshold is infinite */
+    float cooc_rate;
+    /* METRIC_DECL */
+
+    /* METRIC_PER_CALL */
+
+    rethresh_dist = rethresh = (postings + results->acc_limit - 1) 
+      / results->acc_limit;
+
+    if (results->v_t == FLT_MIN) {
+        unsigned long int docno_copy = docno;
+
+        /* this should be the first thresholded list, need to estimate 
+         * threshold */
+        assert(rethresh && rethresh < postings);
+        thresh = 0;
+
+        assert(rethresh < postings);
+        while (rethresh) {
+            while (rethresh && NEXT_DOC(&v, docno, f_dt)) {
+                rethresh--;
+                SCAN_OFFSETS(src, &v, f_dt);
+                if (f_dt > thresh) {
+                    thresh = f_dt;
+                }
+            }
+
+            /* need to read more data, preserving bytes that we already have */
+            if (rethresh && (ret = src->readlist(src, VEC_LEN(&v),
+                (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+                v.end = v.pos + bytes;
+            } else if (rethresh) {
+                assert(ret != SEARCH_FINISH);
+                return ret;
+            }
+        }
+        thresh--;
+
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        acc->acc.weight = 0.0;
+        f_dt = thresh;
+        /* METRIC_CONTRIB */
+        results->v_t = acc->acc.weight;
+
+        /* reset source/vector to start */
+        v.pos = v.end = NULL;
+        if ((ret = src->reset(src)) != SEARCH_OK) {
+            return ret;
+        }
+
+        acc = *prevptr;
+        docno = docno_copy;
+        rethresh = rethresh_dist;
+    } else {
+        /* translate the existing v_t threshold to an f_dt */
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        f_dt = 0;
+        do {
+            acc->acc.weight = 0.0;
+            f_dt++;
+            /* METRIC_CONTRIB */
+        } while (acc->acc.weight < results->v_t && f_dt < INF);
+        thresh = f_dt; 
+        acc = *prevptr;
+
+        if (thresh == INF) {
+            /* this is not a sensible term */
+            infinite = 1;
+            rethresh = postings + 1;
+        }
+    }
+
+    /* set step to 1/2 of the threshold */
+    step = (thresh + 1) / 2;
+    step += !step; /* but don't let it become 0 */
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                /* perform threshold test */
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = (*prevptr);
+                    results->accs--;
+                } else {
+                    /* retain this accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = *prevptr;
+                    results->accs--;
+                } else {
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+                hit++;
+            } else {
+                if (f_dt > thresh) {
+                    struct search_acc_cons *newacc;
+                    assert(!acc || docno < acc->acc.docno); 
+
+                    if ((newacc = objalloc_malloc(results->alloc, 
+                      sizeof(*newacc)))) {
+                        newacc->acc.docno = docno;
+                        newacc->acc.weight = 0.0;
+                        newacc->next = acc;
+                        acc = newacc;
+                        /* note that we have to be careful around here to 
+                         * assign newacc to acc before using PER_DOC, 
+                         * otherwise we end up with nonsense in some 
+                         * accumulators */
+                        /* METRIC_PER_DOC */
+                        *prevptr = newacc;
+                        results->accs++;
+                    } else {
+                        return SEARCH_ENOMEM;
+                    }
+
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                } else {
+                    missed++;
+                }
+            }
+
+            if (!--rethresh) {
+                int estimate;
+                unsigned int prev_thresh = thresh;
+
+                estimate = (int) (results->accs 
+                  + ((postings - decoded) 
+                    * ((float) results->accs - initial_accs)) / decoded);
+
+                if (estimate > TOLERANCE * results->acc_limit) {
+                    thresh += step;
+                } else if ((estimate < results->acc_limit / TOLERANCE) 
+                  && thresh) {
+                    if (thresh >= step) {
+                        thresh -= step;
+                    } else {
+                        thresh = 0;
+                    }
+                }
+
+                step = (step + 1) / 2;
+                assert(step);
+
+                /* note that we don't want to recalculate the threshold if it
+                 * doesn't change because this involves re-discretising it */
+                if (prev_thresh != thresh) {
+                    /* recalculate contribution that corresponds to the new 
+                     * threshold */
+                    f_dt = thresh;
+                    if (f_dt) {
+                        acc = &dummy;
+                        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+                        acc->acc.weight = 0.0;
+                        /* METRIC_CONTRIB */
+                        results->v_t = acc->acc.weight;
+                        acc = *prevptr;
+                    } else {
+                        results->v_t = FLT_MIN;
+                    }
+                }
+
+                rethresh_dist *= 2;
+                rethresh = rethresh_dist;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate total results count */
+            assert(postings == decoded);
+
+            results->total_results += (int) (results->accs - initial_accs);
+
+            /* list entries now divide up into three portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *   - added
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            /* note that the total results are not an estimate if either there
+             * were no accumulators in the list when we started (in which case
+             * missed records exactly the number, uh, missing from the
+             * accumulators) or there were none missed, in which case the
+             * accumulators have fully accounted for everything in this list.
+             * In either case, the (1 - cooc_rate) * missed maths above handles
+             * it exactly (modulo floating point errors of course). */
+            if (initial_accs && missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                if (!infinite) {
+                    /* continue threshold evaluation */
+                    return SEARCH_OK;
+                } else {
+                    /* switch to AND processing */
+                    return SEARCH_FINISH;
+                }
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* Declare a function named the same as the metric that returns a structure 
+ * containing function pointers */
+const struct search_metric * /* METRIC_NAME */ () {
+    const static struct search_metric sm 
+      = {pre, /* METRIC_DEPENDS_POST */ ? post : NULL, 
+         or_decode, and_decode, thresh_decode};
+    return &sm;
+}
+
diff --git a/src/mime.c b/src/mime.c
new file mode 100644 (file)
index 0000000..20523bf
--- /dev/null
@@ -0,0 +1,8663 @@
+/* mime.c implements the interface declared by mime.h
+ *
+ * DO NOT modify this file, as it is automatically generated 
+ * and changes will be lost upon subsequent regeneration.
+ *
+ * It is automatically generated from media-type files describing 
+ * valid MIME types by scripts/mime.py.  The definitive list can be found at 
+ * http://www.isi.edu/in-notes/iana/assignments/media-types/media-types, 
+ * although scripts/mime.py will accept multiple files (in the same format), 
+ * allowing you to define your own MIME types as convenient.
+ *
+ * This file was generated on Wed, 03 May 2006 07:26:21 +0000 
+ * by scripts/mime.py
+ *
+ */
+               
+#include "firstinclude.h"
+
+#include "mime.h"
+
+#include "str.h"
+
+#include <ctype.h>
+          
+struct mime_lookup {
+    const char *name;
+    enum mime_top_types toptype;
+};
+          
+static const struct mime_lookup lookup[] = {
+    {"text/html", MIME_TOP_TYPE_TEXT},
+    {"text/plain", MIME_TOP_TYPE_TEXT},
+    {"application/x-inex", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-trec", MIME_TOP_TYPE_APPLICATION},
+    {"text/css", MIME_TOP_TYPE_TEXT},
+    {"text/rtf", MIME_TOP_TYPE_TEXT},
+    {"text/xml", MIME_TOP_TYPE_TEXT},
+    {"image/gif", MIME_TOP_TYPE_IMAGE},
+    {"image/png", MIME_TOP_TYPE_IMAGE},
+    {"audio/mpeg", MIME_TOP_TYPE_AUDIO},
+    {"image/jpeg", MIME_TOP_TYPE_IMAGE},
+    {"image/tiff", MIME_TOP_TYPE_IMAGE},
+    {"video/mpeg", MIME_TOP_TYPE_VIDEO},
+    {"audio/basic", MIME_TOP_TYPE_AUDIO},
+    {"message/http", MIME_TOP_TYPE_MESSAGE},
+    {"message/rfc822", MIME_TOP_TYPE_MESSAGE},
+    {"message/s-http", MIME_TOP_TYPE_MESSAGE},
+    {"application/pdf", MIME_TOP_TYPE_APPLICATION},
+    {"application/zip", MIME_TOP_TYPE_APPLICATION},
+    {"message/partial", MIME_TOP_TYPE_MESSAGE},
+    {"multipart/mixed", MIME_TOP_TYPE_MULTIPART},
+    {"video/quicktime", MIME_TOP_TYPE_VIDEO},
+    {"multipart/digest", MIME_TOP_TYPE_MULTIPART},
+    {"multipart/signed", MIME_TOP_TYPE_MULTIPART},
+    {"application/msword", MIME_TOP_TYPE_APPLICATION},
+    {"multipart/parallel", MIME_TOP_TYPE_MULTIPART},
+    {"multipart/encrypted", MIME_TOP_TYPE_MULTIPART},
+    {"multipart/byteranges", MIME_TOP_TYPE_MULTIPART},
+    {"message/external-body", MIME_TOP_TYPE_MESSAGE},
+    {"multipart/alternative", MIME_TOP_TYPE_MULTIPART},
+    {"application/postscript", MIME_TOP_TYPE_APPLICATION},
+    {"application/mathematica", MIME_TOP_TYPE_APPLICATION},
+    {"application/octet-stream", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-tar", MIME_TOP_TYPE_APPLICATION},
+    {"image/cgm", MIME_TOP_TYPE_IMAGE},
+    {"image/ief", MIME_TOP_TYPE_IMAGE},
+    {"text/sgml", MIME_TOP_TYPE_TEXT},
+    {"text/t140", MIME_TOP_TYPE_TEXT},
+    {"audio/tone", MIME_TOP_TYPE_AUDIO},
+    {"model/iges", MIME_TOP_TYPE_MODEL},
+    {"model/mesh", MIME_TOP_TYPE_MODEL},
+    {"model/vrml", MIME_TOP_TYPE_MODEL},
+    {"image/g3fax", MIME_TOP_TYPE_IMAGE},
+    {"image/naplps", MIME_TOP_TYPE_IMAGE},
+    {"message/news", MIME_TOP_TYPE_MESSAGE},
+    {"text/vnd.abc", MIME_TOP_TYPE_TEXT},
+    {"text/vnd.fly", MIME_TOP_TYPE_TEXT},
+    {"audio/prs.sid", MIME_TOP_TYPE_AUDIO},
+    {"image/prs.pti", MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.dwg", MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.dxf", MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.fpx", MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.fst", MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.mix", MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.svf", MIME_TOP_TYPE_IMAGE},
+    {"model/vnd.dwf", MIME_TOP_TYPE_MODEL},
+    {"model/vnd.gdl", MIME_TOP_TYPE_MODEL},
+    {"model/vnd.gtw", MIME_TOP_TYPE_MODEL},
+    {"model/vnd.mts", MIME_TOP_TYPE_MODEL},
+    {"model/vnd.vtu", MIME_TOP_TYPE_MODEL},
+    {"text/calendar", MIME_TOP_TYPE_TEXT},
+    {"text/enriched", MIME_TOP_TYPE_TEXT},
+    {"text/richtext", MIME_TOP_TYPE_TEXT},
+    {"text/uri-list", MIME_TOP_TYPE_TEXT},
+    {"text/vnd.curl", MIME_TOP_TYPE_TEXT},
+    {"video/pointer", MIME_TOP_TYPE_VIDEO},
+    {"video/vnd.fvt", MIME_TOP_TYPE_VIDEO},
+    {"audio/32kadpcm", MIME_TOP_TYPE_AUDIO},
+    {"image/prs.btif", MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.xiff", MIME_TOP_TYPE_IMAGE},
+    {"text/directory", MIME_TOP_TYPE_TEXT},
+    {"text/parityfec", MIME_TOP_TYPE_TEXT},
+    {"video/vnd.vivo", MIME_TOP_TYPE_VIDEO},
+    {"application/ipp", MIME_TOP_TYPE_APPLICATION},
+    {"application/oda", MIME_TOP_TYPE_APPLICATION},
+    {"application/rtf", MIME_TOP_TYPE_APPLICATION},
+    {"application/sdp", MIME_TOP_TYPE_APPLICATION},
+    {"application/xml", MIME_TOP_TYPE_APPLICATION},
+    {"audio/parityfec", MIME_TOP_TYPE_AUDIO},
+    {"audio/vnd.qcelp", MIME_TOP_TYPE_AUDIO},
+    {"text/vnd.wap.si", MIME_TOP_TYPE_TEXT},
+    {"text/vnd.wap.sl", MIME_TOP_TYPE_TEXT},
+    {"video/parityfec", MIME_TOP_TYPE_VIDEO},
+    {"application/dvcs", MIME_TOP_TYPE_APPLICATION},
+    {"application/http", MIME_TOP_TYPE_APPLICATION},
+    {"application/iges", MIME_TOP_TYPE_APPLICATION},
+    {"application/iotp", MIME_TOP_TYPE_APPLICATION},
+    {"application/isup", MIME_TOP_TYPE_APPLICATION},
+    {"application/marc", MIME_TOP_TYPE_APPLICATION},
+    {"application/qsig", MIME_TOP_TYPE_APPLICATION},
+    {"application/sgml", MIME_TOP_TYPE_APPLICATION},
+    {"application/wita", MIME_TOP_TYPE_APPLICATION},
+    {"audio/mpa-robust", MIME_TOP_TYPE_AUDIO},
+    {"model/vnd.gs-gdl", MIME_TOP_TYPE_MODEL},
+    {"multipart/report", MIME_TOP_TYPE_MULTIPART},
+    {"text/vnd.latex-z", MIME_TOP_TYPE_TEXT},
+    {"text/vnd.wap.wml", MIME_TOP_TYPE_TEXT},
+    {"application/eshop", MIME_TOP_TYPE_APPLICATION},
+    {"application/index", MIME_TOP_TYPE_APPLICATION},
+    {"application/sieve", MIME_TOP_TYPE_APPLICATION},
+    {"application/slate", MIME_TOP_TYPE_APPLICATION},
+    {"application/vemmi", MIME_TOP_TYPE_APPLICATION},
+    {"image/vnd.net-fpx", MIME_TOP_TYPE_IMAGE},
+    {"multipart/related", MIME_TOP_TYPE_MULTIPART},
+    {"video/vnd.mpegurl", MIME_TOP_TYPE_VIDEO},
+    {"application/dec-dx", MIME_TOP_TYPE_APPLICATION},
+    {"application/pkcs10", MIME_TOP_TYPE_APPLICATION},
+    {"application/riscos", MIME_TOP_TYPE_APPLICATION},
+    {"audio/vnd.cns.anp1", MIME_TOP_TYPE_AUDIO},
+    {"audio/vnd.cns.inf1", MIME_TOP_TYPE_AUDIO},
+    {"audio/vnd.vmx.cvsd", MIME_TOP_TYPE_AUDIO},
+    {"image/vnd.cns.inf2", MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.wap.wbmp", MIME_TOP_TYPE_IMAGE},
+    {"text/prs.lines.tag", MIME_TOP_TYPE_TEXT},
+    {"text/vnd.IPTC.NITF", MIME_TOP_TYPE_TEXT},
+    {"text/vnd.in3d.3dml", MIME_TOP_TYPE_TEXT},
+    {"text/vnd.in3d.spot", MIME_TOP_TYPE_TEXT},
+    {"application/EDI-X12", MIME_TOP_TYPE_APPLICATION},
+    {"application/EDIFACT", MIME_TOP_TYPE_APPLICATION},
+    {"application/dca-rft", MIME_TOP_TYPE_APPLICATION},
+    {"application/pkixcmp", MIME_TOP_TYPE_APPLICATION},
+    {"application/prs.cww", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.bmi", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.dna", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.dxr", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fdf", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.mcd", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.mif", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.svd", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.vcx", MIME_TOP_TYPE_APPLICATION},
+    {"application/x400-bp", MIME_TOP_TYPE_APPLICATION},
+    {"application/xml-dtd", MIME_TOP_TYPE_APPLICATION},
+    {"audio/vnd.cisco.nse", MIME_TOP_TYPE_AUDIO},
+    {"audio/vnd.octel.sbc", MIME_TOP_TYPE_AUDIO},
+    {"multipart/form-data", MIME_TOP_TYPE_MULTIPART},
+    {"text/rfc822-headers", MIME_TOP_TYPE_TEXT},
+    {"application/beep+xml", MIME_TOP_TYPE_APPLICATION},
+    {"application/pgp-keys", MIME_TOP_TYPE_APPLICATION},
+    {"application/pkix-crl", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.koan", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.mseq", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.palm", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ufdl", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.xara", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.xfdl", MIME_TOP_TYPE_APPLICATION},
+    {"audio/vnd.everad.plj", MIME_TOP_TYPE_AUDIO},
+    {"audio/vnd.nortel.vbk", MIME_TOP_TYPE_AUDIO},
+    {"multipart/header-set", MIME_TOP_TYPE_MULTIPART},
+    {"text/vnd.IPTC.NewsML", MIME_TOP_TYPE_TEXT},
+    {"application/applefile", MIME_TOP_TYPE_APPLICATION},
+    {"application/cals-1840", MIME_TOP_TYPE_APPLICATION},
+    {"application/cybercash", MIME_TOP_TYPE_APPLICATION},
+    {"application/index.cmd", MIME_TOP_TYPE_APPLICATION},
+    {"application/index.obj", MIME_TOP_TYPE_APPLICATION},
+    {"application/index.vnd", MIME_TOP_TYPE_APPLICATION},
+    {"application/parityfec", MIME_TOP_TYPE_APPLICATION},
+    {"application/pkix-cert", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ffsns", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.msign", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.rapid", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.s3sms", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.visio", MIME_TOP_TYPE_APPLICATION},
+    {"audio/telephone-event", MIME_TOP_TYPE_AUDIO},
+    {"multipart/appledouble", MIME_TOP_TYPE_MULTIPART},
+    {"text/vnd.fmi.flexstor", MIME_TOP_TYPE_TEXT},
+    {"application/atomicmail", MIME_TOP_TYPE_APPLICATION},
+    {"application/batch-SMTP", MIME_TOP_TYPE_APPLICATION},
+    {"application/font-tdpfr", MIME_TOP_TYPE_APPLICATION},
+    {"application/macwriteii", MIME_TOP_TYPE_APPLICATION},
+    {"application/pkcs7-mime", MIME_TOP_TYPE_APPLICATION},
+    {"application/prs.nprend", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.cybank", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.grafeq", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.hp-PCL", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.hp-hps", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.is-xpr", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ms-asf", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ms-lrm", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.netfpx", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.wt.stf", MIME_TOP_TYPE_APPLICATION},
+    {"audio/vnd.lucent.voice", MIME_TOP_TYPE_AUDIO},
+    {"image/vnd.fastbidsheet", MIME_TOP_TYPE_IMAGE},
+    {"text/vnd.wap.wmlscript", MIME_TOP_TYPE_TEXT},
+    {"application/EDI-Consent", MIME_TOP_TYPE_APPLICATION},
+    {"application/hyperstudio", MIME_TOP_TYPE_APPLICATION},
+    {"application/set-payment", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.dpgraph", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.enliven", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.hp-HPGL", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.hp-hpid", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ms-tnef", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.seemail", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sss-cod", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sss-dtf", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sss-ntf", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.trueapp", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.truedoc", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.wap.sic", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.wap.slc", MIME_TOP_TYPE_APPLICATION},
+    {"audio/vnd.digital-winds", MIME_TOP_TYPE_AUDIO},
+    {"message/delivery-status", MIME_TOP_TYPE_MESSAGE},
+    {"model/vnd.flatland.3dml", MIME_TOP_TYPE_MODEL},
+    {"multipart/voice-message", MIME_TOP_TYPE_MULTIPART},
+    {"text/vnd.DMClientScript", MIME_TOP_TYPE_TEXT},
+    {"application/andrew-inset", MIME_TOP_TYPE_APPLICATION},
+    {"application/commonground", MIME_TOP_TYPE_APPLICATION},
+    {"application/mac-binhex40", MIME_TOP_TYPE_APPLICATION},
+    {"application/ocsp-request", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.acucobol", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.claymore", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.cups-raw", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.hp-PCLXL", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.httphone", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.intu.qbo", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.intu.qfx", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ms-excel", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ms-works", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.musician", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.wap.wmlc", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.webturbo", MIME_TOP_TYPE_APPLICATION},
+    {"text/vnd.motorola.reflex", MIME_TOP_TYPE_TEXT},
+    {"text/vnd.ms-mediapackage", MIME_TOP_TYPE_TEXT},
+    {"video/vnd.motorola.video", MIME_TOP_TYPE_VIDEO},
+    {"application/activemessage", MIME_TOP_TYPE_APPLICATION},
+    {"application/ocsp-response", MIME_TOP_TYPE_APPLICATION},
+    {"application/pgp-encrypted", MIME_TOP_TYPE_APPLICATION},
+    {"application/pgp-signature", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ctc-posml", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.epson.esf", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.epson.msf", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.epson.ssf", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.pg.format", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.pg.osasli", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.pvi.ptid1", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.wap.wbxml", MIME_TOP_TYPE_APPLICATION},
+    {"application/whoispp-query", MIME_TOP_TYPE_APPLICATION},
+    {"audio/vnd.nuera.ecelp4800", MIME_TOP_TYPE_AUDIO},
+    {"audio/vnd.nuera.ecelp7470", MIME_TOP_TYPE_AUDIO},
+    {"audio/vnd.nuera.ecelp9600", MIME_TOP_TYPE_AUDIO},
+    {"text/tab-separated-values", MIME_TOP_TYPE_TEXT},
+    {"video/vnd.motorola.videop", MIME_TOP_TYPE_VIDEO},
+    {"application/index.response", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.FloGraphIt", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.aether.imp", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.audiograph", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.canon-cpdl", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.canon-lips", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.epson.salt", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.framemaker", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fut-misnet", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ibm.modcap", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ms-project", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.music-niff", MIME_TOP_TYPE_APPLICATION},
+    {"application/wordperfect5.1", MIME_TOP_TYPE_APPLICATION},
+    {"application/news-message-id", MIME_TOP_TYPE_APPLICATION},
+    {"application/pkcs7-signature", MIME_TOP_TYPE_APPLICATION},
+    {"application/remote-printing", MIME_TOP_TYPE_APPLICATION},
+    {"application/timestamp-query", MIME_TOP_TYPE_APPLICATION},
+    {"application/timestamp-reply", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.commonspace", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.comsocaller", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.cups-raster", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.eudora.data", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ibm.MiniPay", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.lotus-1-2-3", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.lotus-notes", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ms-artgalry", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.tve-trigger", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.vectorworks", MIME_TOP_TYPE_APPLICATION},
+    {"audio/vnd.rhetorex.32kadpcm", MIME_TOP_TYPE_AUDIO},
+    {"application/set-registration", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.contact.cmsg", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ecdis-update", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ecowin.chart", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.groove-vcard", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.noblenet-web", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.novadigm.EDM", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.novadigm.EDX", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.novadigm.EXT", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.triscape.mxs", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.list", MIME_TOP_TYPE_APPLICATION},
+    {"application/whoispp-response", MIME_TOP_TYPE_APPLICATION},
+    {"application/news-transmission",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/sgml-open-catalog",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ecowin.series",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fsc.weblaunch",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fujitsu.oasys",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fujixerox.ddd",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.lotus-wordpro",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ms-powerpoint",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.osa.netdeploy",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.powerbuilder6",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.powerbuilder7",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.street-stream",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.swiftview-ics",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.alert",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fujitsu.oasys2",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fujitsu.oasys3",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.groove-account",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.lotus-approach",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.powerbuilder75",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.signal",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.wap.wmlscriptc",
+      MIME_TOP_TYPE_APPLICATION},
+    {"image/vnd.fujixerox.edmics-mmr",
+      MIME_TOP_TYPE_IMAGE},
+    {"image/vnd.fujixerox.edmics-rlc",
+      MIME_TOP_TYPE_IMAGE},
+    {"application/vnd.businessobjects",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.cups-postscript",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fujitsu.oasysgp",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.groove-injector",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ibm.afplinedata",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.intertrust.nncp",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.lotus-freelance",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.lotus-organizer",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.lotus-screencam",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.mozilla.xul+xml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.noblenet-sealer",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.powerbuilder6-s",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.powerbuilder7-s",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.cacheop",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.channel",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.listcmd",
+      MIME_TOP_TYPE_APPLICATION},
+    {"text/xml-external-parsed-entity",
+      MIME_TOP_TYPE_TEXT},
+    {"application/vnd.3M.Post-it-Notes",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.epson.quickanime",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fujitsu.oasysprs",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.hzn-3d-crossword",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.intercon.formnet",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.powerbuilder75-s",
+      MIME_TOP_TYPE_APPLICATION},
+    {"message/disposition-notification",
+      MIME_TOP_TYPE_MESSAGE},
+    {"application/vnd.accpac.simply.aso",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.accpac.simply.imp",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ecowin.fileupdate",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.hhe.lesson-player",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/set-payment-initiation",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ecowin.filerequest",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ericsson.quickcall",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.informix-visionary",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.intertrust.digibox",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.mediastation.cdkey",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.meridian-slingshot",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.motorola.flexsuite",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.noblenet-directory",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.previewsystems.box",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.list-wbxml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ecowin.seriesupdate",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fujixerox.docuworks",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.groove-tool-message",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.pwg-xhtml-print+xml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.alert-wbxml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.wrq-hp3000-labelled",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.ecowin.seriesrequest",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.groove-tool-template",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.minisoft-hp3000-save",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.vividence.scriptfile",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.japannet-registration",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.japannet-verification",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.publishare-delta-tree",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.bearer-choice",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.cacheop-wbxml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.channel-wbxml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.listcmd-wbxml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.vidsoft.vidconference",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.motorola.flexsuite.fis",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.motorola.flexsuite.kmr",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.motorola.flexsuite.ttc",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.motorola.flexsuite.wem",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.shana.informed.package",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/xml-external-parsed-entity",
+      MIME_TOP_TYPE_APPLICATION},
+    {"video/vnd.nokia.interleaved-multimedia",
+      MIME_TOP_TYPE_VIDEO},
+    {"application/prs.alvestrand.titrax-sheet",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/set-registration-initiation",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.groove-identity-message",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.irepository.package+xml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.japannet-payment-wakeup",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.motorola.flexsuite.adsi",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.shana.informed.formdata",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.yellowriver-custom-menu",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.japannet-jpnstore-wakeup",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.japannet-setstore-wakeup",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.motorola.flexsuite.gotap",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.fujixerox.docuworks.binder",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.japannet-directory-service",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.shana.informed.interchange",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.shana.informed.formtemplate",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.uplanet.bearer-choice-wbxml",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.japannet-registration-wakeup",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.japannet-verification-wakeup",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.mitsubishi.misty-guard.trustweb",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.anser-web-funds-transfer-initiation",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.anser-web-certificate-issue-initiation",
+      MIME_TOP_TYPE_APPLICATION},
+    {"audio/L16", MIME_TOP_TYPE_AUDIO},
+    {"audio/L20", MIME_TOP_TYPE_AUDIO},
+    {"audio/L24", MIME_TOP_TYPE_AUDIO},
+    {"image/bmp", MIME_TOP_TYPE_IMAGE},
+    {"audio/midi", MIME_TOP_TYPE_AUDIO},
+    {"audio/DAT12", MIME_TOP_TYPE_AUDIO},
+    {"audio/x-wav", MIME_TOP_TYPE_AUDIO},
+    {"image/x-rgb", MIME_TOP_TYPE_IMAGE},
+    {"audio/x-aiff", MIME_TOP_TYPE_AUDIO},
+    {"audio/G.722.1", MIME_TOP_TYPE_AUDIO},
+    {"text/x-setext", MIME_TOP_TYPE_TEXT},
+    {"video/MP4V-ES", MIME_TOP_TYPE_VIDEO},
+    {"video/vnd.mts", MIME_TOP_TYPE_VIDEO},
+    {"chemical/x-pdb", MIME_TOP_TYPE_CHEMICAL},
+    {"chemical/x-xyz", MIME_TOP_TYPE_CHEMICAL},
+    {"image/vnd.djvu", MIME_TOP_TYPE_IMAGE},
+    {"application/ogg", MIME_TOP_TYPE_APPLICATION},
+    {"audio/MP4A-LATM", MIME_TOP_TYPE_AUDIO},
+    {"audio/x-mpegurl", MIME_TOP_TYPE_AUDIO},
+    {"image/x-xbitmap", MIME_TOP_TYPE_IMAGE},
+    {"image/x-xpixmap", MIME_TOP_TYPE_IMAGE},
+    {"video/x-msvideo", MIME_TOP_TYPE_VIDEO},
+    {"application/smil", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-sh", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-csh", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-dvi", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-hdf", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-rpm", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-tcl", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-tex", MIME_TOP_TYPE_APPLICATION},
+    {"audio/x-realaudio", MIME_TOP_TYPE_AUDIO},
+    {"video/x-sgi-movie", MIME_TOP_TYPE_VIDEO},
+    {"application/x-cpio", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-gtar", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-gzip", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-koan", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-shar", MIME_TOP_TYPE_APPLICATION},
+    {"image/x-cmu-raster", MIME_TOP_TYPE_IMAGE},
+    {"application/x-bcpio", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-bzip2", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-kword", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-latex", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-troff", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-ustar", MIME_TOP_TYPE_APPLICATION},
+    {"image/x-xwindowdump", MIME_TOP_TYPE_IMAGE},
+    {"application/x-cdlink", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-kchart", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-netcdf", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-sv4crc", MIME_TOP_TYPE_APPLICATION},
+    {"audio/x-pn-realaudio", MIME_TOP_TYPE_AUDIO},
+    {"application/x-kspread", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-stuffit", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-sv4cpio", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-texinfo", MIME_TOP_TYPE_APPLICATION},
+    {"application/xhtml+xml", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-compress", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-director", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-troff-me", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-troff-ms", MIME_TOP_TYPE_APPLICATION},
+    {"text/vnd.flatland.3dml", MIME_TOP_TYPE_TEXT},
+    {"application/x-chess-pgn", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-troff-man", MIME_TOP_TYPE_APPLICATION},
+    {"image/x-portable-anymap", MIME_TOP_TYPE_IMAGE},
+    {"image/x-portable-bitmap", MIME_TOP_TYPE_IMAGE},
+    {"image/x-portable-pixmap", MIME_TOP_TYPE_IMAGE},
+    {"x-conference/x-cooltalk", MIME_TOP_TYPE_X_CONFERENCE},
+    {"application/x-bittorrent", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-javascript", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-kpresenter", MIME_TOP_TYPE_APPLICATION},
+    {"image/x-portable-graymap", MIME_TOP_TYPE_IMAGE},
+    {"application/x-wais-source", MIME_TOP_TYPE_APPLICATION},
+    {"application/mac-compactpro", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.Mobius.DAF", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.Mobius.DIS", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.Mobius.MBK", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.Mobius.MQY", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.Mobius.MSL", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.Mobius.PLC", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.Mobius.TXF", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-futuresplash", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-killustrator", MIME_TOP_TYPE_APPLICATION},
+    {"application/mathematica-old", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.cosmocaller", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.calc", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.draw", MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.math", MIME_TOP_TYPE_APPLICATION},
+    {"application/x-shockwave-flash",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.writer",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.impress",
+      MIME_TOP_TYPE_APPLICATION},
+    {"model/vnd.parasolid.transmit.text",
+      MIME_TOP_TYPE_MODEL},
+    {"application/vnd.$commerce_battelle",
+      MIME_TOP_TYPE_APPLICATION},
+    {"model/vnd.parasolid.transmit.binary",
+      MIME_TOP_TYPE_MODEL},
+    {"application/vnd.sun.xml.calc.template",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.draw.template",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.writer.global",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.writer.template",
+      MIME_TOP_TYPE_APPLICATION},
+    {"application/vnd.sun.xml.impress.template",
+      MIME_TOP_TYPE_APPLICATION},
+
+    {NULL, MIME_TOP_TYPE_ERR}
+};
+
+const char *mime_string(enum mime_types mtype) {
+    if (mtype <= 487) {
+        return lookup[mtype].name;
+    } else {
+        return NULL;
+    }
+}
+
+enum mime_top_types mime_top_type(enum mime_types mtype) {
+    if (mtype <= 487) {
+        return lookup[mtype].toptype;
+    } else {
+        return MIME_TOP_TYPE_ERR;
+    }
+}
+
+       
+/* FIXME: do this properly, using parsing-type stuff */
+enum mime_types mime_content_guess(const void *buf, unsigned int len) {
+    const char *cbuf = buf;
+
+    if (len >= 4) {
+        /* test for JPEG */
+        if ((cbuf[0] == (char) 0xff) && (cbuf[1] == (char) 0xd8) 
+          && (cbuf[2] == (char) 0xff) && (cbuf[3] == (char) 0xe0)) {
+            return MIME_TYPE_IMAGE_JPEG;
+        }
+    }
+
+    if (len >= 6) {
+        /* test for GIF */
+        if (!str_ncmp(cbuf, "GIF8", 4) && ((cbuf[4] == '9') || (cbuf[4] == '7'))
+          && (cbuf[5] == 'a')) {
+            return MIME_TYPE_IMAGE_GIF;
+        }
+    }
+
+    if (len >= 4) {
+        /* test for MS cbuf (badly) */
+        if ((cbuf[0] == (char) 0xd0) && (cbuf[1] == (char) 0xcf) 
+          && (cbuf[2] == (char) 0x11) && (cbuf[3] == (char) 0xe0)) {
+            /* XXX: not strictly true, its just an OLE document, but most of 
+             * them are MS cbuf docs anyway.  Testing for MS cbuf requires 
+             * looking further into the document, so we won't be doing that 
+             * here. */
+            return MIME_TYPE_APPLICATION_MSWORD;
+        }
+
+        if (len == 2) {
+            if ((cbuf[0] == (char) 0x31) && (cbuf[1] == (char) 0xbe) 
+              && (cbuf[0] == '\0')) {
+                /* more MS cbuf stuff :o( */
+                return MIME_TYPE_APPLICATION_MSWORD;
+            } else if ((cbuf[0] == (char) 0xfe) && (cbuf[1] == '7') 
+              && (cbuf[0] == '\0')) {
+                /* office document */
+                return MIME_TYPE_APPLICATION_MSWORD;
+            }
+        }
+    }
+
+    /* test for wordperfect files */
+    if (len >= 4) {
+        if ((cbuf[0] == (char) 0xff) && (cbuf[1] == 'W') && (cbuf[2] == 'P') 
+          && (cbuf[3] == 'C')) {
+            return MIME_TYPE_APPLICATION_WORDPERFECT5_1;
+        }
+    }
+
+    /* test for postscript files */
+    if (len >= 2) {
+        if ((cbuf[0] == '%') && (cbuf[1] == '!')) {
+            return MIME_TYPE_APPLICATION_POSTSCRIPT;
+        }
+    }
+
+    /* test for PDF files */
+    if (len >= 5) {
+        if ((cbuf[0] == '%') && (cbuf[1] == 'P') && (cbuf[2] == 'D') 
+          && (cbuf[3] == 'F') && (cbuf[4] == '-')) {
+            return MIME_TYPE_APPLICATION_PDF;
+        }
+    }
+
+    /* test for markup languages, first locating the first
+     * non-whitespace character */
+    while (isspace(*cbuf) && len) {
+        cbuf++;
+        len--;
+    }
+
+    /* TREC documents */
+    if (((len >= str_len("<doc>")) 
+        && !str_ncasecmp("<doc>", cbuf, str_len("<doc>")))) {
+        return MIME_TYPE_APPLICATION_X_TREC;
+    }
+
+    /* INEX documents */
+    if (((len >= str_len("<article>")) 
+        && !str_ncasecmp("<article>", cbuf, str_len("<article>")))) {
+        return MIME_TYPE_APPLICATION_X_INEX;
+    }
+
+    /* HTML */
+    if (((len >= str_len("<!doctype html")) 
+        && !str_ncasecmp("<!doctype html", cbuf, str_len("<!doctype html")))
+      || ((len >= str_len("<head")) 
+        && !str_ncasecmp("<head", cbuf, str_len("<head")))
+      || ((len >= str_len("<title")) 
+        && !str_ncasecmp("<title", cbuf, str_len("<title")))
+      || ((len >= str_len("<html")) 
+        && !str_ncasecmp("<html", cbuf, str_len("<html")))) {
+        return MIME_TYPE_TEXT_HTML;
+    }
+
+    /* SGML */
+    if (((len >= str_len("<!doctype ")) 
+        && !str_ncasecmp("<!doctype ", cbuf, str_len("<!doctype ")))
+      || ((len >= str_len("<subdoc")) 
+        && !str_ncasecmp("<subdoc", cbuf, str_len("<subdoc")))) {
+        return MIME_TYPE_TEXT_SGML;
+    }
+
+    /* XML */
+    if (((len >= str_len("<?xml")) 
+        && !str_ncasecmp("<?xml", cbuf, str_len("<?xml")))) {
+        return MIME_TYPE_TEXT_XML;
+    }
+
+    /* XXX: test for tar files */
+
+    return MIME_TYPE_APPLICATION_OCTET_STREAM;
+}
+
+enum mime_types mime_type(const char *str) {
+
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        goto a_label;
+
+    case 'c':
+    case 'C':
+        /* skip to prefix 'chemical/x-' */
+        if (!str_ncasecmp(str, "hemical/x-", 10)) {
+            str += 10;
+            goto chemical_x__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'i':
+    case 'I':
+        /* skip to prefix 'image/' */
+        if (!str_ncasecmp(str, "mage/", 5)) {
+            str += 5;
+            goto image__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'm':
+    case 'M':
+        goto m_label;
+
+    case 't':
+    case 'T':
+        /* skip to prefix 'text/' */
+        if (!str_ncasecmp(str, "ext/", 4)) {
+            str += 4;
+            goto text__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'v':
+    case 'V':
+        /* skip to prefix 'video/' */
+        if (!str_ncasecmp(str, "ideo/", 5)) {
+            str += 5;
+            goto video__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'x':
+    case 'X':
+        /* must be 'x-conference/x-cooltalk' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_X_CONFERENCE_X_COOLTALK].name[1])) {
+            return MIME_TYPE_X_CONFERENCE_X_COOLTALK;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+a_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* skip to prefix 'application/' */
+        if (!str_ncasecmp(str, "plication/", 10)) {
+            str += 10;
+            goto application__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'u':
+    case 'U':
+        /* skip to prefix 'audio/' */
+        if (!str_ncasecmp(str, "dio/", 4)) {
+            str += 4;
+            goto audio__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        goto application_a_label;
+
+    case 'c':
+    case 'C':
+        goto application_c_label;
+
+    case 'b':
+    case 'B':
+        goto application_b_label;
+
+    case 'e':
+    case 'E':
+        goto application_e_label;
+
+    case 'd':
+    case 'D':
+        goto application_d_label;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/font-tdpfr' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_FONT_TDPFR].name[13])) {
+            return MIME_TYPE_APPLICATION_FONT_TDPFR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'i':
+    case 'I':
+        goto application_i_label;
+
+    case 'h':
+    case 'H':
+        goto application_h_label;
+
+    case 'm':
+    case 'M':
+        goto application_m_label;
+
+    case 'o':
+    case 'O':
+        goto application_o_label;
+
+    case 'n':
+    case 'N':
+        /* skip to prefix 'application/news-' */
+        if (!str_ncasecmp(str, "ews-", 4)) {
+            str += 4;
+            goto application_news__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'q':
+    case 'Q':
+        /* must be 'application/qsig' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_QSIG].name[13])) {
+            return MIME_TYPE_APPLICATION_QSIG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        goto application_p_label;
+
+    case 's':
+    case 'S':
+        goto application_s_label;
+
+    case 'r':
+    case 'R':
+        goto application_r_label;
+
+    case 't':
+    case 'T':
+        /* skip to prefix 'application/timestamp-' */
+        if (!str_ncasecmp(str, "imestamp-", 9)) {
+            str += 9;
+            goto application_timestamp__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'w':
+    case 'W':
+        goto application_w_label;
+
+    case 'v':
+    case 'V':
+        goto application_v_label;
+
+    case 'x':
+    case 'X':
+        goto application_x_label;
+
+    case 'z':
+    case 'Z':
+        /* must be 'application/zip' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_ZIP].name[13])) {
+            return MIME_TYPE_APPLICATION_ZIP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_a_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'application/applefile' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_APPLEFILE].name[14])) {
+            return MIME_TYPE_APPLICATION_APPLEFILE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'c':
+    case 'C':
+        /* must be 'application/activemessage' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_ACTIVEMESSAGE].name[14])) {
+            return MIME_TYPE_APPLICATION_ACTIVEMESSAGE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/atomicmail' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_ATOMICMAIL].name[14])) {
+            return MIME_TYPE_APPLICATION_ATOMICMAIL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/andrew-inset' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_ANDREW_INSET].name[14])) {
+            return MIME_TYPE_APPLICATION_ANDREW_INSET;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_c_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/cals-1840' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_CALS_1840].name[14])) {
+            return MIME_TYPE_APPLICATION_CALS_1840;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'y':
+    case 'Y':
+        /* must be 'application/cybercash' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_CYBERCASH].name[14])) {
+            return MIME_TYPE_APPLICATION_CYBERCASH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/commonground' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_COMMONGROUND].name[14])) {
+            return MIME_TYPE_APPLICATION_COMMONGROUND;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_b_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/batch-smtp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_BATCH_SMTP].name[14])) {
+            return MIME_TYPE_APPLICATION_BATCH_SMTP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/beep+xml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_BEEP_XML].name[14])) {
+            return MIME_TYPE_APPLICATION_BEEP_XML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_e_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'application/eshop' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_ESHOP].name[14])) {
+            return MIME_TYPE_APPLICATION_ESHOP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* skip to prefix 'application/edi' */
+        if (!str_ncasecmp(str, "i", 1)) {
+            str += 1;
+            goto application_edi_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_edi_label:
+    switch (*str++) {
+    case '-':
+        goto application_edi__label;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/edifact' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_EDIFACT].name[16])) {
+            return MIME_TYPE_APPLICATION_EDIFACT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_edi__label:
+    switch (*str++) {
+    case 'x':
+    case 'X':
+        /* must be 'application/edi-x12' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_EDI_X12].name[17])) {
+            return MIME_TYPE_APPLICATION_EDI_X12;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'c':
+    case 'C':
+        /* must be 'application/edi-consent' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_EDI_CONSENT].name[17])) {
+            return MIME_TYPE_APPLICATION_EDI_CONSENT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_d_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/dca-rft' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_DCA_RFT].name[14])) {
+            return MIME_TYPE_APPLICATION_DCA_RFT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/dec-dx' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_DEC_DX].name[14])) {
+            return MIME_TYPE_APPLICATION_DEC_DX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* must be 'application/dvcs' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_DVCS].name[14])) {
+            return MIME_TYPE_APPLICATION_DVCS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_i_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'application/ipp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_IPP].name[14])) {
+            return MIME_TYPE_APPLICATION_IPP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/isup' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_ISUP].name[14])) {
+            return MIME_TYPE_APPLICATION_ISUP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/iotp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_IOTP].name[14])) {
+            return MIME_TYPE_APPLICATION_IOTP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* must be 'application/iges' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_IGES].name[14])) {
+            return MIME_TYPE_APPLICATION_IGES;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* skip to prefix 'application/index' */
+        if (!str_ncasecmp(str, "dex", 3)) {
+            str += 3;
+            goto application_index_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_index_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_INDEX;
+
+    case '.':
+        goto application_index__label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_index__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/index.cmd' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_INDEX_CMD].name[19])) {
+            return MIME_TYPE_APPLICATION_INDEX_CMD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/index.response' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_INDEX_RESPONSE].name[19])) {
+            return MIME_TYPE_APPLICATION_INDEX_RESPONSE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/index.obj' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_INDEX_OBJ].name[19])) {
+            return MIME_TYPE_APPLICATION_INDEX_OBJ;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* must be 'application/index.vnd' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_INDEX_VND].name[19])) {
+            return MIME_TYPE_APPLICATION_INDEX_VND;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_h_label:
+    switch (*str++) {
+    case 'y':
+    case 'Y':
+        /* must be 'application/hyperstudio' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_HYPERSTUDIO].name[14])) {
+            return MIME_TYPE_APPLICATION_HYPERSTUDIO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/http' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_HTTP].name[14])) {
+            return MIME_TYPE_APPLICATION_HTTP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_m_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        goto application_ma_label;
+
+    case 's':
+    case 'S':
+        /* must be 'application/msword' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_MSWORD].name[14])) {
+            return MIME_TYPE_APPLICATION_MSWORD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_ma_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        goto application_mac_label;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/marc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_MARC].name[15])) {
+            return MIME_TYPE_APPLICATION_MARC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* skip to prefix 'application/mathematica' */
+        if (!str_ncasecmp(str, "hematica", 8)) {
+            str += 8;
+            goto application_mathematica_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_mac_label:
+    switch (*str++) {
+    case '-':
+        goto application_mac__label;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/macwriteii' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_MACWRITEII].name[16])) {
+            return MIME_TYPE_APPLICATION_MACWRITEII;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_mac__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/mac-compactpro' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_MAC_COMPACTPRO].name[17])) {
+            return MIME_TYPE_APPLICATION_MAC_COMPACTPRO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'b':
+    case 'B':
+        /* must be 'application/mac-binhex40' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_MAC_BINHEX40].name[17])) {
+            return MIME_TYPE_APPLICATION_MAC_BINHEX40;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_mathematica_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_MATHEMATICA;
+
+    case '-':
+        /* must be 'application/mathematica-old' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_MATHEMATICA_OLD].name[24])) {
+            return MIME_TYPE_APPLICATION_MATHEMATICA_OLD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_o_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        goto application_oc_label;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/oda' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_ODA].name[14])) {
+            return MIME_TYPE_APPLICATION_ODA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* must be 'application/ogg' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_OGG].name[14])) {
+            return MIME_TYPE_APPLICATION_OGG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_oc_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* skip to prefix 'application/ocsp-re' */
+        if (!str_ncasecmp(str, "p-re", 4)) {
+            str += 4;
+            goto application_ocsp_re_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 't':
+    case 'T':
+        /* must be 'application/octet-stream' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_OCTET_STREAM].name[15])) {
+            return MIME_TYPE_APPLICATION_OCTET_STREAM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_ocsp_re_label:
+    switch (*str++) {
+    case 'q':
+    case 'Q':
+        /* must be 'application/ocsp-request' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_OCSP_REQUEST].name[20])) {
+            return MIME_TYPE_APPLICATION_OCSP_REQUEST;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/ocsp-response' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_OCSP_RESPONSE].name[20])) {
+            return MIME_TYPE_APPLICATION_OCSP_RESPONSE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_news__label:
+    switch (*str++) {
+    case 'm':
+    case 'M':
+        /* must be 'application/news-message-id' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_NEWS_MESSAGE_ID].name[18])) {
+            return MIME_TYPE_APPLICATION_NEWS_MESSAGE_ID;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/news-transmission' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_NEWS_TRANSMISSION].name[18])) {
+            return MIME_TYPE_APPLICATION_NEWS_TRANSMISSION;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_p_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/parityfec' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PARITYFEC].name[14])) {
+            return MIME_TYPE_APPLICATION_PARITYFEC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/pdf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PDF].name[14])) {
+            return MIME_TYPE_APPLICATION_PDF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* skip to prefix 'application/pgp-' */
+        if (!str_ncasecmp(str, "p-", 2)) {
+            str += 2;
+            goto application_pgp__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'k':
+    case 'K':
+        goto application_pk_label;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/postscript' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_POSTSCRIPT].name[14])) {
+            return MIME_TYPE_APPLICATION_POSTSCRIPT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* skip to prefix 'application/prs.' */
+        if (!str_ncasecmp(str, "s.", 2)) {
+            str += 2;
+            goto application_prs__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_pgp__label:
+    switch (*str++) {
+    case 'k':
+    case 'K':
+        /* must be 'application/pgp-keys' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PGP_KEYS].name[17])) {
+            return MIME_TYPE_APPLICATION_PGP_KEYS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/pgp-encrypted' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PGP_ENCRYPTED].name[17])) {
+            return MIME_TYPE_APPLICATION_PGP_ENCRYPTED;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/pgp-signature' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PGP_SIGNATURE].name[17])) {
+            return MIME_TYPE_APPLICATION_PGP_SIGNATURE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_pk_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* skip to prefix 'application/pkix' */
+        if (!str_ncasecmp(str, "x", 1)) {
+            str += 1;
+            goto application_pkix_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'c':
+    case 'C':
+        /* skip to prefix 'application/pkcs' */
+        if (!str_ncasecmp(str, "s", 1)) {
+            str += 1;
+            goto application_pkcs_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_pkix_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/pkixcmp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PKIXCMP].name[17])) {
+            return MIME_TYPE_APPLICATION_PKIXCMP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '-':
+        /* skip to prefix 'application/pkix-c' */
+        if (!str_ncasecmp(str, "c", 1)) {
+            str += 1;
+            goto application_pkix_c_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_pkix_c_label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        /* must be 'application/pkix-crl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PKIX_CRL].name[19])) {
+            return MIME_TYPE_APPLICATION_PKIX_CRL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/pkix-cert' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PKIX_CERT].name[19])) {
+            return MIME_TYPE_APPLICATION_PKIX_CERT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_pkcs_label:
+    switch (*str++) {
+    case '1':
+        /* must be 'application/pkcs10' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PKCS10].name[17])) {
+            return MIME_TYPE_APPLICATION_PKCS10;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '7':
+        /* skip to prefix 'application/pkcs7-' */
+        if (!str_ncasecmp(str, "-", 1)) {
+            str += 1;
+            goto application_pkcs7__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_pkcs7__label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'application/pkcs7-signature' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PKCS7_SIGNATURE].name[19])) {
+            return MIME_TYPE_APPLICATION_PKCS7_SIGNATURE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'application/pkcs7-mime' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PKCS7_MIME].name[19])) {
+            return MIME_TYPE_APPLICATION_PKCS7_MIME;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_prs__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/prs.alvestrand.titrax-sheet' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PRS_ALVESTRAND_TITRAX_SHEET].name[17])) {
+            return MIME_TYPE_APPLICATION_PRS_ALVESTRAND_TITRAX_SHEET;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'c':
+    case 'C':
+        /* must be 'application/prs.cww' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PRS_CWW].name[17])) {
+            return MIME_TYPE_APPLICATION_PRS_CWW;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/prs.nprend' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_PRS_NPREND].name[17])) {
+            return MIME_TYPE_APPLICATION_PRS_NPREND;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_s_label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* skip to prefix 'application/set-' */
+        if (!str_ncasecmp(str, "t-", 2)) {
+            str += 2;
+            goto application_set__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'd':
+    case 'D':
+        /* must be 'application/sdp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_SDP].name[14])) {
+            return MIME_TYPE_APPLICATION_SDP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* skip to prefix 'application/sgml' */
+        if (!str_ncasecmp(str, "ml", 2)) {
+            str += 2;
+            goto application_sgml_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'i':
+    case 'I':
+        /* must be 'application/sieve' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_SIEVE].name[14])) {
+            return MIME_TYPE_APPLICATION_SIEVE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'application/smil' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_SMIL].name[14])) {
+            return MIME_TYPE_APPLICATION_SMIL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'application/slate' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_SLATE].name[14])) {
+            return MIME_TYPE_APPLICATION_SLATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_set__label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* skip to prefix 'application/set-payment' */
+        if (!str_ncasecmp(str, "ayment", 6)) {
+            str += 6;
+            goto application_set_payment_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'r':
+    case 'R':
+        /* skip to prefix 'application/set-registration' */
+        if (!str_ncasecmp(str, "egistration", 11)) {
+            str += 11;
+            goto application_set_registration_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_set_payment_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_SET_PAYMENT;
+
+    case '-':
+        /* must be 'application/set-payment-initiation' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_SET_PAYMENT_INITIATION].name[24])) {
+            return MIME_TYPE_APPLICATION_SET_PAYMENT_INITIATION;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_set_registration_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_SET_REGISTRATION;
+
+    case '-':
+        /* must be 'application/set-registration-initiation' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_SET_REGISTRATION_INITIATION].name[29])) {
+            return MIME_TYPE_APPLICATION_SET_REGISTRATION_INITIATION;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_sgml_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_SGML;
+
+    case '-':
+        /* must be 'application/sgml-open-catalog' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_SGML_OPEN_CATALOG].name[17])) {
+            return MIME_TYPE_APPLICATION_SGML_OPEN_CATALOG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_r_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/riscos' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_RISCOS].name[14])) {
+            return MIME_TYPE_APPLICATION_RISCOS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/remote-printing' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_REMOTE_PRINTING].name[14])) {
+            return MIME_TYPE_APPLICATION_REMOTE_PRINTING;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/rtf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_RTF].name[14])) {
+            return MIME_TYPE_APPLICATION_RTF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_timestamp__label:
+    switch (*str++) {
+    case 'q':
+    case 'Q':
+        /* must be 'application/timestamp-query' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_TIMESTAMP_QUERY].name[23])) {
+            return MIME_TYPE_APPLICATION_TIMESTAMP_QUERY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/timestamp-reply' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_TIMESTAMP_REPLY].name[23])) {
+            return MIME_TYPE_APPLICATION_TIMESTAMP_REPLY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_w_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/wita' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_WITA].name[14])) {
+            return MIME_TYPE_APPLICATION_WITA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'h':
+    case 'H':
+        /* skip to prefix 'application/whoispp-' */
+        if (!str_ncasecmp(str, "oispp-", 6)) {
+            str += 6;
+            goto application_whoispp__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'o':
+    case 'O':
+        /* must be 'application/wordperfect5.1' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_WORDPERFECT5_1].name[14])) {
+            return MIME_TYPE_APPLICATION_WORDPERFECT5_1;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_whoispp__label:
+    switch (*str++) {
+    case 'q':
+    case 'Q':
+        /* must be 'application/whoispp-query' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_WHOISPP_QUERY].name[21])) {
+            return MIME_TYPE_APPLICATION_WHOISPP_QUERY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/whoispp-response' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_WHOISPP_RESPONSE].name[21])) {
+            return MIME_TYPE_APPLICATION_WHOISPP_RESPONSE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_v_label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* must be 'application/vemmi' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VEMMI].name[14])) {
+            return MIME_TYPE_APPLICATION_VEMMI;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* skip to prefix 'application/vnd.' */
+        if (!str_ncasecmp(str, "d.", 2)) {
+            str += 2;
+            goto application_vnd__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd__label:
+    switch (*str++) {
+    case '$':
+        /* must be 'application/vnd.$commerce_battelle' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_COMMERCE_BATTELLE].name[17])) {
+            return MIME_TYPE_APPLICATION_VND_COMMERCE_BATTELLE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '3':
+        /* must be 'application/vnd.3m.post-it-notes' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_3M_POST_IT_NOTES].name[17])) {
+            return MIME_TYPE_APPLICATION_VND_3M_POST_IT_NOTES;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'a':
+    case 'A':
+        goto application_vnd_a_label;
+
+    case 'c':
+    case 'C':
+        goto application_vnd_c_label;
+
+    case 'b':
+    case 'B':
+        goto application_vnd_b_label;
+
+    case 'e':
+    case 'E':
+        goto application_vnd_e_label;
+
+    case 'd':
+    case 'D':
+        goto application_vnd_d_label;
+
+    case 'g':
+    case 'G':
+        /* skip to prefix 'application/vnd.gr' */
+        if (!str_ncasecmp(str, "r", 1)) {
+            str += 1;
+            goto application_vnd_gr_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'f':
+    case 'F':
+        goto application_vnd_f_label;
+
+    case 'i':
+    case 'I':
+        goto application_vnd_i_label;
+
+    case 'h':
+    case 'H':
+        goto application_vnd_h_label;
+
+    case 'k':
+    case 'K':
+        /* must be 'application/vnd.koan' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_KOAN].name[17])) {
+            return MIME_TYPE_APPLICATION_VND_KOAN;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'j':
+    case 'J':
+        /* skip to prefix 'application/vnd.japannet-' */
+        if (!str_ncasecmp(str, "apannet-", 8)) {
+            str += 8;
+            goto application_vnd_japannet__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'm':
+    case 'M':
+        goto application_vnd_m_label;
+
+    case 'l':
+    case 'L':
+        /* skip to prefix 'application/vnd.lotus-' */
+        if (!str_ncasecmp(str, "otus-", 5)) {
+            str += 5;
+            goto application_vnd_lotus__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'o':
+    case 'O':
+        /* must be 'application/vnd.osa.netdeploy' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_OSA_NETDEPLOY].name[17])) {
+            return MIME_TYPE_APPLICATION_VND_OSA_NETDEPLOY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        goto application_vnd_n_label;
+
+    case 'p':
+    case 'P':
+        goto application_vnd_p_label;
+
+    case 's':
+    case 'S':
+        goto application_vnd_s_label;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.rapid' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_RAPID].name[17])) {
+            return MIME_TYPE_APPLICATION_VND_RAPID;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        goto application_vnd_u_label;
+
+    case 't':
+    case 'T':
+        goto application_vnd_t_label;
+
+    case 'w':
+    case 'W':
+        goto application_vnd_w_label;
+
+    case 'v':
+    case 'V':
+        goto application_vnd_v_label;
+
+    case 'y':
+    case 'Y':
+        /* must be 'application/vnd.yellowriver-custom-menu' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_YELLOWRIVER_CUSTOM_MENU].name[17])) {
+            return MIME_TYPE_APPLICATION_VND_YELLOWRIVER_CUSTOM_MENU;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'x':
+    case 'X':
+        goto application_vnd_x_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_a_label:
+    switch (*str++) {
+    case 'u':
+    case 'U':
+        /* must be 'application/vnd.audiograph' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_AUDIOGRAPH].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_AUDIOGRAPH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'c':
+    case 'C':
+        goto application_vnd_ac_label;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/vnd.aether.imp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_AETHER_IMP].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_AETHER_IMP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* skip to prefix 'application/vnd.anser-web-' */
+        if (!str_ncasecmp(str, "ser-web-", 8)) {
+            str += 8;
+            goto application_vnd_anser_web__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ac_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* skip to prefix 'application/vnd.accpac.simply.' */
+        if (!str_ncasecmp(str, "pac.simply.", 11)) {
+            str += 11;
+            goto application_vnd_accpac_simply__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'u':
+    case 'U':
+        /* must be 'application/vnd.acucobol' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ACUCOBOL].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_ACUCOBOL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_accpac_simply__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.accpac.simply.aso' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ACCPAC_SIMPLY_ASO].name[31])) {
+            return MIME_TYPE_APPLICATION_VND_ACCPAC_SIMPLY_ASO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.accpac.simply.imp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ACCPAC_SIMPLY_IMP].name[31])) {
+            return MIME_TYPE_APPLICATION_VND_ACCPAC_SIMPLY_IMP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_anser_web__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/vnd.anser-web-certificate-issue-initiation' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ANSER_WEB_CERTIFICATE_ISSUE_INITIATION].name[27])) {
+            return MIME_TYPE_APPLICATION_VND_ANSER_WEB_CERTIFICATE_ISSUE_INITIATION;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.anser-web-funds-transfer-initiation' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ANSER_WEB_FUNDS_TRANSFER_INITIATION].name[27])) {
+            return MIME_TYPE_APPLICATION_VND_ANSER_WEB_FUNDS_TRANSFER_INITIATION;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_c_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* skip to prefix 'application/vnd.canon-' */
+        if (!str_ncasecmp(str, "non-", 4)) {
+            str += 4;
+            goto application_vnd_canon__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'l':
+    case 'L':
+        /* must be 'application/vnd.claymore' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CLAYMORE].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_CLAYMORE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        goto application_vnd_co_label;
+
+    case 'u':
+    case 'U':
+        /* skip to prefix 'application/vnd.cups-' */
+        if (!str_ncasecmp(str, "ps-", 3)) {
+            str += 3;
+            goto application_vnd_cups__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.ctc-posml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CTC_POSML].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_CTC_POSML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'y':
+    case 'Y':
+        /* must be 'application/vnd.cybank' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CYBANK].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_CYBANK;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_canon__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/vnd.canon-cpdl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CANON_CPDL].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_CANON_CPDL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'application/vnd.canon-lips' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CANON_LIPS].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_CANON_LIPS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_co_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.cosmocaller' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_COSMOCALLER].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_COSMOCALLER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        goto application_vnd_com_label;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/vnd.contact.cmsg' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CONTACT_CMSG].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_CONTACT_CMSG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_com_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.comsocaller' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_COMSOCALLER].name[20])) {
+            return MIME_TYPE_APPLICATION_VND_COMSOCALLER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'application/vnd.commonspace' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_COMMONSPACE].name[20])) {
+            return MIME_TYPE_APPLICATION_VND_COMMONSPACE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_cups__label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'application/vnd.cups-postscript' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CUPS_POSTSCRIPT].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_CUPS_POSTSCRIPT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* skip to prefix 'application/vnd.cups-ra' */
+        if (!str_ncasecmp(str, "a", 1)) {
+            str += 1;
+            goto application_vnd_cups_ra_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_cups_ra_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.cups-raster' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CUPS_RASTER].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_CUPS_RASTER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/vnd.cups-raw' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_CUPS_RAW].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_CUPS_RAW;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_b_label:
+    switch (*str++) {
+    case 'u':
+    case 'U':
+        /* must be 'application/vnd.businessobjects' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_BUSINESSOBJECTS].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_BUSINESSOBJECTS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'application/vnd.bmi' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_BMI].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_BMI;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_e_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* skip to prefix 'application/vnd.epson.' */
+        if (!str_ncasecmp(str, "son.", 4)) {
+            str += 4;
+            goto application_vnd_epson__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'c':
+    case 'C':
+        goto application_vnd_ec_label;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.ericsson.quickcall' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ERICSSON_QUICKCALL].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_ERICSSON_QUICKCALL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        /* must be 'application/vnd.eudora.data' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_EUDORA_DATA].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_EUDORA_DATA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/vnd.enliven' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ENLIVEN].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_ENLIVEN;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_epson__label:
+    switch (*str++) {
+    case 'q':
+    case 'Q':
+        /* must be 'application/vnd.epson.quickanime' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_EPSON_QUICKANIME].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_EPSON_QUICKANIME;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'application/vnd.epson.msf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_EPSON_MSF].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_EPSON_MSF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        goto application_vnd_epson_s_label;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/vnd.epson.esf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_EPSON_ESF].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_EPSON_ESF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_epson_s_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.epson.salt' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_EPSON_SALT].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_EPSON_SALT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.epson.ssf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_EPSON_SSF].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_EPSON_SSF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ec_label:
+    switch (*str++) {
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.ecdis-update' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ECDIS_UPDATE].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_ECDIS_UPDATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* skip to prefix 'application/vnd.ecowin.' */
+        if (!str_ncasecmp(str, "win.", 4)) {
+            str += 4;
+            goto application_vnd_ecowin__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ecowin__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/vnd.ecowin.chart' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ECOWIN_CHART].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_ECOWIN_CHART;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* skip to prefix 'application/vnd.ecowin.series' */
+        if (!str_ncasecmp(str, "eries", 5)) {
+            str += 5;
+            goto application_vnd_ecowin_series_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'f':
+    case 'F':
+        /* skip to prefix 'application/vnd.ecowin.file' */
+        if (!str_ncasecmp(str, "ile", 3)) {
+            str += 3;
+            goto application_vnd_ecowin_file_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ecowin_series_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_ECOWIN_SERIES;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.ecowin.seriesrequest' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ECOWIN_SERIESREQUEST].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_ECOWIN_SERIESREQUEST;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        /* must be 'application/vnd.ecowin.seriesupdate' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ECOWIN_SERIESUPDATE].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_ECOWIN_SERIESUPDATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ecowin_file_label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.ecowin.filerequest' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ECOWIN_FILEREQUEST].name[28])) {
+            return MIME_TYPE_APPLICATION_VND_ECOWIN_FILEREQUEST;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        /* must be 'application/vnd.ecowin.fileupdate' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_ECOWIN_FILEUPDATE].name[28])) {
+            return MIME_TYPE_APPLICATION_VND_ECOWIN_FILEUPDATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_d_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'application/vnd.dpgraph' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_DPGRAPH].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_DPGRAPH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'x':
+    case 'X':
+        /* must be 'application/vnd.dxr' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_DXR].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_DXR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/vnd.dna' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_DNA].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_DNA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_gr_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.grafeq' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_GRAFEQ].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_GRAFEQ;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* skip to prefix 'application/vnd.groove-' */
+        if (!str_ncasecmp(str, "ove-", 4)) {
+            str += 4;
+            goto application_vnd_groove__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_groove__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.groove-account' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_GROOVE_ACCOUNT].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_GROOVE_ACCOUNT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'i':
+    case 'I':
+        goto application_vnd_groove_i_label;
+
+    case 't':
+    case 'T':
+        /* skip to prefix 'application/vnd.groove-tool-' */
+        if (!str_ncasecmp(str, "ool-", 4)) {
+            str += 4;
+            goto application_vnd_groove_tool__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'v':
+    case 'V':
+        /* must be 'application/vnd.groove-vcard' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_GROOVE_VCARD].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_GROOVE_VCARD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_groove_i_label:
+    switch (*str++) {
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.groove-identity-message' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_GROOVE_IDENTITY_MESSAGE].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_GROOVE_IDENTITY_MESSAGE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/vnd.groove-injector' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_GROOVE_INJECTOR].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_GROOVE_INJECTOR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_groove_tool__label:
+    switch (*str++) {
+    case 'm':
+    case 'M':
+        /* must be 'application/vnd.groove-tool-message' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_GROOVE_TOOL_MESSAGE].name[29])) {
+            return MIME_TYPE_APPLICATION_VND_GROOVE_TOOL_MESSAGE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.groove-tool-template' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_GROOVE_TOOL_TEMPLATE].name[29])) {
+            return MIME_TYPE_APPLICATION_VND_GROOVE_TOOL_TEMPLATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_f_label:
+    switch (*str++) {
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.fdf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FDF].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_FDF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.ffsns' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FFSNS].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_FFSNS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'application/vnd.flographit' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FLOGRAPHIT].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_FLOGRAPHIT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.fsc.weblaunch' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FSC_WEBLAUNCH].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_FSC_WEBLAUNCH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.framemaker' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FRAMEMAKER].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_FRAMEMAKER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        goto application_vnd_fu_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_fu_label:
+    switch (*str++) {
+    case 'j':
+    case 'J':
+        /* skip to prefix 'application/vnd.fuji' */
+        if (!str_ncasecmp(str, "i", 1)) {
+            str += 1;
+            goto application_vnd_fuji_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.fut-misnet' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FUT_MISNET].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_FUT_MISNET;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_fuji_label:
+    switch (*str++) {
+    case 'x':
+    case 'X':
+        /* skip to prefix 'application/vnd.fujixerox.d' */
+        if (!str_ncasecmp(str, "erox.d", 6)) {
+            str += 6;
+            goto application_vnd_fujixerox_d_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 't':
+    case 'T':
+        /* skip to prefix 'application/vnd.fujitsu.oasys' */
+        if (!str_ncasecmp(str, "su.oasys", 8)) {
+            str += 8;
+            goto application_vnd_fujitsu_oasys_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_fujixerox_d_label:
+    switch (*str++) {
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.fujixerox.ddd' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FUJIXEROX_DDD].name[28])) {
+            return MIME_TYPE_APPLICATION_VND_FUJIXEROX_DDD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* skip to prefix 'application/vnd.fujixerox.docuworks' */
+        if (!str_ncasecmp(str, "cuworks", 7)) {
+            str += 7;
+            goto application_vnd_fujixerox_docuworks_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_fujixerox_docuworks_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_FUJIXEROX_DOCUWORKS;
+
+    case '.':
+        /* must be 'application/vnd.fujixerox.docuworks.binder' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FUJIXEROX_DOCUWORKS_BINDER].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_FUJIXEROX_DOCUWORKS_BINDER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_fujitsu_oasys_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_FUJITSU_OASYS;
+
+    case 'p':
+    case 'P':
+        /* must be 'application/vnd.fujitsu.oasysprs' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FUJITSU_OASYSPRS].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_FUJITSU_OASYSPRS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '3':
+        /* must be 'application/vnd.fujitsu.oasys3' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FUJITSU_OASYS3].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_FUJITSU_OASYS3;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '2':
+        /* must be 'application/vnd.fujitsu.oasys2' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FUJITSU_OASYS2].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_FUJITSU_OASYS2;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* must be 'application/vnd.fujitsu.oasysgp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_FUJITSU_OASYSGP].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_FUJITSU_OASYSGP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_i_label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.irepository.package+xml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_IREPOSITORY_PACKAGE_XML].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_IREPOSITORY_PACKAGE_XML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'b':
+    case 'B':
+        /* skip to prefix 'application/vnd.ibm.' */
+        if (!str_ncasecmp(str, "m.", 2)) {
+            str += 2;
+            goto application_vnd_ibm__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.is-xpr' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_IS_XPR].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_IS_XPR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        goto application_vnd_in_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ibm__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.ibm.afplinedata' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_IBM_AFPLINEDATA].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_IBM_AFPLINEDATA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        goto application_vnd_ibm_m_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ibm_m_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.ibm.minipay' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_IBM_MINIPAY].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_IBM_MINIPAY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/vnd.ibm.modcap' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_IBM_MODCAP].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_IBM_MODCAP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_in_label:
+    switch (*str++) {
+    case 't':
+    case 'T':
+        goto application_vnd_int_label;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.informix-visionary' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_INFORMIX_VISIONARY].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_INFORMIX_VISIONARY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_int_label:
+    switch (*str++) {
+    case 'u':
+    case 'U':
+        /* skip to prefix 'application/vnd.intu.q' */
+        if (!str_ncasecmp(str, ".q", 2)) {
+            str += 2;
+            goto application_vnd_intu_q_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'e':
+    case 'E':
+        /* skip to prefix 'application/vnd.inter' */
+        if (!str_ncasecmp(str, "r", 1)) {
+            str += 1;
+            goto application_vnd_inter_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_intu_q_label:
+    switch (*str++) {
+    case 'b':
+    case 'B':
+        /* must be 'application/vnd.intu.qbo' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_INTU_QBO].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_INTU_QBO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.intu.qfx' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_INTU_QFX].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_INTU_QFX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_inter_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/vnd.intercon.formnet' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_INTERCON_FORMNET].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_INTERCON_FORMNET;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* skip to prefix 'application/vnd.intertrust.' */
+        if (!str_ncasecmp(str, "rust.", 5)) {
+            str += 5;
+            goto application_vnd_intertrust__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_intertrust__label:
+    switch (*str++) {
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.intertrust.digibox' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_INTERTRUST_DIGIBOX].name[28])) {
+            return MIME_TYPE_APPLICATION_VND_INTERTRUST_DIGIBOX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/vnd.intertrust.nncp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_INTERTRUST_NNCP].name[28])) {
+            return MIME_TYPE_APPLICATION_VND_INTERTRUST_NNCP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_h_label:
+    switch (*str++) {
+    case 'h':
+    case 'H':
+        /* must be 'application/vnd.hhe.lesson-player' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_HHE_LESSON_PLAYER].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_HHE_LESSON_PLAYER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'z':
+    case 'Z':
+        /* must be 'application/vnd.hzn-3d-crossword' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_HZN_3D_CROSSWORD].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_HZN_3D_CROSSWORD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.httphone' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_HTTPHONE].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_HTTPHONE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* skip to prefix 'application/vnd.hp-' */
+        if (!str_ncasecmp(str, "-", 1)) {
+            str += 1;
+            goto application_vnd_hp__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_hp__label:
+    switch (*str++) {
+    case 'h':
+    case 'H':
+        /* skip to prefix 'application/vnd.hp-hp' */
+        if (!str_ncasecmp(str, "p", 1)) {
+            str += 1;
+            goto application_vnd_hp_hp_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'p':
+    case 'P':
+        /* skip to prefix 'application/vnd.hp-pcl' */
+        if (!str_ncasecmp(str, "cl", 2)) {
+            str += 2;
+            goto application_vnd_hp_pcl_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_hp_hp_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.hp-hpid' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_HP_HPID].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_HP_HPID;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.hp-hps' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_HP_HPS].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_HP_HPS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* must be 'application/vnd.hp-hpgl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_HP_HPGL].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_HP_HPGL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_hp_pcl_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_HP_PCL;
+
+    case 'x':
+    case 'X':
+        /* must be 'application/vnd.hp-pclxl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_HP_PCLXL].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_HP_PCLXL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_japannet__label:
+    switch (*str++) {
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.japannet-directory-service' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_JAPANNET_DIRECTORY_SERVICE].name[26])) {
+            return MIME_TYPE_APPLICATION_VND_JAPANNET_DIRECTORY_SERVICE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'j':
+    case 'J':
+        /* must be 'application/vnd.japannet-jpnstore-wakeup' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_JAPANNET_JPNSTORE_WAKEUP].name[26])) {
+            return MIME_TYPE_APPLICATION_VND_JAPANNET_JPNSTORE_WAKEUP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'application/vnd.japannet-payment-wakeup' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_JAPANNET_PAYMENT_WAKEUP].name[26])) {
+            return MIME_TYPE_APPLICATION_VND_JAPANNET_PAYMENT_WAKEUP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.japannet-setstore-wakeup' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_JAPANNET_SETSTORE_WAKEUP].name[26])) {
+            return MIME_TYPE_APPLICATION_VND_JAPANNET_SETSTORE_WAKEUP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* skip to prefix 'application/vnd.japannet-registration' */
+        if (!str_ncasecmp(str, "egistration", 11)) {
+            str += 11;
+            goto application_vnd_japannet_registration_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'v':
+    case 'V':
+        /* skip to prefix 'application/vnd.japannet-verification' */
+        if (!str_ncasecmp(str, "erification", 11)) {
+            str += 11;
+            goto application_vnd_japannet_verification_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_japannet_registration_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_JAPANNET_REGISTRATION;
+
+    case '-':
+        /* must be 'application/vnd.japannet-registration-wakeup' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_JAPANNET_REGISTRATION_WAKEUP].name[38])) {
+            return MIME_TYPE_APPLICATION_VND_JAPANNET_REGISTRATION_WAKEUP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_japannet_verification_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_JAPANNET_VERIFICATION;
+
+    case '-':
+        /* must be 'application/vnd.japannet-verification-wakeup' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_JAPANNET_VERIFICATION_WAKEUP].name[38])) {
+            return MIME_TYPE_APPLICATION_VND_JAPANNET_VERIFICATION_WAKEUP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_m_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/vnd.mcd' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MCD].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_MCD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        goto application_vnd_me_label;
+
+    case 'i':
+    case 'I':
+        goto application_vnd_mi_label;
+
+    case 'o':
+    case 'O':
+        goto application_vnd_mo_label;
+
+    case 's':
+    case 'S':
+        goto application_vnd_ms_label;
+
+    case 'u':
+    case 'U':
+        /* skip to prefix 'application/vnd.music' */
+        if (!str_ncasecmp(str, "sic", 3)) {
+            str += 3;
+            goto application_vnd_music_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_me_label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.meridian-slingshot' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MERIDIAN_SLINGSHOT].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_MERIDIAN_SLINGSHOT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.mediastation.cdkey' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MEDIASTATION_CDKEY].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_MEDIASTATION_CDKEY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_mi_label:
+    switch (*str++) {
+    case 'n':
+    case 'N':
+        /* must be 'application/vnd.minisoft-hp3000-save' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MINISOFT_HP3000_SAVE].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_MINISOFT_HP3000_SAVE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.mitsubishi.misty-guard.trustweb' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MITSUBISHI_MISTY_GUARD_TRUSTWEB].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_MITSUBISHI_MISTY_GUARD_TRUSTWEB;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.mif' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MIF].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_MIF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_mo_label:
+    switch (*str++) {
+    case 'b':
+    case 'B':
+        /* skip to prefix 'application/vnd.mobius.' */
+        if (!str_ncasecmp(str, "ius.", 4)) {
+            str += 4;
+            goto application_vnd_mobius__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 't':
+    case 'T':
+        /* skip to prefix 'application/vnd.motorola.flexsuite' */
+        if (!str_ncasecmp(str, "orola.flexsuite", 15)) {
+            str += 15;
+            goto application_vnd_motorola_flexsuite_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'z':
+    case 'Z':
+        /* must be 'application/vnd.mozilla.xul+xml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOZILLA_XUL_XML].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_MOZILLA_XUL_XML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_mobius__label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'application/vnd.mobius.plc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOBIUS_PLC].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_MOBIUS_PLC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        goto application_vnd_mobius_m_label;
+
+    case 'd':
+    case 'D':
+        goto application_vnd_mobius_d_label;
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.mobius.txf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOBIUS_TXF].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_MOBIUS_TXF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_mobius_m_label:
+    switch (*str++) {
+    case 'q':
+    case 'Q':
+        /* must be 'application/vnd.mobius.mqy' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOBIUS_MQY].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_MOBIUS_MQY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.mobius.msl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOBIUS_MSL].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_MOBIUS_MSL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'b':
+    case 'B':
+        /* must be 'application/vnd.mobius.mbk' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOBIUS_MBK].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_MOBIUS_MBK;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_mobius_d_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.mobius.daf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOBIUS_DAF].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_MOBIUS_DAF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.mobius.dis' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOBIUS_DIS].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_MOBIUS_DIS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_motorola_flexsuite_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE;
+
+    case '.':
+        goto application_vnd_motorola_flexsuite__label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_motorola_flexsuite__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.motorola.flexsuite.adsi' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_ADSI].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_ADSI;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* must be 'application/vnd.motorola.flexsuite.gotap' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_GOTAP].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_GOTAP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.motorola.flexsuite.fis' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_FIS].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_FIS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'k':
+    case 'K':
+        /* must be 'application/vnd.motorola.flexsuite.kmr' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_KMR].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_KMR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.motorola.flexsuite.ttc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_TTC].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_TTC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/vnd.motorola.flexsuite.wem' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_WEM].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_MOTOROLA_FLEXSUITE_WEM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ms_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.msign' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MSIGN].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_MSIGN;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/vnd.mseq' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MSEQ].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_MSEQ;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '-':
+        goto application_vnd_ms__label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ms__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        goto application_vnd_ms_a_label;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/vnd.ms-excel' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MS_EXCEL].name[20])) {
+            return MIME_TYPE_APPLICATION_VND_MS_EXCEL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'application/vnd.ms-lrm' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MS_LRM].name[20])) {
+            return MIME_TYPE_APPLICATION_VND_MS_LRM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        goto application_vnd_ms_p_label;
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.ms-tnef' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MS_TNEF].name[20])) {
+            return MIME_TYPE_APPLICATION_VND_MS_TNEF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/vnd.ms-works' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MS_WORKS].name[20])) {
+            return MIME_TYPE_APPLICATION_VND_MS_WORKS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ms_a_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.ms-asf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MS_ASF].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_MS_ASF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.ms-artgalry' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MS_ARTGALRY].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_MS_ARTGALRY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_ms_p_label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.ms-project' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MS_PROJECT].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_MS_PROJECT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/vnd.ms-powerpoint' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MS_POWERPOINT].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_MS_POWERPOINT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_music_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.musician' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MUSICIAN].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_MUSICIAN;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '-':
+        /* must be 'application/vnd.music-niff' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_MUSIC_NIFF].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_MUSIC_NIFF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_lotus__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.lotus-approach' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_LOTUS_APPROACH].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_LOTUS_APPROACH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.lotus-freelance' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_LOTUS_FREELANCE].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_LOTUS_FREELANCE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/vnd.lotus-organizer' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_LOTUS_ORGANIZER].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_LOTUS_ORGANIZER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/vnd.lotus-notes' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_LOTUS_NOTES].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_LOTUS_NOTES;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '1':
+        /* must be 'application/vnd.lotus-1-2-3' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_LOTUS_1_2_3].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_LOTUS_1_2_3;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.lotus-screencam' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_LOTUS_SCREENCAM].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_LOTUS_SCREENCAM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/vnd.lotus-wordpro' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_LOTUS_WORDPRO].name[23])) {
+            return MIME_TYPE_APPLICATION_VND_LOTUS_WORDPRO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_n_label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* must be 'application/vnd.netfpx' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_NETFPX].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_NETFPX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        goto application_vnd_no_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_no_label:
+    switch (*str++) {
+    case 'b':
+    case 'B':
+        /* skip to prefix 'application/vnd.noblenet-' */
+        if (!str_ncasecmp(str, "lenet-", 6)) {
+            str += 6;
+            goto application_vnd_noblenet__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'v':
+    case 'V':
+        /* skip to prefix 'application/vnd.novadigm.e' */
+        if (!str_ncasecmp(str, "adigm.e", 7)) {
+            str += 7;
+            goto application_vnd_novadigm_e_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_noblenet__label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.noblenet-sealer' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_NOBLENET_SEALER].name[26])) {
+            return MIME_TYPE_APPLICATION_VND_NOBLENET_SEALER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.noblenet-directory' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_NOBLENET_DIRECTORY].name[26])) {
+            return MIME_TYPE_APPLICATION_VND_NOBLENET_DIRECTORY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/vnd.noblenet-web' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_NOBLENET_WEB].name[26])) {
+            return MIME_TYPE_APPLICATION_VND_NOBLENET_WEB;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_novadigm_e_label:
+    switch (*str++) {
+    case 'x':
+    case 'X':
+        /* must be 'application/vnd.novadigm.ext' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_NOVADIGM_EXT].name[27])) {
+            return MIME_TYPE_APPLICATION_VND_NOVADIGM_EXT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        goto application_vnd_novadigm_ed_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_novadigm_ed_label:
+    switch (*str++) {
+    case 'x':
+    case 'X':
+        /* must be 'application/vnd.novadigm.edx' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_NOVADIGM_EDX].name[28])) {
+            return MIME_TYPE_APPLICATION_VND_NOVADIGM_EDX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'application/vnd.novadigm.edm' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_NOVADIGM_EDM].name[28])) {
+            return MIME_TYPE_APPLICATION_VND_NOVADIGM_EDM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_p_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.palm' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_PALM].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_PALM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* skip to prefix 'application/vnd.pg.' */
+        if (!str_ncasecmp(str, ".", 1)) {
+            str += 1;
+            goto application_vnd_pg__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'o':
+    case 'O':
+        /* skip to prefix 'application/vnd.powerbuilder' */
+        if (!str_ncasecmp(str, "werbuilder", 10)) {
+            str += 10;
+            goto application_vnd_powerbuilder_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.previewsystems.box' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_PREVIEWSYSTEMS_BOX].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_PREVIEWSYSTEMS_BOX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        /* must be 'application/vnd.publishare-delta-tree' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_PUBLISHARE_DELTA_TREE].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_PUBLISHARE_DELTA_TREE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/vnd.pwg-xhtml-print+xml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_PWG_XHTML_PRINT_XML].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_PWG_XHTML_PRINT_XML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* must be 'application/vnd.pvi.ptid1' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_PVI_PTID1].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_PVI_PTID1;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_pg__label:
+    switch (*str++) {
+    case 'o':
+    case 'O':
+        /* must be 'application/vnd.pg.osasli' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_PG_OSASLI].name[20])) {
+            return MIME_TYPE_APPLICATION_VND_PG_OSASLI;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.pg.format' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_PG_FORMAT].name[20])) {
+            return MIME_TYPE_APPLICATION_VND_PG_FORMAT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_powerbuilder_label:
+    switch (*str++) {
+    case '7':
+        goto application_vnd_powerbuilder7_label;
+
+    case '6':
+        goto application_vnd_powerbuilder6_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_powerbuilder7_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_POWERBUILDER7;
+
+    case '5':
+        goto application_vnd_powerbuilder75_label;
+
+    case '-':
+        /* must be 'application/vnd.powerbuilder7-s' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_POWERBUILDER7_S].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_POWERBUILDER7_S;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_powerbuilder75_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_POWERBUILDER75;
+
+    case '-':
+        /* must be 'application/vnd.powerbuilder75-s' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_POWERBUILDER75_S].name[31])) {
+            return MIME_TYPE_APPLICATION_VND_POWERBUILDER75_S;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_powerbuilder6_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_POWERBUILDER6;
+
+    case '-':
+        /* must be 'application/vnd.powerbuilder6-s' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_POWERBUILDER6_S].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_POWERBUILDER6_S;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_s_label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* must be 'application/vnd.seemail' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SEEMAIL].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_SEEMAIL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'h':
+    case 'H':
+        /* skip to prefix 'application/vnd.shana.informed.' */
+        if (!str_ncasecmp(str, "ana.informed.", 13)) {
+            str += 13;
+            goto application_vnd_shana_informed__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 's':
+    case 'S':
+        /* skip to prefix 'application/vnd.sss-' */
+        if (!str_ncasecmp(str, "s-", 2)) {
+            str += 2;
+            goto application_vnd_sss__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case '3':
+        /* must be 'application/vnd.s3sms' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_S3SMS].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_S3SMS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        /* skip to prefix 'application/vnd.sun.xml.' */
+        if (!str_ncasecmp(str, "n.xml.", 6)) {
+            str += 6;
+            goto application_vnd_sun_xml__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.street-stream' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_STREET_STREAM].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_STREET_STREAM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/vnd.swiftview-ics' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SWIFTVIEW_ICS].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_SWIFTVIEW_ICS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* must be 'application/vnd.svd' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SVD].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_SVD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_shana_informed__label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.shana.informed.interchange' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_INTERCHANGE].name[32])) {
+            return MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_INTERCHANGE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'application/vnd.shana.informed.package' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_PACKAGE].name[32])) {
+            return MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_PACKAGE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* skip to prefix 'application/vnd.shana.informed.form' */
+        if (!str_ncasecmp(str, "orm", 3)) {
+            str += 3;
+            goto application_vnd_shana_informed_form_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_shana_informed_form_label:
+    switch (*str++) {
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.shana.informed.formdata' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_FORMDATA].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_FORMDATA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.shana.informed.formtemplate' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_FORMTEMPLATE].name[36])) {
+            return MIME_TYPE_APPLICATION_VND_SHANA_INFORMED_FORMTEMPLATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_sss__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/vnd.sss-cod' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SSS_COD].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_SSS_COD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.sss-dtf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SSS_DTF].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_SSS_DTF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/vnd.sss-ntf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SSS_NTF].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_SSS_NTF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_sun_xml__label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* skip to prefix 'application/vnd.sun.xml.impress' */
+        if (!str_ncasecmp(str, "mpress", 6)) {
+            str += 6;
+            goto application_vnd_sun_xml_impress_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'c':
+    case 'C':
+        /* skip to prefix 'application/vnd.sun.xml.calc' */
+        if (!str_ncasecmp(str, "alc", 3)) {
+            str += 3;
+            goto application_vnd_sun_xml_calc_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'm':
+    case 'M':
+        /* must be 'application/vnd.sun.xml.math' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SUN_XML_MATH].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_SUN_XML_MATH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* skip to prefix 'application/vnd.sun.xml.draw' */
+        if (!str_ncasecmp(str, "raw", 3)) {
+            str += 3;
+            goto application_vnd_sun_xml_draw_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'w':
+    case 'W':
+        /* skip to prefix 'application/vnd.sun.xml.writer' */
+        if (!str_ncasecmp(str, "riter", 5)) {
+            str += 5;
+            goto application_vnd_sun_xml_writer_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_sun_xml_impress_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_SUN_XML_IMPRESS;
+
+    case '.':
+        /* must be 'application/vnd.sun.xml.impress.template' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SUN_XML_IMPRESS_TEMPLATE].name[32])) {
+            return MIME_TYPE_APPLICATION_VND_SUN_XML_IMPRESS_TEMPLATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_sun_xml_calc_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_SUN_XML_CALC;
+
+    case '.':
+        /* must be 'application/vnd.sun.xml.calc.template' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SUN_XML_CALC_TEMPLATE].name[29])) {
+            return MIME_TYPE_APPLICATION_VND_SUN_XML_CALC_TEMPLATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_sun_xml_draw_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_SUN_XML_DRAW;
+
+    case '.':
+        /* must be 'application/vnd.sun.xml.draw.template' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SUN_XML_DRAW_TEMPLATE].name[29])) {
+            return MIME_TYPE_APPLICATION_VND_SUN_XML_DRAW_TEMPLATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_sun_xml_writer_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_SUN_XML_WRITER;
+
+    case '.':
+        goto application_vnd_sun_xml_writer__label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_sun_xml_writer__label:
+    switch (*str++) {
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.sun.xml.writer.template' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SUN_XML_WRITER_TEMPLATE].name[32])) {
+            return MIME_TYPE_APPLICATION_VND_SUN_XML_WRITER_TEMPLATE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* must be 'application/vnd.sun.xml.writer.global' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_SUN_XML_WRITER_GLOBAL].name[32])) {
+            return MIME_TYPE_APPLICATION_VND_SUN_XML_WRITER_GLOBAL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_u_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* skip to prefix 'application/vnd.uplanet.' */
+        if (!str_ncasecmp(str, "lanet.", 6)) {
+            str += 6;
+            goto application_vnd_uplanet__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.ufdl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_UFDL].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_UFDL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_uplanet__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* skip to prefix 'application/vnd.uplanet.alert' */
+        if (!str_ncasecmp(str, "lert", 4)) {
+            str += 4;
+            goto application_vnd_uplanet_alert_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.uplanet.signal' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_UPLANET_SIGNAL].name[25])) {
+            return MIME_TYPE_APPLICATION_VND_UPLANET_SIGNAL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'c':
+    case 'C':
+        goto application_vnd_uplanet_c_label;
+
+    case 'b':
+    case 'B':
+        /* skip to prefix 'application/vnd.uplanet.bearer-choice' */
+        if (!str_ncasecmp(str, "earer-choice", 12)) {
+            str += 12;
+            goto application_vnd_uplanet_bearer_choice_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'l':
+    case 'L':
+        /* skip to prefix 'application/vnd.uplanet.list' */
+        if (!str_ncasecmp(str, "ist", 3)) {
+            str += 3;
+            goto application_vnd_uplanet_list_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_uplanet_alert_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_UPLANET_ALERT;
+
+    case '-':
+        /* must be 'application/vnd.uplanet.alert-wbxml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_UPLANET_ALERT_WBXML].name[30])) {
+            return MIME_TYPE_APPLICATION_VND_UPLANET_ALERT_WBXML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_uplanet_c_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* skip to prefix 'application/vnd.uplanet.cacheop' */
+        if (!str_ncasecmp(str, "cheop", 5)) {
+            str += 5;
+            goto application_vnd_uplanet_cacheop_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'h':
+    case 'H':
+        /* skip to prefix 'application/vnd.uplanet.channel' */
+        if (!str_ncasecmp(str, "annel", 5)) {
+            str += 5;
+            goto application_vnd_uplanet_channel_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_uplanet_cacheop_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_UPLANET_CACHEOP;
+
+    case '-':
+        /* must be 'application/vnd.uplanet.cacheop-wbxml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_UPLANET_CACHEOP_WBXML].name[32])) {
+            return MIME_TYPE_APPLICATION_VND_UPLANET_CACHEOP_WBXML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_uplanet_channel_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_UPLANET_CHANNEL;
+
+    case '-':
+        /* must be 'application/vnd.uplanet.channel-wbxml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_UPLANET_CHANNEL_WBXML].name[32])) {
+            return MIME_TYPE_APPLICATION_VND_UPLANET_CHANNEL_WBXML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_uplanet_bearer_choice_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_UPLANET_BEARER_CHOICE;
+
+    case '-':
+        /* must be 'application/vnd.uplanet.bearer-choice-wbxml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_UPLANET_BEARER_CHOICE_WBXML].name[38])) {
+            return MIME_TYPE_APPLICATION_VND_UPLANET_BEARER_CHOICE_WBXML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_uplanet_list_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_UPLANET_LIST;
+
+    case 'c':
+    case 'C':
+        /* skip to prefix 'application/vnd.uplanet.listcmd' */
+        if (!str_ncasecmp(str, "md", 2)) {
+            str += 2;
+            goto application_vnd_uplanet_listcmd_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case '-':
+        /* must be 'application/vnd.uplanet.list-wbxml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_UPLANET_LIST_WBXML].name[29])) {
+            return MIME_TYPE_APPLICATION_VND_UPLANET_LIST_WBXML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_uplanet_listcmd_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_VND_UPLANET_LISTCMD;
+
+    case '-':
+        /* must be 'application/vnd.uplanet.listcmd-wbxml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_UPLANET_LISTCMD_WBXML].name[32])) {
+            return MIME_TYPE_APPLICATION_VND_UPLANET_LISTCMD_WBXML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_t_label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        goto application_vnd_tr_label;
+
+    case 'v':
+    case 'V':
+        /* must be 'application/vnd.tve-trigger' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_TVE_TRIGGER].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_TVE_TRIGGER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_tr_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.triscape.mxs' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_TRISCAPE_MXS].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_TRISCAPE_MXS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        /* skip to prefix 'application/vnd.true' */
+        if (!str_ncasecmp(str, "e", 1)) {
+            str += 1;
+            goto application_vnd_true_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_true_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.trueapp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_TRUEAPP].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_TRUEAPP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.truedoc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_TRUEDOC].name[21])) {
+            return MIME_TYPE_APPLICATION_VND_TRUEDOC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_w_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* skip to prefix 'application/vnd.wap.' */
+        if (!str_ncasecmp(str, "p.", 2)) {
+            str += 2;
+            goto application_vnd_wap__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'r':
+    case 'R':
+        /* must be 'application/vnd.wrq-hp3000-labelled' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_WRQ_HP3000_LABELLED].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_WRQ_HP3000_LABELLED;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/vnd.webturbo' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_WEBTURBO].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_WEBTURBO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/vnd.wt.stf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_WT_STF].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_WT_STF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_wap__label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        goto application_vnd_wap_s_label;
+
+    case 'w':
+    case 'W':
+        goto application_vnd_wap_w_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_wap_s_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/vnd.wap.sic' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_WAP_SIC].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_WAP_SIC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'application/vnd.wap.slc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_WAP_SLC].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_WAP_SLC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_wap_w_label:
+    switch (*str++) {
+    case 'b':
+    case 'B':
+        /* must be 'application/vnd.wap.wbxml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_WAP_WBXML].name[22])) {
+            return MIME_TYPE_APPLICATION_VND_WAP_WBXML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* skip to prefix 'application/vnd.wap.wml' */
+        if (!str_ncasecmp(str, "l", 1)) {
+            str += 1;
+            goto application_vnd_wap_wml_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_wap_wml_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/vnd.wap.wmlc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_WAP_WMLC].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_WAP_WMLC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.wap.wmlscriptc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_WAP_WMLSCRIPTC].name[24])) {
+            return MIME_TYPE_APPLICATION_VND_WAP_WMLSCRIPTC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_v_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        goto application_vnd_vi_label;
+
+    case 'c':
+    case 'C':
+        /* must be 'application/vnd.vcx' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_VCX].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_VCX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/vnd.vectorworks' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_VECTORWORKS].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_VECTORWORKS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_vi_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'application/vnd.visio' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_VISIO].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_VISIO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/vnd.vidsoft.vidconference' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_VIDSOFT_VIDCONFERENCE].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_VIDSOFT_VIDCONFERENCE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* must be 'application/vnd.vividence.scriptfile' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_VIVIDENCE_SCRIPTFILE].name[19])) {
+            return MIME_TYPE_APPLICATION_VND_VIVIDENCE_SCRIPTFILE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_vnd_x_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/vnd.xara' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_XARA].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_XARA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/vnd.xfdl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_VND_XFDL].name[18])) {
+            return MIME_TYPE_APPLICATION_VND_XFDL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_label:
+    switch (*str++) {
+    case 'h':
+    case 'H':
+        /* must be 'application/xhtml+xml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_XHTML_XML].name[14])) {
+            return MIME_TYPE_APPLICATION_XHTML_XML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* skip to prefix 'application/xml' */
+        if (!str_ncasecmp(str, "l", 1)) {
+            str += 1;
+            goto application_xml_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case '-':
+        goto application_x__label;
+
+    case '4':
+        /* must be 'application/x400-bp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X400_BP].name[14])) {
+            return MIME_TYPE_APPLICATION_X400_BP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_xml_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_XML;
+
+    case '-':
+        goto application_xml__label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_xml__label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* must be 'application/xml-external-parsed-entity' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_XML_EXTERNAL_PARSED_ENTITY].name[17])) {
+            return MIME_TYPE_APPLICATION_XML_EXTERNAL_PARSED_ENTITY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/xml-dtd' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_XML_DTD].name[17])) {
+            return MIME_TYPE_APPLICATION_XML_DTD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        goto application_x_c_label;
+
+    case 'b':
+    case 'B':
+        goto application_x_b_label;
+
+    case 'd':
+    case 'D':
+        goto application_x_d_label;
+
+    case 'g':
+    case 'G':
+        goto application_x_g_label;
+
+    case 'f':
+    case 'F':
+        /* must be 'application/x-futuresplash' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_FUTURESPLASH].name[15])) {
+            return MIME_TYPE_APPLICATION_X_FUTURESPLASH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'i':
+    case 'I':
+        /* must be 'application/x-inex' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_INEX].name[15])) {
+            return MIME_TYPE_APPLICATION_X_INEX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'h':
+    case 'H':
+        /* must be 'application/x-hdf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_HDF].name[15])) {
+            return MIME_TYPE_APPLICATION_X_HDF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'k':
+    case 'K':
+        goto application_x_k_label;
+
+    case 'j':
+    case 'J':
+        /* must be 'application/x-javascript' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_JAVASCRIPT].name[15])) {
+            return MIME_TYPE_APPLICATION_X_JAVASCRIPT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'application/x-latex' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_LATEX].name[15])) {
+            return MIME_TYPE_APPLICATION_X_LATEX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'application/x-netcdf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_NETCDF].name[15])) {
+            return MIME_TYPE_APPLICATION_X_NETCDF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        goto application_x_s_label;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/x-rpm' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_RPM].name[15])) {
+            return MIME_TYPE_APPLICATION_X_RPM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        /* must be 'application/x-ustar' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_USTAR].name[15])) {
+            return MIME_TYPE_APPLICATION_X_USTAR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        goto application_x_t_label;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/x-wais-source' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_WAIS_SOURCE].name[15])) {
+            return MIME_TYPE_APPLICATION_X_WAIS_SOURCE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_c_label:
+    switch (*str++) {
+    case 'h':
+    case 'H':
+        /* must be 'application/x-chess-pgn' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_CHESS_PGN].name[16])) {
+            return MIME_TYPE_APPLICATION_X_CHESS_PGN;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/x-csh' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_CSH].name[16])) {
+            return MIME_TYPE_APPLICATION_X_CSH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'application/x-cdlink' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_CDLINK].name[16])) {
+            return MIME_TYPE_APPLICATION_X_CDLINK;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/x-compress' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_COMPRESS].name[16])) {
+            return MIME_TYPE_APPLICATION_X_COMPRESS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'application/x-cpio' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_CPIO].name[16])) {
+            return MIME_TYPE_APPLICATION_X_CPIO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_b_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/x-bittorrent' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_BITTORRENT].name[16])) {
+            return MIME_TYPE_APPLICATION_X_BITTORRENT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'c':
+    case 'C':
+        /* must be 'application/x-bcpio' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_BCPIO].name[16])) {
+            return MIME_TYPE_APPLICATION_X_BCPIO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'z':
+    case 'Z':
+        /* must be 'application/x-bzip2' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_BZIP2].name[16])) {
+            return MIME_TYPE_APPLICATION_X_BZIP2;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_d_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'application/x-director' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_DIRECTOR].name[16])) {
+            return MIME_TYPE_APPLICATION_X_DIRECTOR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* must be 'application/x-dvi' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_DVI].name[16])) {
+            return MIME_TYPE_APPLICATION_X_DVI;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_g_label:
+    switch (*str++) {
+    case 'z':
+    case 'Z':
+        /* must be 'application/x-gzip' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_GZIP].name[16])) {
+            return MIME_TYPE_APPLICATION_X_GZIP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'application/x-gtar' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_GTAR].name[16])) {
+            return MIME_TYPE_APPLICATION_X_GTAR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_k_label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'application/x-kchart' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_KCHART].name[16])) {
+            return MIME_TYPE_APPLICATION_X_KCHART;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'i':
+    case 'I':
+        /* must be 'application/x-killustrator' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_KILLUSTRATOR].name[16])) {
+            return MIME_TYPE_APPLICATION_X_KILLUSTRATOR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/x-koan' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_KOAN].name[16])) {
+            return MIME_TYPE_APPLICATION_X_KOAN;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'application/x-kpresenter' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_KPRESENTER].name[16])) {
+            return MIME_TYPE_APPLICATION_X_KPRESENTER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/x-kspread' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_KSPREAD].name[16])) {
+            return MIME_TYPE_APPLICATION_X_KSPREAD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'application/x-kword' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_KWORD].name[16])) {
+            return MIME_TYPE_APPLICATION_X_KWORD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_s_label:
+    switch (*str++) {
+    case 'h':
+    case 'H':
+        goto application_x_sh_label;
+
+    case 't':
+    case 'T':
+        /* must be 'application/x-stuffit' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_STUFFIT].name[16])) {
+            return MIME_TYPE_APPLICATION_X_STUFFIT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* skip to prefix 'application/x-sv4c' */
+        if (!str_ncasecmp(str, "4c", 2)) {
+            str += 2;
+            goto application_x_sv4c_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_sh_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_X_SH;
+
+    case 'a':
+    case 'A':
+        /* must be 'application/x-shar' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_SHAR].name[17])) {
+            return MIME_TYPE_APPLICATION_X_SHAR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'application/x-shockwave-flash' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_SHOCKWAVE_FLASH].name[17])) {
+            return MIME_TYPE_APPLICATION_X_SHOCKWAVE_FLASH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_sv4c_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'application/x-sv4cpio' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_SV4CPIO].name[19])) {
+            return MIME_TYPE_APPLICATION_X_SV4CPIO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'application/x-sv4crc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_SV4CRC].name[19])) {
+            return MIME_TYPE_APPLICATION_X_SV4CRC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_t_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/x-tar' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_TAR].name[16])) {
+            return MIME_TYPE_APPLICATION_X_TAR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'c':
+    case 'C':
+        /* must be 'application/x-tcl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_TCL].name[16])) {
+            return MIME_TYPE_APPLICATION_X_TCL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        goto application_x_tr_label;
+
+    case 'e':
+    case 'E':
+        /* skip to prefix 'application/x-tex' */
+        if (!str_ncasecmp(str, "x", 1)) {
+            str += 1;
+            goto application_x_tex_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_tr_label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* must be 'application/x-trec' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_TREC].name[17])) {
+            return MIME_TYPE_APPLICATION_X_TREC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* skip to prefix 'application/x-troff' */
+        if (!str_ncasecmp(str, "ff", 2)) {
+            str += 2;
+            goto application_x_troff_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_troff_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_X_TROFF;
+
+    case '-':
+        /* skip to prefix 'application/x-troff-m' */
+        if (!str_ncasecmp(str, "m", 1)) {
+            str += 1;
+            goto application_x_troff_m_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_troff_m_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'application/x-troff-man' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_TROFF_MAN].name[22])) {
+            return MIME_TYPE_APPLICATION_X_TROFF_MAN;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'application/x-troff-ms' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_TROFF_MS].name[22])) {
+            return MIME_TYPE_APPLICATION_X_TROFF_MS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'application/x-troff-me' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_TROFF_ME].name[22])) {
+            return MIME_TYPE_APPLICATION_X_TROFF_ME;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+application_x_tex_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_APPLICATION_X_TEX;
+
+    case 'i':
+    case 'I':
+        /* must be 'application/x-texinfo' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_APPLICATION_X_TEXINFO].name[18])) {
+            return MIME_TYPE_APPLICATION_X_TEXINFO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio__label:
+    switch (*str++) {
+    case 'b':
+    case 'B':
+        /* must be 'audio/basic' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_BASIC].name[7])) {
+            return MIME_TYPE_AUDIO_BASIC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'audio/dat12' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_DAT12].name[7])) {
+            return MIME_TYPE_AUDIO_DAT12;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* must be 'audio/g.722.1' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_G_722_1].name[7])) {
+            return MIME_TYPE_AUDIO_G_722_1;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        goto audio_m_label;
+
+    case 'l':
+    case 'L':
+        goto audio_l_label;
+
+    case 'p':
+    case 'P':
+        goto audio_p_label;
+
+    case '3':
+        /* must be 'audio/32kadpcm' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_32KADPCM].name[7])) {
+            return MIME_TYPE_AUDIO_32KADPCM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        goto audio_t_label;
+
+    case 'v':
+    case 'V':
+        /* skip to prefix 'audio/vnd.' */
+        if (!str_ncasecmp(str, "nd.", 3)) {
+            str += 3;
+            goto audio_vnd__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'x':
+    case 'X':
+        /* skip to prefix 'audio/x-' */
+        if (!str_ncasecmp(str, "-", 1)) {
+            str += 1;
+            goto audio_x__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_m_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'audio/midi' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_MIDI].name[8])) {
+            return MIME_TYPE_AUDIO_MIDI;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        goto audio_mp_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_mp_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'audio/mpa-robust' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_MPA_ROBUST].name[9])) {
+            return MIME_TYPE_AUDIO_MPA_ROBUST;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'audio/mpeg' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_MPEG].name[9])) {
+            return MIME_TYPE_AUDIO_MPEG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '4':
+        /* must be 'audio/mp4a-latm' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_MP4A_LATM].name[9])) {
+            return MIME_TYPE_AUDIO_MP4A_LATM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_l_label:
+    switch (*str++) {
+    case '1':
+        /* must be 'audio/l16' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_L16].name[8])) {
+            return MIME_TYPE_AUDIO_L16;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '2':
+        goto audio_l2_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_l2_label:
+    switch (*str++) {
+    case '0':
+        /* must be 'audio/l20' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_L20].name[9])) {
+            return MIME_TYPE_AUDIO_L20;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '4':
+        /* must be 'audio/l24' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_L24].name[9])) {
+            return MIME_TYPE_AUDIO_L24;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_p_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'audio/parityfec' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_PARITYFEC].name[8])) {
+            return MIME_TYPE_AUDIO_PARITYFEC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'audio/prs.sid' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_PRS_SID].name[8])) {
+            return MIME_TYPE_AUDIO_PRS_SID;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_t_label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* must be 'audio/telephone-event' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_TELEPHONE_EVENT].name[8])) {
+            return MIME_TYPE_AUDIO_TELEPHONE_EVENT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'audio/tone' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_TONE].name[8])) {
+            return MIME_TYPE_AUDIO_TONE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_vnd__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        goto audio_vnd_c_label;
+
+    case 'e':
+    case 'E':
+        /* must be 'audio/vnd.everad.plj' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_EVERAD_PLJ].name[11])) {
+            return MIME_TYPE_AUDIO_VND_EVERAD_PLJ;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'audio/vnd.digital-winds' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_DIGITAL_WINDS].name[11])) {
+            return MIME_TYPE_AUDIO_VND_DIGITAL_WINDS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'audio/vnd.lucent.voice' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_LUCENT_VOICE].name[11])) {
+            return MIME_TYPE_AUDIO_VND_LUCENT_VOICE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'audio/vnd.octel.sbc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_OCTEL_SBC].name[11])) {
+            return MIME_TYPE_AUDIO_VND_OCTEL_SBC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        goto audio_vnd_n_label;
+
+    case 'q':
+    case 'Q':
+        /* must be 'audio/vnd.qcelp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_QCELP].name[11])) {
+            return MIME_TYPE_AUDIO_VND_QCELP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'audio/vnd.rhetorex.32kadpcm' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_RHETOREX_32KADPCM].name[11])) {
+            return MIME_TYPE_AUDIO_VND_RHETOREX_32KADPCM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* must be 'audio/vnd.vmx.cvsd' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_VMX_CVSD].name[11])) {
+            return MIME_TYPE_AUDIO_VND_VMX_CVSD;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_vnd_c_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'audio/vnd.cisco.nse' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_CISCO_NSE].name[12])) {
+            return MIME_TYPE_AUDIO_VND_CISCO_NSE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* skip to prefix 'audio/vnd.cns.' */
+        if (!str_ncasecmp(str, "s.", 2)) {
+            str += 2;
+            goto audio_vnd_cns__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_vnd_cns__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'audio/vnd.cns.anp1' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_CNS_ANP1].name[15])) {
+            return MIME_TYPE_AUDIO_VND_CNS_ANP1;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'i':
+    case 'I':
+        /* must be 'audio/vnd.cns.inf1' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_CNS_INF1].name[15])) {
+            return MIME_TYPE_AUDIO_VND_CNS_INF1;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_vnd_n_label:
+    switch (*str++) {
+    case 'u':
+    case 'U':
+        /* skip to prefix 'audio/vnd.nuera.ecelp' */
+        if (!str_ncasecmp(str, "era.ecelp", 9)) {
+            str += 9;
+            goto audio_vnd_nuera_ecelp_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'o':
+    case 'O':
+        /* must be 'audio/vnd.nortel.vbk' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_NORTEL_VBK].name[12])) {
+            return MIME_TYPE_AUDIO_VND_NORTEL_VBK;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_vnd_nuera_ecelp_label:
+    switch (*str++) {
+    case '9':
+        /* must be 'audio/vnd.nuera.ecelp9600' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_NUERA_ECELP9600].name[22])) {
+            return MIME_TYPE_AUDIO_VND_NUERA_ECELP9600;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '4':
+        /* must be 'audio/vnd.nuera.ecelp4800' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_NUERA_ECELP4800].name[22])) {
+            return MIME_TYPE_AUDIO_VND_NUERA_ECELP4800;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '7':
+        /* must be 'audio/vnd.nuera.ecelp7470' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_VND_NUERA_ECELP7470].name[22])) {
+            return MIME_TYPE_AUDIO_VND_NUERA_ECELP7470;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+audio_x__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'audio/x-aiff' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_X_AIFF].name[9])) {
+            return MIME_TYPE_AUDIO_X_AIFF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'audio/x-pn-realaudio' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_X_PN_REALAUDIO].name[9])) {
+            return MIME_TYPE_AUDIO_X_PN_REALAUDIO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'audio/x-realaudio' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_X_REALAUDIO].name[9])) {
+            return MIME_TYPE_AUDIO_X_REALAUDIO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'audio/x-mpegurl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_X_MPEGURL].name[9])) {
+            return MIME_TYPE_AUDIO_X_MPEGURL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'audio/x-wav' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_AUDIO_X_WAV].name[9])) {
+            return MIME_TYPE_AUDIO_X_WAV;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+chemical_x__label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'chemical/x-pdb' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_CHEMICAL_X_PDB].name[12])) {
+            return MIME_TYPE_CHEMICAL_X_PDB;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'x':
+    case 'X':
+        /* must be 'chemical/x-xyz' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_CHEMICAL_X_XYZ].name[12])) {
+            return MIME_TYPE_CHEMICAL_X_XYZ;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'image/cgm' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_CGM].name[7])) {
+            return MIME_TYPE_IMAGE_CGM;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'b':
+    case 'B':
+        /* must be 'image/bmp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_BMP].name[7])) {
+            return MIME_TYPE_IMAGE_BMP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        goto image_g_label;
+
+    case 'i':
+    case 'I':
+        /* must be 'image/ief' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_IEF].name[7])) {
+            return MIME_TYPE_IMAGE_IEF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'j':
+    case 'J':
+        /* must be 'image/jpeg' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_JPEG].name[7])) {
+            return MIME_TYPE_IMAGE_JPEG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'image/naplps' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_NAPLPS].name[7])) {
+            return MIME_TYPE_IMAGE_NAPLPS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        goto image_p_label;
+
+    case 't':
+    case 'T':
+        /* must be 'image/tiff' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_TIFF].name[7])) {
+            return MIME_TYPE_IMAGE_TIFF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        /* skip to prefix 'image/vnd.' */
+        if (!str_ncasecmp(str, "nd.", 3)) {
+            str += 3;
+            goto image_vnd__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'x':
+    case 'X':
+        /* skip to prefix 'image/x-' */
+        if (!str_ncasecmp(str, "-", 1)) {
+            str += 1;
+            goto image_x__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_g_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'image/gif' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_GIF].name[8])) {
+            return MIME_TYPE_IMAGE_GIF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '3':
+        /* must be 'image/g3fax' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_G3FAX].name[8])) {
+            return MIME_TYPE_IMAGE_G3FAX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_p_label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        /* skip to prefix 'image/prs.' */
+        if (!str_ncasecmp(str, "s.", 2)) {
+            str += 2;
+            goto image_prs__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'n':
+    case 'N':
+        /* must be 'image/png' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_PNG].name[8])) {
+            return MIME_TYPE_IMAGE_PNG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_prs__label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'image/prs.pti' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_PRS_PTI].name[11])) {
+            return MIME_TYPE_IMAGE_PRS_PTI;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'b':
+    case 'B':
+        /* must be 'image/prs.btif' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_PRS_BTIF].name[11])) {
+            return MIME_TYPE_IMAGE_PRS_BTIF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_vnd__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        /* must be 'image/vnd.cns.inf2' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_CNS_INF2].name[11])) {
+            return MIME_TYPE_IMAGE_VND_CNS_INF2;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        goto image_vnd_d_label;
+
+    case 'f':
+    case 'F':
+        goto image_vnd_f_label;
+
+    case 'm':
+    case 'M':
+        /* must be 'image/vnd.mix' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_MIX].name[11])) {
+            return MIME_TYPE_IMAGE_VND_MIX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'image/vnd.net-fpx' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_NET_FPX].name[11])) {
+            return MIME_TYPE_IMAGE_VND_NET_FPX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'image/vnd.svf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_SVF].name[11])) {
+            return MIME_TYPE_IMAGE_VND_SVF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'image/vnd.wap.wbmp' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_WAP_WBMP].name[11])) {
+            return MIME_TYPE_IMAGE_VND_WAP_WBMP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'x':
+    case 'X':
+        /* must be 'image/vnd.xiff' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_XIFF].name[11])) {
+            return MIME_TYPE_IMAGE_VND_XIFF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_vnd_d_label:
+    switch (*str++) {
+    case 'x':
+    case 'X':
+        /* must be 'image/vnd.dxf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_DXF].name[12])) {
+            return MIME_TYPE_IMAGE_VND_DXF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'j':
+    case 'J':
+        /* must be 'image/vnd.djvu' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_DJVU].name[12])) {
+            return MIME_TYPE_IMAGE_VND_DJVU;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'image/vnd.dwg' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_DWG].name[12])) {
+            return MIME_TYPE_IMAGE_VND_DWG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_vnd_f_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'image/vnd.fastbidsheet' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_FASTBIDSHEET].name[12])) {
+            return MIME_TYPE_IMAGE_VND_FASTBIDSHEET;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'image/vnd.fpx' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_FPX].name[12])) {
+            return MIME_TYPE_IMAGE_VND_FPX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'image/vnd.fst' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_FST].name[12])) {
+            return MIME_TYPE_IMAGE_VND_FST;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'u':
+    case 'U':
+        /* skip to prefix 'image/vnd.fujixerox.edmics-' */
+        if (!str_ncasecmp(str, "jixerox.edmics-", 15)) {
+            str += 15;
+            goto image_vnd_fujixerox_edmics__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_vnd_fujixerox_edmics__label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        /* must be 'image/vnd.fujixerox.edmics-rlc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_FUJIXEROX_EDMICS_RLC].name[28])) {
+            return MIME_TYPE_IMAGE_VND_FUJIXEROX_EDMICS_RLC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'image/vnd.fujixerox.edmics-mmr' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_VND_FUJIXEROX_EDMICS_MMR].name[28])) {
+            return MIME_TYPE_IMAGE_VND_FUJIXEROX_EDMICS_MMR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_x__label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* skip to prefix 'image/x-portable-' */
+        if (!str_ncasecmp(str, "ortable-", 8)) {
+            str += 8;
+            goto image_x_portable__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'c':
+    case 'C':
+        /* must be 'image/x-cmu-raster' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_CMU_RASTER].name[9])) {
+            return MIME_TYPE_IMAGE_X_CMU_RASTER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'image/x-rgb' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_RGB].name[9])) {
+            return MIME_TYPE_IMAGE_X_RGB;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'x':
+    case 'X':
+        goto image_x_x_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_x_portable__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'image/x-portable-anymap' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_PORTABLE_ANYMAP].name[18])) {
+            return MIME_TYPE_IMAGE_X_PORTABLE_ANYMAP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'image/x-portable-pixmap' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_PORTABLE_PIXMAP].name[18])) {
+            return MIME_TYPE_IMAGE_X_PORTABLE_PIXMAP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'b':
+    case 'B':
+        /* must be 'image/x-portable-bitmap' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_PORTABLE_BITMAP].name[18])) {
+            return MIME_TYPE_IMAGE_X_PORTABLE_BITMAP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        /* must be 'image/x-portable-graymap' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_PORTABLE_GRAYMAP].name[18])) {
+            return MIME_TYPE_IMAGE_X_PORTABLE_GRAYMAP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+image_x_x_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'image/x-xpixmap' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_XPIXMAP].name[10])) {
+            return MIME_TYPE_IMAGE_X_XPIXMAP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'b':
+    case 'B':
+        /* must be 'image/x-xbitmap' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_XBITMAP].name[10])) {
+            return MIME_TYPE_IMAGE_X_XBITMAP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* must be 'image/x-xwindowdump' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_IMAGE_X_XWINDOWDUMP].name[10])) {
+            return MIME_TYPE_IMAGE_X_XWINDOWDUMP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+m_label:
+    switch (*str++) {
+    case 'u':
+    case 'U':
+        /* skip to prefix 'multipart/' */
+        if (!str_ncasecmp(str, "ltipart/", 8)) {
+            str += 8;
+            goto multipart__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'e':
+    case 'E':
+        /* skip to prefix 'message/' */
+        if (!str_ncasecmp(str, "ssage/", 6)) {
+            str += 6;
+            goto message__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'o':
+    case 'O':
+        /* skip to prefix 'model/' */
+        if (!str_ncasecmp(str, "del/", 4)) {
+            str += 4;
+            goto model__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+multipart__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        goto multipart_a_label;
+
+    case 'b':
+    case 'B':
+        /* must be 'multipart/byteranges' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_BYTERANGES].name[11])) {
+            return MIME_TYPE_MULTIPART_BYTERANGES;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'multipart/encrypted' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_ENCRYPTED].name[11])) {
+            return MIME_TYPE_MULTIPART_ENCRYPTED;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'multipart/digest' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_DIGEST].name[11])) {
+            return MIME_TYPE_MULTIPART_DIGEST;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'multipart/form-data' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_FORM_DATA].name[11])) {
+            return MIME_TYPE_MULTIPART_FORM_DATA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'h':
+    case 'H':
+        /* must be 'multipart/header-set' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_HEADER_SET].name[11])) {
+            return MIME_TYPE_MULTIPART_HEADER_SET;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'multipart/mixed' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_MIXED].name[11])) {
+            return MIME_TYPE_MULTIPART_MIXED;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'multipart/parallel' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_PARALLEL].name[11])) {
+            return MIME_TYPE_MULTIPART_PARALLEL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'multipart/signed' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_SIGNED].name[11])) {
+            return MIME_TYPE_MULTIPART_SIGNED;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* skip to prefix 'multipart/re' */
+        if (!str_ncasecmp(str, "e", 1)) {
+            str += 1;
+            goto multipart_re_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'v':
+    case 'V':
+        /* must be 'multipart/voice-message' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_VOICE_MESSAGE].name[11])) {
+            return MIME_TYPE_MULTIPART_VOICE_MESSAGE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+multipart_a_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'multipart/appledouble' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_APPLEDOUBLE].name[12])) {
+            return MIME_TYPE_MULTIPART_APPLEDOUBLE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'multipart/alternative' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_ALTERNATIVE].name[12])) {
+            return MIME_TYPE_MULTIPART_ALTERNATIVE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+multipart_re_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'multipart/report' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_REPORT].name[13])) {
+            return MIME_TYPE_MULTIPART_REPORT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'multipart/related' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MULTIPART_RELATED].name[13])) {
+            return MIME_TYPE_MULTIPART_RELATED;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+message__label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* must be 'message/external-body' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MESSAGE_EXTERNAL_BODY].name[9])) {
+            return MIME_TYPE_MESSAGE_EXTERNAL_BODY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        goto message_d_label;
+
+    case 'h':
+    case 'H':
+        /* must be 'message/http' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MESSAGE_HTTP].name[9])) {
+            return MIME_TYPE_MESSAGE_HTTP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'message/news' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MESSAGE_NEWS].name[9])) {
+            return MIME_TYPE_MESSAGE_NEWS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* must be 'message/partial' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MESSAGE_PARTIAL].name[9])) {
+            return MIME_TYPE_MESSAGE_PARTIAL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'message/s-http' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MESSAGE_S_HTTP].name[9])) {
+            return MIME_TYPE_MESSAGE_S_HTTP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'message/rfc822' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MESSAGE_RFC822].name[9])) {
+            return MIME_TYPE_MESSAGE_RFC822;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+message_d_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'message/disposition-notification' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MESSAGE_DISPOSITION_NOTIFICATION].name[10])) {
+            return MIME_TYPE_MESSAGE_DISPOSITION_NOTIFICATION;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'message/delivery-status' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MESSAGE_DELIVERY_STATUS].name[10])) {
+            return MIME_TYPE_MESSAGE_DELIVERY_STATUS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+model__label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'model/iges' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_IGES].name[7])) {
+            return MIME_TYPE_MODEL_IGES;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'model/mesh' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_MESH].name[7])) {
+            return MIME_TYPE_MODEL_MESH;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'v':
+    case 'V':
+        goto model_v_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+model_v_label:
+    switch (*str++) {
+    case 'r':
+    case 'R':
+        /* must be 'model/vrml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VRML].name[8])) {
+            return MIME_TYPE_MODEL_VRML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* skip to prefix 'model/vnd.' */
+        if (!str_ncasecmp(str, "d.", 2)) {
+            str += 2;
+            goto model_vnd__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+model_vnd__label:
+    switch (*str++) {
+    case 'd':
+    case 'D':
+        /* must be 'model/vnd.dwf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_DWF].name[11])) {
+            return MIME_TYPE_MODEL_VND_DWF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'g':
+    case 'G':
+        goto model_vnd_g_label;
+
+    case 'f':
+    case 'F':
+        /* must be 'model/vnd.flatland.3dml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_FLATLAND_3DML].name[11])) {
+            return MIME_TYPE_MODEL_VND_FLATLAND_3DML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'model/vnd.mts' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_MTS].name[11])) {
+            return MIME_TYPE_MODEL_VND_MTS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        /* skip to prefix 'model/vnd.parasolid.transmit.' */
+        if (!str_ncasecmp(str, "arasolid.transmit.", 18)) {
+            str += 18;
+            goto model_vnd_parasolid_transmit__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'v':
+    case 'V':
+        /* must be 'model/vnd.vtu' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_VTU].name[11])) {
+            return MIME_TYPE_MODEL_VND_VTU;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+model_vnd_g_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'model/vnd.gs-gdl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_GS_GDL].name[12])) {
+            return MIME_TYPE_MODEL_VND_GS_GDL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'model/vnd.gdl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_GDL].name[12])) {
+            return MIME_TYPE_MODEL_VND_GDL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'model/vnd.gtw' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_GTW].name[12])) {
+            return MIME_TYPE_MODEL_VND_GTW;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+model_vnd_parasolid_transmit__label:
+    switch (*str++) {
+    case 'b':
+    case 'B':
+        /* must be 'model/vnd.parasolid.transmit.binary' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_PARASOLID_TRANSMIT_BINARY].name[30])) {
+            return MIME_TYPE_MODEL_VND_PARASOLID_TRANSMIT_BINARY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'model/vnd.parasolid.transmit.text' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_MODEL_VND_PARASOLID_TRANSMIT_TEXT].name[30])) {
+            return MIME_TYPE_MODEL_VND_PARASOLID_TRANSMIT_TEXT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text__label:
+    switch (*str++) {
+    case 'c':
+    case 'C':
+        goto text_c_label;
+
+    case 'e':
+    case 'E':
+        /* must be 'text/enriched' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_ENRICHED].name[6])) {
+            return MIME_TYPE_TEXT_ENRICHED;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'text/directory' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_DIRECTORY].name[6])) {
+            return MIME_TYPE_TEXT_DIRECTORY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'h':
+    case 'H':
+        /* must be 'text/html' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_HTML].name[6])) {
+            return MIME_TYPE_TEXT_HTML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        goto text_p_label;
+
+    case 's':
+    case 'S':
+        /* must be 'text/sgml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_SGML].name[6])) {
+            return MIME_TYPE_TEXT_SGML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        goto text_r_label;
+
+    case 'u':
+    case 'U':
+        /* must be 'text/uri-list' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_URI_LIST].name[6])) {
+            return MIME_TYPE_TEXT_URI_LIST;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        goto text_t_label;
+
+    case 'v':
+    case 'V':
+        /* skip to prefix 'text/vnd.' */
+        if (!str_ncasecmp(str, "nd.", 3)) {
+            str += 3;
+            goto text_vnd__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'x':
+    case 'X':
+        goto text_x_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_c_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'text/calendar' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_CALENDAR].name[7])) {
+            return MIME_TYPE_TEXT_CALENDAR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'text/css' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_CSS].name[7])) {
+            return MIME_TYPE_TEXT_CSS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_p_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'text/parityfec' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_PARITYFEC].name[7])) {
+            return MIME_TYPE_TEXT_PARITYFEC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'r':
+    case 'R':
+        /* must be 'text/prs.lines.tag' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_PRS_LINES_TAG].name[7])) {
+            return MIME_TYPE_TEXT_PRS_LINES_TAG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'text/plain' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_PLAIN].name[7])) {
+            return MIME_TYPE_TEXT_PLAIN;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_r_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'text/richtext' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_RICHTEXT].name[7])) {
+            return MIME_TYPE_TEXT_RICHTEXT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'text/rtf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_RTF].name[7])) {
+            return MIME_TYPE_TEXT_RTF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        /* must be 'text/rfc822-headers' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_RFC822_HEADERS].name[7])) {
+            return MIME_TYPE_TEXT_RFC822_HEADERS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_t_label:
+    switch (*str++) {
+    case '1':
+        /* must be 'text/t140' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_T140].name[7])) {
+            return MIME_TYPE_TEXT_T140;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'a':
+    case 'A':
+        /* must be 'text/tab-separated-values' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_TAB_SEPARATED_VALUES].name[7])) {
+            return MIME_TYPE_TEXT_TAB_SEPARATED_VALUES;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd__label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'text/vnd.abc' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_ABC].name[10])) {
+            return MIME_TYPE_TEXT_VND_ABC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'c':
+    case 'C':
+        /* must be 'text/vnd.curl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_CURL].name[10])) {
+            return MIME_TYPE_TEXT_VND_CURL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'd':
+    case 'D':
+        /* must be 'text/vnd.dmclientscript' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_DMCLIENTSCRIPT].name[10])) {
+            return MIME_TYPE_TEXT_VND_DMCLIENTSCRIPT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'f':
+    case 'F':
+        goto text_vnd_f_label;
+
+    case 'i':
+    case 'I':
+        goto text_vnd_i_label;
+
+    case 'm':
+    case 'M':
+        goto text_vnd_m_label;
+
+    case 'l':
+    case 'L':
+        /* must be 'text/vnd.latex-z' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_LATEX_Z].name[10])) {
+            return MIME_TYPE_TEXT_VND_LATEX_Z;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'w':
+    case 'W':
+        /* skip to prefix 'text/vnd.wap.' */
+        if (!str_ncasecmp(str, "ap.", 3)) {
+            str += 3;
+            goto text_vnd_wap__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_f_label:
+    switch (*str++) {
+    case 'm':
+    case 'M':
+        /* must be 'text/vnd.fmi.flexstor' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_FMI_FLEXSTOR].name[11])) {
+            return MIME_TYPE_TEXT_VND_FMI_FLEXSTOR;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        goto text_vnd_fl_label;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_fl_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'text/vnd.flatland.3dml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_FLATLAND_3DML].name[12])) {
+            return MIME_TYPE_TEXT_VND_FLATLAND_3DML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'y':
+    case 'Y':
+        /* must be 'text/vnd.fly' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_FLY].name[12])) {
+            return MIME_TYPE_TEXT_VND_FLY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_i_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* skip to prefix 'text/vnd.iptc.n' */
+        if (!str_ncasecmp(str, "tc.n", 4)) {
+            str += 4;
+            goto text_vnd_iptc_n_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'n':
+    case 'N':
+        /* skip to prefix 'text/vnd.in3d.' */
+        if (!str_ncasecmp(str, "3d.", 3)) {
+            str += 3;
+            goto text_vnd_in3d__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_iptc_n_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'text/vnd.iptc.nitf' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_IPTC_NITF].name[16])) {
+            return MIME_TYPE_TEXT_VND_IPTC_NITF;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'e':
+    case 'E':
+        /* must be 'text/vnd.iptc.newsml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_IPTC_NEWSML].name[16])) {
+            return MIME_TYPE_TEXT_VND_IPTC_NEWSML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_in3d__label:
+    switch (*str++) {
+    case '3':
+        /* must be 'text/vnd.in3d.3dml' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_IN3D_3DML].name[15])) {
+            return MIME_TYPE_TEXT_VND_IN3D_3DML;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 's':
+    case 'S':
+        /* must be 'text/vnd.in3d.spot' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_IN3D_SPOT].name[15])) {
+            return MIME_TYPE_TEXT_VND_IN3D_SPOT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_m_label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'text/vnd.ms-mediapackage' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_MS_MEDIAPACKAGE].name[11])) {
+            return MIME_TYPE_TEXT_VND_MS_MEDIAPACKAGE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'text/vnd.motorola.reflex' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_MOTOROLA_REFLEX].name[11])) {
+            return MIME_TYPE_TEXT_VND_MOTOROLA_REFLEX;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_wap__label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        goto text_vnd_wap_s_label;
+
+    case 'w':
+    case 'W':
+        /* skip to prefix 'text/vnd.wap.wml' */
+        if (!str_ncasecmp(str, "ml", 2)) {
+            str += 2;
+            goto text_vnd_wap_wml_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_wap_s_label:
+    switch (*str++) {
+    case 'i':
+    case 'I':
+        /* must be 'text/vnd.wap.si' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_WAP_SI].name[15])) {
+            return MIME_TYPE_TEXT_VND_WAP_SI;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'l':
+    case 'L':
+        /* must be 'text/vnd.wap.sl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_WAP_SL].name[15])) {
+            return MIME_TYPE_TEXT_VND_WAP_SL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_vnd_wap_wml_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_TEXT_VND_WAP_WML;
+
+    case 's':
+    case 'S':
+        /* must be 'text/vnd.wap.wmlscript' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_VND_WAP_WMLSCRIPT].name[17])) {
+            return MIME_TYPE_TEXT_VND_WAP_WMLSCRIPT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_x_label:
+    switch (*str++) {
+    case 'm':
+    case 'M':
+        /* skip to prefix 'text/xml' */
+        if (!str_ncasecmp(str, "l", 1)) {
+            str += 1;
+            goto text_xml_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case '-':
+        /* must be 'text/x-setext' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_X_SETEXT].name[7])) {
+            return MIME_TYPE_TEXT_X_SETEXT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+text_xml_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_TEXT_XML;
+
+    case '-':
+        /* must be 'text/xml-external-parsed-entity' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_TEXT_XML_EXTERNAL_PARSED_ENTITY].name[9])) {
+            return MIME_TYPE_TEXT_XML_EXTERNAL_PARSED_ENTITY;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+video__label:
+    switch (*str++) {
+    case 'q':
+    case 'Q':
+        /* must be 'video/quicktime' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_QUICKTIME].name[7])) {
+            return MIME_TYPE_VIDEO_QUICKTIME;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'p':
+    case 'P':
+        goto video_p_label;
+
+    case 'm':
+    case 'M':
+        /* skip to prefix 'video/mp' */
+        if (!str_ncasecmp(str, "p", 1)) {
+            str += 1;
+            goto video_mp_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'x':
+    case 'X':
+        /* skip to prefix 'video/x-' */
+        if (!str_ncasecmp(str, "-", 1)) {
+            str += 1;
+            goto video_x__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    case 'v':
+    case 'V':
+        /* skip to prefix 'video/vnd.' */
+        if (!str_ncasecmp(str, "nd.", 3)) {
+            str += 3;
+            goto video_vnd__label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+video_p_label:
+    switch (*str++) {
+    case 'a':
+    case 'A':
+        /* must be 'video/parityfec' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_PARITYFEC].name[8])) {
+            return MIME_TYPE_VIDEO_PARITYFEC;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* must be 'video/pointer' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_POINTER].name[8])) {
+            return MIME_TYPE_VIDEO_POINTER;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+video_mp_label:
+    switch (*str++) {
+    case 'e':
+    case 'E':
+        /* must be 'video/mpeg' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_MPEG].name[9])) {
+            return MIME_TYPE_VIDEO_MPEG;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case '4':
+        /* must be 'video/mp4v-es' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_MP4V_ES].name[9])) {
+            return MIME_TYPE_VIDEO_MP4V_ES;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+video_x__label:
+    switch (*str++) {
+    case 's':
+    case 'S':
+        /* must be 'video/x-sgi-movie' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_X_SGI_MOVIE].name[9])) {
+            return MIME_TYPE_VIDEO_X_SGI_MOVIE;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        /* must be 'video/x-msvideo' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_X_MSVIDEO].name[9])) {
+            return MIME_TYPE_VIDEO_X_MSVIDEO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+video_vnd__label:
+    switch (*str++) {
+    case 'v':
+    case 'V':
+        /* must be 'video/vnd.vivo' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_VND_VIVO].name[11])) {
+            return MIME_TYPE_VIDEO_VND_VIVO;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'n':
+    case 'N':
+        /* must be 'video/vnd.nokia.interleaved-multimedia' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_VND_NOKIA_INTERLEAVED_MULTIMEDIA].name[11])) {
+            return MIME_TYPE_VIDEO_VND_NOKIA_INTERLEAVED_MULTIMEDIA;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'm':
+    case 'M':
+        goto video_vnd_m_label;
+
+    case 'f':
+    case 'F':
+        /* must be 'video/vnd.fvt' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_VND_FVT].name[11])) {
+            return MIME_TYPE_VIDEO_VND_FVT;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+video_vnd_m_label:
+    switch (*str++) {
+    case 'p':
+    case 'P':
+        /* must be 'video/vnd.mpegurl' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_VND_MPEGURL].name[12])) {
+            return MIME_TYPE_VIDEO_VND_MPEGURL;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 't':
+    case 'T':
+        /* must be 'video/vnd.mts' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_VND_MTS].name[12])) {
+            return MIME_TYPE_VIDEO_VND_MTS;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    case 'o':
+    case 'O':
+        /* skip to prefix 'video/vnd.motorola.video' */
+        if (!str_ncasecmp(str, "torola.video", 12)) {
+            str += 12;
+            goto video_vnd_motorola_video_label;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+
+video_vnd_motorola_video_label:
+    switch (*str++) {
+    case '\0':
+        return MIME_TYPE_VIDEO_VND_MOTOROLA_VIDEO;
+
+    case 'p':
+    case 'P':
+        /* must be 'video/vnd.motorola.videop' or unrecognised */
+        if (!str_casecmp(str, 
+          &lookup[MIME_TYPE_VIDEO_VND_MOTOROLA_VIDEOP].name[25])) {
+            return MIME_TYPE_VIDEO_VND_MOTOROLA_VIDEOP;
+        } else {
+            return MIME_TYPE_UNKNOWN_UNKNOWN;
+        }
+        break;
+
+    default: 
+        return MIME_TYPE_UNKNOWN_UNKNOWN;
+    }
+}
+
+#ifdef MIME_TEST
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "str.h"
+
+int main() {
+    char buf[BUFSIZ + 1];
+    enum mime_types mtype;
+
+    while (fgets(buf, BUFSIZ, stdin)) {
+        str_rtrim(buf);
+        mtype = mime_type(str_ltrim(buf));
+        printf("%s\n", mime_string(mtype));
+    }
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
diff --git a/src/mlparse.c b/src/mlparse.c
new file mode 100644 (file)
index 0000000..3c91c1a
--- /dev/null
@@ -0,0 +1,4472 @@
+/* mlparse.c implements the parser declared in mlparse.h
+ *
+ * If you want to figure out how this works, you're probably best off
+ * compiling the program at the bottom of this file and running it over some
+ * data (need to #define MLPARSE_TEST).
+ *
+ * there are two main components to understanding the code,
+ * understanding the buffering and understanding the state machine
+ * (if you don't know what a state machine is, go find out).  
+ *
+ * The whole business of parsing SGML/XML/HTML is complicated by the fact that
+ * almost nobody writes it correctly.  As such, we can't just accept structures
+ * like open tags and open comments as correct, we need to verify that they will
+ * actually close.  This requires us to examine characters further ahead in the
+ * stream than we are currently parsing.  Since our interface doesn't guarantee
+ * that they are available in advance, we have to be prepared to buffer a 
+ * certain number of characters internally.  This complicates things a lot,
+ * because we now sometimes have two sources of characters (internal and 
+ * external buffers) and sometimes have two seperate positions (current parsing
+ * position and current look-ahead position) in the character stream that we 
+ * have to maintain.  Throughout the code i have referred to this look-ahead
+ * process as 'peek'ing.  This process can only be performed forward until we
+ * run out of buffer space, so state->lookahead limits the amount of characters
+ * that can be passed over this way.  In the peek'ing states, the number of
+ * characters peek'd over is recorded in the state->count variable, which MUST
+ * record all characters passed over, so we know that they'll fit in the buffer.
+ * (note that i actually break this slightly for the eref peek, but we only 
+ * allow very short erefs).  The buffer is implemented by the state->buf 
+ * (current  buffer), state->tmpbuf (spare buffer), state->pos 
+ * (position in current buffer) and state->end (end of data in current buffer)
+ * variables within the state structure.  state->pos and state->end dictate how
+ * much data is in the buffer, and must both be placed at the start of the 
+ * buffer if no buffered data is available (simplifies the buffering process).
+ * state->tmpbuf is used for miscellaneous purposes, including copying buffered
+ * data into it to make it contiguous.  This occurs if we don't have enough
+ * space in the current buffer for text that we want to add to it.  At the end
+ * of each peek'ing process we want to ensure that the text we have looked over
+ * is either all in the internal buffer, or all in the external buffer (and
+ * hence contiguous).  This means that in states where we know that we've
+ * already parsed the data we are looking at, we don't have to worry about
+ * testing for the end of the stream until we hit the end delimiter.  Note that
+ * although buffering is necessary for the correct operation of the parser, the
+ * assumption is that large buffers are available and that buffering will be
+ * fairly rare.  Thus our optimisation efforts are directed toward the case
+ * where buffering is extremely rare, ensuring only that buffering works when
+ * required.  Non-stripping operation is likewise supported but not considered
+ * important for performance purposes.
+ *
+ * Another set of design decisions had to be made about what constitutes markup,
+ * especially in the cases where it doesn't quite conform to the standards.
+ * Particular situations that cropped up were what to accept in a tag name, 
+ * (we accept the XML/SGML name character set) where to allow whitespace in
+ * structural elements (tags: anywhere but straight after '<', comments: not in
+ * '<!--' or '-->', cdata: not in '<![' or ']]>', entity references: not 
+ * allowed).  I beleive that valid SGML tags aren't allowed whitespace 
+ * immediately after the start tag, although its a little hard to tell from
+ * casual inspection of the productions.
+ *
+ * The state machine is implemented as a set of states (declared in enum
+ * mlparse_states) and a set of flags (in enum mlparse_flags).  The flags are
+ * supposed to be orthogonal to the states, so that pretty much any set of flags
+ * can occur in any state (this isn't true of FLAG_COMMENT and FLAG_CDATA, but
+ * close enough).  The JUMP macro implements a mapping between states and flags
+ * and the bits of code that implement operations for that state.  In this way,
+ * different, specialised bits of code can handle the same state when different
+ * flags are in effect, as happens to the word parsing states when FLAG_COMMENT
+ * or FLAG_CDATA is on.  This could also be used to optimise away some of the
+ * overhead of buffering/stripping (both of which weren't in the previous
+ * version of this parser) by specialising the most used states so that they
+ * don't have to use conditionals to determine whether stripping/buffering are
+ * on.  However, states that are connected by direct goto statements (pretty
+ * much anything not seperated by peek states, which must use JUMP statements to
+ * exit given the uncertainty of where they came from) have to be consistent in
+ * their assumptions of what flags are enabled.  One technique that i have used
+ * to reduce the bulk of the code is to use macro's and indirect blocks of code
+ * that appear as 'transitional' states (marked with trans_).  The macros are
+ * fairly self-evident (and commented), but in some cases the inline replacement
+ * of macros was bulking up the code a lot.  In these situations i expanded the
+ * macros in only a few places in the code (typically in a trans_ block of
+ * code), using local variables in the trans union to pass parameters, and then
+ * used a stub macro to marshall parameters and jump to the indirect macro
+ * location.
+ *
+ * A major design decision in the code was to allow 'floating' states, that act
+ * sort of like functions in that you can jump to them from anywhere in the code
+ * and they return through (an extremely) limited stack mechanism.  The stack is
+ * the state->next_state variable, which specifies how the 'floating' states are
+ * to exit.  The 'floating' states are those that detect/process entity
+ * references/tags/other entities, since they can occur in a number of contexts,
+ * and keeping track of exactly what the context is without this technique is
+ * extremely difficult.  However, since only one next_state variable is
+ * available, only one 'floating' state can be active at a time.  This caused
+ * some minor issues with the end sentence detection, which i initially tried to
+ * implement as a 'floating' state, but couldn't as that raised scenarios when i
+ * wanted two floating states active at one time (like 'word.&nbsp;', where the
+ * transition from end sentence state to entity reference state causes us to
+ * kill the next_state value that the end sentence state relies upon.
+ *
+ * The code could be improved in many ways:
+ *   - specialise some states (especially the toplevel word detection states)
+ *     for stripping and non-buffering for performance
+ *   - allow multi-character entity references (not necessary at the moment,
+ *     since we only allow HTML and numeric erefs, which only reference a single
+ *     character).  This could be implemented by loading st->count with the
+ *     number of escaped characters and counting down in escape states.  This
+ *     would probably require that esc becomes a flag as discussed below.
+ *   - do a better job of detection of entity references (using a trie,
+ *     probably) and numeric character decoding (anything other than strtol).
+ *     Same thing applies to recognition of marked sections.  This will become
+ *     much more important if you want to recognise custom entity references.
+ *   - most of the CASE macros should be moved to a more central bit of code,
+ *     since they are useful for more than just here.  It would also be an
+ *     improvement if the characters were turned into numbers so that it will
+ *     work identically on non-ASCII machines.
+ *   - further character analysis (maybe?).  This would complicate things, but
+ *     better output might be obtained by breaking words across characters like
+ *     '/' (which seems to unequivocally represent an alternative in english
+ *     text) and by allowing (double) quotes between sentence ending punctuation
+ *     and whitespace (which i tried but removed to reduce complexity).
+ *   - escape (almost certainly) and end sentence (maybe) should be flags.  They
+ *     aren't because of lack of foresight by me and the fact that turning end
+ *     sentence into a flag could contention over the next_state variable as
+ *     discussed above.
+ *   - declarations could be handled properly, which would assist in comment
+ *     resolution stuff.  It isn't particularly hard either, just a bit more
+ *     work.  However, theres a bit of a conflict between SGML and XML here, in
+ *     that XML expects comments to be a single entity.  The SGML comment is
+ *     more general, and solves some problems with whitespace in comment
+ *     start/end.  Somewhat harder along the same lines is to allow DTD 
+ *     declarations using the <!DTD [ ]> syntax, since it involves detecting 
+ *     tags within tags.
+ *   - mark EOF as a flag, so that user only has to call EOF once.
+ *     Unfortunately this may require a lot more in the way of states to handle
+ *     properly.
+ *   - sort out what should/shouldn't be filtered from parameter names (+
+ *     implicit values)
+ *   - self-ending tags (i.e. <p/>) are truncated for the end tag return if the
+ *     name goes over wordlen chars
+ *   - explicit end-tag notification (simple to do, just not done because i
+ *     didn't want to make it less efficient)
+ *
+ * A few more random notes about the code:
+ *   - length has to be assigned before using RETURN().  I've assigned it
+ *     immediately before use so you can use grep to validate this (a frequent
+ *     source of bugs not to assign length before RETURN()).
+ *
+ * FIXME: include (at least conceptual) state diagrams
+ *
+ * written nml 2004-04-10
+ *
+ */
+
+/* XXX: should decouple buffer size and lookahead so fill_buffer can scale up */
+
+/* test: */
+/* XXX: vary buffer size and compare outputs */
+
+#include "firstinclude.h" 
+
+#include "mlparse.h"
+
+#include "ascii.h" 
+#include "def.h" 
+#include "str.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* the maximum number of characters that we recognise entity references over */
+#define MAXENTITYREF 8
+
+/* flags that store additional state about the parsing */
+enum mlparse_flags {
+    FLAG_NONE = 0,                  /* no flags */
+    FLAG_STRIP = 1,                 /* flag indicating that junk can be 
+                                     * stripped out while parsing.  Note that
+                                     * strip is never set in the flags, its
+                                     * passed by the user at every invocation,
+                                     * so it can change between each call. */
+    FLAG_BUFFER = 2,                /* indicates that bytes have been stored in 
+                                     * the internal buffer */
+    FLAG_COMMENT = 4,               /* indicates that we're in a comment */
+    FLAG_CDATA = 8,                 /* indicates that we're in a cdata sec. */
+
+    /* entry to allow us to mask in/out flags easily */
+    FLAG_ALL = FLAG_STRIP | FLAG_BUFFER | FLAG_COMMENT | FLAG_CDATA,
+    FLAG_BITS = 4                   /* number of flag bits (MUST keep this up 
+                                     * to date) */
+};
+
+/* states that we can be in when we enter the parser */
+enum mlparse_states {
+    STATE_ERR = 0,                    /* error state */
+
+    /* states based on words */
+    STATE_TOPLEVEL = 1,               /* not in any HTML entities or words */
+    STATE_WORD = 2,                   /* in a word */
+    STATE_WORD_ENDS = 3,              /* in a word, after sentence-ending
+                                       * punctuation */
+    STATE_PUNC = 6,                   /* in a word, after punctuation */
+    STATE_PUNC_ENDS = 7,              /* in a word, after sentence ending 
+                                       * punctuation, after punctuation*/
+    STATE_ACRONYM = 8,                /* in an acronym, after capital letter */
+    STATE_ACRONYM_LETTER = 9,         /* in an acronym, after a period */
+    STATE_SPACE = 10,                 /* in whitespace */
+
+    /* states based on tags */
+    STATE_TAG_PEEK_FIRST = 20,        /* looking ahead to validate a tag, 
+                                       * expecting first letter of tag name (or
+                                       * '!' or '?' or '/' depending on what it
+                                       * is) */
+    STATE_TAG_PEEK_NAME = 21,         /* looking ahead to validate a tag, 
+                                       * parsing the tag name after first 
+                                       * char */
+    STATE_TAG_PEEK_NAME_CONT = 22,    /* looking ahead to validate a tag,
+                                       * parsing tag name after its exceeded
+                                       * wordlen characters */
+    STATE_TAG_PEEK = 23,              /* looking ahead to validate a tag, 
+                                       * after the tag name */
+    STATE_TAG_ENTRY = 24,             /* in a tag from start once 
+                                       * validated */
+    STATE_TAG_NAME_CONT = 25,         /* in a tag name after 
+                                       * continuation */
+    STATE_TAG_NAME_SELFEND = 26,      /* in a tag that may self-end during 
+                                       * name */ 
+    STATE_TAG = 27,                   /* in a tag after name */
+    STATE_TAG_SELFEND = 28,           /* in a tag that may self-end */
+
+    /* states based on parameters/values */
+    STATE_PARAM = 30,                 /* in a parameter name */
+    STATE_PARAM_EQ = 31,              /* after parameter name */
+    STATE_PVAL_FIRST = 32,            /* at the first char of a pval */
+    STATE_PVAL = 33,                  /* in a whitespace-delimited pval */
+    STATE_PVAL_PUNC = 35,             /* in a whitespace-delimited pval, after 
+                                       * puncation */
+    STATE_PVAL_SELFEND = 36,          /* in a whitespace-delimited pval, after 
+                                       * a / may self-end the tag */
+    STATE_PVAL_QUOT = 37,             /* in a quote-delimited pval */
+    STATE_PVAL_QUOT_WORD = 38,        /* in a word in a quote-delimited pval */
+    STATE_PVAL_QUOT_PUNC = 40,        /* in a word in a quote-delimited pval, 
+                                       * after punctuation */
+    STATE_PVAL_QUOT_SPACE = 41,       /* in whitespaec in a quote-delimited 
+                                       * pval */
+    STATE_PVAL_DQUOT = 42,            /*                                     */
+    STATE_PVAL_DQUOT_WORD = 43,       /*  these states are equivalent to     */
+    STATE_PVAL_DQUOT_PUNC = 45,       /*  double-quote delimited pvals       */
+    STATE_PVAL_DQUOT_SPACE = 46,      /*                                     */
+
+    /* states based on entity references */
+    STATE_EREF_PEEK_FIRST = 50,       /* looking ahead to validate an eref, on 
+                                       * first character after '&' */
+    STATE_EREF_NUM_PEEK_FIRST = 52,   /* looking ahead to validate a numeric 
+                                       * eref, on first char after '#' */
+    STATE_EREF_NUM_PEEK = 53,         /* looking ahead to validate a numeric 
+                                       * eref */
+    STATE_EREF_HEX_PEEK = 54,         /* looking ahead to validate a 
+                                       * hexadecimal numeric eref */
+    STATE_EREF_PEEK = 55,             /* looking ahead to validate a 
+                                       * non-numeric eref */
+
+    /* states based on comment or cdata sections */
+
+    STATE_DECL_PEEK = 70,                 /* looking ahead to validate a 
+                                           * declaration, after '!' char */
+    STATE_COMMENT_PEEK_FIRST = 71,        /* looking ahead to validate a 
+                                           * comment, after first '-' char */
+    STATE_COMMENT_PEEK = 72,              /* looking ahead to validate a 
+                                           * comment */
+
+    /* these two states just validate --> ending on comment (one for each char
+     * except the first) */
+    STATE_COMMENT_PEEK_END_FIRST = 73,
+    STATE_COMMENT_PEEK_END = 74,
+
+    /* these three states just look out for <!-- within comment (one for each
+     * char except the first) */
+    STATE_COMMENT_PEEK_BADEND_FIRST = 75,
+    STATE_COMMENT_PEEK_BADEND_SECOND = 76,   
+    STATE_COMMENT_PEEK_BADEND = 77,
+
+    STATE_COMMENT_ENTRY = 78,             /* parsing a validated comment */
+    STATE_MARKSEC_PEEK_LABEL_FIRST = 79,  /* looking ahead to validate a 
+                                           * marked section, after first '[' */
+    STATE_MARKSEC_PEEK_LABEL = 80,        /* looking ahead to validate a marked 
+                                           * section, during its label 
+                                           * (i.e. 'CDATA') */
+    STATE_MARKSEC_PEEK_LABEL_LAST = 81,   /* looking ahead to validate a marked 
+                                           * section, after end of label */
+    STATE_MARKSEC_PEEK = 82,              /* looking ahead to validate a marked
+                                           * section */
+    STATE_MARKSEC_PEEK_END_FIRST = 83,    /* looking ahead to validate a marked 
+                                           * section, after first ']' end 
+                                           * char */
+    STATE_MARKSEC_PEEK_END = 84,          /* looking ahead to validate a marked
+                                           * section, after second ']' end 
+                                           * char */
+    STATE_CDATA_ENTRY = 85,               /* parsing a validated cdata marked 
+                                           * section */
+
+    /* these two states just look for --> within a cdata/comment section */
+    STATE_CCDATA_END_COMMENT_FIRST = 86,
+    STATE_CCDATA_END_COMMENT = 87,
+
+    /* these two states just look for ]]> within a cdata/comment section */
+    STATE_CCDATA_END_CDATA_FIRST = 88,
+    STATE_CCDATA_END_CDATA = 89,
+
+    STATE_CCDATA_RECOVERY = 90,           /* recover from false cdata/comment 
+                                           * end detection */
+
+    /* escape states, which correspond to the normal states except that the next
+     * character is escaped */
+    STATE_TOPLEVEL_ESC = 100,
+    STATE_WORD_ESC = 101,
+    STATE_WORD_ENDS_ESC = 102,
+    STATE_PUNC_ESC = 105,
+    STATE_PUNC_ENDS_ESC = 106,
+    STATE_SPACE_ESC = 107,
+    STATE_ACRONYM_ESC = 108,
+    STATE_ACRONYM_LETTER_ESC = 109,
+    STATE_PVAL_QUOT_ESC = 110,
+    STATE_PVAL_QUOT_WORD_ESC = 111,
+    STATE_PVAL_QUOT_PUNC_ESC = 113,
+    STATE_PVAL_QUOT_SPACE_ESC = 114,
+    STATE_PVAL_DQUOT_ESC = 115,
+    STATE_PVAL_DQUOT_WORD_ESC = 116,
+    STATE_PVAL_DQUOT_PUNC_ESC = 118,
+    STATE_PVAL_DQUOT_SPACE_ESC = 119,
+
+    STATE_EOF = 120                       /* end of file state */
+};
+
+struct mlparse_state {
+    enum mlparse_states state;            /* current state of parser */
+    enum mlparse_flags flags;             /* additional state flags */
+    unsigned int len;                     /* length of entity in state */
+    enum mlparse_states next_state;       /* next state to go to (where 
+                                           * applicable) */
+    unsigned int count;                   /* chars we've processed in current 
+                                           * state */
+    unsigned int wordlen;                 /* maximum length of a word */
+    unsigned int lookahead;               /* maximum length to look ahead for 
+                                           * end tags */
+    unsigned int buflen;                  /* length of the internal buffer */
+    const char *pos;                      /* current position in buffer */
+    const char *end;                      /* first position past end of 
+                                           * buffer */
+    char *buf;                            /* buffer for lookahead */
+    char *tagbuf;                         /* buffer to store tag names in */
+    unsigned int tagbuflen;               /* length of stuff in tagbuf */
+    char *tmpbuf;                         /* temporary buffer (size of buf) */
+    char erefbuf[MAXENTITYREF + 1];       /* entity reference buffer */
+    unsigned int errline;                 /* line error occurred on (debugging 
+                                           * tool) */
+};
+
+int mlparse_new(struct mlparse *space, unsigned int wordlen, 
+  unsigned int lookahead) {
+
+    if (wordlen <= 1) {
+        return 0;
+    }
+
+    /* XXX: note slight overallocation of buf for fudge factor purposes:
+     * sometimes the maths are a bit funny, so we allow a few extra characters
+     * on the end just in case */
+
+    if ((space->state = malloc(sizeof(*space->state))) 
+      && (space->state->buflen = lookahead + 2 * MAXENTITYREF)
+      && (space->state->buf = malloc(space->state->buflen + 1)) 
+      && (space->state->tmpbuf = malloc(space->state->buflen + 1)) 
+      && (space->state->tagbuf = malloc(wordlen + 1))) {
+        space->state->wordlen = wordlen;
+        space->state->lookahead = lookahead;
+        space->state->tagbuf[0] = '\0';
+        space->state->erefbuf[0] = '\0';
+        space->state->buf[space->state->buflen] = '\0';
+        mlparse_reinit(space);
+    } else if (space->state) {
+        if (space->state->buf) {
+            if (space->state->tmpbuf) {
+                free(space->state->tmpbuf);
+            }
+            free(space->state->buf);
+        }
+        free(space->state);
+        return 0;
+    }
+
+    return 1;
+}
+
+void mlparse_reinit(struct mlparse *p) {
+    /* reset variables */
+    p->state->pos = p->state->end = p->state->buf;
+    p->state->state = STATE_TOPLEVEL;             /* start in toplevel state */
+    p->state->flags = FLAG_NONE;
+    p->state->errline = 0;
+    return;
+}
+
+unsigned long int mlparse_buffered(struct mlparse *parser) {
+    if (parser->state->flags & FLAG_BUFFER) {
+        return parser->state->end - parser->state->pos;
+    } else {
+        return 0;
+    }
+}
+
+const char *mlparse_buffer(struct mlparse *parser) {
+    return parser->state->pos;
+}
+
+void mlparse_delete(struct mlparse *parser) {
+    free(parser->state->tagbuf);
+    free(parser->state->buf);
+    free(parser->state->tmpbuf);
+    free(parser->state);
+}
+
+unsigned int mlparse_err_line(struct mlparse *parser) {
+    return parser->state->errline;
+}
+
+/* macro to combine state values with flag values by shifting state values */
+#define COMB(stateval) ((stateval) << (FLAG_BITS))
+
+/* stub macro to jump to state state_ (modified by flags_).  unbuf_ is boolean,
+ * indicating whether to allow jump to trans_unbuf_label */
+#define JUMP(state_, flags_, unbuf_)                                          \
+    trans.jump.state = (state_);                                              \
+    trans.jump.flags = (flags_);                                              \
+    if (unbuf_) {                                                             \
+        goto trans_jump_unbuf_label;                                          \
+    } else if (1) {                                                           \
+        goto trans_jump_label;                                                \
+    } else 
+
+/* macro to manage jump table, which maps the state/flag variables to chunks of
+ * code that are executed when they are encountered.  However, this has to be
+ * consistent with the direct gotos between states for proper operation.  
+ * (please don't change this stuff unless you *really* know what you're 
+ * doing) */
+#define ACTUAL_JUMP(state_, flags, unbuf_)                                    \
+    if (1) {                                                                  \
+        switch (COMB(state_) | (flags) | strip) {                             \
+        case FLAG_STRIP | COMB(STATE_SPACE):                                  \
+        case COMB(STATE_TOPLEVEL):                                            \
+        case FLAG_STRIP | COMB(STATE_TOPLEVEL): goto toplevel_label;          \
+                                                                              \
+        case COMB(STATE_WORD_ENDS):                                           \
+        case FLAG_STRIP | COMB(STATE_WORD_ENDS): goto word_ends_label;        \
+                                                                              \
+        case COMB(STATE_WORD):                                                \
+        case FLAG_STRIP | COMB(STATE_WORD): goto word_label;                  \
+                                                                              \
+        case COMB(STATE_PUNC_ENDS):                                           \
+        case FLAG_STRIP | COMB(STATE_PUNC_ENDS): goto punc_ends_label;        \
+                                                                              \
+        case COMB(STATE_PUNC):                                                \
+        case FLAG_STRIP | COMB(STATE_PUNC): goto punc_label;                  \
+                                                                              \
+        case COMB(STATE_ACRONYM):                                             \
+        case FLAG_STRIP | COMB(STATE_ACRONYM): goto acronym_label;            \
+                                                                              \
+        case COMB(STATE_ACRONYM_LETTER):                                      \
+        case FLAG_STRIP | COMB(STATE_ACRONYM_LETTER):                         \
+            goto acronym_letter_label;                                        \
+        case COMB(STATE_SPACE): goto space_label;                             \
+                                                                              \
+        case COMB(STATE_TAG_PEEK_FIRST):                                      \
+        case FLAG_STRIP | COMB(STATE_TAG_PEEK_FIRST):                         \
+            goto tag_peek_first_label;                                        \
+                                                                              \
+        case COMB(STATE_TAG_PEEK_NAME):                                       \
+        case FLAG_STRIP | COMB(STATE_TAG_PEEK_NAME):                          \
+            goto tag_peek_name_label;                                         \
+                                                                              \
+        case COMB(STATE_TAG_PEEK_NAME_CONT):                                  \
+        case FLAG_STRIP | COMB(STATE_TAG_PEEK_NAME_CONT):                     \
+            goto tag_peek_name_cont_label;                                    \
+                                                                              \
+        case COMB(STATE_TAG_PEEK):                                            \
+        case FLAG_STRIP | COMB(STATE_TAG_PEEK):                               \
+            goto tag_peek_label;                                              \
+                                                                              \
+        case COMB(STATE_TAG_ENTRY):                                           \
+        case FLAG_STRIP | COMB(STATE_TAG_ENTRY):                              \
+            goto tag_entry_label;                                             \
+                                                                              \
+        case COMB(STATE_TAG_NAME_CONT):                                       \
+        case FLAG_STRIP | COMB(STATE_TAG_NAME_CONT):                          \
+            goto tag_name_cont_label;                                         \
+                                                                              \
+        case COMB(STATE_TAG_NAME_SELFEND):                                    \
+        case FLAG_STRIP | COMB(STATE_TAG_NAME_SELFEND):                       \
+            goto tag_name_selfend_label;                                      \
+                                                                              \
+        case COMB(STATE_TAG):                                                 \
+        case FLAG_STRIP | COMB(STATE_TAG):                                    \
+            goto tag_label;                                                   \
+                                                                              \
+        case COMB(STATE_TAG_SELFEND):                                         \
+        case FLAG_STRIP | COMB(STATE_TAG_SELFEND):                            \
+            goto tag_selfend_label;                                           \
+                                                                              \
+        case COMB(STATE_PARAM):                                               \
+        case FLAG_STRIP | COMB(STATE_PARAM):                                  \
+            goto param_label;                                                 \
+                                                                              \
+        case COMB(STATE_PARAM_EQ):                                            \
+        case FLAG_STRIP | COMB(STATE_PARAM_EQ):                               \
+            goto param_eq_label;                                              \
+                                                                              \
+        case COMB(STATE_PVAL_FIRST):                                          \
+        case FLAG_STRIP | COMB(STATE_PVAL_FIRST):                             \
+            goto pval_first_label;                                            \
+                                                                              \
+        case COMB(STATE_PVAL):                                                \
+        case FLAG_STRIP | COMB(STATE_PVAL):                                   \
+            goto pval_label;                                                  \
+                                                                              \
+        case COMB(STATE_PVAL_PUNC):                                           \
+        case FLAG_STRIP | COMB(STATE_PVAL_PUNC):                              \
+            goto pval_punc_label;                                             \
+                                                                              \
+        case COMB(STATE_PVAL_SELFEND):                                        \
+        case FLAG_STRIP | COMB(STATE_PVAL_SELFEND):                           \
+            goto pval_selfend_label;                                          \
+                                                                              \
+        case COMB(STATE_PVAL_QUOT):                                           \
+        case FLAG_STRIP | COMB(STATE_PVAL_QUOT):                              \
+        case FLAG_STRIP | COMB(STATE_PVAL_QUOT_SPACE):                        \
+            goto pval_quot_label;                                             \
+                                                                              \
+        case COMB(STATE_PVAL_QUOT_WORD):                                      \
+        case FLAG_STRIP | COMB(STATE_PVAL_QUOT_WORD):                         \
+            goto pval_quot_word_label;                                        \
+                                                                              \
+        case COMB(STATE_PVAL_QUOT_PUNC):                                      \
+        case FLAG_STRIP | COMB(STATE_PVAL_QUOT_PUNC):                         \
+            goto pval_quot_punc_label;                                        \
+                                                                              \
+        case COMB(STATE_PVAL_QUOT_SPACE):                                     \
+            goto pval_quot_space_label;                                       \
+                                                                              \
+        case COMB(STATE_PVAL_DQUOT):                                          \
+        case FLAG_STRIP | COMB(STATE_PVAL_DQUOT):                             \
+            goto pval_dquot_label;                                            \
+                                                                              \
+        case COMB(STATE_PVAL_DQUOT_WORD):                                     \
+        case FLAG_STRIP | COMB(STATE_PVAL_DQUOT_WORD):                        \
+            goto pval_dquot_word_label;                                       \
+                                                                              \
+        case COMB(STATE_PVAL_DQUOT_PUNC):                                     \
+        case FLAG_STRIP | COMB(STATE_PVAL_DQUOT_PUNC):                        \
+            goto pval_dquot_punc_label;                                       \
+                                                                              \
+        case COMB(STATE_PVAL_DQUOT_SPACE):                                    \
+        case FLAG_STRIP | COMB(STATE_PVAL_DQUOT_SPACE):                       \
+            goto pval_dquot_space_label;                                      \
+                                                                              \
+        case COMB(STATE_EREF_PEEK_FIRST):                                     \
+        case FLAG_STRIP | COMB(STATE_EREF_PEEK_FIRST):                        \
+            goto eref_peek_first_label;                                       \
+                                                                              \
+        case COMB(STATE_EREF_NUM_PEEK_FIRST):                                 \
+        case FLAG_STRIP | COMB(STATE_EREF_NUM_PEEK_FIRST):                    \
+            goto eref_num_peek_first_label;                                   \
+                                                                              \
+        case COMB(STATE_EREF_NUM_PEEK):                                       \
+        case FLAG_STRIP | COMB(STATE_EREF_NUM_PEEK):                          \
+            goto eref_num_peek_label;                                         \
+                                                                              \
+        case COMB(STATE_EREF_HEX_PEEK):                                       \
+        case FLAG_STRIP | COMB(STATE_EREF_HEX_PEEK):                          \
+            goto eref_hex_peek_label;                                         \
+                                                                              \
+        case COMB(STATE_EREF_PEEK):                                           \
+        case FLAG_STRIP | COMB(STATE_EREF_PEEK):                              \
+            goto eref_peek_label;                                             \
+                                                                              \
+        case FLAG_STRIP | COMB(STATE_SPACE_ESC):                              \
+        case COMB(STATE_TOPLEVEL_ESC):                                        \
+        case FLAG_STRIP | COMB(STATE_TOPLEVEL_ESC): goto toplevel_esc_label;  \
+                                                                              \
+        case COMB(STATE_WORD_ESC):                                            \
+        case FLAG_STRIP | COMB(STATE_WORD_ESC): goto word_esc_label;          \
+                                                                              \
+        case COMB(STATE_WORD_ENDS_ESC):                                       \
+        case FLAG_STRIP | COMB(STATE_WORD_ENDS_ESC):                          \
+            goto word_ends_esc_label;                                         \
+                                                                              \
+        case COMB(STATE_PUNC_ESC):                                            \
+        case FLAG_STRIP | COMB(STATE_PUNC_ESC): goto punc_esc_label;          \
+                                                                              \
+        case COMB(STATE_PUNC_ENDS_ESC):                                       \
+        case FLAG_STRIP | COMB(STATE_PUNC_ENDS_ESC):                          \
+            goto punc_ends_esc_label;                                         \
+                                                                              \
+        case COMB(STATE_SPACE_ESC): goto space_esc_label;                     \
+                                                                              \
+        case COMB(STATE_ACRONYM_ESC): goto acronym_esc_label;                 \
+        case FLAG_STRIP | COMB(STATE_ACRONYM_ESC): goto acronym_esc_label;    \
+                                                                              \
+        case COMB(STATE_ACRONYM_LETTER_ESC):                                  \
+        case FLAG_STRIP | COMB(STATE_ACRONYM_LETTER_ESC):                     \
+            goto acronym_letter_esc_label;                                    \
+                                                                              \
+        case COMB(STATE_PVAL_QUOT_ESC):                                       \
+        case FLAG_STRIP | COMB(STATE_PVAL_QUOT_ESC):                          \
+        case FLAG_STRIP | COMB(STATE_PVAL_QUOT_SPACE_ESC):                    \
+            goto pval_quot_esc_label;                                         \
+                                                                              \
+        case COMB(STATE_PVAL_QUOT_WORD_ESC):                                  \
+        case FLAG_STRIP | COMB(STATE_PVAL_QUOT_WORD_ESC):                     \
+            goto pval_quot_word_esc_label;                                    \
+                                                                              \
+        case COMB(STATE_PVAL_QUOT_PUNC_ESC):                                  \
+        case FLAG_STRIP | COMB(STATE_PVAL_QUOT_PUNC_ESC):                     \
+            goto pval_quot_punc_esc_label;                                    \
+                                                                              \
+        case COMB(STATE_PVAL_QUOT_SPACE_ESC):                                 \
+            goto pval_quot_space_esc_label;                                   \
+                                                                              \
+        case COMB(STATE_PVAL_DQUOT_ESC):                                      \
+        case FLAG_STRIP | COMB(STATE_PVAL_DQUOT_ESC):                         \
+        case FLAG_STRIP | COMB(STATE_PVAL_DQUOT_SPACE_ESC):                   \
+            goto pval_dquot_esc_label;                                        \
+                                                                              \
+        case COMB(STATE_PVAL_DQUOT_WORD_ESC):                                 \
+        case FLAG_STRIP | COMB(STATE_PVAL_DQUOT_WORD_ESC):                    \
+            goto pval_dquot_word_esc_label;                                   \
+                                                                              \
+        case COMB(STATE_PVAL_DQUOT_PUNC_ESC):                                 \
+        case FLAG_STRIP | COMB(STATE_PVAL_DQUOT_PUNC_ESC):                    \
+            goto pval_dquot_punc_esc_label;                                   \
+                                                                              \
+        case COMB(STATE_PVAL_DQUOT_SPACE_ESC):                                \
+            goto pval_dquot_space_esc_label;                                  \
+                                                                              \
+        case COMB(STATE_DECL_PEEK):                                           \
+        case FLAG_STRIP | COMB(STATE_DECL_PEEK):                              \
+            goto decl_peek_label;                                             \
+                                                                              \
+        case COMB(STATE_COMMENT_PEEK_FIRST):                                  \
+        case FLAG_STRIP | COMB(STATE_COMMENT_PEEK_FIRST):                     \
+            goto comment_peek_first_label;                                    \
+                                                                              \
+        case COMB(STATE_COMMENT_PEEK):                                        \
+        case FLAG_STRIP | COMB(STATE_COMMENT_PEEK):                           \
+            goto comment_peek_label;                                          \
+                                                                              \
+        case COMB(STATE_COMMENT_PEEK_END_FIRST):                              \
+        case FLAG_STRIP | COMB(STATE_COMMENT_PEEK_END_FIRST):                 \
+            goto comment_peek_end_first_label;                                \
+                                                                              \
+        case COMB(STATE_COMMENT_PEEK_END):                                    \
+        case FLAG_STRIP | COMB(STATE_COMMENT_PEEK_END):                       \
+            goto comment_peek_end_label;                                      \
+                                                                              \
+        case COMB(STATE_COMMENT_PEEK_BADEND_FIRST):                           \
+        case FLAG_STRIP | COMB(STATE_COMMENT_PEEK_BADEND_FIRST):              \
+            goto comment_peek_badend_first_label;                             \
+                                                                              \
+        case COMB(STATE_COMMENT_PEEK_BADEND_SECOND):                          \
+        case FLAG_STRIP | COMB(STATE_COMMENT_PEEK_BADEND_SECOND):             \
+            goto comment_peek_badend_second_label;                            \
+                                                                              \
+        case COMB(STATE_COMMENT_PEEK_BADEND):                                 \
+        case FLAG_STRIP | COMB(STATE_COMMENT_PEEK_BADEND):                    \
+            goto comment_peek_badend_label;                                   \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_COMMENT_ENTRY):                        \
+        case FLAG_COMMENT | FLAG_STRIP | COMB(STATE_COMMENT_ENTRY):           \
+            goto comment_entry_label;                                         \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_TOPLEVEL):                             \
+        case FLAG_CDATA | COMB(STATE_TOPLEVEL):                               \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_TOPLEVEL):                \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_TOPLEVEL):                  \
+            goto ccdata_toplevel_label;                                       \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_WORD):                                 \
+        case FLAG_CDATA | COMB(STATE_WORD):                                   \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_WORD):                    \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_WORD):                      \
+            goto ccdata_word_label;                                           \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_PUNC):                                 \
+        case FLAG_CDATA | COMB(STATE_PUNC):                                   \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_PUNC):                    \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_PUNC):                      \
+            goto ccdata_punc_label;                                           \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_SPACE):                                \
+        case FLAG_CDATA | COMB(STATE_SPACE):                                  \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_SPACE):                   \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_SPACE):                     \
+            goto ccdata_space_label;                                          \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_CCDATA_END_COMMENT_FIRST):             \
+        case FLAG_CDATA | COMB(STATE_CCDATA_END_COMMENT_FIRST):               \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_CCDATA_END_COMMENT_FIRST):\
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_CCDATA_END_COMMENT_FIRST):  \
+            goto ccdata_end_comment_first_label;                              \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_CCDATA_END_COMMENT):                   \
+        case FLAG_CDATA | COMB(STATE_CCDATA_END_COMMENT):                     \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_CCDATA_END_COMMENT):      \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_CCDATA_END_COMMENT):        \
+            goto ccdata_end_comment_label;                                    \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_CCDATA_END_CDATA_FIRST):               \
+        case FLAG_CDATA | COMB(STATE_CCDATA_END_CDATA_FIRST):                 \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_CCDATA_END_CDATA_FIRST):  \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_CCDATA_END_CDATA_FIRST):    \
+            goto ccdata_end_cdata_first_label;                                \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_CCDATA_END_CDATA):                     \
+        case FLAG_CDATA | COMB(STATE_CCDATA_END_CDATA):                       \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_CCDATA_END_CDATA):        \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_CCDATA_END_CDATA):          \
+            goto ccdata_end_cdata_label;                                      \
+                                                                              \
+        case FLAG_COMMENT | COMB(STATE_CCDATA_RECOVERY):                      \
+        case FLAG_CDATA | COMB(STATE_CCDATA_RECOVERY):                        \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_CCDATA_RECOVERY):         \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_CCDATA_RECOVERY):           \
+            goto ccdata_recovery_label;                                       \
+                                                                              \
+        case COMB(STATE_CDATA_ENTRY):                                         \
+        case FLAG_STRIP | COMB(STATE_CDATA_ENTRY):                            \
+        case FLAG_CDATA | COMB(STATE_CDATA_ENTRY):                            \
+        case FLAG_CDATA | FLAG_STRIP | COMB(STATE_CDATA_ENTRY):               \
+            goto cdata_entry_label;                                           \
+                                                                              \
+        case COMB(STATE_MARKSEC_PEEK_LABEL_FIRST):                            \
+        case FLAG_STRIP | COMB(STATE_MARKSEC_PEEK_LABEL_FIRST):               \
+            goto marksec_peek_label_first_label;                              \
+                                                                              \
+        case COMB(STATE_MARKSEC_PEEK_LABEL):                                  \
+        case FLAG_STRIP | COMB(STATE_MARKSEC_PEEK_LABEL):                     \
+            goto marksec_peek_label_label;                                    \
+                                                                              \
+        case COMB(STATE_MARKSEC_PEEK_LABEL_LAST):                             \
+        case FLAG_STRIP | COMB(STATE_MARKSEC_PEEK_LABEL_LAST):                \
+            goto marksec_peek_label_last_label;                               \
+                                                                              \
+        case COMB(STATE_MARKSEC_PEEK):                                        \
+        case FLAG_STRIP | COMB(STATE_MARKSEC_PEEK):                           \
+            goto marksec_peek_label;                                          \
+                                                                              \
+        case COMB(STATE_MARKSEC_PEEK_END_FIRST):                              \
+        case FLAG_STRIP | COMB(STATE_MARKSEC_PEEK_END_FIRST):                 \
+            goto marksec_peek_end_first_label;                                \
+                                                                              \
+        case COMB(STATE_MARKSEC_PEEK_END):                                    \
+        case FLAG_STRIP | COMB(STATE_MARKSEC_PEEK_END):                       \
+            goto marksec_peek_end_label;                                      \
+                                                                              \
+        case COMB(STATE_EOF):                                                 \
+        case FLAG_STRIP | COMB(STATE_EOF):                                    \
+        case FLAG_COMMENT | COMB(STATE_EOF):                                  \
+        case FLAG_CDATA | COMB(STATE_EOF):                                    \
+        case FLAG_STRIP | FLAG_COMMENT | COMB(STATE_EOF):                     \
+        case FLAG_STRIP | FLAG_CDATA | COMB(STATE_EOF):                       \
+        case FLAG_STRIP | FLAG_COMMENT | FLAG_CDATA | COMB(STATE_EOF):        \
+            goto eof_label;                                                   \
+                                                                              \
+        default:                                                              \
+            /* have to save state because trans_unbuffer_label will jump to   \
+             * st->state after altering pos, end */                           \
+            if (unbuf_) {                                                     \
+                goto trans_unbuffer_label;                                    \
+            } else {                                                          \
+                st->state = (state_);                                         \
+                st->errline = UINT_MAX;                                       \
+                goto err_label;                                               \
+            }                                                                 \
+        }                                                                     \
+    } else /* dangling else to allow trailing semi-colon */
+
+/* macro to detect (unexpected) errors in the parsing process, leaving enough
+ * info around to figure out how they occurred (hopefully) */
+#define CANT_GET_HERE()                                                       \
+    assert(0);                                                                \
+    st->errline = __LINE__;                                                   \
+    goto err_label
+
+/* catch sentence ending punctuation (no ending colon and no first case so we 
+ * can use case syntax) */
+#define CASE_ENDS                                                             \
+         '.': case '?': case '!'
+
+/* convert a character case, given that its the opposite case, if CASE_FOLDING
+ * has been defined */
+#ifdef CASE_FOLDING
+/* they want case folding */
+#define TOLOWER(c) ASCII_TOLOWER(c)
+#define TOUPPER(c) ASCII_TOUPPER(c)
+#else
+/* no case folding */
+#define TOLOWER(c) c
+#define TOUPPER(c) c
+#endif
+
+/* fix things up for a return where we're requesting more input */
+#define RETURN_INPUT(state_)                                                  \
+    trans.return_input.state = (state_);                                      \
+    goto trans_return_input_label
+
+/* fix things up for return, assuming that we're working from the buffer */
+#define RETURN_BUFFER(retval, state_)                                         \
+    assert(st->flags & FLAG_BUFFER);                                          \
+    st->pos = pos;                                                            \
+    st->state = (state_);                                                     \
+    return (retval);
+
+/* fix things up for return, assuming that we're not working from the buffer */
+#define RETURN_NOBUFFER(retval, state_)                                       \
+    assert(!(st->flags & FLAG_BUFFER));                                       \
+    parser->next_in = pos;                                                    \
+    parser->avail_in = end - pos;                                             \
+    st->state = (state_);                                                     \
+    return (retval);
+
+/* fix things up for return (by altering buffer positions to reflect what we've
+ * parsed this call) */
+#define RETURN(retval, state_)                                                \
+    if (1) {                                                                  \
+        if (st->flags & FLAG_BUFFER) {                                        \
+            RETURN_BUFFER(retval, state_);                                    \
+        } else {                                                              \
+            RETURN_NOBUFFER(retval, state_);                                  \
+        }                                                                     \
+    } else
+
+/* macro to handle boilerplate transitions to tag parsing */
+#define CASE_TAG(next_state_)                                                 \
+         '<':                                                                 \
+        tmppos = pos + 1;                                                     \
+        tmpend = end;                                                         \
+        st->count = 1;                                                        \
+        st->next_state = (next_state_);                                       \
+        goto tag_peek_first_label
+
+/* macro to handle boilerplate transitions to entity reference parsing */
+#define CASE_EREF(next_state_)                                                \
+         '&':                                                                 \
+        tmppos = pos + 1;                                                     \
+        tmpend = end;                                                         \
+        st->count = 1;                                                        \
+        st->next_state = (next_state_);                                       \
+        goto eref_peek_first_label
+
+/* push a character onto the current word, returning MLPARSE_CONT | retval 
+ * and maintaining state state_ if there is no room left */
+#define PUSH(char_, retval, state_)                                           \
+    if (st->len < st->wordlen) {                                              \
+        word[st->len++] = (char_);                                            \
+    } else if (1) {                                                           \
+        *length = st->len;                                                    \
+        st->len = 0;                                                          \
+        RETURN(MLPARSE_CONT | (retval), (state_));                            \
+    } else
+
+/* a macro to place characters examined by a peek state (as indicated by tmppos)
+ * into the buffer */
+#define BUFFER()                                                              \
+    if (1) {                                                                  \
+        const char *tmpstart;                                                 \
+                                                                              \
+        assert((tmppos >= parser->next_in)                                    \
+          && (tmppos <= parser->next_in + parser->avail_in));                 \
+                                                                              \
+        /* figure out where to start copying, else we're in danger of         \
+         * trying to copy stuff from the buffer into the buffer */            \
+        if (st->flags & FLAG_BUFFER) {                                        \
+            assert((pos >= st->pos) && (pos <= st->end));                     \
+            tmpstart = parser->next_in;                                       \
+        } else {                                                              \
+            assert(1 && (pos >= parser->next_in)                              \
+              && (pos <= parser->next_in + parser->avail_in));                \
+            tmpstart = pos;                                                   \
+        }                                                                     \
+                                                                              \
+        if (tmppos - tmpstart) {                                              \
+            /* need to copy stuff into buffer */                              \
+            assert(st->end >= st->pos);                                       \
+            assert((st->end > st->pos)                                        \
+              || ((st->buf == st->end) && (st->buf == st->pos)));             \
+                                                                              \
+            if ((tmppos - tmpstart) < (st->buf + st->buflen - st->end)) {     \
+                /* easy case, just copy chunk in to end of buffer */          \
+                memcpy((char *) st->end, tmpstart, (tmppos - tmpstart));      \
+                pos = st->pos;                                                \
+                end = st->end += (tmppos - tmpstart);                         \
+            } else {                                                          \
+                unsigned int tmp = end - pos;                                 \
+                char *tmpbuf = st->buf;                                       \
+                                                                              \
+                /* must already be in the buffer */                           \
+                assert((unsigned int) ((tmppos - tmpstart) + (end - pos))     \
+                  < st->buflen);                                              \
+                assert((pos >= st->pos) && (pos <= st->end));                 \
+                                                                              \
+                /* copy existing into temporary buffer */                     \
+                memcpy(st->tmpbuf, pos, tmp);                                 \
+                                                                              \
+                /* copy new stuff in */                                       \
+                memcpy(st->tmpbuf + tmp, tmpstart, tmppos - tmpstart);        \
+                tmp += tmppos - tmpstart;                                     \
+                assert(tmp < st->buflen);                                     \
+                                                                              \
+                /* swap buffers over */                                       \
+                pos = st->pos = st->buf = st->tmpbuf;                         \
+                end = st->end = st->pos + tmp;                                \
+                st->tmpbuf = tmpbuf;                                          \
+            }                                                                 \
+            st->flags |= FLAG_BUFFER;                                         \
+            parser->next_in += (tmppos - tmpstart);                           \
+            parser->avail_in -= (tmppos - tmpstart);                          \
+        }                                                                     \
+    } else
+
+/* macro to return a stored value depending on state in state->next_state.  
+ * It can return a value (setting next_state to next_state_ param) or merely 
+ * continue if no value needs to be returned.  This is the end of each of the 
+ * peek states, where they have to return buffered values if appropriate or 
+ * continue on into the states associated with the entity just detected.  Note
+ * that it alters the buffer to ensure contiguity either way. */
+#define RETURN_IF_STORED(next_state_)                                         \
+    if (1) {                                                                  \
+        enum mlparse_ret RETURN_STORED_ret;                                   \
+                                                                              \
+        /* note that this only has to handle 'toplevel' states, since we      \
+         * can't enter an entity while parsing another entity */              \
+        switch (st->next_state) {                                             \
+        case STATE_WORD:                                                      \
+        case STATE_WORD_ESC:                                                  \
+        case STATE_WORD_ENDS:                                                 \
+        case STATE_WORD_ENDS_ESC:                                             \
+        case STATE_PUNC:                                                      \
+        case STATE_PUNC_ESC:                                                  \
+        case STATE_PUNC_ENDS:                                                 \
+        case STATE_PUNC_ENDS_ESC:                                             \
+        case STATE_ACRONYM:                                                   \
+        case STATE_ACRONYM_ESC:                                               \
+        case STATE_ACRONYM_LETTER:                                            \
+        case STATE_ACRONYM_LETTER_ESC:                                        \
+            *length = st->len;                                                \
+            RETURN_STORED_ret = MLPARSE_WORD;                                 \
+            break;                                                            \
+                                                                              \
+        case STATE_SPACE:                                                     \
+        case STATE_SPACE_ESC:                                                 \
+            *length = st->len;                                                \
+            RETURN_STORED_ret = MLPARSE_WHITESPACE;                           \
+            break;                                                            \
+                                                                              \
+        default:                                                              \
+            RETURN_STORED_ret = MLPARSE_INPUT;                                \
+            break;                                                            \
+        }                                                                     \
+                                                                              \
+        /* ensure everything is either wholly buffered or not buffered at all \
+         * to ensure contiguity as we reparse over the peek'd section.  Also  \
+         * save buffer position as we might return below. */                  \
+        if ((st->flags & FLAG_BUFFER) && (tmppos >= parser->next_in)          \
+          && (tmppos <= parser->next_in + parser->avail_in)) {                \
+            /* need to buffer */                                              \
+            assert((pos >= st->pos)                                           \
+              && (pos <= st->end));                                           \
+                                                                              \
+            st->pos = pos;                                                    \
+            BUFFER();                                                         \
+        } else if (!(st->flags & FLAG_BUFFER)) {                              \
+            /* nothing in buffer, no need to alter it */                      \
+            assert((pos >= parser->next_in)                                   \
+              && (pos <= parser->next_in + parser->avail_in));                \
+            assert((tmppos >= parser->next_in)                                \
+              && (tmppos <= parser->next_in + parser->avail_in));             \
+                                                                              \
+            parser->next_in = pos;                                            \
+            parser->avail_in = end - pos;                                     \
+        } else {                                                              \
+            st->pos = pos;                                                    \
+        }                                                                     \
+                                                                              \
+        st->len = 0;                                                          \
+        if (RETURN_STORED_ret != MLPARSE_INPUT) {                             \
+            st->next_state = STATE_ERR;                                       \
+            st->state = (next_state_);                                        \
+            return (RETURN_STORED_ret);                                       \
+        }                                                                     \
+    } else 
+
+/* stub macro to jump to end buffering code, which allows peek states to manage
+ * the buffer/get text from buffer/finish looking ahead after a certain number
+ * of characters (limit_) */
+#define ENDBUF(limit_, state_)                                                \
+    trans.endbuf.state = (state_);                                            \
+    trans.endbuf.limit = (limit_);                                            \
+    goto trans_endbuf_label;
+
+int mlparse_parse(struct mlparse *parser, char *word, unsigned int *length, 
+  int strip) {
+    struct mlparse_state *st = parser->state;
+    const char *pos = parser->next_in,
+               *end = parser->next_in + parser->avail_in,
+               *tmppos = pos,
+               *tmpend = end;
+
+    /* used to pass information to transitional states */
+    union {
+        struct {
+            enum mlparse_states state;
+        } return_input;
+
+        struct {
+            enum mlparse_states state;
+            enum mlparse_flags flags;
+        } jump;
+
+        struct {
+            enum mlparse_states state;
+            unsigned int limit;
+        } endbuf;
+    } trans;
+
+    strip = !!strip * FLAG_STRIP;
+
+    /* some of the code relies on strip being 1 for stripping (i.e. *length =
+     * st->len - strip, which removes last character under stripping) */
+    assert(((strip == 1) || (strip == 0)) && (FLAG_STRIP == 1));
+
+    /* fallthrough to jump to initial state (or to buffer state if we need to 
+     * first) */
+    JUMP(st->state, st->flags, 1); 
+
+trans_jump_unbuf_label:
+    ACTUAL_JUMP(trans.jump.state, trans.jump.flags, 1);
+
+trans_jump_label:
+    ACTUAL_JUMP(trans.jump.state, trans.jump.flags, 0);
+
+trans_endbuf_label:
+    if (st->count < trans.endbuf.limit) {
+        /* detect whether we're currently working in the buffer (except that the
+         * flag is unreliable because we've come from a peek state) */
+        if ((tmpend == st->end) && (st->end != st->pos)) {
+            /* working from existing buffer, go to external input and try
+             * again (have to update buffer pos as we may have consumed some) */
+            st->pos = pos;
+            tmppos = parser->next_in;
+            tmpend = parser->next_in + parser->avail_in;
+            JUMP(trans.endbuf.state, st->flags & ~FLAG_BUFFER, 0);
+        } else {
+            /* save buffer position if necessary */
+            if (st->flags & FLAG_BUFFER) {
+                assert((pos >= st->pos) && (pos <= st->end));
+                st->pos = pos;
+            } else {
+                assert((pos >= parser->next_in)
+                  && (pos <= parser->next_in + parser->avail_in));
+                parser->next_in = pos;
+                parser->avail_in = end - pos;
+            }
+
+            BUFFER();
+            st->state = trans.endbuf.state;
+            return MLPARSE_INPUT;
+        }
+    } else {
+        /* couldn't find an endtag in time, its not a tag */
+        JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+    }
+    CANT_GET_HERE();
+
+trans_return_input_label:
+    if (st->flags & FLAG_BUFFER) {
+            /* requesting more input, but more is available so point pos and
+             * end to the right stuff and JUMP back in there... */
+            if (end != st->end) {
+                pos = st->pos = st->buf;
+                end = st->end;
+            } else {
+                /* finished buffer */
+                st->pos = st->end = st->buf;
+                st->buf[0] = '\0';
+                pos = parser->next_in;
+                end = parser->next_in + parser->avail_in;
+                st->flags &= ~FLAG_BUFFER;  /* no more buffering for now */
+            }
+            JUMP(trans.return_input.state, st->flags, 0);
+    } else {
+        parser->next_in = pos;
+        parser->avail_in = end - pos;
+        st->state = trans.return_input.state;
+        return MLPARSE_INPUT;
+    }
+    CANT_GET_HERE();
+
+/* the parser hasn't entered any structures */
+toplevel_label:
+    while (pos < end) {
+        switch (*pos) {
+        /* uppercase start to the word, could be an acronym */
+        case ASCII_CASE_UPPER:
+            if (strip) {
+                word[0] = TOLOWER(*pos++);
+            } else {
+                word[0] = *pos++;
+            }
+            st->len = 1;
+            goto acronym_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            word[0] = *pos++;
+            st->len = 1;
+            goto word_label;
+
+        case ASCII_CASE_SPACE:
+            if (!strip) {
+                word[0] = *pos++;
+                st->len = 1;
+                goto space_label;
+            } else {
+                pos++;
+            }
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        default:
+            if (strip) {
+                /* ignore junk as input */
+                pos++;
+            } else {
+                word[0] = *pos++;
+                st->len = 1;
+                goto word_label;
+            }
+            break;
+
+        case CASE_TAG(STATE_TOPLEVEL_ESC);
+        case CASE_EREF(STATE_TOPLEVEL_ESC);
+        }
+    }
+    RETURN_INPUT(STATE_TOPLEVEL);
+
+/* toplevel state, except that the next character is escaped */
+toplevel_esc_label:
+    assert(pos < end);     /* escaped chars are always immediately available */
+    switch (*pos) {
+    case '<':
+    case '&':
+        if (strip) {
+            /* ignore special characters */
+            pos++;
+        } else {
+            word[0] = *pos++;
+            st->len = 1;
+            goto word_label;
+        }
+        /* fallthrough */
+    default:
+        /* let toplevel handle others */
+        goto toplevel_label;
+        break;
+    }
+    CANT_GET_HERE();
+
+/* the parser is in whitespace */
+space_label:
+    assert(!strip);
+    while (pos < end) {
+        switch (*pos) {
+        case ASCII_CASE_SPACE:
+            PUSH(*pos++, MLPARSE_WHITESPACE, STATE_SPACE);
+            break;
+
+        default:
+            /* anything else breaks the whitespace up */
+            *length = st->len;
+            RETURN(MLPARSE_WHITESPACE, STATE_TOPLEVEL);
+            break;
+
+        case CASE_TAG(STATE_SPACE_ESC);
+        case CASE_EREF(STATE_SPACE_ESC);
+        }
+    }
+    RETURN_INPUT(STATE_SPACE);
+/* space state, except that the next character is escaped */
+space_esc_label:
+    assert(!strip);
+    assert(pos < end);     /* escaped chars are always immediately available */
+    switch (*pos) {
+    case '<':
+    case '&':
+        /* break on special characters */
+        *length = st->len;
+        RETURN(MLPARSE_WHITESPACE, STATE_TOPLEVEL);
+
+    default:
+        /* let space handle others */
+        goto space_label;
+        break;
+    }
+    CANT_GET_HERE();
+
+/* the parser is reading a normal word */
+word_label:
+    while (pos < end) {
+        switch (*pos) {
+        case CASE_ENDS:
+            /* could be the end of a sentence */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            st->next_state = STATE_WORD;
+            goto word_ends_label;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto word */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_WORD, STATE_WORD);
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            break;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            break;
+
+        case '-':
+        default:
+        case '\'':
+            /* break if we get two consecutive punctuation marks */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            goto punc_label;
+
+        case ASCII_CASE_SPACE:
+            /* word ends */
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            if (strip) {
+                /* ignore junk in words */
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            break;
+            
+        case CASE_TAG(STATE_WORD_ESC);
+        case CASE_EREF(STATE_WORD_ESC);
+        }
+    }
+    RETURN_INPUT(STATE_WORD);
+
+/* word state, except that the next character is escaped */
+word_esc_label:
+    assert(pos < end);     /* escaped chars are always immediately available */
+    switch (*pos) {
+    case '<':
+    case '&':
+        if (strip) {
+            /* ignore special characters */
+            pos++;
+        } else {
+            PUSH(*pos++, MLPARSE_WORD, STATE_WORD_ESC);
+        }
+        /* fallthrough */
+    default:
+        /* let word handle others */
+        goto word_label;
+        break;
+    }
+    CANT_GET_HERE();
+
+/* have parsed an end-of-sentence character, now we see what comes next to
+ * determine whether it really is the end of the sentence */
+word_ends_label:
+    while (pos < end) {
+        switch (*pos) {
+        case ASCII_CASE_SPACE:
+            /* it was the end of a sentence */
+            *length = st->len;
+            RETURN(MLPARSE_END | MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case CASE_ENDS:
+            /* have to take care of these since otherwise we'll just end up back
+             * here */
+            if (strip) {
+                /* ignore special characters */
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD_ENDS);
+            }
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case CASE_TAG(STATE_WORD_ENDS_ESC);
+        case CASE_EREF(STATE_WORD_ENDS_ESC);
+
+        default:
+            /* wasn't the end of a sentence */
+            goto word_label;
+        }
+    }
+    RETURN_INPUT(STATE_WORD_ENDS);
+
+/* ends state, except that the next character is escaped */
+word_ends_esc_label:
+    assert(pos < end);     /* escaped chars are always immediately available */
+    switch (*pos) {
+    case '<':
+    case '&':
+        /* special characters indicate no end of sentence */
+        if (strip) {
+            pos++;
+        } else {
+            PUSH(*pos++, MLPARSE_WORD, STATE_WORD_ENDS_ESC);
+        }
+        *length = st->len;
+        RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+    default:
+        /* let word_ends handle others */
+        goto word_ends_label;
+        break;
+    }
+    CANT_GET_HERE();
+
+punc_label:
+    while (pos < end) {
+        switch (*pos) {
+        case CASE_ENDS:
+            /* could be the end of a sentence */
+            st->next_state = STATE_PUNC;
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_PUNC);
+            }
+            goto punc_ends_label;
+
+        case ASCII_CASE_UPPER:
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_WORD, STATE_PUNC);
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_PUNC);
+            }
+            goto word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            PUSH(*pos++, MLPARSE_WORD, STATE_PUNC);
+            goto word_label;
+
+        default:
+            /* break across two successive punctuation marks */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_PUNC);
+            }
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case ASCII_CASE_SPACE:
+            /* word ends */
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            if (strip) {
+                /* ignore junk in words */
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_PUNC);
+            }
+            break;
+
+        case CASE_TAG(STATE_PUNC_ESC);
+        case CASE_EREF(STATE_PUNC_ESC);
+        }
+    }
+    RETURN_INPUT(STATE_PUNC);
+
+/* punc state, except that the next character is escaped */
+punc_esc_label:
+    assert(pos < end);     /* escaped chars are always immediately available */
+    switch (*pos) {
+    case '<':
+    case '&':
+        /* break across two successive punctuation marks */
+        *length = st->len;
+        RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+    default:
+        /* let punc handle others */
+        goto punc_label;
+        break;
+    }
+    CANT_GET_HERE();
+
+/* have parsed an end-of-sentence character, now we see what comes next to
+ * determine whether it really is the end of the sentence */
+punc_ends_label:
+    while (pos < end) {
+        switch (*pos) {
+        case ASCII_CASE_SPACE:
+            /* it was the end of a sentence */
+            *length = st->len;
+            RETURN(MLPARSE_END | MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case CASE_ENDS:
+            /* have to take care of these since otherwise we'll just end up back
+             * here */
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case CASE_TAG(STATE_PUNC_ENDS_ESC);
+        case CASE_EREF(STATE_PUNC_ENDS_ESC);
+
+        default:
+            /* wasn't the end of a sentence */
+            goto punc_label;
+        }
+    }
+    RETURN_INPUT(STATE_PUNC_ENDS);
+
+/* ends state, except that the next character is escaped */
+punc_ends_esc_label:
+    assert(pos < end);     /* escaped chars are always immediately available */
+    switch (*pos) {
+    case '<':
+    case '&':
+        /* need to break here because of two consecutive punctuation marks */
+        /* special characters indicate no end of sentence */
+        if (strip) {
+            pos++;
+        } else {
+            PUSH(*pos++, MLPARSE_WORD, STATE_PUNC_ENDS_ESC);
+        }
+        *length = st->len;
+        RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+    default:
+        /* let punc_ends handle others */
+        goto punc_ends_label;
+        break;
+    }
+    CANT_GET_HERE();
+
+/* parsing what may be an acronym, expecting '.' next */
+acronym_label:
+    while (pos < end) {
+        switch (*pos) {
+        case '.':
+            /* the acronym continues */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_ACRONYM);
+            }
+            goto acronym_letter_label;
+
+        case ASCII_CASE_SPACE:
+            /* end of the word */
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case ASCII_CASE_UPPER:
+            /* push character onto word */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_WORD, STATE_ACRONYM);
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_ACRONYM);
+            }
+            goto word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            PUSH(*pos++, MLPARSE_WORD, STATE_ACRONYM);
+            goto word_label;
+
+        case ASCII_CASE_EXTENDED:
+        default:
+            /* anything else, let the word state deal with it */
+            goto word_label;
+
+        case CASE_TAG(STATE_ACRONYM_ESC);
+        case CASE_EREF(STATE_ACRONYM_ESC);
+        }
+    }
+    RETURN_INPUT(STATE_ACRONYM);
+
+/* acronym state, except that the next character is escaped */
+acronym_esc_label:
+    assert(pos < end);     /* escaped chars are always immediately available */
+    switch (*pos) {
+    case '<':
+    case '&':
+        /* ignore special characters */
+        if (strip) {
+            pos++;
+        } else {
+            PUSH(*pos++, MLPARSE_WORD, STATE_ACRONYM_ESC);
+        }
+        /* fallthrough */
+    default:
+        /* let acronym handle others */
+        goto acronym_label;
+        break;
+    }
+    CANT_GET_HERE();
+
+/* parsing what may be an acronym, expecting a capital letter next */
+acronym_letter_label:
+    while (pos < end) {
+        switch (*pos) {
+        case ASCII_CASE_SPACE:
+            /* end of the word, note no end of sentence */
+            /* XXX: maybe check and make sure acronym is len > 1, else might be
+             * end of sentence */
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case ASCII_CASE_UPPER:
+            /* the acronym continues */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_WORD, STATE_ACRONYM_LETTER);  
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_ACRONYM_LETTER);  
+            }
+            /* note that the acronym continues even if we have to return a 
+             * chunk of it */
+            goto acronym_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* acronym ends, push character onto word */
+            PUSH(*pos++, MLPARSE_WORD, STATE_ACRONYM_LETTER);  
+            goto word_label;
+
+        case ASCII_CASE_EXTENDED:
+        default:
+            /* anything else, let the punc state deal with it */
+            goto punc_label;
+
+        case CASE_TAG(STATE_ACRONYM_LETTER_ESC);
+        case CASE_EREF(STATE_ACRONYM_LETTER_ESC);
+        }
+    }
+    RETURN_INPUT(STATE_ACRONYM_LETTER);
+
+/* acronym_letter state, except that the next character is escaped */
+acronym_letter_esc_label:
+    assert(pos < end);     /* escaped chars are always immediately available */
+    switch (*pos) {
+    case '<':
+    case '&':
+        if (strip) {
+            /* ignore special characters */
+            pos++;
+        } else {
+
+            PUSH(*pos++, MLPARSE_WORD, STATE_ACRONYM_LETTER_ESC);
+        }
+        /* fallthrough */
+    default:
+        /* let acronym_letter handle others */
+        goto acronym_letter_label;
+        break;
+    }
+    CANT_GET_HERE();
+
+/* have just recieved an open tag, need to establish whether its really a valid 
+ * tag */
+tag_peek_first_label:
+    while (tmppos < tmpend) {
+        switch (*tmppos) {
+        default:
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_SPACE:
+            /* can't have space or other junk directly after tag open, 
+             * its not a tag */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+
+        case '!':
+            /* its probably a declaration */
+            st->count++;
+            st->tagbuf[0] = *tmppos++;
+            st->tagbuflen = 1;
+            goto decl_peek_label;
+
+        case '<':
+        case '>':
+            /* let tag_peek_label handle these */
+            st->tagbuflen = 0;
+            goto tag_peek_label;
+
+        case ASCII_CASE_UPPER:
+            st->tagbuf[0] = ASCII_TOLOWER(*tmppos);
+            st->tagbuflen = 1;
+            tmppos++;
+            st->count++;
+            goto tag_peek_name_label;
+
+        /* xml allows these characters in tags */
+        case '.': case '-': case '_': case ':':
+        case '/': case '?': 
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* pretty much anything else qualifies, loosely speaking */
+            st->tagbuf[0] = *tmppos;
+            st->tagbuflen = 1;
+            tmppos++;
+            st->count++;
+            goto tag_peek_name_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_TAG_PEEK_FIRST);
+
+tag_peek_name_label:
+    while (tmppos < tmpend) {
+        switch (*tmppos) {
+        default:
+        case ASCII_CASE_EXTENDED:
+            /* don't accept junk in tag names */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+
+        case '<':
+        case '>':
+            /* let tag_peek_label handle these */
+            goto tag_peek_label;
+
+        case '/':
+            /* allow / so we recognise self-ending tags, but don't count as part
+             * of the name */
+            tmppos++;
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* end of tag name */
+            tmppos++;
+            st->count++;
+            goto tag_peek_label;
+
+        case ASCII_CASE_UPPER:
+            /* pretty much anything else qualifies, loosely speaking */
+            if (st->tagbuflen < st->wordlen) {
+                st->tagbuf[st->tagbuflen++] = ASCII_TOLOWER(*tmppos);
+                tmppos++;
+                st->count++;
+            } else {
+                tmppos++;
+                st->count++;
+                goto tag_peek_name_cont_label;
+            }
+            break;
+
+        /* xml allows these characters in tags */
+        case '.': case '-': case '_': case ':':
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* pretty much anything else qualifies, loosely speaking */
+            if (st->tagbuflen < st->wordlen) {
+                st->tagbuf[st->tagbuflen++] = *tmppos;
+                tmppos++;
+                st->count++;
+            } else {
+                tmppos++;
+                st->count++;
+                goto tag_peek_name_cont_label;
+            }
+            break;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_TAG_PEEK_NAME);
+
+tag_peek_name_cont_label:
+    while (tmppos < tmpend) {
+        switch (*tmppos) {
+        default:
+        case ASCII_CASE_EXTENDED:
+            /* don't accept junk in tag names */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+
+        case '<':
+        case '>':
+            /* let tag_peek_label handle these */
+            goto tag_peek_label;
+
+        case ASCII_CASE_SPACE:
+            /* end of tag name */
+            tmppos++;
+            st->count++;
+            goto tag_peek_label;
+
+        case ASCII_CASE_UPPER:
+        /* xml allows these characters in tags */
+        case '.': case '-': case '_': case ':':
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* pretty much anything else qualifies, loosely speaking */
+            tmppos++;
+            st->count++;
+            break;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_TAG_PEEK_NAME_CONT);
+
+/* have recieved an open tag, need to establish whether its really a valid 
+ * tag */
+tag_peek_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case '<':
+            /* can't have another tag open character, its not a tag */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+
+        case '>':
+            /* found end tag, need to return entity previously being parsed */
+            tmppos++;
+            RETURN_IF_STORED(STATE_TAG_ENTRY);
+            /* otherwise (nothing stored) */
+            goto tag_entry_label;
+
+        default:
+            /* ignore everything else */
+            st->count++;
+            tmppos++;
+            break;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_TAG_PEEK);
+
+/* parsing an open tag */
+tag_entry_label:
+    /* skip tag that we've already parsed */
+    memcpy(word, st->tagbuf, st->tagbuflen);
+    pos += st->tagbuflen + 1; /* + 1 for the open tag */
+
+    /* need to decide where to go next */
+    while (1) {
+        switch (*pos) {
+        case '>':
+        case ASCII_CASE_SPACE:
+            *length = st->tagbuflen;
+            RETURN(MLPARSE_TAG, STATE_TAG);
+
+        case '/':
+            st->next_state = STATE_TAG;
+            pos++;
+            *length = st->tagbuflen;
+            RETURN(MLPARSE_TAG, STATE_TAG_SELFEND);
+
+        default:
+            st->len = 0;
+            *length = st->tagbuflen;
+            RETURN(MLPARSE_TAG, STATE_TAG_NAME_CONT);
+        }
+    }
+
+/* parsing a tag name after having to break it into pieces */
+tag_name_cont_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case ASCII_CASE_SPACE:
+            /* end of tag */
+            *length = st->len;
+            RETURN(MLPARSE_TAG, STATE_TAG);
+
+        case '>':
+            /* end of tag */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_TAG, STATE_TOPLEVEL);
+
+        case ASCII_CASE_UPPER:
+            /* add character to tag name */
+            PUSH(ASCII_TOLOWER(*pos++), MLPARSE_TAG, STATE_TAG_NAME_CONT);
+            break;
+
+            /* fallthrough */
+        /* xml allows these characters in tags */
+        case '.': case '-': case '_': case ':':
+            /* fallthrough */
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* add character to tag name */
+            PUSH(*pos++, MLPARSE_TAG, STATE_TAG_NAME_CONT);
+            break;
+
+        case '/':
+            /* may be self-ending */
+            st->next_state = STATE_TAG_NAME_CONT;
+            pos++;
+            goto tag_name_selfend_label;
+
+        case '<':
+            CANT_GET_HERE();
+
+        default:
+        case ASCII_CASE_EXTENDED:
+            /* ignore anything else */
+            pos++;
+            break;
+        }
+    }
+
+/* parsing what may be a self-ending tag with only a name */
+tag_name_selfend_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case ASCII_CASE_SPACE:
+        case '>':
+            /* name ended, return it and let self-end state handle the rest */
+            *length = st->len;
+            RETURN(MLPARSE_TAG, STATE_TAG_SELFEND);
+
+        default:
+            /* didn't self-end, go back to where we came from */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+
+/* parsing a tag after the name */
+tag_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            goto toplevel_label;
+
+        case '/':
+            /* could be a self-ending tag */
+            pos++;
+            goto tag_selfend_label;
+
+        case ASCII_CASE_UPPER:
+            /* add character to tag name */
+            word[0] = ASCII_TOLOWER(*pos++);
+            st->len = 1;
+            goto param_label;
+
+        /* xml allows these characters in names */
+        case '.': case '-': case '_': case ':':
+            /* fallthrough */
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* add character to tag name */
+            word[0] = *pos++;
+            st->len = 1;
+            goto param_label;
+
+        case '\'':
+            /* start of a single-quote-delimited anonymous parameter value */
+            pos++;
+            goto pval_quot_label;
+
+        case '"':
+            /* start of a double-quote-delimited anonymous parameter value */
+            pos++;
+            goto pval_dquot_label;
+
+        case ASCII_CASE_EXTENDED:
+        default:
+            /* ignore everything else */
+            pos++;
+            break;
+        }
+    }
+
+/* parsing a tag that may be self-ending */
+tag_selfend_label:
+    while (1) {
+        unsigned int tmp;
+
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* self-ended, copy tag name from buffer into word */
+            pos++;
+            assert(st->tagbuflen <= st->wordlen);
+            word[0] = '/';
+
+            if (st->tagbuflen == st->wordlen) {
+                /* need to exclude last character */
+                tmp = st->wordlen;
+            } else {
+                tmp = st->tagbuflen + 1;
+            }
+            memcpy(&word[1], st->tagbuf, tmp);
+            *length = tmp;
+            RETURN(MLPARSE_TAG, STATE_TOPLEVEL);
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* ignore */
+            pos++;
+            break;
+
+        default:
+            /* not self-ending, let tag handle it */
+            goto tag_label;
+        }
+    }
+
+/* parsing a parameter name */
+param_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* tag and parameter ended */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAM, STATE_TOPLEVEL);
+
+        case '=':
+            /* start of a parameter value */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAM, STATE_PVAL_FIRST);
+
+        case ASCII_CASE_SPACE:
+            /* possibly the start of a parameter value */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAM, STATE_PARAM_EQ);
+
+        case ASCII_CASE_UPPER:
+            /* add character to tag name */
+            PUSH(ASCII_TOLOWER(*pos++), MLPARSE_PARAM, STATE_PARAM);
+            break;
+
+        /* xml allows these characters in names */
+        case '.': case '-': case '_': case ':':
+            /* fallthrough */
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* add character to tag name */
+            PUSH(*pos++, MLPARSE_PARAM, STATE_PARAM);
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        default:
+            /* ignore junk */
+            pos++;
+            break;
+        }
+    }
+
+/* have parsed a parameter name, waiting to see if it has a value */
+param_eq_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* tag ends */
+            pos++;
+            goto toplevel_label;
+
+        case '=':
+            pos++;
+            goto pval_first_label;
+
+        case '\'':
+            /* start of a single-quote-delimited anonymous parameter value */
+            pos++;
+            goto pval_quot_label;
+
+        case '"':
+            /* start of a double-quote-delimited anonymous parameter value */
+            pos++;
+            goto pval_dquot_label;
+
+        case ASCII_CASE_UPPER:
+            /* start of a different parameter */
+            word[0] = ASCII_TOLOWER(*pos++);
+            st->len = 1;
+            goto param_label;
+
+        /* xml allows these characters in names */
+        case '.': case '-': case '_': case ':':
+            /* fallthrough */
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* start of a different parameter */
+            word[0] = *pos++;
+            st->len = 1;
+            goto param_label;
+
+        case ASCII_CASE_EXTENDED:
+        default:
+        case ASCII_CASE_SPACE:
+            /* ignore */
+            pos++;
+            break;
+        }
+    }
+
+/* parsing the first character of a parameter value */
+pval_first_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* tag and parameter (empty) ended */
+            pos++;
+            *length = 0;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        case '\'':
+            /* start of a single-quote-delimited parameter value */
+            pos++;
+            goto pval_quot_label;
+
+        case '"':
+            /* start of a double-quote-delimited parameter value */
+            pos++;
+            goto pval_dquot_label;
+
+        case ASCII_CASE_UPPER:
+            /* start of a whitespace delimited parameter value */
+            if (strip) {
+                word[0] = TOLOWER(*pos++);
+            } else {
+                word[0] = *pos++;
+            }
+            st->len = 1;
+            goto pval_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* start of a whitespace delimited parameter value */
+            word[0] = *pos++;
+            st->len = 1;
+            goto pval_label;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_SPACE:
+        default:
+            /* ignore */
+            pos++;
+            break;
+        }
+    }
+
+/* parsing a whitespace delimited parameter value */
+pval_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* tag and parameter end */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        case '-':
+        case '\'':
+        default:
+            /* break after two successive punctuation marks */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL);
+            }
+            goto pval_punc_label;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_PARAMVAL, STATE_PVAL);
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL);
+            }
+            break;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL);
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* end of the pval */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG);
+        case '/':
+            /* could be the end of a self-ending tag */
+            pos++;
+            st->next_state = STATE_PVAL;
+            goto pval_selfend_label;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:   
+            /* ignore junk */
+            pos++;
+            break;
+        }
+    }
+
+/* parsing a whitespace delimited parameter value after in-word punctuation */
+pval_punc_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* tag and parameter value end */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        default:
+        case '-':
+        case '\'':
+            /* end of the pval */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_PUNC);
+            }
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL);
+
+        case ASCII_CASE_UPPER:
+            /* push character onto word */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_PARAMVAL, STATE_PVAL_PUNC);
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_PUNC);
+            }
+            goto pval_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_PUNC);
+            goto pval_label;
+
+        case ASCII_CASE_SPACE:
+            /* end of the pval */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG);
+
+        case '/':
+            /* could be the end of a self-ending tag */
+            pos++;
+            st->next_state = STATE_PVAL_PUNC;
+            goto pval_selfend_label;
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore junk */
+            pos++;
+            break;
+        }
+    }
+
+/* parsing a whitespace-delimited parameter value after we received a / */
+pval_selfend_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* pval ended, tag self-ended */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG_SELFEND);
+
+        default:
+            /* not self-ending, go back to where we came from */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+
+/* parsing a single-quote-delimited parameter value */
+pval_quot_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            goto toplevel_label;
+
+        case '\'':
+            /* end single quote (apostrophe) ends pval */
+            pos++;
+            goto tag_label;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                word[0] = TOLOWER(*pos++);
+            } else {
+                word[0] = *pos++;
+            }
+            st->len = 1;
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            word[0] = *pos++;
+            st->len = 1;
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_SPACE:
+            if (!strip) {
+                word[0] = *pos++;
+                st->len = 1;
+                goto pval_quot_space_label;
+            } else {
+                pos++;
+            }
+            break;
+
+        default:
+            if (!strip) {
+                word[0] = *pos++;
+                st->len = 1;
+                goto pval_quot_word_label;
+            } else {
+                pos++;
+            }
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            pos++;
+            break;
+
+        case CASE_EREF(STATE_PVAL_QUOT_ESC);
+        }
+    }
+
+/* same as pval_quote, but next character is escaped */
+pval_quot_esc_label:
+    while (1) {
+
+        /* catch non-contiguity that entity references may have introduced (by
+         * forcing the use of the internal buffer when the rest of the 
+         * contiguous data is in the provided buffer */
+        assert(pos < end);
+        tmppos = pos++;
+        if (pos == end) {
+            assert(pos == st->end);
+            assert(st->flags & FLAG_BUFFER);
+            st->flags &= ~FLAG_BUFFER;
+            st->end = st->pos = st->buf;
+            pos = parser->next_in;
+            end = parser->next_in + parser->avail_in;
+        }
+
+        switch (*tmppos) {
+        case '&':
+        case '>':
+        case '\'':
+            if (strip) {
+                /* ignore */
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_ESC);
+            }
+            break;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                word[0] = TOLOWER(*tmppos);
+            } else {
+                word[0] = *tmppos;
+            }
+            st->len = 1;
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            word[0] = *tmppos;
+            st->len = 1;
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_SPACE:
+            if (!strip) {
+                word[0] = *tmppos;
+                st->len = 1;
+                goto pval_quot_space_label;
+            }
+            break;
+
+        default:
+            if (!strip) {
+                word[0] = *tmppos;
+                st->len = 1;
+                goto pval_quot_word_label;
+            }
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+        }
+
+        /* now return to normal processing */
+        goto pval_quot_label;
+    }
+
+/* in a word in a single-quote-delimited parameter value */
+pval_quot_word_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        case '\'':
+            /* end single quote (apostrophe) ends pval */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG);
+
+        case '-':
+        default:
+            /* break after two successive punctuation characters in a word */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_WORD);
+            }
+            goto pval_quot_punc_label;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_PARAMVAL, STATE_PVAL_QUOT_WORD);
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_WORD);
+            }
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_WORD);
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_SPACE:
+            /* end of pval */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_QUOT);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            pos++;
+            break;
+
+        case CASE_EREF(STATE_PVAL_QUOT_WORD_ESC);
+        }
+    }
+
+/* same as pval_quot_word, but next character is escaped */
+pval_quot_word_esc_label:
+    while (1) {
+
+        /* catch non-contiguity that entity references may have introduced (by
+         * forcing the use of the internal buffer when the rest of the 
+         * contiguous data is in the provided buffer */
+        assert(pos < end);
+        tmppos = pos++;
+        if (pos == end) {
+            assert(pos == st->end);
+            assert(st->flags & FLAG_BUFFER);
+            st->flags &= ~FLAG_BUFFER;
+            st->end = st->pos = st->buf;
+            pos = parser->next_in;
+            end = parser->next_in + parser->avail_in;
+        }
+
+        switch (*tmppos) {
+        case '&':
+        case '>':
+        case '\'':
+            if (strip) {
+                /* ignore */
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_WORD_ESC);
+            }
+            break;
+
+        default:
+        case '-':
+            /* break after two successive punctuation characters in a word */
+            if (strip) {
+                /* ignore */
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_WORD_ESC);
+            }
+            goto pval_quot_punc_label;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*tmppos), MLPARSE_PARAMVAL, 
+                  STATE_PVAL_QUOT_WORD_ESC);
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_WORD_ESC);
+            }
+            break;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_WORD_ESC);
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* end of pval */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_QUOT);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+        }
+
+        /* now return to normal processing */
+        goto pval_quot_word_label;
+    }
+    CANT_GET_HERE();
+
+/* in a word after punctuation in a single-quote-delimited parameter value */
+pval_quot_punc_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        case '\'':
+            /* end single quote (apostrophe) ends pval */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG);
+
+        default:
+        case '-':
+            /* end of pval */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_PUNC);
+            }
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_QUOT);
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_PARAMVAL, STATE_PVAL_QUOT_PUNC);
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_PUNC);
+            }
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_PUNC);
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_SPACE:
+            /* end of pval */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_QUOT);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            pos++;
+            break;
+
+        case CASE_EREF(STATE_PVAL_QUOT_PUNC_ESC);
+        }
+    }
+
+/* same as pval_quot_punc, but next character is escaped */
+pval_quot_punc_esc_label:
+    while (1) {
+
+        /* catch non-contiguity that entity references may have introduced (by
+         * forcing the use of the internal buffer when the rest of the 
+         * contiguous data is in the provided buffer */
+        assert(pos < end);
+        tmppos = pos++;
+        if (pos == end) {
+            assert(pos == st->end);
+            assert(st->flags & FLAG_BUFFER);
+            st->flags &= ~FLAG_BUFFER;
+            st->end = st->pos = st->buf;
+            pos = parser->next_in;
+            end = parser->next_in + parser->avail_in;
+        }
+
+        switch (*tmppos) {
+        case '&':
+        case '>':
+        case '\'':
+        default:
+        case '-':
+            /* end of pval */
+            if (strip) {
+                /* ignore */
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_PUNC_ESC);
+            }
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_QUOT);
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*tmppos), MLPARSE_PARAMVAL, 
+                  STATE_PVAL_QUOT_PUNC_ESC);
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_PUNC_ESC);
+            }
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_PUNC_ESC);
+            goto pval_quot_word_label;
+
+        case ASCII_CASE_SPACE:
+            /* end of pval */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_QUOT);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+        }
+
+        /* now return to normal processing */
+        goto pval_quot_punc_label;
+    }
+    CANT_GET_HERE();
+
+pval_quot_space_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        case '\'':
+            /* end single quote (apostrophe) ends pval */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG);
+
+        default:
+            /* end of space */
+            *length = st->len;
+            RETURN(MLPARSE_WHITESPACE, STATE_PVAL_QUOT);
+
+        case ASCII_CASE_SPACE:
+            /* space continues */
+            PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_SPACE);
+            break;
+
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            pos++;
+            break;
+
+        case CASE_EREF(STATE_PVAL_QUOT_SPACE_ESC);
+        }
+    }
+
+pval_quot_space_esc_label:
+    while (1) {
+
+        /* catch non-contiguity that entity references may have introduced (by
+         * forcing the use of the internal buffer when the rest of the 
+         * contiguous data is in the provided buffer */
+        assert(pos < end);
+        tmppos = pos++;
+        if (pos == end) {
+            assert(pos == st->end);
+            assert(st->flags & FLAG_BUFFER);
+            st->flags &= ~FLAG_BUFFER;
+            st->end = st->pos = st->buf;
+            pos = parser->next_in;
+            end = parser->next_in + parser->avail_in;
+        }
+
+        switch (*tmppos) {
+        case '&':
+        case '>':
+        case '\'':
+        default:
+            /* end of space */
+            pos--;  /* dodgy, but we need to preserve the character */
+            *length = st->len;
+            RETURN(MLPARSE_WHITESPACE, STATE_PVAL_QUOT_ESC);
+
+        case ASCII_CASE_SPACE:
+            /* space continues */
+            PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_QUOT_SPACE_ESC);
+            break;
+
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+        }
+
+        /* now return to normal processing */
+        goto pval_quot_space_label;
+    }
+    CANT_GET_HERE();
+
+/* parsing a double-quote-delimited parameter value */
+pval_dquot_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            goto toplevel_label;
+
+        case '"':
+            /* end double quote ends pval */
+            pos++;
+            goto tag_label;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                word[0] = TOLOWER(*pos++);
+            } else {
+                word[0] = *pos++;
+            }
+            st->len = 1;
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            word[0] = *pos++;
+            st->len = 1;
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_SPACE:
+            if (strip) {
+                pos++;
+            } else {
+                word[0] = *pos++;
+                st->len = 1;
+                goto pval_dquot_space_label;
+            }
+            break;
+
+        default:
+            if (strip) {
+                pos++;
+            } else {
+                word[0] = *pos++;
+                st->len = 1;
+                goto pval_dquot_word_label;
+            }
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            pos++;
+            break;
+
+        case CASE_EREF(STATE_PVAL_DQUOT_ESC);
+        }
+    }
+
+/* same as pval_dquot, but next character is escaped */
+pval_dquot_esc_label:
+    while (1) {
+
+        /* catch non-contiguity that entity references may have introduced (by
+         * forcing the use of the internal buffer when the rest of the 
+         * contiguous data is in the provided buffer */
+        assert(pos < end);
+        tmppos = pos++;
+        if (pos == end) {
+            assert(pos == st->end);
+            assert(st->flags & FLAG_BUFFER);
+            st->flags &= ~FLAG_BUFFER;
+            st->end = st->pos = st->buf;
+            pos = parser->next_in;
+            end = parser->next_in + parser->avail_in;
+        }
+
+        switch (*tmppos) {
+        case '&':
+        case '>':
+        case '"':
+        default:
+            if (strip) {
+                /* ignore */
+            } else {
+                word[0] = *tmppos;
+                st->len = 1;
+                goto pval_dquot_word_label;
+            }
+            break;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                word[0] = TOLOWER(*tmppos);
+            } else {
+                word[0] = *tmppos;
+            }
+            st->len = 1;
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            word[0] = *tmppos;
+            st->len = 1;
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_SPACE:
+            if (strip) {
+                /* ignore */
+            } else {
+                word[0] = *tmppos;
+                st->len = 1;
+                goto pval_dquot_space_label;
+            }
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+        }
+
+        /* now resume normal processing */
+        goto pval_dquot_label;
+    }
+
+/* in a word in a double-quote-delimited parameter value */
+pval_dquot_word_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        case '"':
+            /* end double quote ends pval */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG);
+
+        case '-':
+        default:
+            /* two successive punctuation characters end a word */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_WORD);
+            }
+            goto pval_dquot_punc_label;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_WORD);
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_WORD);
+            }
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_WORD);
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_SPACE:
+            /* end of pval */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_DQUOT);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            pos++;
+            break;
+
+        case CASE_EREF(STATE_PVAL_DQUOT_WORD_ESC);
+        }
+    }
+
+/* same as pval_dquot_word, but next character is escaped */
+pval_dquot_word_esc_label:
+    while (1) {
+
+        /* catch non-contiguity that entity references may have introduced (by
+         * forcing the use of the internal buffer when the rest of the 
+         * contiguous data is in the provided buffer */
+        assert(pos < end);
+        tmppos = pos++;
+        if (pos == end) {
+            assert(pos == st->end);
+            assert(st->flags & FLAG_BUFFER);
+            st->flags &= ~FLAG_BUFFER;
+            st->end = st->pos = st->buf;
+            pos = parser->next_in;
+            end = parser->next_in + parser->avail_in;
+        }
+
+        switch (*tmppos) {
+        case '&':
+        case '>':
+        case '"':
+        case '-':
+        default:
+            if (strip) {
+                /* ignore */
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_WORD_ESC);
+            }
+            goto pval_dquot_punc_label;
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*tmppos), MLPARSE_PARAMVAL, 
+                  STATE_PVAL_DQUOT_WORD_ESC);
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_WORD_ESC);
+            }
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_WORD_ESC);
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_SPACE:
+            /* end of pval */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_DQUOT);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+        }
+
+        /* now resume normal processing */
+        goto pval_dquot_word_label;
+    }
+
+/* in a word after punctuation in a double-quote-delimited parameter value */
+pval_dquot_punc_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        case '"':
+            /* end double quote ends pval */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG);
+
+        case '-':
+        default:
+            /* two successive punctuation marks end the word */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_PUNC);
+            }
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_DQUOT);
+
+        case ASCII_CASE_SPACE:
+            /* end of word */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_DQUOT);
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_PUNC);
+            } else {
+                PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_PUNC);
+            }
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_PUNC);
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            pos++;
+            break;
+
+        case CASE_EREF(STATE_PVAL_DQUOT_PUNC_ESC);
+        }
+    }
+
+/* same as pval_dquot_punc, but next character is escaped */
+pval_dquot_punc_esc_label:
+    while (1) {
+
+        /* catch non-contiguity that entity references may have introduced (by
+         * forcing the use of the internal buffer when the rest of the 
+         * contiguous data is in the provided buffer */
+        assert(pos < end);
+        tmppos = pos++;
+        if (pos == end) {
+            assert(pos == st->end);
+            assert(st->flags & FLAG_BUFFER);
+            st->flags &= ~FLAG_BUFFER;
+            st->end = st->pos = st->buf;
+            pos = parser->next_in;
+            end = parser->next_in + parser->avail_in;
+        }
+
+        switch (*tmppos) {
+        case '&':
+        case '>':
+        case '"':
+        case '-':
+        default:
+            if (strip) {
+                /* ignore */
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_PUNC_ESC);
+            }
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_DQUOT);
+
+        case ASCII_CASE_SPACE:
+            /* end of word */
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_PVAL_DQUOT);
+
+        case ASCII_CASE_UPPER:
+            /* push character onto pval */
+            if (strip) {
+                PUSH(TOLOWER(*tmppos), MLPARSE_PARAMVAL, 
+                  STATE_PVAL_DQUOT_PUNC_ESC);
+            } else {
+                PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_PUNC_ESC);
+            }
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto pval */
+            PUSH(*tmppos, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_PUNC_ESC);
+            goto pval_dquot_word_label;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+        }
+
+        /* now resume normal processing */
+        goto pval_dquot_punc_label;
+    }
+
+pval_dquot_space_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            /* end of tag */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TOPLEVEL);
+
+        case '\'':
+            /* end single quote (apostrophe) ends pval */
+            pos++;
+            *length = st->len;
+            RETURN(MLPARSE_PARAMVAL, STATE_TAG);
+
+        default:
+            /* end of space */
+            *length = st->len;
+            RETURN(MLPARSE_WHITESPACE, STATE_PVAL_DQUOT);
+
+        case ASCII_CASE_SPACE:
+            /* space continues */
+            PUSH(*pos++, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_SPACE);
+            break;
+
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            pos++;
+            break;
+
+        case CASE_EREF(STATE_PVAL_DQUOT_SPACE_ESC);
+        }
+    }
+
+pval_dquot_space_esc_label:
+    while (1) {
+
+        /* catch non-contiguity that entity references may have introduced (by
+         * forcing the use of the internal buffer when the rest of the 
+         * contiguous data is in the provided buffer */
+        assert(pos < end);
+        tmppos = pos++;
+        if (pos == end) {
+            assert(pos == st->end);
+            assert(st->flags & FLAG_BUFFER);
+            st->flags &= ~FLAG_BUFFER;
+            st->end = st->pos = st->buf;
+            pos = parser->next_in;
+            end = parser->next_in + parser->avail_in;
+        }
+
+        switch (*tmppos) {
+        case '&':
+        case '>':
+        case '\'':
+        default:
+            /* end of space */
+            pos--;  /* dodgy, but we need to preserve the character */
+            *length = st->len;
+            RETURN(MLPARSE_WHITESPACE, STATE_PVAL_DQUOT_ESC);
+
+        case ASCII_CASE_SPACE:
+            /* space continues */
+            PUSH(*tmppos++, MLPARSE_PARAMVAL, STATE_PVAL_DQUOT_SPACE_ESC);
+            break;
+
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+        }
+
+        /* now resume normal processing */
+        goto pval_dquot_space_label;
+    }
+
+/* parse the first character of an entity reference */
+eref_peek_first_label:
+    while (tmppos < tmpend) {
+        switch (*tmppos) {
+        /* xml allows these characters in names */
+        case ASCII_CASE_UPPER:
+        case '.': case '-': case '_': case ':':
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            st->erefbuf[0] = *tmppos++;
+            st->count = 1;
+            goto eref_peek_label;
+
+        case '#':
+            /* allowed, as it denotes a numeric character reference */
+            tmppos++;
+            goto eref_num_peek_first_label;
+
+        default:
+        case ASCII_CASE_EXTENDED:
+            /* shouldn't get anything else */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(MAXENTITYREF, STATE_EREF_PEEK_FIRST);
+
+/* parse the first character of an entity reference */
+eref_num_peek_first_label:
+    while (tmppos < tmpend) {
+        switch (*tmppos) {
+        /* xml allows these characters in names */
+        case ASCII_CASE_DIGIT:
+            st->erefbuf[0] = *tmppos++;
+            st->count = 1;
+            goto eref_num_peek_label;
+
+        case 'X':
+        case 'x':
+            /* indicates start of hexadecimal numeric character reference */
+            tmppos++;
+            st->count = 0;
+            goto eref_hex_peek_label;
+
+        default:
+            /* shouldn't get anything else */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(MAXENTITYREF, STATE_EREF_NUM_PEEK_FIRST);
+
+/* parse a numeric entity reference */
+eref_num_peek_label:
+    while ((tmppos < tmpend) && (st->count < MAXENTITYREF)) {
+        char *numend;
+        long int num;
+
+        switch (*tmppos) {
+        /* xml allows these characters in names */
+        case ASCII_CASE_DIGIT:
+            st->erefbuf[st->count++] = *tmppos++;
+            break;
+
+        case ';':
+            /* XXX: note that we don't recognise references to the extended
+             * character set at the moment, this requires i18n of the whole
+             * parser */
+            tmppos++;
+            st->erefbuf[st->count] = '\0';
+            if (((num = strtol(st->erefbuf, &numend, 10)) >= 0) 
+              && (*numend == '\0') && (num < UCHAR_MAX)) {
+                /* fiddle the buffers to replace text */
+                if ((st->flags & FLAG_BUFFER) 
+                  /* handle case where part of eref is in the buffer */
+                  && ((tmppos >= st->pos) && (tmppos <= st->end))) {
+                    /* working in the buffer */
+                    pos += st->count + 1;  /* + 1 for opening '#' */
+                } else {
+                    /* nothing should be buffered after this, put reference char
+                     * in buffer alone, saving next_in position */
+                    parser->next_in = tmppos;
+                    parser->avail_in = tmpend - parser->next_in;
+                    pos = st->pos = st->buf;
+                    end = st->end = st->buf + 1;
+                    st->flags |= FLAG_BUFFER;
+                }
+
+                /* XXX: semi-dodgy cast to allow changing of the buffer */
+                numend = (char *) pos;
+                *numend = (char) num;
+
+                JUMP(st->next_state, (st->flags & ~FLAG_BUFFER), 0);
+            }
+            /* fallthrough for failed conversions */
+
+        default:
+            /* shouldn't get anything else */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(MAXENTITYREF, STATE_EREF_NUM_PEEK);
+
+/* parse a hexadecimal numeric entity reference */
+eref_hex_peek_label:
+    while ((tmppos < tmpend) && (st->count < MAXENTITYREF)) {
+        long int num;
+        char *numend;
+
+        switch (*tmppos) {
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+            st->erefbuf[st->count++] = ASCII_TOLOWER(*tmppos++);
+            break;
+
+        case ASCII_CASE_DIGIT:
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+            st->erefbuf[st->count++] = *tmppos++;
+            break;
+
+        case ';':
+            /* XXX: note that we don't recognise references to the extended
+             * character set at the moment, this requires i18n of the whole
+             * parser */
+            tmppos++;
+            st->erefbuf[st->count] = '\0';
+            if (((num = strtol(st->erefbuf, &numend, 16)) >= 0) 
+              && (*numend == '\0') && (num < UCHAR_MAX)) {
+                /* fiddle the buffers to replace text */
+                if ((st->flags & FLAG_BUFFER) 
+                  /* handle case where part of eref is in the buffer */
+                  && ((tmppos >= st->pos) && (tmppos <= st->end))) {
+                    /* working in the buffer */
+                    pos += st->count + 2;  /* + 1 for opening '#x' */
+                } else {
+                    /* nothing should be buffered after this, put reference char
+                     * in buffer alone, saving next_in position */
+                    parser->next_in = tmppos;
+                    parser->avail_in = tmpend - parser->next_in;
+                    pos = st->pos = st->buf;
+                    end = st->end = st->buf + 1;
+                    st->flags |= FLAG_BUFFER;
+                }
+
+                /* XXX: semi-dodgy cast to allow changing of the buffer */
+                numend = (char *) pos;
+                *numend = (char) num;
+
+                JUMP(st->next_state, (st->flags & ~FLAG_BUFFER), 0);
+            }
+            /* fallthrough for failed conversions */
+
+        default:
+            /* shouldn't get anything else */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(MAXENTITYREF, STATE_EREF_HEX_PEEK);
+
+/* have recieved an open entity reference, need to establish whether its 
+ * valid */
+eref_peek_label:
+    while ((tmppos < tmpend) && (st->count < MAXENTITYREF)) {
+        int c;
+
+        switch (*tmppos) {
+        /* xml allows these characters in names */
+        case ASCII_CASE_UPPER:
+        case '.': case '-': case '_': case ':':
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            st->erefbuf[st->count++] = *tmppos++;
+            break;
+
+        case ';':
+            /* match entity reference */
+            tmppos++;
+            st->erefbuf[st->count] = '\0';
+            switch (st->count) {
+            case 2:
+                /* lt, gt */
+                if (!str_cmp("lt", st->erefbuf)) {
+                    c = '<';
+                } else if (!str_cmp("gt", st->erefbuf)) {
+                    c = '>';
+                } else {
+                    c = -1;
+                }
+                break;
+
+            case 3:
+                /* amp */
+                if (!str_cmp("amp", st->erefbuf)) {
+                    c = '&';
+                } else {
+                    c = -1;
+                }
+                break;
+
+            case 4:
+                /* quot, nbsp, apos */
+                if (!str_cmp("quot", st->erefbuf)) {
+                    c = '"';
+                } else if (!str_cmp("apos", st->erefbuf)) {
+                    c = '\'';
+                } else if (!str_cmp("nbsp", st->erefbuf)) {
+                    /* this is incorrect but is semantically better than just 
+                     * ignoring it with the rest of the extended char 
+                     * references (XXX: at least until we recognise nbsp as a 
+                     * whitespace character) */
+                    c = ' ';
+                } else {
+                    c = -1;
+                }
+                break;
+
+            default:
+                c = -1;
+                break;
+            };
+
+            if (c != -1) {
+                char *tmp;
+
+                if ((st->flags & FLAG_BUFFER) 
+                  /* handle case where part of eref is in the buffer */
+                  && ((tmppos >= st->pos) && (tmppos <= st->end))) {
+                    /* working in the buffer */
+                    pos += st->count;
+                } else {
+                    /* nothing should be buffered after this, put reference char
+                     * in buffer alone, saving next_in position */
+                    parser->next_in = tmppos;
+                    parser->avail_in = tmpend - parser->next_in;
+                    pos = st->pos = st->buf;
+                    end = st->end = st->buf + 1;
+                    st->flags |= FLAG_BUFFER;
+                }
+                
+                /* XXX: semi-dodgy cast to allow changing of the buffer */
+                tmp = (char *) pos;
+                *tmp = (char) c;
+
+                JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+            }
+            /* fallthrough for failed conversions */
+
+        case ASCII_CASE_EXTENDED:
+        default:
+            /* anything else isn't valid */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(MAXENTITYREF, STATE_EREF_PEEK);
+
+/* recognising comments and marked sections */
+decl_peek_label:
+    while (tmppos < tmpend) {
+        switch (*tmppos) {
+        case '[':
+            /* possible marked section */
+            tmppos++;
+            st->count++;
+            goto marksec_peek_label_first_label;
+
+        case '-':
+            /* possible comment */
+            tmppos++;
+            st->count++;
+            goto comment_peek_first_label;
+
+        case '>':
+            /* <!> (empty) comment */
+            goto tag_peek_name_label;
+
+        default:
+            goto tag_peek_name_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_DECL_PEEK);
+
+/* recognising comments (second hyphen character) */
+comment_peek_first_label:
+    while (tmppos < tmpend) {
+        switch (*tmppos) {
+        case '-':
+            /* comment continues */
+            tmppos++;
+            st->count++;
+            goto comment_peek_label;
+
+        default:
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(st->lookahead, STATE_COMMENT_PEEK_FIRST);
+
+/* recognising comments */
+comment_peek_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case '-':
+            /* comment starts to end? */
+            tmppos++;
+            st->count++;
+            goto comment_peek_end_first_label;
+
+        case '<':
+            /* start of another comment? */
+            tmppos++;
+            st->count++;
+            goto comment_peek_badend_first_label;
+
+        default:
+            tmppos++;
+            st->count++;
+            break;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_COMMENT_PEEK);
+
+/* recognising comments */
+comment_peek_end_first_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case '-':
+            /* comment continues to end */
+            tmppos++;
+            st->count++;
+            goto comment_peek_end_label;
+
+        case '<':
+            /* start of another comment? */
+            tmppos++;
+            st->count++;
+            goto comment_peek_badend_first_label;
+
+        default:
+            /* not ending after all */
+            tmppos++;
+            st->count++;
+            goto comment_peek_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_COMMENT_PEEK_END_FIRST);
+
+/* recognising comments */
+comment_peek_end_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case '-':
+            /* comment continues to end */
+            tmppos++;
+            st->count++;
+            break;
+
+        case '<':
+            /* start of another comment? */
+            tmppos++;
+            st->count++;
+            goto comment_peek_badend_first_label;
+
+        case '>':
+            /* comment ends */
+            st->flags |= FLAG_COMMENT;
+            
+            /* need to return previous entity */
+            st->count = 0;
+            tmppos++;
+            RETURN_IF_STORED(STATE_COMMENT_ENTRY);
+            /* otherwise (nothing stored) */
+            goto comment_entry_label;
+
+        default:
+            /* not ending after all */
+            tmppos++;
+            st->count++;
+            goto comment_peek_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_COMMENT_PEEK_END);
+
+comment_peek_badend_first_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case '!':
+            /* comment start continues */
+            tmppos++;
+            st->count++;
+            goto comment_peek_badend_second_label;
+
+        default:
+            /* not starting another comment after all */
+            tmppos++;
+            st->count++;
+            goto comment_peek_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_COMMENT_PEEK_BADEND_FIRST);
+
+comment_peek_badend_second_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case '-':
+            /* comment start continues */
+            tmppos++;
+            st->count++;
+            goto comment_peek_badend_label;
+
+        default:
+            /* not starting another comment after all */
+            tmppos++;
+            st->count++;
+            goto comment_peek_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_COMMENT_PEEK_BADEND_SECOND);
+
+comment_peek_badend_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case '-':
+            /* comment start complete, don't accept previous comment start as
+             * valid */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+
+        default:
+            /* not starting another comment after all */
+            tmppos++;
+            st->count++;
+            goto comment_peek_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_COMMENT_PEEK_BADEND);
+
+/* need to pass over the <!-- */
+comment_entry_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos++) {
+        case '-':
+            st->count++;
+            /* pass two hyphens and then return a start comment */
+            if (st->count >= 2) {
+                *length = 0;
+                RETURN(MLPARSE_COMMENT, STATE_TOPLEVEL);
+            }
+            break;
+        }
+    }
+
+/* parsing inside a comment or cdata section */
+ccdata_toplevel_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case ASCII_CASE_UPPER:
+            /* push character onto word */
+            if (strip) {
+                word[0] = TOLOWER(*pos++);
+            } else {
+                word[0] = *pos++;
+            }
+            st->len = 1;
+            goto ccdata_word_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            word[0] = *pos++;
+            st->len = 1;
+            goto ccdata_word_label;
+
+        case '-':
+            st->len = 0;
+            pos++;
+            st->next_state = STATE_TOPLEVEL;
+            goto ccdata_end_comment_first_label;
+
+        case ']':
+            st->len = 0;
+            pos++;
+            st->next_state = STATE_TOPLEVEL;
+            goto ccdata_end_cdata_first_label;
+
+        case ASCII_CASE_SPACE:
+            if (strip) {
+                pos++;
+            } else {
+                word[0] = *pos++;
+                st->len = 1;
+                goto ccdata_space_label;
+            }
+            break;
+
+        default:
+            if (strip) {
+                pos++;
+            } else {
+                word[0] = *pos++;
+                st->len = 1;
+                goto ccdata_word_label;
+            }
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            if (strip) {
+                /* ignore junk in words */
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            break;
+        }
+    }
+
+/* parsing a word in a cdata or comment section */
+ccdata_word_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case ASCII_CASE_UPPER:
+            /* push character onto word */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_WORD, STATE_WORD);
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            break;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            break;
+
+        case '-':
+            /* could be the end of the comment */
+            pos++;
+            st->next_state = STATE_WORD;
+            goto ccdata_end_comment_first_label;
+
+        case ']':
+            /* could be the end of the cdata section */
+            pos++;
+            st->next_state = STATE_WORD;
+            goto ccdata_end_cdata_first_label;
+
+        case ASCII_CASE_SPACE:
+            /* word ends */
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case '\'':
+        default:
+            /* two successive punctuation marks end a word */
+            if (strip) {
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            goto ccdata_punc_label;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            if (strip) {
+                /* ignore junk in words */
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            break;
+        }
+    }
+
+ccdata_punc_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case ASCII_CASE_UPPER:
+            /* push character onto word */
+            if (strip) {
+                PUSH(TOLOWER(*pos++), MLPARSE_WORD, STATE_PUNC);
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_PUNC);
+            }
+            goto ccdata_word_label;
+
+        case '-':
+            /* could be the end of the comment */
+            pos++;
+            st->next_state = STATE_PUNC;
+            goto ccdata_end_comment_first_label;
+
+        case ']':
+            /* could be the end of the cdata section */
+            pos++;
+            st->next_state = STATE_PUNC;
+            goto ccdata_end_cdata_first_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            PUSH(*pos++, MLPARSE_WORD, STATE_PUNC);
+            goto ccdata_word_label;
+
+        default:
+        case ASCII_CASE_SPACE:
+            /* word ends */
+            *length = st->len;
+            RETURN(MLPARSE_WORD, STATE_TOPLEVEL);
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            if (strip) {
+                /* ignore junk in words */
+                pos++;
+            } else {
+                PUSH(*pos++, MLPARSE_WORD, STATE_WORD);
+            }
+            break;
+        }
+    }
+
+ccdata_space_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        default:
+            /* space ends */
+            *length = st->len;
+            RETURN(MLPARSE_WHITESPACE, STATE_TOPLEVEL);
+
+        case ASCII_CASE_SPACE:
+            /* space continues */
+            PUSH(*pos++, MLPARSE_WHITESPACE, STATE_SPACE);
+            break;
+
+        case ASCII_CASE_CONTROL:
+            /* ignore junk */
+            pos++;
+            break;
+        }
+    }
+
+ccdata_end_comment_first_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '-':
+            /* continues to end */
+            pos++;
+            st->count = 2;  /* we've consumed two hyphens */
+            goto ccdata_end_comment_label;
+
+        default:
+            /* not ending after all */
+            st->count = 1;  /* we've consumed one hyphen */
+            goto ccdata_recovery_label;
+        }
+    }
+
+ccdata_end_comment_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            if (st->flags & FLAG_COMMENT) {
+                /* comment ends, return stored value */
+                tmppos++;
+                RETURN_IF_STORED(STATE_CCDATA_END_COMMENT); /* and here after */
+                /* otherwise (nothing stored) */
+                st->flags &= ~FLAG_COMMENT;
+                pos++;
+                *length = 0;
+                RETURN(MLPARSE_END | MLPARSE_COMMENT, STATE_TOPLEVEL);
+            } else {
+                /* was a comment ending in a cdata section */
+                assert(st->flags & FLAG_CDATA);
+                goto ccdata_recovery_label;
+            }
+            break;
+
+        case '-':
+            /* continues to end */
+            st->count++;
+            pos++;
+            break;
+
+        default:
+            /* not ending after all */
+            goto ccdata_recovery_label;
+        }
+    }
+
+ccdata_end_cdata_first_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case ']':
+            /* continues to end */
+            pos++;
+            st->count = 2;  /* we've consumed two ']' characters */
+            goto ccdata_end_cdata_label;
+
+        default:
+            /* not ending after all */
+            st->count = 1;  /* we've consumed one ']' character */
+            goto ccdata_recovery_label;
+        }
+    }
+
+ccdata_end_cdata_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '>':
+            if (st->flags & FLAG_CDATA) {
+                /* cdata ends, return stored value */
+                tmppos++;
+                RETURN_IF_STORED(STATE_CCDATA_END_CDATA); /* and here after */
+                /* otherwise (nothing stored) */
+                st->flags &= ~FLAG_CDATA;
+                pos++;
+                *length = 0;
+                RETURN(MLPARSE_END | MLPARSE_CDATA, STATE_TOPLEVEL);
+            } else {
+                /* was a comment ending in a cdata section */
+                assert(st->flags & FLAG_COMMENT);
+                goto ccdata_recovery_label;
+            }
+            break;
+
+        case ']':
+            /* continues to end */
+            st->count++;
+            pos++;
+            break;
+
+        default:
+            /* not ending after all */
+            goto ccdata_recovery_label;
+        }
+    }
+
+ccdata_recovery_label:
+    while (st->count) {
+        if (st->flags & FLAG_COMMENT) {
+            /* need to push '-' onto the string */
+            switch (st->next_state) {
+            case STATE_TOPLEVEL:
+                if (!strip) {
+                    word[0] = '-';
+                    st->len = 1;
+                    st->next_state = STATE_WORD;
+                } else {
+                    /* do nothing */
+                }
+                break;
+
+            case STATE_WORD:
+                if (!strip) {
+                    PUSH('-', MLPARSE_WORD, STATE_CCDATA_RECOVERY);
+                }
+                st->next_state = STATE_PUNC;
+                break;
+
+            case STATE_PUNC:
+                if (!strip) {
+                    PUSH('-', MLPARSE_WORD, STATE_CCDATA_RECOVERY);
+                }
+                st->next_state = STATE_TOPLEVEL;
+                *length = st->len;
+                RETURN(MLPARSE_WORD, STATE_CCDATA_RECOVERY);
+
+            default:
+            case STATE_SPACE:
+                CANT_GET_HERE();
+            }
+        } else {
+            assert(st->flags & FLAG_CDATA);
+            /* need to push ']' onto the string */
+            switch (st->next_state) {
+            case STATE_TOPLEVEL:
+                if (!strip) {
+                    word[0] = ']';
+                    st->len = 1;
+                    st->next_state = STATE_WORD;
+                } else {
+                    /* do nothing */
+                }
+                break;
+
+            case STATE_WORD:
+                if (!strip) {
+                    PUSH(']', MLPARSE_WORD, STATE_CCDATA_RECOVERY);
+                } else {
+                    /* do nothing */
+                }
+                st->next_state = STATE_PUNC;
+                break;
+
+            case STATE_PUNC:
+                if (!strip) {
+                    PUSH(']', MLPARSE_WORD, STATE_CCDATA_RECOVERY);
+                }
+                st->next_state = STATE_TOPLEVEL;
+                *length = st->len;
+                RETURN(MLPARSE_WORD, STATE_CCDATA_RECOVERY);
+
+            default:
+            case STATE_SPACE:
+                CANT_GET_HERE();
+            }
+
+        }
+        st->count--;
+    }
+    JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+
+marksec_peek_label_first_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case ASCII_CASE_SPACE:
+            /* ignore */
+            tmppos++;
+            st->count++;
+            break;
+
+        case ASCII_CASE_UPPER:
+            /* start of marked section identifier */
+            st->tagbuf[0] = ASCII_TOLOWER(*tmppos++);
+            st->tagbuflen = 1;
+            st->count++;
+            goto marksec_peek_label_label;
+
+        case ASCII_CASE_LOWER:
+            /* start of marked section identifier */
+            /* (ab)use the entity refence buffer to identify marked sections */
+            st->tagbuf[0] = *tmppos++;
+            st->tagbuflen = 1;
+            st->count++;
+            goto marksec_peek_label_label;
+
+        default:
+            /* not a marked section */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(st->lookahead, STATE_MARKSEC_PEEK_LABEL_FIRST);
+
+marksec_peek_label_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case ASCII_CASE_UPPER:
+            /* add to marked section name in entity reference buffer */
+            if (st->tagbuflen < st->wordlen) {
+                st->tagbuf[st->tagbuflen++] = ASCII_TOLOWER(*tmppos);
+            }
+            tmppos++;
+            st->count++;
+            break;
+
+        case ASCII_CASE_LOWER:
+            /* add to marked section name in entity reference buffer */
+            if (st->tagbuflen < st->wordlen) {
+                st->tagbuf[st->tagbuflen++] = *tmppos;
+            }
+            tmppos++;
+            st->count++;
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* marked section label should now end */
+            tmppos++;
+            st->count++;
+            goto marksec_peek_label_last_label;
+
+        case '[':
+            /* marked section has started, but let _last state handle this */
+            goto marksec_peek_label_last_label;
+
+        default:
+            /* not a marked section */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(st->lookahead, STATE_MARKSEC_PEEK_LABEL);
+
+marksec_peek_label_last_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case ASCII_CASE_SPACE:
+            /* ignore */
+            tmppos++;
+            st->count++;
+            break;
+
+        case '[':
+            /* finished parsing marked section label */
+            tmppos++;
+            st->count++;
+            goto marksec_peek_label;
+
+        default:
+            /* not a marked section */
+            JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+        }
+    }
+    ENDBUF(st->lookahead, STATE_MARKSEC_PEEK_LABEL_LAST);
+
+marksec_peek_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case ']':
+            /* start of an end of marked section */
+            tmppos++;
+            st->count++;
+            goto marksec_peek_end_first_label;
+
+        default:
+            /* ignore */
+            tmppos++;
+            st->count++;
+            break;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_MARKSEC_PEEK);
+
+marksec_peek_end_first_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case ']':
+            /* continuation of an end of marked section */
+            tmppos++;
+            st->count++;
+            goto marksec_peek_end_label;
+
+        default:
+            tmppos++;
+            st->count++;
+            goto marksec_peek_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_MARKSEC_PEEK_END_FIRST);
+
+marksec_peek_end_label:
+    while ((tmppos < tmpend) && (st->count < st->lookahead)) {
+        switch (*tmppos) {
+        case '>':
+            if (!str_ncmp(st->tagbuf, "cdata", 5 /* strlen("cdata") */)) {
+                /* end marked section */
+                st->flags |= FLAG_CDATA;
+            
+                /* need to return previous entity */
+                st->count = 0;
+                tmppos++;
+                RETURN_IF_STORED(STATE_CDATA_ENTRY);
+                /* otherwise (nothing stored) */
+                goto cdata_entry_label;
+            } else {
+                /* its a marked section, but we don't recognise the type.  If
+                 * its SGML other valid (but currently unhandled) types are
+                 * ignore, include, rcdata, temp */
+
+                JUMP(st->next_state, st->flags & ~FLAG_BUFFER, 0);
+            }
+            break;
+
+        case ']':
+            /* continuation of an end marked section? */
+            tmppos++;
+            st->count++;
+            break;
+
+        default:
+            tmppos++;
+            st->count++;
+            goto marksec_peek_label;
+        }
+    }
+    ENDBUF(st->lookahead, STATE_MARKSEC_PEEK_END);
+
+/* parsing <![ CDATA [.  Because i'm sick of the whole trie-in-code thing, (and
+ * we've just validated the actual tag) just wait for two ['s to go past */
+cdata_entry_label:
+    while (1) {
+        assert(pos < end);
+        switch (*pos) {
+        case '[':
+            pos++;
+            st->count++;
+            if (st->count >= 2) {
+                *length = 0;
+                RETURN(MLPARSE_CDATA, STATE_TOPLEVEL);
+            }
+            break;
+
+        default:
+            pos++;
+            break;
+        }
+    }
+
+/* parser has buffered content, set pos and end appropriately and then jump to
+ * the correct state */
+trans_unbuffer_label:
+    pos = st->pos;
+    end = st->end;
+    JUMP(st->state, st->flags & ~FLAG_BUFFER, 0);
+
+/* the parser has hit EOF */
+eof_label:
+    switch (st->next_state) {
+    case STATE_WORD:
+    case STATE_WORD_ENDS:
+    case STATE_PUNC:
+    case STATE_PUNC_ENDS:
+    case STATE_ACRONYM:
+    case STATE_ACRONYM_LETTER:
+        st->next_state = STATE_EOF;
+        *length = st->len;
+        RETURN(MLPARSE_WORD, STATE_EOF);
+
+    case STATE_SPACE:
+        st->next_state = STATE_EOF;
+        *length = st->len;
+        RETURN(MLPARSE_WHITESPACE, STATE_EOF);
+
+    case STATE_PARAM:
+        st->next_state = STATE_EOF;
+        *length = st->len;
+        RETURN(MLPARSE_PARAM, STATE_EOF);
+
+    case STATE_PVAL:
+    case STATE_PVAL_PUNC:
+    case STATE_PVAL_QUOT:
+    case STATE_PVAL_QUOT_WORD:
+    case STATE_PVAL_QUOT_PUNC:
+    case STATE_PVAL_DQUOT:
+    case STATE_PVAL_DQUOT_WORD:
+    case STATE_PVAL_DQUOT_PUNC:
+        st->next_state = STATE_EOF;
+        *length = st->len;
+        RETURN(MLPARSE_PARAMVAL, STATE_EOF);
+
+    case STATE_PVAL_DQUOT_SPACE:
+    case STATE_PVAL_QUOT_SPACE:
+        st->next_state = STATE_EOF;
+        *length = st->len;
+        RETURN(MLPARSE_WHITESPACE, STATE_EOF);
+
+    case STATE_PARAM_EQ:
+    case STATE_PVAL_FIRST:
+    case STATE_PVAL_SELFEND:
+        /* don't do anything */
+        st->next_state = STATE_EOF;
+        break;
+
+    case STATE_EOF:
+        break;
+
+    default:
+        goto err_label;
+    }
+
+    *length = 0;
+    RETURN(MLPARSE_EOF, STATE_EOF);
+   
+/* the parser has hit an error */
+err_label:
+    st->flags = FLAG_NONE;
+    *length = 0;
+    RETURN(MLPARSE_ERR, STATE_ERR);
+}
+
+void mlparse_eof(struct mlparse *parser) {
+    switch (parser->state->state) {
+    default:
+        /* arrange to return the word being parsed */
+        parser->state->next_state = parser->state->state;
+        parser->state->state = STATE_EOF;
+        break;
+
+    case STATE_TOPLEVEL:
+        /* arrange to return EOF on next call (can validly end in this state) */
+        parser->state->next_state = STATE_EOF;
+        parser->state->state = STATE_EOF;
+        break;
+
+    /* all of the peek states fail to find target on eof */
+    case STATE_TAG_PEEK_FIRST:
+    case STATE_TAG_PEEK:
+    case STATE_TAG_PEEK_NAME:
+    case STATE_TAG_PEEK_NAME_CONT:
+    case STATE_EREF_PEEK_FIRST:
+    case STATE_EREF_PEEK:
+    case STATE_EREF_NUM_PEEK_FIRST:
+    case STATE_EREF_NUM_PEEK:
+    case STATE_EREF_HEX_PEEK:
+    case STATE_DECL_PEEK:
+    case STATE_COMMENT_PEEK_FIRST:
+    case STATE_COMMENT_PEEK:
+    case STATE_COMMENT_PEEK_END:
+    case STATE_COMMENT_PEEK_END_FIRST:
+    case STATE_COMMENT_PEEK_BADEND_FIRST:
+    case STATE_COMMENT_PEEK_BADEND_SECOND:
+    case STATE_COMMENT_PEEK_BADEND:
+    case STATE_MARKSEC_PEEK_LABEL_FIRST:
+    case STATE_MARKSEC_PEEK_LABEL:
+    case STATE_MARKSEC_PEEK_LABEL_LAST:
+    case STATE_MARKSEC_PEEK:
+    case STATE_MARKSEC_PEEK_END_FIRST:
+    case STATE_MARKSEC_PEEK_END:
+    case STATE_CCDATA_RECOVERY: /* FIXME: need to alter current word for 
+                                 * proper recovery */
+        /* break out of peek state */
+        parser->state->state = parser->state->next_state;
+        parser->state->next_state = STATE_EOF;
+        break;
+
+    case STATE_TOPLEVEL_ESC:
+    case STATE_WORD_ESC:
+    case STATE_WORD_ENDS_ESC:
+    case STATE_PUNC_ESC:
+    case STATE_PUNC_ENDS_ESC:
+    case STATE_SPACE_ESC:
+    case STATE_ACRONYM_ESC:
+    case STATE_ACRONYM_LETTER_ESC:
+    case STATE_PVAL_QUOT_ESC:
+    case STATE_PVAL_QUOT_WORD_ESC:
+    case STATE_PVAL_QUOT_PUNC_ESC:
+    case STATE_PVAL_QUOT_SPACE_ESC:
+    case STATE_PVAL_DQUOT_ESC:
+    case STATE_PVAL_DQUOT_WORD_ESC:
+    case STATE_PVAL_DQUOT_PUNC_ESC:
+    case STATE_PVAL_DQUOT_SPACE_ESC:
+    case STATE_COMMENT_ENTRY:
+    case STATE_CDATA_ENTRY:
+        /* shouldn't happen */
+        parser->state->state = STATE_ERR;
+        break;
+
+    case STATE_EOF:
+        break;
+    }
+}
+
+/* test code */
+#ifdef MLPARSE_TEST
+#define WORDLEN 50
+#define BUFSIZE 4096
+#define LOOKAHEAD 999
+
+/* whether to print stuff out or not (makes debugging much harder if incredible
+ * amounts of stuff are going to stdout) */
+#define MLPARSE_TEST_OUTPUT
+
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "stream.h"
+
+void parse(struct mlparse *parser, FILE *output, FILE *input, 
+  unsigned int buflen) {
+    enum mlparse_ret parse_ret;      /* value returned by the parser */
+    char word[WORDLEN + 1];          /* word returned by the parser */
+    unsigned int len;                /* length of word */
+    char *buf = (char *) parser->next_in;
+    unsigned int bytes = 0;
+    struct stream *instream;
+    struct stream_filter *filter;
+
+    if ((instream = stream_new()) 
+      && (filter = (struct stream_filter *) detectfilter_new(BUFSIZ, 0))
+      && (stream_filter_push(instream, filter) == STREAM_OK)) {
+        /* succeeded */
+        instream->next_in = NULL;
+        instream->avail_in = 0;
+    } else {
+        fprintf(stderr, "couldn't initialise stream/detection filter\n");
+        return;
+    }
+
+    while (((parse_ret = mlparse_parse(parser, word, &len, 1)) != MLPARSE_ERR) 
+      && (parse_ret != MLPARSE_EOF)) {
+        switch (parse_ret) {
+        case MLPARSE_WORD:
+        case MLPARSE_END | MLPARSE_WORD:
+        case MLPARSE_CONT | MLPARSE_WORD:
+#ifdef MLPARSE_TEST_OUTPUT
+            word[len] = '\0';
+            fprintf(output, "WORD = %s (%u)%s\n", word, len, 
+              parse_ret & MLPARSE_CONT ? " (cont)" 
+                : ((parse_ret & MLPARSE_END) ? " (endsentence)" : ""));
+#endif
+            break;
+
+        case MLPARSE_TAG:
+        case MLPARSE_CONT | MLPARSE_TAG:
+#ifdef MLPARSE_TEST_OUTPUT
+            word[len] = '\0';
+            fprintf(output, "TAG = %s (%u)%s\n", word, len, 
+              parse_ret & MLPARSE_CONT ? " (cont)" : "");
+#endif
+            break;
+
+        case MLPARSE_END | MLPARSE_TAG:
+        case MLPARSE_END | MLPARSE_CONT | MLPARSE_TAG:
+#ifdef MLPARSE_TEST_OUTPUT
+            word[len] = '\0';
+            fprintf(output, "ENDTAG = %s (%u)%s\n", word, len, 
+              parse_ret & MLPARSE_CONT ? " (cont)" : "");
+#endif
+            break;
+
+        case MLPARSE_PARAM:
+        case MLPARSE_CONT | MLPARSE_PARAM:
+#ifdef MLPARSE_TEST_OUTPUT
+            word[len] = '\0';
+            fprintf(output, "PARAM = %s (%u)%s\n", word, len, 
+              parse_ret & MLPARSE_CONT ? " (cont)" : "");
+#endif
+            break;
+
+        case MLPARSE_PARAMVAL:
+        case MLPARSE_CONT | MLPARSE_PARAMVAL:
+#ifdef MLPARSE_TEST_OUTPUT
+            word[len] = '\0';
+            fprintf(output, "PARAMVAL = %s (%u)%s\n", word, len, 
+              parse_ret & MLPARSE_CONT ? " (cont)" : "");
+#endif
+            break;
+
+        case MLPARSE_COMMENT:
+#ifdef MLPARSE_TEST_OUTPUT
+            fprintf(output, "START_COMMENT\n");
+#endif
+            break;
+
+        case MLPARSE_END | MLPARSE_COMMENT:
+#ifdef MLPARSE_TEST_OUTPUT
+            fprintf(output, "END_COMMENT\n");
+#endif
+            break;
+
+        case MLPARSE_WHITESPACE:
+        case MLPARSE_CONT | MLPARSE_WHITESPACE:
+#ifdef MLPARSE_TEST_OUTPUT
+            word[len] = '\0';
+            fprintf(output, "WHITESPACE = '%s' (%u)%s\n", word, len, 
+              parse_ret & MLPARSE_CONT ? " (cont)" : "");
+#endif
+            break;
+
+        case MLPARSE_CDATA:
+#ifdef MLPARSE_TEST_OUTPUT
+            fprintf(output, "START_CDATA\n");
+#endif
+            break;
+
+        case MLPARSE_CDATA | MLPARSE_END:
+#ifdef MLPARSE_TEST_OUTPUT
+            fprintf(output, "END_CDATA\n");
+#endif
+            break;
+
+        case MLPARSE_INPUT:
+            switch (stream(instream)) {
+            case STREAM_OK:
+                parser->next_in = instream->curr_out;
+                parser->avail_in = instream->avail_out;
+                break;
+
+            case STREAM_INPUT:
+                if ((len = fread(buf, 1, buflen, input)) && (len != -1)) {
+                    instream->next_in = buf;
+                    instream->avail_in = len;
+                    bytes += len;
+                } else if (len) {
+                    fprintf(stderr, "read error: %s\n", strerror(errno));
+                } else {
+                    stream_flush(instream, STREAM_FLUSH_FINISH);
+                }
+                break;
+
+            case STREAM_END:
+                mlparse_eof(parser);
+                break;
+
+            default:
+                fprintf(stderr, "error streaming\n");
+                return;
+            }
+            break;
+
+        default:
+            fprintf(stderr, "unknown retval %d\n", parse_ret);
+            return;
+        }
+    }
+
+    if (parse_ret == MLPARSE_ERR) {
+        fprintf(stderr, "parser failed at %lu\n", 
+          bytes - mlparse_buffered(parser) - parser->avail_in);
+    }
+
+    stream_delete(instream);
+    fputc('\n', output);
+    return;
+}
+
+int main(int argc, char **argv) {
+    unsigned int i;
+    struct mlparse parser = {NULL, 0, NULL};
+    FILE *fp;
+
+    if (argc > 1) {
+        for (i = 1; i < argc; i++) {
+            if ((fp = fopen(argv[i], "rb"))
+              && mlparse_new(&parser, WORDLEN, LOOKAHEAD)
+              && (parser.next_in = malloc(BUFSIZE))) {
+                parse(&parser, stdout, fp, BUFSIZE);
+                mlparse_delete(&parser);
+                fclose(fp);
+            } else if (fp) {
+                fprintf(stderr, "failed to open parser on %s: %s\n", argv[i], 
+                  strerror(errno));
+                fclose(fp);
+                return EXIT_FAILURE;
+            } else {
+                fprintf(stderr, "failed to open %s: %s\n", argv[i], 
+                  strerror(errno));
+                return EXIT_FAILURE;
+            }
+        }
+    } else {
+        if (mlparse_new(&parser, WORDLEN, LOOKAHEAD)
+          && (parser.next_in = malloc(BUFSIZE))) {
+            parse(&parser, stdout, stdin, BUFSIZE);
+            mlparse_delete(&parser);
+        } else {
+            fprintf(stderr, "failed to open parser on stdin\n");
+            return EXIT_FAILURE;
+        } 
+    }
+
+    return EXIT_SUCCESS;
+}
+#endif
+
diff --git a/src/mlparse_wrap.c b/src/mlparse_wrap.c
new file mode 100644 (file)
index 0000000..6a85b56
--- /dev/null
@@ -0,0 +1,316 @@
+/* mlparse_wrap.c implements a wrapper around mlparse to handle IO
+ *
+ * written nml 2004-05-13
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "mlparse_wrap.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+struct mlparse_wrap {
+    void *src;                     /* pointer to source of data */
+    void *buf;                     /* allocated buffer */
+    unsigned int bufsize;          /* size of allocated buffer */
+    struct mlparse parser;         /* wrapped parser */
+    unsigned int bytes;            /* number of bytes read from src */
+    unsigned int limit;            /* number of bytes to read if limited */
+    int limited;                   /* whether we're limiting the number of 
+                                    * bytes we read */
+    int fd;                        /* space to store an fd value */
+    unsigned int (*fillbuf)        /* method to fill the buffer from the src */
+      (void *src, void *buf, unsigned int len);
+};
+
+static unsigned int stdio_fillbuf(void *src, void *buf, unsigned int len) {
+    return fread(buf, 1, len, src);
+}
+
+static unsigned int fd_fillbuf(void *src, void *buf, unsigned int len) {
+    int *fd = src;
+    int rlen;
+
+    if ((rlen = read(*fd, buf, len)) > 0) {
+        return rlen;
+    } else {
+        return 0;
+    }
+}
+
+void mlparse_wrap_reinit_fd(struct mlparse_wrap *wrapper, int fd, 
+  unsigned int limit) {
+    wrapper->bytes = 0;
+    wrapper->limited = limit;
+    wrapper->limit = limit;
+    wrapper->src = &wrapper->fd;
+    wrapper->fd = fd;
+    wrapper->fillbuf = fd_fillbuf;
+    wrapper->parser.avail_in = 0;
+    wrapper->parser.next_in = NULL;
+    mlparse_reinit(&wrapper->parser);
+}
+
+void mlparse_wrap_reinit_file(struct mlparse_wrap *wrapper, FILE *fp, 
+  unsigned int limit) {
+    wrapper->bytes = 0;
+    wrapper->limited = limit;
+    wrapper->limit = limit;
+    wrapper->src = fp;
+    wrapper->fillbuf = stdio_fillbuf;
+    wrapper->parser.avail_in = 0;
+    wrapper->parser.next_in = NULL;
+    mlparse_reinit(&wrapper->parser);
+}
+
+struct mlparse_wrap *mlparse_wrap_new_fd(unsigned int wordlen, 
+  unsigned int lookahead, int fd, unsigned int bufsize, unsigned int limit) {
+    struct mlparse_wrap *wrapper = malloc(sizeof(*wrapper));
+
+    if (wrapper && (wrapper->buf = malloc(bufsize))
+      && mlparse_new(&wrapper->parser, wordlen, lookahead)) {
+        wrapper->bufsize = bufsize;
+        mlparse_wrap_reinit_fd(wrapper, fd, limit);
+    } else {
+        if (wrapper) {
+            if (wrapper->buf) {
+                free(wrapper->buf);
+            }
+            free(wrapper);
+        }
+        wrapper = NULL;
+    }
+
+    return wrapper;
+}
+
+struct mlparse_wrap *mlparse_wrap_new_file(unsigned int wordlen, 
+  unsigned int lookahead, FILE *fp, unsigned int bufsize, unsigned int limit) {
+    struct mlparse_wrap *wrapper = malloc(sizeof(*wrapper));
+
+    if (wrapper && (wrapper->buf = malloc(bufsize))
+      && mlparse_new(&wrapper->parser, wordlen, lookahead)) {
+        wrapper->bufsize = bufsize;
+        mlparse_wrap_reinit_file(wrapper, fp, limit);
+    } else {
+        if (wrapper) {
+            if (wrapper->buf) {
+                free(wrapper->buf);
+            }
+            free(wrapper);
+        }
+        wrapper = NULL;
+    }
+
+    return wrapper;
+}
+
+enum mlparse_ret mlparse_wrap_parse(struct mlparse_wrap *wrapper, 
+  char *buf, unsigned int *len, int strip) {
+    enum mlparse_ret ret;
+    unsigned int readlen;
+
+    while ((ret 
+      = mlparse_parse(&wrapper->parser, buf, len, strip)) == MLPARSE_INPUT) {
+        assert(!wrapper->parser.avail_in);
+
+        /* figure out how much to read (implement limit) */
+        readlen = wrapper->bufsize;
+        if (wrapper->limited 
+          && (wrapper->bufsize + wrapper->bytes > wrapper->limit)) {
+            readlen = wrapper->limit - wrapper->bytes;
+        }
+
+        if ((readlen 
+          = wrapper->fillbuf(wrapper->src, wrapper->buf, readlen))) {
+            wrapper->parser.avail_in = readlen;
+            wrapper->parser.next_in = wrapper->buf;
+            wrapper->bytes += readlen;
+        } else {
+            mlparse_eof(&wrapper->parser);
+        }
+    }
+
+    buf[*len] = '\0';
+    return ret;
+}
+
+unsigned int mlparse_wrap_bytes(struct mlparse_wrap *wrapper) {
+    assert(wrapper->bytes >= wrapper->parser.avail_in 
+      + mlparse_buffered(&wrapper->parser));
+
+    return wrapper->bytes - wrapper->parser.avail_in 
+      - mlparse_buffered(&wrapper->parser);
+}
+
+void mlparse_wrap_delete(struct mlparse_wrap *wrapper) {
+    mlparse_delete(&wrapper->parser);
+    free(wrapper->buf);
+    free(wrapper);
+}
+
+#ifdef MLPARSE_WRAP_TEST
+#undef MLPARSE_TEST_OUTPUT
+#define WORDLEN 50
+#define LOOKAHEAD 999
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <strings.h>
+#include <string.h>
+
+void parse(struct mlparse_wrap *parser, FILE *output) {
+    enum mlparse_ret parse_ret;      /* value returned by the parser */
+    char word[WORDLEN + 1];          /* word returned by the parser */
+    unsigned int len;                /* length of word */
+    int print = 0;
+
+#ifdef MLPARSE_TEST_OUTPUT
+    print = 1;
+#endif
+
+    while (((parse_ret = mlparse_wrap_parse(parser, word, &len, 1)) 
+        != MLPARSE_ERR) 
+      && (parse_ret != MLPARSE_EOF)) {
+        switch (parse_ret) {
+        case MLPARSE_WORD:
+        case MLPARSE_END | MLPARSE_WORD:
+        case MLPARSE_CONT | MLPARSE_WORD:
+            word[len] = '\0';
+            if (print) {
+                fprintf(output, "WORD = %s (%u)%s\n", word, len, 
+                  parse_ret & MLPARSE_CONT ? " (cont)" 
+                    : ((parse_ret & MLPARSE_END) ? " (endsentence)" : ""));
+            }
+            break;
+
+        case MLPARSE_TAG:
+        case MLPARSE_CONT | MLPARSE_TAG:
+            word[len] = '\0';
+            if (print) {
+                fprintf(output, "TAG = %s (%u)%s\n", word, len, 
+                  parse_ret & MLPARSE_CONT ? " (cont)" : "");
+            }
+            break;
+
+        case MLPARSE_END | MLPARSE_TAG:
+        case MLPARSE_END | MLPARSE_CONT | MLPARSE_TAG:
+            word[len] = '\0';
+            if (print) {
+                fprintf(output, "ENDTAG = %s (%u)%s\n", word, len, 
+                  parse_ret & MLPARSE_CONT ? " (cont)" : "");
+            }
+            break;
+
+        case MLPARSE_PARAM:
+        case MLPARSE_CONT | MLPARSE_PARAM:
+            word[len] = '\0';
+            if (print) {
+                fprintf(output, "PARAM = %s (%u)%s\n", word, len, 
+                  parse_ret & MLPARSE_CONT ? " (cont)" : "");
+            }
+            break;
+
+        case MLPARSE_PARAMVAL:
+        case MLPARSE_CONT | MLPARSE_PARAMVAL:
+            word[len] = '\0';
+            if (print) {
+                fprintf(output, "PARAMVAL = %s (%u)%s\n", word, len, 
+                  parse_ret & MLPARSE_CONT ? " (cont)" : "");
+            }
+            break;
+
+        case MLPARSE_COMMENT:
+            if (print) {
+                fprintf(output, "START_COMMENT\n");
+            }
+            break;
+
+        case MLPARSE_END | MLPARSE_COMMENT:
+            if (print) {
+                fprintf(output, "END_COMMENT\n");
+            }
+            break;
+
+        case MLPARSE_WHITESPACE:
+        case MLPARSE_CONT | MLPARSE_WHITESPACE:
+            word[len] = '\0';
+            if (print) {
+                fprintf(output, "WHITESPACE = '%s' (%u)%s\n", word, len, 
+                  parse_ret & MLPARSE_CONT ? " (cont)" : "");
+            }
+            break;
+
+        case MLPARSE_CDATA:
+            if (print) {
+                fprintf(output, "START_CDATA\n");
+            }
+            break;
+
+        case MLPARSE_CDATA | MLPARSE_END:
+            if (print) {
+                fprintf(output, "END_CDATA\n");
+            }
+            break;
+
+        default:
+            fprintf(stderr, "unknown retval %d\n", parse_ret);
+            return;
+        }
+    }
+
+    if (parse_ret == MLPARSE_ERR) {
+        fprintf(stderr, "parser failed at %u\n", mlparse_wrap_bytes(parser));
+    }
+
+    fputc('\n', output);
+    return;
+}
+
+int main(int argc, char **argv) {
+    unsigned int i;
+    struct mlparse_wrap *wrapper;
+    int fd;
+
+    if (argc > 1) {
+        for (i = 1; i < argc; i++) {
+            if (((fd = open(argv[i], O_RDONLY)) >= 0)
+              && (wrapper 
+                = mlparse_wrap_new_fd(WORDLEN, LOOKAHEAD, fd, BUFSIZ, 0))) {
+
+                parse(wrapper, stdout);
+                mlparse_wrap_delete(wrapper);
+                close(fd);
+            } else if (fd >= 0) {
+                fprintf(stderr, "failed to open parser on %s: %s\n", argv[i], 
+                  strerror(errno));
+                close(fd);
+                return EXIT_FAILURE;
+            } else {
+                fprintf(stderr, "failed to open %s: %s\n", argv[i], 
+                  strerror(errno));
+                return EXIT_FAILURE;
+            }
+        }
+    } else {
+        if ((wrapper 
+          = mlparse_wrap_new_fd(WORDLEN, LOOKAHEAD, STDIN_FILENO, BUFSIZ, 0))) {
+            parse(wrapper, stdout);
+            mlparse_wrap_delete(wrapper);
+        } else {
+            fprintf(stderr, "failed to open parser on stdin\n");
+            return EXIT_FAILURE;
+        } 
+    }
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
+
diff --git a/src/objalloc.c b/src/objalloc.c
new file mode 100644 (file)
index 0000000..29d2ad1
--- /dev/null
@@ -0,0 +1,716 @@
+/* objalloc.c implements an object that efficiently returns allocations of a 
+ * set size.  Our implementation is fairly simple, in that we request memory
+ * from the underlying allocation mechanism in chunks, which we arrange into a
+ * singly-linked list.  We also maintain a singly-linked list of free objects,
+ * which we manipulate as objects are allocated/freed.
+ *
+ * Naturally, the next step for this bit of code would be to *accept* an
+ * allocator and free functions to be able to chain allocators.
+ *
+ * written nml 2004-08-30
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "objalloc.h"
+
+#include "alloc.h"
+#include "def.h"
+#include "mem.h"
+#include "_mem.h"
+#include "zvalgrind.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+/* integer value we use to fill up space */
+#define SPACE_FILL 0xdeadbeefU
+
+#define FILL_BYTE(i) ((unsigned char) (SPACE_FILL >> (8 * (3 - ((i) % 4)))))
+
+struct objalloc_chunk { 
+    struct objalloc_chunk *next;     /* linked list of chunks */
+    unsigned int size;               /* size of the rest of the chunk */
+    /* more memory than this is allocated, and is managed below */
+};
+
+struct objalloc_alloc {
+    struct objalloc_alloc *next;     /* linked list of alloc objects */
+};
+
+struct objalloc {
+    unsigned int allocsize;          /* size of objects we're allocating */
+    unsigned int redzone;            /* size of redzone we're putting after 
+                                      * objects */
+    unsigned int chunksize;          /* size of chunks we're requesting from 
+                                      * the underlying allocation mechanism */
+    unsigned int allocated;          /* how many objects are currently 
+                                      * allocated */
+    unsigned int reserved;           /* how many objects are currently on the 
+                                      * next linked list, ready for 
+                                      * allocation */
+    unsigned int align;              /* object alignment */
+    struct alloc alloc;              /* underlying allocator */
+    struct objalloc_alloc *next;     /* linked list of objects ready for 
+                                      * allocation */
+    struct objalloc_chunk chunk;     /* first chunk */
+};
+
+/* internal function to check that the object allocator is in a sane state */
+static int objalloc_invariant(struct objalloc *obj) {
+    struct objalloc_alloc *alloc = obj->next,
+                          *nextalloc;
+    struct objalloc_chunk *chunk,
+                          *next;
+    unsigned int reserved = 0;
+
+    if (!DEAR_DEBUG) {
+        return 1;
+    }
+
+    /* check all allocations are from our set of memory */
+    while (alloc) {
+        /* check alignment */
+        assert((((unsigned long int) alloc) / obj->align) * obj->align 
+          == (unsigned long int) alloc);
+        VALGRIND_MAKE_READABLE(alloc, sizeof(*alloc));
+        nextalloc = alloc->next;
+        /* this check is a bit too expensive even for DEAR_DEBUG
+        if (!objalloc_is_managed(obj, alloc)) {
+            assert(!CRASH);
+            return 0;
+        } */
+        VALGRIND_MAKE_NOACCESS(alloc, sizeof(*alloc));
+        alloc = nextalloc;
+        reserved++;
+    }
+
+    /* check we have the number reserved that we said we did */
+    if (reserved != obj->reserved) {
+        assert(!CRASH);
+        return 0;
+    }
+
+    /* check each chunk */
+    chunk = &obj->chunk;
+    while (chunk) {
+        void *curr,
+             *end;
+
+        /* mark header as accessable */
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+
+        curr = mem_align(mem_ptradd(chunk, sizeof(*chunk)), obj->align);
+        end = mem_ptradd(chunk, sizeof(*chunk) + chunk->size);
+
+        while (MEM_PTRADD(curr, obj->allocsize + obj->redzone) <= end) {
+            unsigned int i;
+
+            /* make redzone valid */
+            VALGRIND_MAKE_READABLE(MEM_PTRADD(curr, obj->allocsize), 
+              obj->redzone);
+
+            /* check redzone value */
+            for (i = 0; i < obj->redzone; i++) {
+                if (((unsigned char *) mem_ptradd(curr, obj->allocsize))[i] 
+                  != FILL_BYTE(i)) {
+                    /* redzone has been violated */
+                    assert(!CRASH);
+                }
+            }
+
+            /* make redzone invalid again */
+            VALGRIND_MAKE_NOACCESS(MEM_PTRADD(curr, obj->allocsize), 
+              obj->redzone);
+
+            curr = MEM_PTRADD(curr, obj->allocsize + obj->redzone);
+        }
+
+        next = chunk->next;
+
+        /* make header invalid again */
+        VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+
+        chunk = next;
+    }
+
+    return 1;
+}
+
+/* internal function to break up the memory in a chunk and allocate it to the
+ * list in the alloc object.  free indicates whether allocations should be
+ * free'd as we go (so that valgrind doesn't report leaks). */
+static void objalloc_chunkify(struct objalloc *obj,
+  struct objalloc_chunk *chunk, int free) {
+    void *curr = mem_align(mem_ptradd(chunk, sizeof(*chunk)), obj->align),
+         *end = mem_ptradd(chunk, sizeof(*chunk) + chunk->size);
+    struct objalloc_alloc *alloc;
+
+    while (MEM_PTRADD(curr, obj->allocsize + obj->redzone) <= end) {
+        /* append allocation to the start of the object's linked list */
+        unsigned int i;
+
+        alloc = curr;
+        alloc->next = obj->next;
+        obj->next = alloc;
+        obj->reserved++;
+
+        /* free the memory from valgrind's point of view */
+        if (RUNNING_ON_VALGRIND && free) {
+            VALGRIND_FREELIKE_BLOCK(alloc, 0);
+        }
+
+        /* mark the redzone with fill value */
+        for (i = 0; i < obj->redzone; i++) {
+            ((unsigned char *) mem_ptradd(alloc, obj->allocsize))[i] 
+              = FILL_BYTE(i);
+        }
+
+        /* mark the redzone out of bounds using valgrind */
+        VALGRIND_MAKE_NOACCESS(MEM_PTRADD(curr, obj->allocsize), obj->redzone);
+
+        curr = MEM_PTRADD(curr, obj->allocsize + obj->redzone);
+    }
+
+    /* mark chunk header out of bounds using valgrind (acts as red-zone above
+     * the objects) */
+    VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+
+    assert(objalloc_invariant(obj));
+}
+
+struct objalloc *objalloc_new(unsigned int size, unsigned int align,
+  unsigned int redzone, unsigned int bulkalloc, const struct alloc *alloc) {
+    struct objalloc *obj;
+    unsigned int min;
+
+    /* don't allow 0 sized objects, it doesn't make any sense */
+    if (!size) {
+        return NULL;
+    }
+
+    if (!alloc) {
+        alloc = &alloc_system;
+    }
+
+    if (!align) {
+        align = mem_align_max();
+    }
+
+    /* ensure that size is a multiple of the alignment */
+    if (size < sizeof(struct objalloc_alloc)) {
+        size = sizeof(struct objalloc_alloc);
+    }
+    if (align * (size / align) != size) {
+        /* round up to nearest alignment boundary */
+        size = align * (size / align + 1);
+    }
+
+    /* figure out redzone allowing for alignment */
+    redzone = ((redzone + (align - 1)) / align) * align;
+
+    /* figure out minimum size that we need bulkalloc to be to allocate the
+     * object, a chunk header, one redzone and one object */
+    min = sizeof(struct objalloc) + align + size + redzone;
+    if (bulkalloc < min) {
+        bulkalloc = min;
+    }
+
+    if ((obj = alloc->malloc(alloc->opaque, bulkalloc))) {
+        obj->align = align;
+        obj->allocsize = size;
+        obj->redzone = redzone;
+        obj->chunksize = bulkalloc;
+        obj->next = NULL;
+        obj->chunk.next = NULL;
+        obj->chunk.size = bulkalloc - sizeof(*obj);
+        obj->allocated = 0;
+        obj->reserved = 0;
+        obj->alloc = *alloc;
+        objalloc_chunkify(obj, &obj->chunk, 0);
+
+        if (!objalloc_invariant(obj)) {
+            objalloc_delete(obj);
+            obj = NULL;
+        }
+    }
+
+    return obj;
+}
+
+void objalloc_delete(struct objalloc *obj) {
+    struct objalloc_chunk *chunk,
+                          *next;
+
+    /* bring chunk headers back into addressable space */
+    VALGRIND_MAKE_READABLE(&obj->chunk, sizeof(obj->chunk));
+
+    chunk = obj->chunk.next;
+    while (chunk) {
+        void *curr,
+             *end;
+
+        /* bring chunk headers back into addressable space */
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+        next = chunk->next;
+
+        curr = mem_align(mem_ptradd(chunk, sizeof(*chunk)), obj->align);
+        end = mem_ptradd(chunk, sizeof(*chunk) + chunk->size);
+
+        while (obj->redzone 
+          && MEM_PTRADD(curr, obj->allocsize + obj->redzone) <= end) {
+            unsigned int i;
+
+            /* make redzone valid */
+            VALGRIND_MAKE_READABLE(MEM_PTRADD(curr, obj->allocsize), 
+              obj->redzone);
+
+            /* check redzone value */
+            for (i = 0; i < obj->redzone; i++) {
+                if (((unsigned char *) mem_ptradd(curr, obj->allocsize))[i] 
+                  != FILL_BYTE(i)) {
+                    /* redzone has been violated */
+                    assert(!CRASH);
+                }
+            }
+
+            curr = MEM_PTRADD(curr, obj->allocsize + obj->redzone);
+        }
+
+        obj->alloc.free(obj->alloc.opaque, chunk);
+        chunk = next;
+    }
+
+    obj->alloc.free(obj->alloc.opaque, obj);
+}
+
+unsigned int objalloc_reserve(struct objalloc *obj, unsigned int reserve) {
+    /* have to allocate a new chunk */
+    struct objalloc_chunk *chunk;
+
+    while ((obj->reserved < reserve) 
+      && (chunk = obj->alloc.malloc(obj->alloc.opaque, obj->chunksize))) {
+        VALGRIND_MAKE_READABLE(&obj->chunk, sizeof(obj->chunk));
+
+        chunk->next = obj->chunk.next;
+        chunk->size = obj->chunksize - sizeof(*chunk);
+        obj->chunk.next = chunk;
+
+        VALGRIND_MAKE_NOACCESS(&obj->chunk, sizeof(obj->chunk));
+
+        objalloc_chunkify(obj, chunk, 0);
+        assert(obj->next);
+    }
+
+    return obj->reserved;
+}
+
+void *objalloc_malloc(struct objalloc *obj, unsigned int size) {
+    void *ptr;
+
+    if (size <= obj->allocsize) {
+        if (!obj->next) {
+            if (!objalloc_reserve(obj, 1)) {
+                return NULL;
+            }
+        }
+
+        assert(obj->reserved);
+        assert(obj->next);
+        ptr = obj->next;
+        VALGRIND_MAKE_READABLE(ptr, obj->allocsize);
+        obj->next = obj->next->next;
+        VALGRIND_MAKE_WRITABLE(ptr, obj->allocsize);
+        obj->allocated++;
+        obj->reserved--;
+        VALGRIND_MALLOCLIKE_BLOCK(ptr, obj->allocsize, 0, 0);
+        return ptr;
+    } else {
+        return NULL;
+    }
+}
+
+void objalloc_free(struct objalloc *obj, void *ptr) {
+    struct objalloc_alloc *alloc = ptr;
+    unsigned char *cptr = ptr;
+    unsigned int i;
+
+    if (!ptr) {
+        return;
+    }
+
+    assert(objalloc_is_managed(obj, ptr));
+
+    alloc->next = obj->next;
+    obj->next = alloc;
+    obj->allocated--;
+    obj->reserved++;
+
+    /* check that redzone is intact */
+    cptr += obj->allocsize;
+    VALGRIND_MAKE_READABLE(cptr, obj->redzone);
+    for (i = 0; i < obj->redzone; i++) {
+        if (cptr[i] != FILL_BYTE(i)) {
+            /* redzone has been violated */
+            assert(!CRASH);
+        }
+    }
+    VALGRIND_MAKE_NOACCESS(cptr, obj->redzone);
+
+    VALGRIND_FREELIKE_BLOCK(ptr, 0);
+    VALGRIND_MAKE_NOACCESS(ptr, obj->allocsize);
+}
+
+void *objalloc_realloc(struct objalloc *obj, void *ptr, unsigned int size) {
+    if (size) {
+        if (ptr) {
+            assert(objalloc_is_managed(obj, ptr));
+
+            if (size <= obj->allocsize) {
+                return ptr;
+            }
+        } else {
+            return objalloc_malloc(obj, size);
+        }
+    } else {
+        if (ptr) {
+            assert(objalloc_is_managed(obj, ptr));
+            objalloc_free(obj, ptr);
+        }
+    }
+
+    return NULL;
+}
+
+void objalloc_clear(struct objalloc *obj) {
+    struct objalloc_chunk *chunk,
+                          *next;
+    struct objalloc_alloc *alloc;
+
+    /* in order to call FREELIKE_BLOCK on all current allocations, we're going
+     * to call MALLOCLIKE_BLOCK on all allocations *not* allocated, and then
+     * FREELIKE_BLOCK them all in chunkify.  Its a little hacky, but its simple
+     * and it works */
+    if (RUNNING_ON_VALGRIND) {
+        alloc = obj->next;
+        while (alloc) {
+            VALGRIND_MALLOCLIKE_BLOCK(alloc, obj->allocsize, 0, 0);
+            VALGRIND_MAKE_READABLE(alloc, sizeof(*alloc));
+            alloc = alloc->next;
+        }
+    }
+
+    obj->next = NULL;
+    obj->allocated = 0;
+    obj->reserved = 0;
+
+    chunk = &obj->chunk;
+    do {
+        /* make chunk contents valid */
+        VALGRIND_MAKE_READABLE(chunk, obj->chunksize);
+        next = chunk->next;
+
+        objalloc_chunkify(obj, chunk, 1);
+    } while ((chunk = next));
+}
+
+void objalloc_drain(struct objalloc *obj) {
+    struct objalloc_chunk *chunk,
+                          *next,
+                          *prevchunk;
+    struct objalloc_alloc *alloc,
+                          *prev,
+                          *nextalloc;
+    unsigned int capacity,
+                 count;
+
+    if (!obj->next) {
+        return;
+    }
+
+    /* try to free as much memory as possible.  This algorithm sucks (iterates
+     * over the list of objects *way* too many times), but its simple and
+     * unlikely to cause problems */
+
+    chunk = obj->chunk.next;
+    prevchunk = &obj->chunk;
+    while (chunk) {
+        /* make chunk header valid */
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+
+        next = chunk->next;
+        capacity = chunk->size / (obj->allocsize + obj->redzone);
+        count = 0;
+
+        for (alloc = obj->next; alloc; alloc = nextalloc) {
+            if ((((void *) alloc) >= mem_ptradd(chunk, sizeof(*chunk))) 
+              && (((void *) alloc) 
+                < mem_ptradd(chunk, sizeof(*chunk) + chunk->size))) {
+
+                count++;
+            }
+            VALGRIND_MAKE_READABLE(alloc, sizeof(*alloc));
+            nextalloc = alloc->next;
+            VALGRIND_MAKE_NOACCESS(alloc, sizeof(*alloc));
+        }
+
+        assert(count <= capacity);
+        if (count == capacity) {
+            /* can remove this chunk */
+
+            obj->reserved -= capacity;
+            alloc = obj->next;
+            while (alloc 
+              && (((void *) alloc) >= mem_ptradd(chunk, sizeof(*chunk))) 
+              && (((void *) alloc) 
+                < mem_ptradd(chunk, sizeof(*chunk) + chunk->size))) {
+
+                VALGRIND_MAKE_READABLE(alloc, sizeof(*alloc));
+                alloc = obj->next = alloc->next;
+            }
+
+            prev = alloc;
+            while (alloc) {
+                if ((((void *) alloc) >= mem_ptradd(chunk, sizeof(*chunk))) 
+                  && (((void *) alloc) 
+                    < mem_ptradd(chunk, sizeof(*chunk) + chunk->size))) {
+
+                    VALGRIND_MAKE_READABLE(alloc, sizeof(*alloc));
+                    VALGRIND_MAKE_WRITABLE(prev, sizeof(*prev));
+                    prev->next = alloc = alloc->next;
+                    VALGRIND_MAKE_NOACCESS(prev, sizeof(*prev));
+                } else {
+                    prev = alloc;
+                    VALGRIND_MAKE_READABLE(alloc, sizeof(*alloc));
+                    nextalloc = alloc->next;
+                    VALGRIND_MAKE_NOACCESS(alloc, sizeof(*alloc));
+                    alloc = nextalloc;
+                }
+            }
+
+            assert(prevchunk);
+            prevchunk->next = next;
+            obj->alloc.free(obj->alloc.opaque, chunk);
+        } else {
+            prevchunk = chunk;
+            /* make chunk header invalid */
+            VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+        }
+
+        chunk = next;
+    }
+}
+
+unsigned int objalloc_allocated(struct objalloc *obj) {
+    return obj->allocated;
+}
+
+int objalloc_is_managed(struct objalloc *obj, void *ptr) {
+    struct objalloc_chunk *chunk,
+                          *next;
+
+    chunk = &obj->chunk;
+    do {
+        /* make chunk header valid */
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+
+        if ((ptr >= mem_ptradd(chunk, sizeof(*chunk))) 
+          && (ptr < mem_ptradd(chunk, sizeof(*chunk) + chunk->size))) {
+            return 1;
+        }
+
+        next = chunk->next;
+        /* make chunk header invalid */
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+    } while ((chunk = next));
+
+    return 0;
+}
+
+unsigned int objalloc_memsize(struct objalloc *obj, void *ptr) {
+    struct objalloc_chunk *chunk,
+                          *next;
+    unsigned int chunks = 0;
+
+    chunk = &obj->chunk;
+    do {
+        /* make chunk header valid */
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+        chunks++;
+        next = chunk->next;
+        /* make chunk header invalid */
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+    } while ((chunk = next));
+
+    return sizeof(*obj) - sizeof(obj->chunk) + chunks * obj->chunksize;
+}
+
+
+unsigned int objalloc_overhead_first() {
+    return sizeof(struct objalloc);
+}
+
+unsigned int objalloc_overhead() {
+    return sizeof(struct objalloc_chunk);
+}
+
+unsigned int objalloc_objsize(struct objalloc *obj) {
+    return obj->allocsize;
+}
+
+#ifdef OBJALLOC_TEST
+
+#include <stdlib.h>
+
+int main() {
+    unsigned int i;
+    int *arr[20];
+    struct objalloc *alloc;
+
+    /* just alloc and free */
+
+    alloc = objalloc_new(sizeof(int), 0, 1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = objalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+    assert(!objalloc_malloc(alloc, sizeof(int) + 1));
+
+    for (i = 0; i < 20; i++) {
+        assert(*arr[i] == i);
+        objalloc_free(alloc, arr[i]);
+    }
+
+    objalloc_delete(alloc); 
+
+    /* different sizes */
+
+    alloc = objalloc_new(sizeof(int), 0, 1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = objalloc_malloc(alloc, i);
+        if (i <= sizeof(int)) {
+            assert(arr[i]);
+            arr[i] = objalloc_realloc(alloc, arr[i], i);
+            if (i) {
+                assert(arr[i]);
+            } else {
+                assert(!arr[i]);
+            }
+        } else {
+            assert(!arr[i]);
+        }
+    }
+    assert(!objalloc_malloc(alloc, sizeof(int) + 1));
+
+    for (i = 0; i < 20; i++) {
+        objalloc_free(alloc, arr[i]);
+    }
+
+    objalloc_delete(alloc); 
+
+    /* test drain */
+
+    alloc = objalloc_new(sizeof(int), 0, 1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = objalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+    assert(!objalloc_malloc(alloc, sizeof(int) + 1));
+
+    for (i = 0; i < 20; i++) {
+        assert(*arr[i] == i);
+        objalloc_free(alloc, arr[i]);
+    }
+
+    objalloc_drain(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = objalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+    assert(!objalloc_malloc(alloc, sizeof(int) + 1));
+
+    for (i = 0; i < 20; i++) {
+        assert(*arr[i] == i);
+        objalloc_free(alloc, arr[i]);
+    }
+
+    objalloc_drain(alloc);
+
+    objalloc_delete(alloc); 
+
+    /* perform some invalid accesses */
+
+    alloc = objalloc_new(sizeof(int), 0, 1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = objalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    /* valid access */
+    *arr[0] = 0;
+
+    /* FIXME: invalid accesses 
+    i = arr[0][-1];
+    arr[1][-1] = -1;
+    arr[1][1] = -1; */
+
+    for (i = 0; i < 20; i++) {
+        assert(*arr[i] == i);
+        objalloc_free(alloc, arr[i]);
+    }
+
+    objalloc_clear(alloc);
+    objalloc_delete(alloc);
+
+    /* cause leaks */
+
+    alloc = objalloc_new(sizeof(int), 0, 1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = objalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    for (i = 1; i < 19; i++) {
+        assert(*arr[i] == i);
+        objalloc_free(alloc, arr[i]);
+    }
+
+    objalloc_delete(alloc); 
+
+    /* use clear */
+
+    alloc = objalloc_new(sizeof(int), 0, 1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = objalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    objalloc_clear(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = objalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    objalloc_clear(alloc);
+    objalloc_delete(alloc); 
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
diff --git a/src/okapi_k3.c b/src/okapi_k3.c
new file mode 100644 (file)
index 0000000..fcee885
--- /dev/null
@@ -0,0 +1,647 @@
+/* okapi_k3.c implements the okapi_k3 metric for the zettair query
+ * subsystem.  This file was automatically generated from
+ * src/okapi_k3.metric and src/metric.c
+ * by scripts/metric.py on Thu, 31 Aug 2006 23:54:32 GMT.  
+ *
+ * DO NOT MODIFY THIS FILE, as changes will be lost upon 
+ * subsequent regeneration (and this code is repetitive enough 
+ * that you probably don't want to anyway).  
+ * Go modify src/okapi_k3.metric or src/metric.c instead.  
+ * 
+ * Comments from okapi_k3.metric:
+ *
+ * okapi_k3.metric is a functional description in our funny zettair metric
+ * language (see metric.py) of how the okapi metric should operate.
+ * 
+ * The okapi metric is probably best described in
+ * 'A probabalistic model of information retrieval: development and
+ * comparative experiments' parts 1 & 2, by Sparck Jones, Walker and
+ * Robertson, although it was (i believe) first presented in
+ * 'Okapi at TREC-7: Automatic ad hoc, filtering, VLC and interactive track'
+ * by Robertson, Walker, and Beaulieu.
+ * 
+ * written nml 2005-07-18
+ *
+ */
+
+
+#include "firstinclude.h"
+
+#include "metric.h"
+
+#include "_index.h"
+#include "_docmap.h"
+#include "index_querybuild.h"
+
+#include "def.h"
+#include "objalloc.h"
+#include "docmap.h"
+#include "search.h"
+#include "vec.h"
+
+#include <assert.h>
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+
+static enum search_ret pre(struct index *idx, struct query *query, 
+  int opts, struct index_search_opt *opt) {
+    /* METRIC_PRE */
+    if (docmap_cache(idx->map, docmap_get_cache(idx->map) | DOCMAP_CACHE_WORDS) != DOCMAP_OK) return SEARCH_EINVAL;
+
+    return SEARCH_OK;
+}
+
+static enum search_ret post(struct index *idx, struct query *query, 
+  struct search_acc_cons *acc, int opts, struct index_search_opt *opt) {
+    /* METRIC_POST */
+
+
+    while (acc) {
+        assert(acc->acc.docno < docmap_entries(idx->map));
+        /* METRIC_POST_PER_DOC */
+
+        acc = acc->next;
+    }
+
+    return SEARCH_OK;
+}
+
+/* macro to atomically read the next docno and f_dt from a vector 
+ * (note: i also tried a more complicated version that tested for a long vec 
+ * and used unchecked reads, but measurements showed no improvement) */
+#define NEXT_DOC(v, docno, f_dt)                                              \
+    (vec_vbyte_read(v, &docno_d)                                              \
+      && (((vec_vbyte_read(v, &f_dt) && ((docno += docno_d + 1), 1))          \
+        /* second read failed, reposition vec back to start of docno_d */     \
+        || (((v)->pos -= vec_vbyte_len(docno_d)), 0))))
+
+/* macro to scan over f_dt offsets from a vector/source */
+#define SCAN_OFFSETS(src, v, f_dt)                                            \
+    do {                                                                      \
+        unsigned int toscan = f_dt,                                           \
+                     scanned;                                                 \
+        enum search_ret sret;                                                 \
+                                                                              \
+        do {                                                                  \
+            if ((scanned = vec_vbyte_scan(v, toscan, &scanned)) == toscan) {  \
+                toscan = 0;                                                   \
+                break;                                                        \
+            } else if (scanned < toscan) {                                    \
+                toscan -= scanned;                                            \
+                /* need to read more */                                       \
+                if ((sret = src->readlist(src, VEC_LEN(v),                    \
+                    (void **) &(v)->pos, &bytes)) == SEARCH_OK) {             \
+                                                                              \
+                    (v)->end = (v)->pos + bytes;                              \
+                } else if (sret == SEARCH_FINISH) {                           \
+                    /* shouldn't end while scanning offsets */                \
+                    return SEARCH_EINVAL;                                     \
+                } else {                                                      \
+                    return sret;                                              \
+                }                                                             \
+            } else {                                                          \
+                assert("can't get here" && 0);                                \
+                return SEARCH_EINVAL;                                         \
+            }                                                                 \
+        } while (toscan);                                                     \
+    } while (0)
+static enum search_ret or_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc;
+    unsigned int accs_added = 0;   /* number of accumulators added */
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    unsigned int bytes;
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+    double avg_D_terms;
+    float w_t;
+    float r_dt;
+
+    float r_qt = (((opt->u.okapi_k3.k3) + 1) * (query->term[qterm].f_qt)) / ((opt->u.okapi_k3.k3) + (query->term[qterm].f_qt));
+    if (docmap_avg_words(idx->map, &avg_D_terms) != DOCMAP_OK) {
+        return SEARCH_EINVAL;
+    }
+
+
+    /* METRIC_PER_CALL */
+    w_t = (float) logf((N - (query->term[qterm].f_t) + 0.5F) / ((query->term[qterm].f_t) + 0.5F));
+    /* fix for okapi bug, w_t shouldn't be 0 or negative. */
+    if (w_t <= 0.0F) {
+        /* use a very small increment instead */
+        w_t = FLT_EPSILON;
+    }
+    
+    
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                prevptr = &acc->next;
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                r_dt = ((((opt->u.okapi_k3.k1) + 1) * f_dt)       / ((opt->u.okapi_k3.k1) * ((1 - (opt->u.okapi_k3.b)) + (((opt->u.okapi_k3.b) * (DOCMAP_GET_WORDS(idx->map, acc->acc.docno))) / (float) avg_D_terms)) + f_dt));
+                (acc->acc.weight) += r_dt * w_t * r_qt;
+
+            } else {
+                struct search_acc_cons *newacc;
+                assert(!acc || docno < acc->acc.docno); 
+
+                /* allocate a new accumulator (we have reserved allocators
+                 * earlier, so this should never fail) */
+                newacc = objalloc_malloc(results->alloc, sizeof(*newacc));
+                assert(newacc);
+                newacc->next = acc;
+                acc = newacc;
+                acc->acc.docno = docno;
+                acc->acc.weight = 0.0;
+                /* METRIC_PER_DOC */
+                r_dt = ((((opt->u.okapi_k3.k1) + 1) * f_dt)       / ((opt->u.okapi_k3.k1) * ((1 - (opt->u.okapi_k3.b)) + (((opt->u.okapi_k3.b) * (DOCMAP_GET_WORDS(idx->map, acc->acc.docno))) / (float) avg_D_terms)) + f_dt));
+                (acc->acc.weight) += r_dt * w_t * r_qt;
+
+                *prevptr = newacc;
+                accs_added++;
+            }
+            assert(acc);
+
+            /* go to next accumulator */
+            prevptr = &acc->next;
+            acc = acc->next;
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, update number of accumulators */
+            results->accs += accs_added;
+            results->total_results += accs_added;
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+static enum search_ret and_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src,
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc;
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    struct vec v = {NULL, NULL};
+    unsigned int bytes,
+                 missed = 0,       /* number of list entries that didn't match 
+                                    * an accumulator */
+                 hit = 0,          /* number of entries in both accs and list*/
+                 decoded = 0;      /* number of list entries seen */
+    enum search_ret ret;
+    float cooc_rate;               /* co-occurrance rate for list entries and 
+                                    * accumulators */
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+    double avg_D_terms;
+    float w_t;
+    float r_dt;
+
+    float r_qt = (((opt->u.okapi_k3.k3) + 1) * (query->term[qterm].f_qt)) / ((opt->u.okapi_k3.k3) + (query->term[qterm].f_qt));
+    if (docmap_avg_words(idx->map, &avg_D_terms) != DOCMAP_OK) {
+        return SEARCH_EINVAL;
+    }
+
+
+    /* METRIC_PER_CALL */
+    w_t = (float) logf((N - (query->term[qterm].f_t) + 0.5F) / ((query->term[qterm].f_t) + 0.5F));
+    /* fix for okapi bug, w_t shouldn't be 0 or negative. */
+    if (w_t <= 0.0F) {
+        /* use a very small increment instead */
+        w_t = FLT_EPSILON;
+    }
+    
+    
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                r_dt = ((((opt->u.okapi_k3.k1) + 1) * f_dt)       / ((opt->u.okapi_k3.k1) * ((1 - (opt->u.okapi_k3.b)) + (((opt->u.okapi_k3.b) * (DOCMAP_GET_WORDS(idx->map, acc->acc.docno))) / (float) avg_D_terms)) + f_dt));
+                (acc->acc.weight) += r_dt * w_t * r_qt;
+
+
+                /* go to next accumulator */
+                acc = acc->next;
+                hit++;
+            } else {
+                missed++;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate number of results */
+
+            /* list entries now divide up into two portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            assert(missed + hit == decoded);
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            if (missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* tolerance value for thresholding estimates.  Should be >= 1.0.  Make higher
+ * for stabler, but higher memory usage, processing. */
+#define TOLERANCE 1.2
+
+/* low-ish approximation of infinity, to make counting up to it acceptable */
+#define INF 2000
+
+static enum search_ret thresh_decode(struct index *idx, struct query *query,
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, 
+  struct search_list_src *src, unsigned int postings, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc,
+                           dummy;
+    unsigned long int f_dt,           /* number of offsets for this document */
+                      docno_d;        /* d-gap */
+
+    /* initial number of accumulators */
+    unsigned int initial_accs = results->accs,
+
+                 decoded = 0,         /* number of postings decoded */
+                 thresh,              /* current discrete threshold */
+                 rethresh,            /* distance to recalculation of the 
+                                       * threshold */
+                 rethresh_dist,
+                 bytes,
+                 step,
+                 missed = 0,        /* number of list entries that didn't match 
+                                     * an accumulator */
+                 hit = 0;           /* number of entries in both accs and list*/
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    int infinite = 0;                 /* whether threshold is infinite */
+    float cooc_rate;
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+    double avg_D_terms;
+    float w_t;
+    float r_dt;
+
+    float r_qt = (((opt->u.okapi_k3.k3) + 1) * (query->term[qterm].f_qt)) / ((opt->u.okapi_k3.k3) + (query->term[qterm].f_qt));
+    if (docmap_avg_words(idx->map, &avg_D_terms) != DOCMAP_OK) {
+        return SEARCH_EINVAL;
+    }
+
+
+    /* METRIC_PER_CALL */
+    w_t = (float) logf((N - (query->term[qterm].f_t) + 0.5F) / ((query->term[qterm].f_t) + 0.5F));
+    /* fix for okapi bug, w_t shouldn't be 0 or negative. */
+    if (w_t <= 0.0F) {
+        /* use a very small increment instead */
+        w_t = FLT_EPSILON;
+    }
+    
+    
+
+
+    rethresh_dist = rethresh = (postings + results->acc_limit - 1) 
+      / results->acc_limit;
+
+    if (results->v_t == FLT_MIN) {
+        unsigned long int docno_copy = docno;
+
+        /* this should be the first thresholded list, need to estimate 
+         * threshold */
+        assert(rethresh && rethresh < postings);
+        thresh = 0;
+
+        assert(rethresh < postings);
+        while (rethresh) {
+            while (rethresh && NEXT_DOC(&v, docno, f_dt)) {
+                rethresh--;
+                SCAN_OFFSETS(src, &v, f_dt);
+                if (f_dt > thresh) {
+                    thresh = f_dt;
+                }
+            }
+
+            /* need to read more data, preserving bytes that we already have */
+            if (rethresh && (ret = src->readlist(src, VEC_LEN(&v),
+                (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+                v.end = v.pos + bytes;
+            } else if (rethresh) {
+                assert(ret != SEARCH_FINISH);
+                return ret;
+            }
+        }
+        thresh--;
+
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        acc->acc.weight = 0.0;
+        f_dt = thresh;
+        /* METRIC_CONTRIB */
+        r_dt = ((((opt->u.okapi_k3.k1) + 1) * f_dt)       / ((opt->u.okapi_k3.k1) * ((1 - (opt->u.okapi_k3.b)) + (((opt->u.okapi_k3.b) * (((float) avg_D_terms))) / (float) avg_D_terms)) + f_dt));
+        (acc->acc.weight) += r_dt * w_t * r_qt;
+
+        results->v_t = acc->acc.weight;
+
+        /* reset source/vector to start */
+        v.pos = v.end = NULL;
+        if ((ret = src->reset(src)) != SEARCH_OK) {
+            return ret;
+        }
+
+        acc = *prevptr;
+        docno = docno_copy;
+        rethresh = rethresh_dist;
+    } else {
+        /* translate the existing v_t threshold to an f_dt */
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        f_dt = 0;
+        do {
+            acc->acc.weight = 0.0;
+            f_dt++;
+            /* METRIC_CONTRIB */
+            r_dt = ((((opt->u.okapi_k3.k1) + 1) * f_dt)       / ((opt->u.okapi_k3.k1) * ((1 - (opt->u.okapi_k3.b)) + (((opt->u.okapi_k3.b) * (((float) avg_D_terms))) / (float) avg_D_terms)) + f_dt));
+            (acc->acc.weight) += r_dt * w_t * r_qt;
+
+        } while (acc->acc.weight < results->v_t && f_dt < INF);
+        thresh = f_dt; 
+        acc = *prevptr;
+
+        if (thresh == INF) {
+            /* this is not a sensible term */
+            infinite = 1;
+            rethresh = postings + 1;
+        }
+    }
+
+    /* set step to 1/2 of the threshold */
+    step = (thresh + 1) / 2;
+    step += !step; /* but don't let it become 0 */
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                /* perform threshold test */
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = (*prevptr);
+                    results->accs--;
+                } else {
+                    /* retain this accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                r_dt = ((((opt->u.okapi_k3.k1) + 1) * f_dt)       / ((opt->u.okapi_k3.k1) * ((1 - (opt->u.okapi_k3.b)) + (((opt->u.okapi_k3.b) * (DOCMAP_GET_WORDS(idx->map, acc->acc.docno))) / (float) avg_D_terms)) + f_dt));
+                (acc->acc.weight) += r_dt * w_t * r_qt;
+
+
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = *prevptr;
+                    results->accs--;
+                } else {
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+                hit++;
+            } else {
+                if (f_dt > thresh) {
+                    struct search_acc_cons *newacc;
+                    assert(!acc || docno < acc->acc.docno); 
+
+                    if ((newacc = objalloc_malloc(results->alloc, 
+                      sizeof(*newacc)))) {
+                        newacc->acc.docno = docno;
+                        newacc->acc.weight = 0.0;
+                        newacc->next = acc;
+                        acc = newacc;
+                        /* note that we have to be careful around here to 
+                         * assign newacc to acc before using PER_DOC, 
+                         * otherwise we end up with nonsense in some 
+                         * accumulators */
+                        /* METRIC_PER_DOC */
+                        r_dt = ((((opt->u.okapi_k3.k1) + 1) * f_dt)       / ((opt->u.okapi_k3.k1) * ((1 - (opt->u.okapi_k3.b)) + (((opt->u.okapi_k3.b) * (DOCMAP_GET_WORDS(idx->map, acc->acc.docno))) / (float) avg_D_terms)) + f_dt));
+                        (acc->acc.weight) += r_dt * w_t * r_qt;
+
+                        *prevptr = newacc;
+                        results->accs++;
+                    } else {
+                        return SEARCH_ENOMEM;
+                    }
+
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                } else {
+                    missed++;
+                }
+            }
+
+            if (!--rethresh) {
+                int estimate;
+                unsigned int prev_thresh = thresh;
+
+                estimate = (int) (results->accs 
+                  + ((postings - decoded) 
+                    * ((float) results->accs - initial_accs)) / decoded);
+
+                if (estimate > TOLERANCE * results->acc_limit) {
+                    thresh += step;
+                } else if ((estimate < results->acc_limit / TOLERANCE) 
+                  && thresh) {
+                    if (thresh >= step) {
+                        thresh -= step;
+                    } else {
+                        thresh = 0;
+                    }
+                }
+
+                step = (step + 1) / 2;
+                assert(step);
+
+                /* note that we don't want to recalculate the threshold if it
+                 * doesn't change because this involves re-discretising it */
+                if (prev_thresh != thresh) {
+                    /* recalculate contribution that corresponds to the new 
+                     * threshold */
+                    f_dt = thresh;
+                    if (f_dt) {
+                        acc = &dummy;
+                        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+                        acc->acc.weight = 0.0;
+                        /* METRIC_CONTRIB */
+                        r_dt = ((((opt->u.okapi_k3.k1) + 1) * f_dt)       / ((opt->u.okapi_k3.k1) * ((1 - (opt->u.okapi_k3.b)) + (((opt->u.okapi_k3.b) * (((float) avg_D_terms))) / (float) avg_D_terms)) + f_dt));
+                        (acc->acc.weight) += r_dt * w_t * r_qt;
+
+                        results->v_t = acc->acc.weight;
+                        acc = *prevptr;
+                    } else {
+                        results->v_t = FLT_MIN;
+                    }
+                }
+
+                rethresh_dist *= 2;
+                rethresh = rethresh_dist;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate total results count */
+            assert(postings == decoded);
+
+            results->total_results += (int) (results->accs - initial_accs);
+
+            /* list entries now divide up into three portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *   - added
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            /* note that the total results are not an estimate if either there
+             * were no accumulators in the list when we started (in which case
+             * missed records exactly the number, uh, missing from the
+             * accumulators) or there were none missed, in which case the
+             * accumulators have fully accounted for everything in this list.
+             * In either case, the (1 - cooc_rate) * missed maths above handles
+             * it exactly (modulo floating point errors of course). */
+            if (initial_accs && missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                if (!infinite) {
+                    /* continue threshold evaluation */
+                    return SEARCH_OK;
+                } else {
+                    /* switch to AND processing */
+                    return SEARCH_FINISH;
+                }
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* Declare a function named the same as the metric that returns a structure 
+ * containing function pointers */
+const struct search_metric * /* METRIC_NAME */ okapi_k3 () {
+    const static struct search_metric sm 
+      = {pre, /* METRIC_DEPENDS_POST */ 0 ? post : NULL, 
+         or_decode, and_decode, thresh_decode};
+    return &sm;
+}
+
diff --git a/src/okapi_k3.metric b/src/okapi_k3.metric
new file mode 100644 (file)
index 0000000..70c1dd6
--- /dev/null
@@ -0,0 +1,38 @@
+# okapi_k3.metric is a functional description in our funny zettair metric
+# language (see metric.py) of how the okapi metric should operate.  
+#
+# The okapi metric is probably best described in 
+# 'A probabalistic model of information retrieval: development and
+# comparative experiments' parts 1 & 2, by Sparck Jones, Walker and
+# Robertson, although it was (i believe) first presented in 
+# 'Okapi at TREC-7: Automatic ad hoc, filtering, VLC and interactive track'  
+# by Robertson, Walker, and Beaulieu.
+#
+# written nml 2005-07-18
+
+parameter float k1;
+parameter float k3;
+parameter float b;
+
+decode() {
+    float w_t;   /* weight of term */
+    float r_dt;  /* weight of term in document */
+       float r_qt = ((k3 + 1) * f_qt) / (k3 + f_qt);
+
+    w_t = (float) logf((N - f_t + 0.5F) / (f_t + 0.5F));
+    /* fix for okapi bug, w_t shouldn't be 0 or negative. */
+    if (w_t <= 0.0F) {
+        /* use a very small increment instead */
+        w_t = FLT_EPSILON;  
+    }
+
+    r_dt = (((k1 + 1) * f_dt) 
+      / (k1 * ((1 - b) + ((b * D_terms) / (float) avg_D_terms)) + f_dt));
+
+    accumulator += r_dt * w_t * r_qt;
+}
+
+post() {
+
+}
+
diff --git a/src/pcosine.c b/src/pcosine.c
new file mode 100644 (file)
index 0000000..5d54abb
--- /dev/null
@@ -0,0 +1,614 @@
+/* pcosine.c implements the pcosine metric for the zettair query
+ * subsystem.  This file was automatically generated from
+ * src/pcosine.metric and src/metric.c
+ * by scripts/metric.py on Thu, 29 Jun 2006 04:12:41 GMT.  
+ *
+ * DO NOT MODIFY THIS FILE, as changes will be lost upon 
+ * subsequent regeneration (and this code is repetitive enough 
+ * that you probably don't want to anyway).  
+ * Go modify src/pcosine.metric or src/metric.c instead.  
+ * 
+ * Comments from pcosine.metric:
+ *
+ * pcosine.metric is a functional description in our funny zettair metric
+ * language (see metric.py) of how the pivoted cosine metric should operate.
+ * 
+ * The pivoted cosine metric uses pivoted document length normalisation
+ * over a fairly standard cosine metric.  A description of some
+ * variations of the cosine metric are given in Managing Gigabytes
+ * by Whitten, Moffat, Bell (2nd ed), page 185+.  The one we'll be
+ * using here calculates the inner product of the documents, treating
+ * each term as a dimension, where the lengths along each dimension are
+ * given by:
+ * 
+ * w_qt = f_qt * ln (1 + (N / f_t))
+ * w_dt = 1 + ln (f_dt)
+ * 
+ * Thus the weight of a document is calculated as
+ * 
+ * sum (for each term in the query and document) of w_dt * w_qt
+ * 
+ * The document length normalisation is implemented as in
+ * 'Pivoted Document Length Normalization' by Singhal, Buckley, Mitra.
+ * The suggested pivot is 0.2.
+ * 
+ * written nml 2005-07-18
+ *
+ */
+
+
+#include "firstinclude.h"
+
+#include "metric.h"
+
+#include "_index.h"
+#include "_docmap.h"
+#include "index_querybuild.h"
+
+#include "def.h"
+#include "objalloc.h"
+#include "docmap.h"
+#include "search.h"
+#include "vec.h"
+
+#include <assert.h>
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+
+static enum search_ret pre(struct index *idx, struct query *query, 
+  int opts, struct index_search_opt *opt) {
+    /* METRIC_PRE */
+    if (docmap_cache(idx->map, docmap_get_cache(idx->map) | DOCMAP_CACHE_WEIGHT) != DOCMAP_OK) return SEARCH_EINVAL;
+
+    return SEARCH_OK;
+}
+
+static enum search_ret post(struct index *idx, struct query *query, 
+  struct search_acc_cons *acc, int opts, struct index_search_opt *opt) {
+    /* METRIC_POST */
+    double avg_D_weight;
+    if (docmap_avg_weight(idx->map, &avg_D_weight) != DOCMAP_OK) {
+                 return SEARCH_EINVAL;
+             }
+
+
+    while (acc) {
+        assert(acc->acc.docno < docmap_entries(idx->map));
+        /* METRIC_POST_PER_DOC */
+        (acc->acc.weight) /= (1.0F - (opt->u.pcosine.pivot)) + (opt->u.pcosine.pivot) * ((DOCMAP_GET_WEIGHT(idx->map, acc->acc.docno)) / (float) avg_D_weight);
+
+        acc = acc->next;
+    }
+
+    return SEARCH_OK;
+}
+
+/* macro to atomically read the next docno and f_dt from a vector 
+ * (note: i also tried a more complicated version that tested for a long vec 
+ * and used unchecked reads, but measurements showed no improvement) */
+#define NEXT_DOC(v, docno, f_dt)                                              \
+    (vec_vbyte_read(v, &docno_d)                                              \
+      && (((vec_vbyte_read(v, &f_dt) && ((docno += docno_d + 1), 1))          \
+        /* second read failed, reposition vec back to start of docno_d */     \
+        || (((v)->pos -= vec_vbyte_len(docno_d)), 0))))
+
+/* macro to scan over f_dt offsets from a vector/source */
+#define SCAN_OFFSETS(src, v, f_dt)                                            \
+    do {                                                                      \
+        unsigned int toscan = f_dt,                                           \
+                     scanned;                                                 \
+        enum search_ret sret;                                                 \
+                                                                              \
+        do {                                                                  \
+            if ((scanned = vec_vbyte_scan(v, toscan, &scanned)) == toscan) {  \
+                toscan = 0;                                                   \
+                break;                                                        \
+            } else if (scanned < toscan) {                                    \
+                toscan -= scanned;                                            \
+                /* need to read more */                                       \
+                if ((sret = src->readlist(src, VEC_LEN(v),                    \
+                    (void **) &(v)->pos, &bytes)) == SEARCH_OK) {             \
+                                                                              \
+                    (v)->end = (v)->pos + bytes;                              \
+                } else if (sret == SEARCH_FINISH) {                           \
+                    /* shouldn't end while scanning offsets */                \
+                    return SEARCH_EINVAL;                                     \
+                } else {                                                      \
+                    return sret;                                              \
+                }                                                             \
+            } else {                                                          \
+                assert("can't get here" && 0);                                \
+                return SEARCH_EINVAL;                                         \
+            }                                                                 \
+        } while (toscan);                                                     \
+    } while (0)
+static enum search_ret or_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc;
+    unsigned int accs_added = 0;   /* number of accumulators added */
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    unsigned int bytes;
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+
+    const float w_qt = (float) ((query->term[qterm].f_qt) * (float) logf(1 + (N / (float) (query->term[qterm].f_t))));
+
+
+    /* METRIC_PER_CALL */
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                prevptr = &acc->next;
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += w_qt * (1 + (float) logf(f_dt));
+
+            } else {
+                struct search_acc_cons *newacc;
+                assert(!acc || docno < acc->acc.docno); 
+
+                /* allocate a new accumulator (we have reserved allocators
+                 * earlier, so this should never fail) */
+                newacc = objalloc_malloc(results->alloc, sizeof(*newacc));
+                assert(newacc);
+                newacc->next = acc;
+                acc = newacc;
+                acc->acc.docno = docno;
+                acc->acc.weight = 0.0;
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += w_qt * (1 + (float) logf(f_dt));
+
+                *prevptr = newacc;
+                accs_added++;
+            }
+            assert(acc);
+
+            /* go to next accumulator */
+            prevptr = &acc->next;
+            acc = acc->next;
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, update number of accumulators */
+            results->accs += accs_added;
+            results->total_results += accs_added;
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+static enum search_ret and_decode(struct index *idx, struct query *query, 
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, struct search_list_src *src,
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc;
+    unsigned long int f_dt,        /* number of offsets for this document */
+                      docno_d;     /* d-gap */
+    struct vec v = {NULL, NULL};
+    unsigned int bytes,
+                 missed = 0,       /* number of list entries that didn't match 
+                                    * an accumulator */
+                 hit = 0,          /* number of entries in both accs and list*/
+                 decoded = 0;      /* number of list entries seen */
+    enum search_ret ret;
+    float cooc_rate;               /* co-occurrance rate for list entries and 
+                                    * accumulators */
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+
+    const float w_qt = (float) ((query->term[qterm].f_qt) * (float) logf(1 + (N / (float) (query->term[qterm].f_t))));
+
+
+    /* METRIC_PER_CALL */
+
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                acc = acc->next;
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += w_qt * (1 + (float) logf(f_dt));
+
+
+                /* go to next accumulator */
+                acc = acc->next;
+                hit++;
+            } else {
+                missed++;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate number of results */
+
+            /* list entries now divide up into two portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            assert(missed + hit == decoded);
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            if (missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                return SEARCH_OK;
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* tolerance value for thresholding estimates.  Should be >= 1.0.  Make higher
+ * for stabler, but higher memory usage, processing. */
+#define TOLERANCE 1.2
+
+/* low-ish approximation of infinity, to make counting up to it acceptable */
+#define INF 2000
+
+static enum search_ret thresh_decode(struct index *idx, struct query *query,
+  unsigned int qterm, unsigned long int docno, 
+  struct search_metric_results *results, 
+  struct search_list_src *src, unsigned int postings, 
+  int opts, struct index_search_opt *opt) {
+    struct search_acc_cons *acc = results->acc,
+                           **prevptr = &results->acc,
+                           dummy;
+    unsigned long int f_dt,           /* number of offsets for this document */
+                      docno_d;        /* d-gap */
+
+    /* initial number of accumulators */
+    unsigned int initial_accs = results->accs,
+
+                 decoded = 0,         /* number of postings decoded */
+                 thresh,              /* current discrete threshold */
+                 rethresh,            /* distance to recalculation of the 
+                                       * threshold */
+                 rethresh_dist,
+                 bytes,
+                 step,
+                 missed = 0,        /* number of list entries that didn't match 
+                                     * an accumulator */
+                 hit = 0;           /* number of entries in both accs and list*/
+    struct vec v = {NULL, NULL};
+    enum search_ret ret;
+    int infinite = 0;                 /* whether threshold is infinite */
+    float cooc_rate;
+    /* METRIC_DECL */
+
+    const unsigned int N = docmap_entries(idx->map);
+
+    const float w_qt = (float) ((query->term[qterm].f_qt) * (float) logf(1 + (N / (float) (query->term[qterm].f_t))));
+
+
+    /* METRIC_PER_CALL */
+
+
+    rethresh_dist = rethresh = (postings + results->acc_limit - 1) 
+      / results->acc_limit;
+
+    if (results->v_t == FLT_MIN) {
+        unsigned long int docno_copy = docno;
+
+        /* this should be the first thresholded list, need to estimate 
+         * threshold */
+        assert(rethresh && rethresh < postings);
+        thresh = 0;
+
+        assert(rethresh < postings);
+        while (rethresh) {
+            while (rethresh && NEXT_DOC(&v, docno, f_dt)) {
+                rethresh--;
+                SCAN_OFFSETS(src, &v, f_dt);
+                if (f_dt > thresh) {
+                    thresh = f_dt;
+                }
+            }
+
+            /* need to read more data, preserving bytes that we already have */
+            if (rethresh && (ret = src->readlist(src, VEC_LEN(&v),
+                (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+                v.end = v.pos + bytes;
+            } else if (rethresh) {
+                assert(ret != SEARCH_FINISH);
+                return ret;
+            }
+        }
+        thresh--;
+
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        acc->acc.weight = 0.0;
+        f_dt = thresh;
+        /* METRIC_CONTRIB */
+        (acc->acc.weight) += w_qt * (1 + (float) logf(f_dt));
+
+        results->v_t = acc->acc.weight;
+
+        /* reset source/vector to start */
+        v.pos = v.end = NULL;
+        if ((ret = src->reset(src)) != SEARCH_OK) {
+            return ret;
+        }
+
+        acc = *prevptr;
+        docno = docno_copy;
+        rethresh = rethresh_dist;
+    } else {
+        /* translate the existing v_t threshold to an f_dt */
+        acc = &dummy;
+        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+        f_dt = 0;
+        do {
+            acc->acc.weight = 0.0;
+            f_dt++;
+            /* METRIC_CONTRIB */
+            (acc->acc.weight) += w_qt * (1 + (float) logf(f_dt));
+
+        } while (acc->acc.weight < results->v_t && f_dt < INF);
+        thresh = f_dt; 
+        acc = *prevptr;
+
+        if (thresh == INF) {
+            /* this is not a sensible term */
+            infinite = 1;
+            rethresh = postings + 1;
+        }
+    }
+
+    /* set step to 1/2 of the threshold */
+    step = (thresh + 1) / 2;
+    step += !step; /* but don't let it become 0 */
+
+    while (1) {
+        while (NEXT_DOC(&v, docno, f_dt)) {
+            SCAN_OFFSETS(src, &v, f_dt);
+            decoded++;
+
+            /* merge into accumulator list */
+            while (acc && (docno > acc->acc.docno)) {
+                /* perform threshold test */
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = (*prevptr);
+                    results->accs--;
+                } else {
+                    /* retain this accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+            }
+
+            if (acc && (docno == acc->acc.docno)) {
+                /* METRIC_PER_DOC */
+                (acc->acc.weight) += w_qt * (1 + (float) logf(f_dt));
+
+
+                if (acc->acc.weight < results->v_t) {
+                    /* remove this accumulator */
+                    *prevptr = acc->next;
+                    objalloc_free(results->alloc, acc);
+                    acc = *prevptr;
+                    results->accs--;
+                } else {
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                }
+                hit++;
+            } else {
+                if (f_dt > thresh) {
+                    struct search_acc_cons *newacc;
+                    assert(!acc || docno < acc->acc.docno); 
+
+                    if ((newacc = objalloc_malloc(results->alloc, 
+                      sizeof(*newacc)))) {
+                        newacc->acc.docno = docno;
+                        newacc->acc.weight = 0.0;
+                        newacc->next = acc;
+                        acc = newacc;
+                        /* note that we have to be careful around here to 
+                         * assign newacc to acc before using PER_DOC, 
+                         * otherwise we end up with nonsense in some 
+                         * accumulators */
+                        /* METRIC_PER_DOC */
+                        (acc->acc.weight) += w_qt * (1 + (float) logf(f_dt));
+
+                        *prevptr = newacc;
+                        results->accs++;
+                    } else {
+                        return SEARCH_ENOMEM;
+                    }
+
+                    /* go to next accumulator */
+                    prevptr = &acc->next;
+                    acc = acc->next;
+                } else {
+                    missed++;
+                }
+            }
+
+            if (!--rethresh) {
+                int estimate;
+                unsigned int prev_thresh = thresh;
+
+                estimate = (int) (results->accs 
+                  + ((postings - decoded) 
+                    * ((float) results->accs - initial_accs)) / decoded);
+
+                if (estimate > TOLERANCE * results->acc_limit) {
+                    thresh += step;
+                } else if ((estimate < results->acc_limit / TOLERANCE) 
+                  && thresh) {
+                    if (thresh >= step) {
+                        thresh -= step;
+                    } else {
+                        thresh = 0;
+                    }
+                }
+
+                step = (step + 1) / 2;
+                assert(step);
+
+                /* note that we don't want to recalculate the threshold if it
+                 * doesn't change because this involves re-discretising it */
+                if (prev_thresh != thresh) {
+                    /* recalculate contribution that corresponds to the new 
+                     * threshold */
+                    f_dt = thresh;
+                    if (f_dt) {
+                        acc = &dummy;
+                        acc->acc.docno = UINT_MAX;   /* shouldn't be used */
+                        acc->acc.weight = 0.0;
+                        /* METRIC_CONTRIB */
+                        (acc->acc.weight) += w_qt * (1 + (float) logf(f_dt));
+
+                        results->v_t = acc->acc.weight;
+                        acc = *prevptr;
+                    } else {
+                        results->v_t = FLT_MIN;
+                    }
+                }
+
+                rethresh_dist *= 2;
+                rethresh = rethresh_dist;
+            }
+        }
+
+        /* need to read more data, preserving bytes that we already have */
+        if ((ret = src->readlist(src, VEC_LEN(&v),
+            (void **) &v.pos, &bytes)) == SEARCH_OK) {
+
+            v.end = v.pos + bytes;
+        } else if (ret == SEARCH_FINISH) {
+            /* finished, estimate total results count */
+            assert(postings == decoded);
+
+            results->total_results += (int) (results->accs - initial_accs);
+
+            /* list entries now divide up into three portions:
+             *   - matching an entry in the acc list (hit)
+             *   - missed
+             *   - added
+             *
+             * cooccurrance rate is the percentage of list items hit */
+            cooc_rate = hit / (float) decoded;
+
+            /* now have sampled co-occurrance rate, use this to estimate 
+             * population co-occurrance rate (assuming unbiased sampling) 
+             * and then number of results from unrestricted evaluation */
+            assert(results->total_results >= results->accs);
+            cooc_rate 
+              *= (float) results->total_results / (float) results->accs; 
+            assert(cooc_rate >= 0.0);
+            if (cooc_rate > 1.0) {
+                cooc_rate = 1.0;
+            }
+
+            /* add number of things we think would have been added from the
+             * things that were missed */
+            results->total_results += (1 - cooc_rate) * missed;
+
+            /* note that the total results are not an estimate if either there
+             * were no accumulators in the list when we started (in which case
+             * missed records exactly the number, uh, missing from the
+             * accumulators) or there were none missed, in which case the
+             * accumulators have fully accounted for everything in this list.
+             * In either case, the (1 - cooc_rate) * missed maths above handles
+             * it exactly (modulo floating point errors of course). */
+            if (initial_accs && missed) {
+                results->estimated |= 1;
+            }
+
+            if (!VEC_LEN(&v)) {
+                if (!infinite) {
+                    /* continue threshold evaluation */
+                    return SEARCH_OK;
+                } else {
+                    /* switch to AND processing */
+                    return SEARCH_FINISH;
+                }
+            } else {
+                return SEARCH_EINVAL;
+            }
+        } else {
+            return ret;
+        }
+    }
+}
+
+/* Declare a function named the same as the metric that returns a structure 
+ * containing function pointers */
+const struct search_metric * /* METRIC_NAME */ pcosine () {
+    const static struct search_metric sm 
+      = {pre, /* METRIC_DEPENDS_POST */ 1 ? post : NULL, 
+         or_decode, and_decode, thresh_decode};
+    return &sm;
+}
+
diff --git a/src/pcosine.metric b/src/pcosine.metric
new file mode 100644 (file)
index 0000000..96b9a3e
--- /dev/null
@@ -0,0 +1,36 @@
+# pcosine.metric is a functional description in our funny zettair metric
+# language (see metric.py) of how the pivoted cosine metric should operate.  
+#
+# The pivoted cosine metric uses pivoted document length normalisation
+# over a fairly standard cosine metric.  A description of some
+# variations of the cosine metric are given in Managing Gigabytes
+# by Whitten, Moffat, Bell (2nd ed), page 185+.  The one we'll be
+# using here calculates the inner product of the documents, treating
+# each term as a dimension, where the lengths along each dimension are
+# given by:
+#
+#   w_qt = f_qt * ln (1 + (N / f_t))
+#   w_dt = 1 + ln (f_dt)
+#
+# Thus the weight of a document is calculated as 
+#
+#   sum (for each term in the query and document) of w_dt * w_qt
+#
+# The document length normalisation is implemented as in 
+# 'Pivoted Document Length Normalization' by Singhal, Buckley, Mitra.
+# The suggested pivot is 0.2.
+#
+# written nml 2005-07-18
+
+parameter float pivot;
+
+decode() {
+    const float w_qt = (float) (f_qt * (float) logf(1 + (N / (float) f_t)));
+
+       accumulator += w_qt * (1 + (float) logf(f_dt));
+}
+
+post() {
+    accumulator /= (1.0F - pivot) + pivot * (D_weight / (float) avg_D_weight);
+}
+
diff --git a/src/poolalloc.c b/src/poolalloc.c
new file mode 100644 (file)
index 0000000..a0b3755
--- /dev/null
@@ -0,0 +1,512 @@
+/* poolalloc.c implements a pooled allocator that efficiently returns memory
+ * via a malloc-like interface.  This allocator is more efficient than general
+ * purpose malloc because it does not track free memory.  This greatly
+ * simplifies memory management, but also means that memory consumption will
+ * grow until the manager is clear()'d or delete()'d
+ *
+ * written nml 2004-09-02
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "chash.h"
+#include "def.h"
+#include "poolalloc.h"
+#include "mem.h"
+#include "_mem.h"
+#include "zvalgrind.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+struct poolalloc_chunk {
+    struct poolalloc_chunk *next;   /* pointer to next chunk in linked list */
+    char *end;                      /* pointer to one past the end of chunk */
+    char *curr;                     /* pointer to the current position in the 
+                                     * chunk */
+};
+
+struct poolalloc {
+    unsigned int redzone;           /* size of the redzone we're putting after 
+                                     * each allocation */
+    unsigned int chunksize;         /* size of chunks we're requesting from 
+                                     * the underlying allocator */
+    unsigned int allocated;         /* how many entities we've allocated */
+    struct chash *allocations;      /* hashtable of current allocations (only 
+                                     * used under valgrind, because valgrind 
+                                     * is the only tool sensitive enough to 
+                                     * pick up memory leaks within this 
+                                     * module) */
+    struct alloc alloc;             /* underlying allocator */
+    struct poolalloc_chunk *curr;   /* chunk we're currently allocating from */
+    struct poolalloc_chunk chunk;   /* first chunk */
+};
+
+#ifndef NDEBUG
+static int poolalloc_invariant(struct poolalloc *pool) {
+    struct poolalloc_chunk *chunk = pool->curr,
+                           *next;
+    unsigned int chunklen;
+
+    if (DEAR_DEBUG) {
+        /* the allocator must always have a current chunk */
+        if (!pool->curr) {
+            assert(!CRASH);
+            return 0;
+        }
+
+        while (chunk) {
+            VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+            next = chunk->next;
+
+            if (chunk->curr > chunk->end) {
+                VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+                assert(!CRASH);
+                return 0;
+            }
+
+            chunklen = MEM_PTRDIFF(chunk->end, chunk);
+            if (chunk == &pool->chunk) {
+                /* this is the original chunk, check size differently */
+                chunklen -= sizeof(*chunk);
+                if (chunklen 
+                  < pool->chunksize - (mem_align_max() - 1) - sizeof(*pool)) {
+                    VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+                    assert(!CRASH);
+                    return 0;
+                }
+            } else {
+                if (chunklen < pool->chunksize - (mem_align_max() - 1)) {
+                    VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+                    assert(!CRASH);
+                    return 0;
+                }
+            }
+            VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+            chunk = next;
+        }
+
+        return 1;
+    } else {
+        return 1;
+    }
+}
+#endif
+
+struct poolalloc *poolalloc_new(unsigned int redzone, unsigned int bulkalloc, 
+  const struct alloc *alloc) {
+    struct poolalloc *pool;
+    unsigned int min;
+    
+    min = sizeof(struct poolalloc) + redzone + mem_align_max() + sizeof(int);
+
+    if (bulkalloc < min) {
+        bulkalloc = min;
+    }
+
+    if (!alloc) {
+        alloc = &alloc_system;
+    }
+
+    if ((pool = alloc->malloc(alloc->opaque, bulkalloc))) {
+        pool->redzone = redzone;
+        pool->chunksize = bulkalloc;
+        pool->allocated = 0;
+        pool->curr = &pool->chunk;
+        pool->chunk.next = NULL;
+        pool->chunk.curr = MEM_PTRADD(&pool->chunk, sizeof(pool->chunk));
+        pool->chunk.end = MEM_PTRADD(pool, bulkalloc);
+        pool->alloc = *alloc;
+        pool->allocations = NULL;
+
+        if (RUNNING_ON_VALGRIND) {
+            /* note that we use luint as type for chash because ptr needs 
+             * comparison functions et al */
+            if ((pool->allocations = chash_luint_new(0, 0.5))) {
+                /* succeeded, do nothing */
+            } else {
+                alloc->free(alloc->opaque, pool);
+                return NULL;
+            }
+
+            VALGRIND_MAKE_NOACCESS(&pool->chunk, bulkalloc);
+        }
+    }
+
+    return pool;
+}
+
+void poolalloc_delete(struct poolalloc *pool) {
+    struct poolalloc_chunk *chunk,
+                           *next;
+
+    chunk = pool->curr;
+    assert(chunk);
+    while (chunk) {
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+        next = chunk->next;
+        if (chunk != &pool->chunk) {
+            pool->alloc.free(pool->alloc.opaque, chunk);
+        }
+        chunk = next;
+    }
+
+    if (RUNNING_ON_VALGRIND) {
+        chash_delete(pool->allocations);
+    }
+
+    pool->alloc.free(pool->alloc.opaque, pool);
+}
+
+void *poolalloc_malloc(struct poolalloc *pool, unsigned int size) {
+    return poolalloc_memalign(pool, size, mem_align_max());
+}
+
+void *poolalloc_memalign(struct poolalloc *pool, unsigned int size, 
+  unsigned int align) {
+    unsigned int min;
+    char *ptr;
+    struct poolalloc_chunk *chunk = pool->curr,
+                           *next;
+    do {
+        assert(chunk);
+        do {
+            VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+            next = chunk->next;
+            ptr = MEM_ALIGN(chunk->curr, align);
+            if ((ptr < chunk->end) 
+              && ((unsigned int) MEM_PTRDIFF(chunk->end, ptr)) 
+                >= size + pool->redzone) {
+
+                /* allocate from current chunk */
+                VALGRIND_MAKE_WRITABLE(ptr, size);
+                VALGRIND_MALLOCLIKE_BLOCK(ptr, size, 0, 0);
+                if (RUNNING_ON_VALGRIND) {
+                    /* insert entry into hashtable so we can keep track of
+                     * allocations */
+                    chash_luint_ptr_insert(pool->allocations, 
+                      (unsigned long int) ptr, ptr);
+                }
+                chunk->curr = MEM_PTRADD(ptr, size + pool->redzone);
+                assert(chunk->curr <= chunk->end);
+                VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+                assert(poolalloc_invariant(pool));
+                pool->allocated++;
+                return ptr;
+            }
+
+            VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+        } while ((chunk = next));
+
+        /* failed to allocate memory from existing chunks */
+
+        /* figure out the maximum space this allocation will consume */
+        min = size + pool->redzone + align + sizeof(*chunk);
+
+        /* up it to the chunksize if its below */
+        if (min < pool->chunksize) {
+            min = pool->chunksize;
+        }
+
+        /* allocate new chunk */
+        if ((chunk = pool->alloc.malloc(pool->alloc.opaque, min))) {
+            chunk->next = pool->curr;
+            chunk->curr = MEM_PTRADD(chunk, sizeof(*chunk));
+            chunk->end = MEM_PTRADD(chunk, min);
+            next = pool->curr = chunk;
+
+            /* make sure we'll allocate next time around */
+            assert(((unsigned int) 
+              MEM_PTRDIFF(chunk->end, MEM_ALIGN(chunk->curr, align)))
+                >= size + pool->redzone);
+
+            VALGRIND_MAKE_NOACCESS(chunk, min);
+        } else {
+            return NULL;
+        }
+        /* loop, and we'll allocate it the next time around */
+    } while (1);
+}
+
+void poolalloc_free(struct poolalloc *pool, void *ptr) {
+    VALGRIND_FREELIKE_BLOCK(ptr, 0);
+    VALGRIND_MAKE_NOACCESS(ptr, 1);
+    if (RUNNING_ON_VALGRIND) {
+        void *dummy = NULL;
+
+        /* remove allocation from allocations table */
+        chash_luint_ptr_remove(pool->allocations, (unsigned long int) ptr, 
+          &dummy);
+        assert(dummy == ptr);
+    }
+    pool->allocated--;
+}
+
+void poolalloc_clear(struct poolalloc *pool) {
+    struct poolalloc_chunk *chunk = pool->curr,
+                           *next;
+
+    if (RUNNING_ON_VALGRIND) {
+        /* free all blocks so we don't get leak reports */
+        struct chash_iter *iter = chash_iter_new(pool->allocations);
+
+        if (iter) {
+            unsigned long int key;
+            void **data;
+
+            while (chash_iter_luint_ptr_next(iter, &key, &data) == CHASH_OK) {
+                VALGRIND_FREELIKE_BLOCK(*data, 0);
+                pool->allocated--;
+            }
+
+            chash_iter_delete(iter);
+        }
+        assert(pool->allocated == 0);
+        chash_clear(pool->allocations);
+    }
+
+    assert(chunk);
+    do {
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+        next = chunk->next;
+        chunk->curr = MEM_PTRADD(chunk, sizeof(*chunk));
+        VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+    } while ((chunk = next));
+
+    pool->allocated = 0;
+}
+
+void poolalloc_drain(struct poolalloc *pool) {
+    struct poolalloc_chunk *chunk = pool->curr,
+                           *next,
+                           *prev = NULL;
+
+
+    /* note that we start at chunk after the first one */
+
+    do {
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+        next = chunk->next;
+        if ((chunk->curr == MEM_PTRADD(chunk, sizeof(*chunk))) 
+          && (chunk != &pool->chunk)) {
+            if (prev) {
+                VALGRIND_MAKE_READABLE(prev, sizeof(*chunk));
+                prev->next = next;
+                VALGRIND_MAKE_NOACCESS(prev, sizeof(*chunk));
+            } else {
+                pool->curr = next;
+            }
+            pool->alloc.free(pool->alloc.opaque, chunk);
+        } else {
+            prev = chunk;
+        }
+        VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+    } while ((chunk = next));
+}
+
+unsigned int poolalloc_allocated(struct poolalloc *pool) {
+    return pool->allocated;
+}
+
+int poolalloc_is_managed(struct poolalloc *pool, void *ptr) {
+    struct poolalloc_chunk *chunk = pool->curr,
+                           *next;
+
+    do {
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+        next = chunk->next;
+        if ((ptr >= (void *) MEM_PTRADD(chunk, sizeof(*chunk))) 
+          && (ptr < (void *) chunk->end)) {
+            VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+            return 1;
+        }
+        VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+    } while ((chunk = next));
+
+    return 0;
+}
+
+unsigned int poolalloc_pages(struct poolalloc *pool) {
+    struct poolalloc_chunk *chunk = pool->curr,
+                           *next;
+    unsigned int pages = 0;
+
+    assert(chunk);
+    do {
+        VALGRIND_MAKE_READABLE(chunk, sizeof(*chunk));
+        next = chunk->next;
+        pages++;
+        VALGRIND_MAKE_NOACCESS(chunk, sizeof(*chunk));
+    } while ((chunk = next));
+
+    return pages;
+}
+
+unsigned int poolalloc_overhead_first(struct poolalloc *pool) {
+    return sizeof(struct poolalloc);
+}
+
+unsigned int poolalloc_overhead(struct poolalloc *pool) {
+    return sizeof(struct poolalloc_chunk);
+}
+
+#ifdef POOLALLOC_TEST
+
+#include <stdlib.h>
+
+int main() {
+    unsigned int i;
+    int *arr[20];
+    struct poolalloc *alloc;
+
+    /* just alloc and free */
+
+    alloc = poolalloc_new(1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    for (i = 0; i < 20; i++) {
+        assert(*arr[i] == i);
+        assert(poolalloc_is_managed(alloc, arr[i]));
+        poolalloc_free(alloc, arr[i]);
+    }
+
+    poolalloc_delete(alloc); 
+
+    /* different sizes */
+
+    alloc = poolalloc_new(1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, i);
+        assert(arr[i]);
+    }
+
+    for (i = 0; i < 20; i++) {
+        assert(poolalloc_is_managed(alloc, arr[i]));
+        poolalloc_free(alloc, arr[i]);
+    }
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, 200 + i);
+        assert(arr[i]);
+    }
+
+    for (i = 0; i < 20; i++) {
+        assert(poolalloc_is_managed(alloc, arr[i]));
+        poolalloc_free(alloc, arr[i]);
+    }
+
+    poolalloc_delete(alloc); 
+
+    /* test drain */
+
+    alloc = poolalloc_new(1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    for (i = 0; i < 20; i++) {
+        assert(*arr[i] == i);
+        assert(poolalloc_is_managed(alloc, arr[i]));
+        poolalloc_free(alloc, arr[i]);
+    }
+
+    poolalloc_drain(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    for (i = 0; i < 20; i++) {
+        assert(*arr[i] == i);
+        assert(poolalloc_is_managed(alloc, arr[i]));
+        poolalloc_free(alloc, arr[i]);
+    }
+
+    poolalloc_clear(alloc);
+    poolalloc_drain(alloc);
+    assert(poolalloc_pages(alloc) == 1);
+
+    poolalloc_delete(alloc); 
+
+    /* perform some invalid accesses */
+
+    alloc = poolalloc_new(1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    /* valid access */
+    *arr[0] = 0;
+
+    /* FIXME: invalid accesses 
+    i = arr[0][-1];
+    arr[1][-1] = -1;
+    arr[1][1] = -1;  */
+
+    for (i = 0; i < 20; i++) {
+        assert(*arr[i] == i);
+        assert(poolalloc_is_managed(alloc, arr[i]));
+        poolalloc_free(alloc, arr[i]);
+    }
+
+    poolalloc_clear(alloc);
+    poolalloc_delete(alloc);
+
+    /* cause leaks */
+
+    alloc = poolalloc_new(1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    for (i = 1; i < 19; i++) {
+        assert(*arr[i] == i);
+        assert(poolalloc_is_managed(alloc, arr[i]));
+        poolalloc_free(alloc, arr[i]);
+    }
+
+    poolalloc_delete(alloc); 
+
+    /* use clear */
+
+    alloc = poolalloc_new(1, 10 * sizeof(int), NULL);
+    assert(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    poolalloc_clear(alloc);
+
+    for (i = 0; i < 20; i++) {
+        arr[i] = poolalloc_malloc(alloc, sizeof(int));
+        *arr[i] = i;
+    }
+
+    poolalloc_clear(alloc);
+    poolalloc_delete(alloc); 
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
diff --git a/src/postings.c b/src/postings.c
new file mode 100644 (file)
index 0000000..d164e5e
--- /dev/null
@@ -0,0 +1,643 @@
+/* postings.c implements a postings list as specified in postings.h
+ *
+ * There are two primary problems in generating postings.  This postings module
+ * uses a (large) internal hashtable that seems to work pretty well for 
+ * locating postings entries, so that's not hard.  However, once you've found
+ * the correct postings entry, there's memory management involved in managing
+ * the compressed accumulated postings, which is difficult.  There's also the
+ * problem that our postings format is <d, f_dt [off1, off2 ... off_f_dt]>.
+ * Note that the f_dt value appears in the vector *before* the offsets it
+ * describes.  So when we recieve the first offset, we don't know how many are
+ * going to follow it in this document, and hence don't know the correct f_dt
+ * value.  But we have to store the offsets *somewhere* in the mean time.
+ *
+ * The solution to the f_dt/offsets problem is to assume that each term is 
+ * going to occur once.  When we recieve the first offset, we write the docno
+ * dgap and an f_dt of 1 prior to writing it.  When we update the changed
+ * postings entries at the end of the document (which i'd like to get away from,
+ * but am finding difficult thanks to the need to calculate the document weight
+ * for the cosine measure) we check the count of offsets received for this
+ * document.  If it turned out to be 1 (which it will in a large number of
+ * cases) then everything is fine.  If not, then we go back to the location
+ * that we wrote the f_dt value and change it.  Since it's stored in vbyte
+ * format, the size of the f_dt value may change, which means we have to 
+ * shuffle the offsets for this document up a couple of bytes to make room.
+ * However, since vbytes are byte-coded, most f_dt's occupy exactly one byte.
+ * That means that actually needing to move the offsets is rare.  Previous
+ * solutions to this problem have been to maintain a linked list of offsets
+ * before encoding them all, or encoding them onto a different memory area and
+ * then copying them.  This should be by far the best.
+ *
+ * originally written Hugh Williams
+ *
+ * updated nml 2003-03-09
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "postings.h"
+#include "_postings.h"
+
+#include "bit.h"
+#include "def.h"
+#include "stop.h"
+#include "str.h"
+#include "poolalloc.h"
+#include "objalloc.h"
+#include "timings.h"
+#include "vec.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* initial size of memory pools created */
+#define MEMPOOL_SIZE 1000000
+
+struct postings* postings_new(unsigned int tablesize, 
+  void (*stem)(void *opaque, char *term), void *opaque, struct stop *list) {
+    struct postings *p = malloc(sizeof(*p));
+    unsigned int bits = bit_log2(tablesize);
+
+    tablesize = bit_pow2(bits);  /* tablesize is now guaranteed to be a power 
+                                  * of two */
+
+    if (p && (p->hash = malloc(sizeof(struct postings_node *) * tablesize))
+      && (p->string_mem = poolalloc_new(!!DEAR_DEBUG, MEMPOOL_SIZE, NULL))
+      && (p->node_mem = objalloc_new(sizeof(struct postings_node), 0, 
+          !!DEAR_DEBUG, MEMPOOL_SIZE, NULL))) {
+        p->stop = list;
+        p->stem = stem; 
+        p->stem_opaque = opaque;
+        p->tblbits = bits;
+        p->tblsize = tablesize;
+        assert(p->tblbits && p->tblsize);
+        p->size = p->dterms = p->terms = 0;
+        p->err = 0;
+        p->docno = 0;
+        p->docs = 0;
+        p->update = NULL;
+        p->update_required = 0;
+        BIT_ARRAY_NULL(p->hash, tablesize);
+    } else if (p) {
+        if (p->hash) {
+            free(p->hash);
+            if (p->string_mem) {
+                poolalloc_delete(p->string_mem);
+                if (p->node_mem) {
+                    objalloc_delete(p->node_mem); 
+                }
+            }
+        }
+        p = NULL;
+    }
+
+    return p;
+}
+
+void postings_delete(struct postings *post) {
+    unsigned int i;
+    struct postings_node* node;
+
+    /* iterate over hashtable, freeing vectors */
+    for (i = 0; i < post->tblsize; i++) {
+        node = post->hash[i];
+        while (node) {
+            free(node->vecmem);
+            node = node->next;
+        }
+
+        post->hash[i] = NULL;
+    }
+
+    poolalloc_delete(post->string_mem);
+    objalloc_delete(post->node_mem);
+    free(post->hash);
+    free(post);
+}
+
+void postings_abort(struct postings* post) {
+    poolalloc_delete(post->string_mem);
+    objalloc_delete(post->node_mem);
+    free(post->hash);
+    free(post);
+    return;
+}
+
+int postings_needs_update(struct postings *post) {
+    return post->update_required;
+}
+
+/* internal function to double the size of the vector allocated to a node */
+static int postings_node_expand(struct postings_node *node) {
+    unsigned int len = node->vec.pos - node->vecmem;
+    unsigned int size = node->vec.end - node->vecmem;
+    unsigned int count = node->last_count - node->vecmem;
+    char *ptr;
+
+    assert(node->last_count >= node->vecmem);
+
+    if ((ptr = realloc(node->vecmem, size * 2))) {
+        node->vecmem = ptr;
+        node->vec.pos = ptr + len;
+        node->vec.end = ptr + size * 2;
+        node->last_count = node->vecmem + count;
+        assert(node->last_count >= node->vecmem);
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int postings_update(struct postings* post, struct postings_docstats* stats) {
+    struct postings_node* node = post->update;
+    unsigned int terms = 0,
+                 dterms = 0;
+    float weight = 0,
+           fdt_log;
+
+    while (node) {
+        /* calculate document weight */
+        fdt_log = (float) logf((float) node->offsets);
+        weight += (1 + fdt_log) * (1 + fdt_log);
+
+        assert(node->offsets);
+        assert(node->last_count != node->vecmem);
+        assert(node->last_count > node->vecmem);
+        assert((post->docno > node->last_docno) || (node->last_docno == -1));
+
+        /* check if we have to correct the count that we wrote before (1) */
+        if (node->offsets > 1) {
+            unsigned int len = vec_vbyte_len(node->offsets);
+            struct vec offsetvec;
+            /* check if the count will expand in size */
+            if (len > 1) {
+                /* check if we need to resize the vector */
+                if ((VEC_LEN(&node->vec) < len - 1) 
+                  /* resize it */
+                  && !postings_node_expand(node)) {
+                    return 0;
+                }
+
+                /* move offsets up to make room for expanded count */
+                assert(node->vec.pos > node->last_count);
+                assert(node->vecmem < node->last_count);
+                memmove(node->last_count + len, node->last_count + 1, 
+                  node->vec.pos - (node->last_count + 1));
+                node->vec.pos += len - 1;
+                post->size += len - 1;
+            }
+
+            /* point offsetvec to the correct location to write the correct
+             * count */
+            offsetvec.pos = node->last_count;
+            offsetvec.end = node->vec.end;
+
+            len = vec_vbyte_write(&offsetvec, node->offsets);
+            assert(len);
+        }
+
+        /* watch for overflow */
+        assert(node->occurs + node->offsets > node->occurs);  
+        node->occurs += node->offsets;
+        terms += node->offsets;
+        dterms++;
+        node->offsets = 0;
+
+        node->last_docno = post->docno;
+        node->last_offset = -1;
+        node->last_count = node->vecmem;
+        node->docs++;
+
+        node = node->update;
+    }
+
+    post->update = NULL;                /* reset update list */
+    post->update_required = 0;
+    stats->weight = (float) sqrtf(weight);
+    stats->terms = terms;
+    stats->distinct = dterms;
+    return 1;
+}
+
+void postings_adddoc(struct postings* post, unsigned long int docno) {
+    /* do compile time check of correct call sequence for efficiency */
+    assert(post->update == NULL);
+    assert((post->docno < docno) || ((post->docno == 0) && (docno == 0)));
+    post->docno = docno;
+    post->docs++;
+    /* this ensures that updates happen even for empty documents! */
+    post->update_required = 1;
+}
+
+int postings_addword(struct postings *post, char *term, 
+  unsigned long int wordno) {
+    unsigned int hash,
+                 len,
+                 bytes;
+    struct postings_node** prev,
+                        * node;
+
+    if (post->stem) {
+        post->stem(post->stem_opaque, term);
+        /* do nothing for 0 length terms (occur sometimes because stemming 
+         * removes entire word :o( ) */
+        if (!term[0]) {
+            return 1;
+        }
+    }
+
+    assert(!iscntrl(term[0]));
+    hash = str_hash(term) & bit_lmask(post->tblbits);
+    prev = &post->hash[hash]; 
+    node = *prev;
+
+    while (node) {
+        if (!str_cmp(term, node->term)) {
+            /* found previous entry, perform move to front on hash chain */
+            *prev = node->next;
+            node->next = post->hash[hash];
+            post->hash[hash] = node;
+            break;
+        }
+        prev = &node->next;
+        node = *prev;
+    }
+
+    if (!node) {
+        /* couldn't find a previous entry, need to add a new one */
+        len = str_len(term);
+        assert(len);
+        if ((node = objalloc_malloc(post->node_mem, sizeof(*node)))
+          && (node->term = poolalloc_memalign(post->string_mem, len + 1, 1))
+          && (node->vec.pos = node->vecmem = malloc(INITVECLEN))) {
+
+            node->vec.end = node->vec.pos + INITVECLEN;
+
+            str_cpy(node->term, term);
+
+            node->last_docno = -1;
+            node->last_offset = -1;
+            node->last_count = node->vecmem;
+            node->next = post->hash[hash];
+            node->docs = node->offsets = node->occurs = 0;
+            /* insert into table */
+            post->hash[hash] = node;
+            post->dterms++;
+            post->size += len + 1;
+        } else if (node->vecmem) {
+            free(node->vecmem);
+            post->err = ENOMEM;
+            return 0;
+        /* don't need to check others because they come from mem pools */
+        } else {
+            post->err = ENOMEM;
+            return 0;
+        }
+    }
+
+    assert(node);
+
+    /* mark document as changed */
+    if (!node->offsets) {
+        node->update = post->update;
+        post->update = node;
+
+        /* write d-gap */
+        while (!(bytes 
+          = vec_vbyte_write(&node->vec, 
+            post->docno - (node->last_docno + 1)))) {
+
+            /* need to expand the node */
+            if (!postings_node_expand(node)) {
+                return 0;
+            }
+        }
+        post->size += bytes + 1;
+
+        /* save current position in case we need to overwrite it later, and
+         * write in a count of 1 */
+        node->last_count = node->vec.pos;
+        assert(node->last_count > node->vecmem);
+        while (!(bytes = vec_vbyte_write(&node->vec, 1))) {
+            /* need to expand the node */
+            if (!postings_node_expand(node)) {
+                return 0;
+            }
+        }
+    }
+
+    /* encode new offset */
+    assert((wordno > node->last_offset) || (node->last_offset == -1));
+    while (!(bytes 
+      = vec_vbyte_write(&node->vec, wordno - (node->last_offset + 1)))) {
+         /* need to expand the node */
+         if (!postings_node_expand(node)) {
+             return 0;
+         }
+    }
+    post->size += bytes;
+    node->last_offset = wordno;
+    node->offsets++;
+    post->terms++;
+    return 1;
+}
+
+int post_cmp(const void *vone, const void *vtwo) {
+    const struct postings_node * const *one = vone,
+                               * const *two = vtwo;
+
+    return str_cmp((*one)->term, (*two)->term);
+}
+
+int postings_remove_offsets(struct postings *post) {
+    unsigned int i,
+                 dgap_bytes,
+                 f_dt_bytes,
+                 bytes,
+                 scanned,
+                 scanned_bytes;
+    struct postings_node *node;
+    struct vec src,
+               dst;
+    unsigned long int dgap,
+                      f_dt;
+
+    /* FIXME: note, this should assert !post->update_required, but due to the
+     * way that TREC documents are parsed (basically under the assumption that
+     * another one is always coming) we end up with an empty document at the 
+     * end */
+    assert(!post->update);
+
+    for (i = 0; i < post->tblsize; i++) {
+        node = post->hash[i];
+        while (node) {
+            src.pos = dst.pos = node->vecmem;
+            src.end = dst.end = node->vec.pos;
+
+            /* remove offsets by decoding and re-encoding the vector.  Note 
+             * that we can read and write from the same vector because the
+             * writing always lags the reading. */
+            while ((dgap_bytes = vec_vbyte_read(&src, &dgap))
+              && (f_dt_bytes = vec_vbyte_read(&src, &f_dt))
+              && ((scanned = vec_vbyte_scan(&src, f_dt, &scanned_bytes)) 
+                == f_dt)) {
+
+                bytes = vec_vbyte_write(&dst, dgap);
+                assert(bytes);
+                bytes = vec_vbyte_write(&dst, f_dt);
+                assert(bytes);
+            }
+
+            assert(dgap_bytes == 0 && VEC_LEN(&src) == 0);
+            node->vec.pos = src.pos;
+            node = node->next;
+        }
+    }
+
+    /* note that after this operation the postings are so completely broken 
+     * that they're only good for dumping or clearing, although this is not
+     * currently enforced. */
+
+    return 1;
+}
+
+int postings_dump(struct postings* post, void *buf, unsigned int bufsize, 
+  int fd) {
+    unsigned int i,
+                 j,
+                 stopped = 0,
+                 pos,                     /* position in current vector */
+                 len,                     /* length of current term */
+                 wlen,                    /* length of last write */
+                 dbufsz;                  /* size of dbuf */
+    struct postings_node* node,           /* current node */
+                        ** arr;           /* array of postings nodes */
+    char *dbuf,                           /* dumping buffer */
+         *dbufpos;                        /* position in dumping buffer */
+    struct vec v;
+
+    /* FIXME: note, this should assert !post->update_required, but due to the
+     * way that TREC documents are parsed (basically under the assumption that
+     * another one is always coming) we end up with an empty document at the 
+     * end */
+    assert(!post->update);
+
+    /* XXX: hack, allocate a big array of postings and then sort them by term.
+     * This is so that postings go out sorted by term instead of hash value. */
+    if (!(arr = malloc(sizeof(*arr) * post->dterms))) {
+        return 0;
+    }
+
+    /* the provided buffer is used to dump the postings */
+    dbuf = buf;
+    dbufsz = bufsize;
+
+    /* copy nodes into array */
+    j = 0;
+    for (i = 0; i < post->tblsize; i++) {
+        node = post->hash[i];
+        while (node) {
+            /* perform stopping.  Ideally we'd like to stop terms before
+             * stemming them, and before they make their way into the postings.
+             * However, this means that we have to call the stoplist
+             * once-per-term, which makes it a big bottleneck.  We stop here to
+             * minimise the performance impact on the most common case, no
+             * stopping.  Note that if we really wanted to make stopping 
+             * (when actually used) go faster, it would be better to have a
+             * sorted stoplist as well, and merge against that rather than 
+             * doing one hash lookup per term. */
+            if (!post->stop || stop_stop(post->stop, node->term) == STOP_OK) {
+                arr[j++] = node;
+            } else {
+                assert(++stopped);  /* count stopped terms while debugging */
+            }
+            node = node->next;
+        }
+
+        /* reset hash node (memory free'd below) */
+        post->hash[i] = NULL;
+    }
+
+    assert(j + stopped == post->dterms);
+    stopped = 0;
+
+    qsort(arr, post->dterms, sizeof(*arr), post_cmp);
+
+    v.pos = dbuf;
+    v.end = dbuf + dbufsz;
+    for (i = 0; i < j;) {
+        while ((i < post->dterms) 
+          && ((len = str_len(arr[i]->term)), 1)
+          && (((unsigned int) VEC_LEN(&v)) >= vec_vbyte_len(len) + len 
+            + vec_vbyte_len(arr[i]->docs) + vec_vbyte_len(arr[i]->occurs) 
+            + vec_vbyte_len(arr[i]->last_docno) 
+            + vec_vbyte_len(arr[i]->vec.pos - arr[i]->vecmem))) {
+
+            unsigned int bytes;
+
+            assert(len);
+            assert(dbufsz > vec_vbyte_len(len) + len 
+              + vec_vbyte_len(arr[i]->docs) + vec_vbyte_len(arr[i]->occurs) 
+              + vec_vbyte_len(arr[i]->last_docno)
+              + vec_vbyte_len(arr[i]->vec.pos - arr[i]->vecmem));
+
+            /* have enough space, copy stuff into buffer */
+            bytes = vec_vbyte_write(&v, len);
+            assert(bytes);
+            bytes = vec_byte_write(&v, arr[i]->term, len);
+            assert(bytes == len);
+            bytes = vec_vbyte_write(&v, arr[i]->docs);
+            assert(bytes);
+            bytes = vec_vbyte_write(&v, arr[i]->occurs);
+            assert(bytes);
+            bytes = vec_vbyte_write(&v, arr[i]->last_docno);
+            assert(bytes);
+            bytes = vec_vbyte_write(&v, arr[i]->vec.pos - arr[i]->vecmem);
+            assert(bytes);
+
+            /* copy the inverted list in */
+            pos = 0;
+            while (((unsigned int) VEC_LEN(&v)) 
+              < (arr[i]->vec.pos - arr[i]->vecmem) - pos) {
+
+                /* copy last bit we can in */
+                pos += vec_byte_write(&v, arr[i]->vecmem + pos, VEC_LEN(&v));
+
+                /* write the buffer out */
+                len = v.pos - dbuf;
+                dbufpos = dbuf;
+
+                while (len && ((wlen = write(fd, dbufpos, len)) >= 0)) {
+                    len -= wlen;
+                    dbufpos += wlen;
+                }
+
+                if (len) {
+                    free(arr);
+                    return 0;
+                }
+
+                v.pos = dbuf;
+                v.end = dbuf + dbufsz;
+            }
+
+            /* copy last bit of inverted list in */
+            pos += vec_byte_write(&v, arr[i]->vecmem + pos, 
+              (arr[i]->vec.pos - arr[i]->vecmem) - pos);
+            assert(arr[i]->vecmem + pos == arr[i]->vec.pos);
+
+            free(arr[i]->vecmem);
+
+            i++;
+        }
+
+        /* write the buffer out */
+        len = v.pos - dbuf;
+        dbufpos = dbuf;
+
+        while (len && ((wlen = write(fd, dbufpos, len)) >= 0)) {
+            len -= wlen;
+            dbufpos += wlen;
+        }
+
+        if (len) {
+            free(arr);
+            return 0;
+        }
+
+        v.pos = dbuf;
+        v.end = dbuf + dbufsz;
+    }
+
+    /* reinitialise hash table */
+    post->size = 0;
+    post->dterms = 0;
+    post->terms = 0;
+    post->docs = 0;
+    poolalloc_clear(post->string_mem);
+    objalloc_clear(post->node_mem);
+    free(arr);
+
+    return 1;
+}
+
+void postings_clear(struct postings* post) {
+    unsigned int i;
+    struct postings_node* node;
+
+    /* free memory from postings */
+    for (i = 0; i < post->tblsize; i++) {
+        if ((node = post->hash[i])) {
+            /* write it out */
+            do {
+                /* free memory (don't use vec_free thanks to our initialisation
+                 * hack */
+                free(node->vecmem);
+            } while ((node = node->next));
+
+            /* reset hash node (memory free'd below) */
+            post->hash[i] = NULL;
+        }
+    }
+
+    /* reinitialise hash table */
+    post->size = 0;
+    post->dterms = 0;
+    post->terms = 0;
+    post->docs = 0;
+    poolalloc_clear(post->string_mem);
+    objalloc_clear(post->node_mem);
+    
+    return;
+}
+
+unsigned int postings_size(struct postings* post) {
+    return post->size;
+}
+
+unsigned int postings_memsize(struct postings* post) {
+    return sizeof(struct postings_node) * post->dterms 
+      + (sizeof(*post->hash) * post->tblsize) 
+      + sizeof(struct postings) + post->size;
+}
+
+int postings_err(struct postings* post) {
+    return post->err;
+}
+
+unsigned int postings_total_terms(struct postings *post) {
+    return post->terms;
+}
+
+unsigned int postings_distinct_terms(struct postings *post) {
+    return post->dterms;
+}
+
+unsigned int postings_documents(struct postings *post) {
+    return post->docs;
+}
+
+struct vec *postings_vector(struct postings *post, char *term) {
+    unsigned int hash;
+    struct postings_node *node;
+
+    if (!post->stop || (stop_stop(post->stop, term) == STOP_OK)) {
+        hash = str_hash(term) & bit_lmask(post->tblbits);
+        node = post->hash[hash];
+        while (node) {
+            if (!str_cmp(term, node->term)) {
+                return &node->vec;
+            }
+        }
+    }
+
+    return NULL;
+}
+
diff --git a/src/psettings.c b/src/psettings.c
new file mode 100644 (file)
index 0000000..1f650bd
--- /dev/null
@@ -0,0 +1,762 @@
+/* psettings.c implements an object that encapsulates parser settings,
+ * including a convenience method that reads settings from an XML
+ * file.
+ *
+ * written nml 2004-08-09
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "psettings.h"
+
+#include "chash.h"
+#include "error.h"
+#include "str.h"
+#include "mlparse_wrap.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+enum type_flags {
+    TYPE_FLAG_DEFSET = (1 << 0),     /* default was set (not inherited) */
+    TYPE_FLAG_SELF_ID = (1 << 1)     /* documents identify themselves */
+};
+
+/* structure to represent the parser settings for one mime type */
+struct psettings_type {
+    struct chash *tags;              /* hashtable of tags to attrs */
+    enum psettings_attr def;         /* default attr */
+    enum type_flags flags;           /* flags for this type */
+};
+
+/* structure to represent all parser settings */
+struct psettings {
+    struct chash *strings;           /* hashtable of tag strings */
+    struct psettings_type *type;     /* per-type array */
+    unsigned int types;              /* size of type array */
+    enum psettings_attr def;         /* default settings for unrecognised 
+                                      * tags */
+};
+
+struct psettings *psettings_new(enum psettings_attr def) {
+    struct psettings *pset = malloc(sizeof(*pset));
+
+    if (pset 
+      && (pset->strings = chash_ptr_new(5, 0.5, 
+          (unsigned int (*)(const void *)) str_hash,
+          (int (*)(const void *, const void *)) str_cmp))) {
+
+        pset->type = NULL;
+        pset->types = 0;
+        pset->def = def;
+    } else if (pset) {
+        if (pset->strings) {
+            chash_delete(pset->strings);
+        }
+        free(pset);
+        pset = NULL;
+    }
+
+    return pset;
+}
+
+static void freestr(void *userdata, const void *key, void **data) {
+    free(*data);
+}
+
+void psettings_delete(struct psettings *pset) {
+    unsigned int i;
+
+    for (i = 0; i < pset->types; i++) {
+        chash_delete(pset->type[i].tags);
+    }
+    if (pset->type) {
+        free(pset->type);
+    }
+    chash_ptr_ptr_foreach(pset->strings, NULL, freestr);
+    chash_delete(pset->strings);
+    free(pset);
+}
+
+static enum psettings_ret psettings_expand(struct psettings *pset, 
+  enum mime_types type) {
+    void *ptr;
+    unsigned int i;
+
+    if ((ptr = realloc(pset->type, 
+        sizeof(*pset->type) * (pset->types * 2 + 1)))) {
+
+        i = pset->types;
+        pset->type = ptr;
+        pset->types = pset->types * 2 + 1;
+
+        for (; i < pset->types; i++) {
+            if ((pset->type[i].tags = chash_ptr_new(1, 2.0, 
+                (unsigned int (*)(const void *)) str_hash,
+                (int (*)(const void *, const void *)) str_cmp))) {
+
+                pset->type[i].def = pset->def;
+                pset->type[i].flags = 0;
+            } else {
+                /* couldn't initialise hashtable */
+                pset->types = i;
+                if (type < 0 || (unsigned int) type >= pset->types) {
+                    return PSETTINGS_ENOMEM;
+                }
+                break;
+            }
+        }
+    } else {
+        return PSETTINGS_ENOMEM;
+    }
+
+    return PSETTINGS_OK;
+}
+
+enum psettings_ret psettings_set(struct psettings *pset, enum mime_types type,
+  const char *tag, enum psettings_attr attr) {
+    void **ptr_find;
+    unsigned long int *settings;
+    char *localtag;
+    enum psettings_ret ret;
+
+    assert(type >= 0);
+    while ((unsigned int) type >= pset->types) {
+        if ((ret = psettings_expand(pset, type)) != PSETTINGS_OK) {
+            return ret;
+        }
+    }
+    assert((unsigned int) type < pset->types);
+
+    if (chash_ptr_luint_find(pset->type[type].tags, tag, &settings) 
+      == CHASH_OK) {
+        /* found an existing entry, modify it */
+        *settings = attr;
+    } else {
+        /* need to insert new entry */
+        
+        /* find or insert it into the strings table */
+        if (chash_ptr_ptr_find(pset->strings, tag, &ptr_find) == CHASH_OK) {
+            localtag = *ptr_find;
+        } else {
+            if ((localtag = str_dup(tag)) 
+              && (chash_ptr_ptr_insert(pset->strings, localtag, localtag) 
+                  == CHASH_OK)) {
+                /* succeeded, do nothing */
+            } else {
+                if (localtag) {
+                    free(localtag);
+                }
+                return PSETTINGS_ENOMEM;
+            }
+        }
+
+        if (chash_ptr_luint_insert(pset->type[type].tags, localtag, attr) 
+          == CHASH_OK) {
+
+            /* succeeded, finish up below */
+        } else {
+            return PSETTINGS_ENOMEM;
+        }
+    }
+
+    /* keep track of whether documents contain an internal identification */
+    if (attr & PSETTINGS_ATTR_ID) {
+        pset->type[type].flags |= TYPE_FLAG_SELF_ID;
+    }
+
+    return PSETTINGS_OK;
+}
+
+enum psettings_ret psettings_type_default(struct psettings *pset, 
+  enum mime_types type, enum psettings_attr def) {
+    enum psettings_ret ret;
+
+    assert(type >= 0);
+    while ((unsigned int) type >= pset->types) {
+        if ((ret = psettings_expand(pset, type)) != PSETTINGS_OK) {
+            return ret;
+        }
+    }
+    assert((unsigned int) type < pset->types);
+
+    pset->type[type].def = def;
+    pset->type[type].flags |= TYPE_FLAG_DEFSET;
+    return PSETTINGS_OK;
+}
+
+enum psettings_attr psettings_find(struct psettings *pset, 
+  enum mime_types type, const char *tag) {
+    if (type >= 0 && ((unsigned int) type) < pset->types) {
+        return psettings_type_find(pset, &pset->type[type], tag);
+    } else {
+        return pset->def;
+    }
+}
+
+enum psettings_attr psettings_type_find(struct psettings *pset, 
+  struct psettings_type *type, const char *tag) {
+    unsigned long int *settings;
+
+    assert(type);
+
+    if (chash_ptr_luint_find(type->tags, tag, &settings) == CHASH_OK) {
+        return *settings;
+    } else {
+        return pset->def;
+    }
+}
+
+/* get the set of tags for a given mime type */
+enum psettings_ret psettings_type_tags(struct psettings *pset, 
+  enum mime_types type, struct psettings_type **ptype) {
+    if (type >= 0 && ((unsigned int) type) < pset->types) {
+        *ptype = &pset->type[type];
+        return PSETTINGS_OK;
+    } else {
+        *ptype = NULL;
+        return PSETTINGS_EEXIST;
+    }
+}
+
+int psettings_self_id(struct psettings *pset, enum mime_types type) {
+    if (type >= 0 && ((unsigned int) type) < pset->types) {
+        return pset->type[type].flags & TYPE_FLAG_SELF_ID;
+    } else {
+        return 0;
+    }
+}
+
+#define WORDLEN 100
+
+static int parse(struct mlparse_wrap *parser, char *buf, unsigned int *len, 
+  int strip) {
+    enum mlparse_ret ret;
+
+    do {
+        ret = mlparse_wrap_parse(parser, buf, len, strip);
+
+        /* filter out comments and whitespace and cdata sections */
+        switch (ret) {
+        case MLPARSE_COMMENT:
+            /* skip to end of comment */
+            do {
+                ret = parse(parser, buf, len, strip);
+
+                switch (ret) {
+                case MLPARSE_WORD:
+                case MLPARSE_END | MLPARSE_WORD:
+                case MLPARSE_CONT | MLPARSE_WORD:
+                    break;
+
+                case MLPARSE_END | MLPARSE_COMMENT:
+                    break;
+
+                case MLPARSE_EOF:
+                    return MLPARSE_EOF;
+
+                default: 
+                    assert(0);
+                    return MLPARSE_ERR;
+                };
+
+            } while ((ret != (MLPARSE_END | MLPARSE_COMMENT)));
+            break;
+
+        case MLPARSE_WHITESPACE:
+            break;
+
+        case MLPARSE_CDATA:
+        case MLPARSE_END | MLPARSE_CDATA:
+            break;
+
+        default: 
+            return ret;
+        };
+    } while (1);
+}
+
+static int psettings_read_tag(struct psettings *pset, 
+  struct mlparse_wrap *parser, enum mime_types type, char *buf, char *tagbuf) {
+    enum mlparse_ret ret;
+    unsigned int len;
+    enum psettings_attr attr = PSETTINGS_ATTR_INDEX,
+                        ex_attr;            /* existing attribute */
+    struct psettings_type *ptype;
+
+    /* 'tag' tag can contain name and index attributes only */
+
+    /* read name and index tags */
+    tagbuf[0] = '\0';
+    while ((ret = parse(parser, buf, &len, 1)) == MLPARSE_PARAM) {
+        buf[len] = '\0';
+        if (!str_casecmp(buf, "name")) {
+            assert(tagbuf[0] == '\0');
+            if ((ret = parse(parser, tagbuf, &len, 0)) == MLPARSE_PARAMVAL) {
+                /* got the tag name in tagbuf */
+                tagbuf[len] = '\0';
+                str_tolower(tagbuf);
+            } else {
+                ERROR("expecting parameter value after name attribute");
+                return 0;
+            }
+        } else if (!str_casecmp(buf, "index")) {
+            if ((ret = parse(parser, buf, &len, 1)) == MLPARSE_PARAMVAL) {
+                buf[len] = '\0';
+                if (!str_casecmp(buf, "true")) {
+                    attr |= PSETTINGS_ATTR_INDEX;
+                } else if (!str_casecmp(buf, "false")) {
+                    attr &= ~PSETTINGS_ATTR_INDEX;
+                } else if (!str_casecmp(buf, "binary")) {
+                    attr &= ~PSETTINGS_ATTR_INDEX;
+                    attr |= PSETTINGS_ATTR_CHECKBIN;
+                } else if (!str_casecmp(buf, "pop")) {
+                    attr &= ~PSETTINGS_ATTR_INDEX;
+                    attr |= PSETTINGS_ATTR_POP;
+                } else if (!str_casecmp(buf, "noop")) {
+                    attr &= ~PSETTINGS_ATTR_INDEX;
+                    attr |= PSETTINGS_ATTR_NOOP;
+                } else if (!str_casecmp(buf, "identifier")) {
+                    attr &= ~PSETTINGS_ATTR_INDEX;
+                    attr |= PSETTINGS_ATTR_ID;
+                } else if (!str_casecmp(buf, "offend")) {
+                    attr &= ~PSETTINGS_ATTR_INDEX;
+                    attr |= PSETTINGS_ATTR_OFF_END;
+                } else if (!str_casecmp(buf, "title")) {
+                    attr &= ~PSETTINGS_ATTR_INDEX;
+                    attr |= PSETTINGS_ATTR_TITLE;
+                } else {
+                    ERROR("expected true, false, binary or identifier as "
+                      "value for index attribute");
+                    return 0;
+                }
+            } else {
+                ERROR("expecting parameter value after index attribute");
+                return 0;
+            }
+        } else if (!str_casecmp(buf, "flow")) {
+            if ((ret = parse(parser, buf, &len, 1)) == MLPARSE_PARAMVAL) {
+                buf[len] = '\0';
+                if (!str_casecmp(buf, "true")) {
+                    attr |= PSETTINGS_ATTR_FLOW;
+                } else if (!str_casecmp(buf, "false")) {
+                    /* do nothing */
+                } else {
+                    ERROR("expected true or false as value for flow "
+                      "attribute");
+                    return 0;
+                }
+            } else {
+                ERROR("expecting parameter value after flow attribute");
+                return 0;
+            }
+        } else {
+            ERROR("expected name, index or flow attribute");
+            return 0;
+        }
+    }
+
+    /* sanity checks */
+    if (!tagbuf[0] || ret != MLPARSE_TAG 
+      || ((buf[len] = '\0'), str_cmp(buf, "/tag"))) {
+        if (!tagbuf[0]) {
+            ERROR("name attribute required");
+        } else {
+            ERROR("expected '/tag' tag");
+        }
+        return 0;
+    }
+
+    /* insert settings for this tag into the table, making sure we don't
+     * overwrite endtag for this tag if it is set */
+    if (psettings_type_tags(pset, type, &ptype) == PSETTINGS_OK) {
+        ex_attr = psettings_type_find(pset, ptype, tagbuf);
+        attr |= ex_attr & PSETTINGS_ATTR_DOCEND;
+        if (psettings_set(pset, type, tagbuf, attr) == PSETTINGS_OK) {
+            /* tag settings created */
+            return 1;
+        } else {
+            ERROR1("couldn't insert tag %s", tagbuf);
+            return 0;
+        }
+    } else {
+        assert("can't get here" && 0);
+        return 0;
+    }
+}
+
+static int psettings_read_type(struct psettings *pset, 
+  struct mlparse_wrap *parser, char *buf, char *tagbuf) {
+    char *endtag = NULL;
+    enum mime_types type = MIME_TYPE_UNKNOWN_UNKNOWN;
+    enum psettings_attr def = PSETTINGS_ATTR_INDEX;
+    enum mlparse_ret ret;
+    unsigned int len;
+
+    /* 'type' tag contains mimetype (required), endtag (optional) and default
+     * (optional) attributes, followed by a list of 'tag' tags */
+    while ((ret = parse(parser, buf, &len, 1)) == MLPARSE_PARAM) {
+        buf[len] = '\0';
+        if (!str_cmp(buf, "mimetype")) {
+            if ((ret = parse(parser, buf, &len, 0)) == MLPARSE_PARAMVAL) {
+                /* save name */
+                buf[len] = '\0';
+                str_tolower(buf);
+                type = mime_type(buf);
+            } else {
+                ERROR("expected parameter value for mimetype attribute");
+                if (endtag) free(endtag);
+                return 0;
+            }
+        } else if (!str_cmp(buf, "endtag")) {
+            if ((ret = parse(parser, buf, &len, 0)) == MLPARSE_PARAMVAL) {
+                /* save name */
+                buf[len] = '\0';
+                str_tolower(buf);
+                if (!(endtag = str_dup(buf))) {
+                    ERROR1("no memory to copy '%s' endtag", buf);
+                    if (endtag) free(endtag);
+                    return 0;
+                }
+            } else {
+                ERROR("expected parameter value for mimetype attribute");
+                if (endtag) free(endtag);
+                return 0;
+            }
+        } else if (!str_cmp(buf, "default")) {
+            if ((ret = parse(parser, buf, &len, 1)) == MLPARSE_PARAMVAL) {
+                buf[len] = '\0';
+                str_tolower(buf);
+                if (!str_cmp(buf, "true")) {
+                    def = PSETTINGS_ATTR_INDEX;
+                } else if (!str_cmp(buf, "false")) {
+                    def = 0;
+                } else {
+                    ERROR1("expected true or false value for default, got '%s'",
+                      buf);
+                    if (endtag) free(endtag);
+                    return 0;
+                }
+            } else {
+                ERROR("expected parameter value for mimetype attribute");
+                if (endtag) free(endtag);
+                return 0;
+            }
+        } else {
+            ERROR1("unrecognised attribute '%s' in 'type' tag", buf);
+            if (endtag) free(endtag);
+            return 0;
+        }
+    }
+
+    if (type == MIME_TYPE_UNKNOWN_UNKNOWN) {
+        ERROR("didn't receive mimetype for 'type' tag");
+        if (endtag) free(endtag);
+        return 0;
+    }
+
+    /* insert type and default into psettings */
+    if (psettings_type_default(pset, type, def) == PSETTINGS_OK) {
+        /* insert endtag tag if received */
+        if (endtag) {
+            /* note that enddoc tag gets DOCEND attribute only */
+            def = PSETTINGS_ATTR_DOCEND;
+            if (psettings_set(pset, type, endtag, def) != PSETTINGS_OK) {
+                ERROR("couldn't set endtag");
+                free(endtag);
+                return 0;
+            }
+            free(endtag);
+        }
+    } else {
+        ERROR("couldn't insert new mime type");
+        if (endtag) free(endtag);
+        return 0;
+    }
+
+    /* process list of 'tag' tags */
+    while ((ret == MLPARSE_TAG)
+      && !str_nncmp(buf, len, "tag", str_len("tag"))) {
+        if (!psettings_read_tag(pset, parser, type, buf, tagbuf)) {
+            return 0;
+        }
+        ret = parse(parser, buf, &len, 1);
+    }
+
+    if (ret == MLPARSE_TAG && !str_nncmp(buf, len, "/type", str_len("/type"))) {
+        /* succeeded */
+        return 1;
+    } else {
+        ERROR("unexpected ending of 'type' tag");
+        return 0;
+    }
+}
+
+struct psettings *psettings_read(FILE *fp, enum psettings_attr def) {
+    struct psettings *pset;
+    struct mlparse_wrap *parser;
+    char buf[WORDLEN + 1];
+    char tagbuf[WORDLEN + 1];
+    unsigned int len;
+    enum mlparse_ret ret;
+
+    if ((pset = psettings_new(def)) 
+      && (parser = mlparse_wrap_new_file(WORDLEN, 1024, fp, 1024, 0))) {
+
+        /* read initial junk (xml declaration) */
+        do {
+            ret = parse(parser, buf, &len, 1);
+
+            switch (ret) {
+            case MLPARSE_TAG:
+                if (!str_cmp(buf, "?xml")) {
+                    break;
+                }
+                /* otherwise fallthrough to error handling */
+
+                /* only allow tags, comments whitespace at the start */
+            default:
+                mlparse_wrap_delete(parser);
+                psettings_delete(pset);
+                return NULL;
+            }
+        } while (!((ret == MLPARSE_TAG) && !str_cmp(buf, "?xml")));
+
+        /* read initial junk (rest of xml declaration, psettings tag) */
+        do {
+            ret = parse(parser, buf, &len, 1);
+
+            switch (ret) {
+            case MLPARSE_PARAM:
+            case MLPARSE_PARAMVAL:
+                break;
+
+            case MLPARSE_TAG:
+                if (!str_cmp(buf, "psettings")) {
+                    break;
+                }
+                /* otherwise fallthrough to error handling */
+
+                /* only allow tags, whitespace at the start */
+            default:
+                mlparse_wrap_delete(parser);
+                psettings_delete(pset);
+                return NULL;
+            }
+        } while (!((ret == MLPARSE_TAG) && !str_cmp(buf, "psettings")));
+
+        /* read types */
+        do {
+            ret = parse(parser, buf, &len, 1);
+
+            switch (ret) {
+            case MLPARSE_TAG:
+                buf[len] = '\0';
+                if (!str_cmp(buf, "type")) {
+                    if (!psettings_read_type(pset, parser, buf, tagbuf)) {
+                        mlparse_wrap_delete(parser);
+                        psettings_delete(pset);
+                        return NULL;
+                    }
+                    break;
+                } else if (!str_cmp(buf, "/psettings")) {
+                    break;
+                }
+                /* otherwise fallthrough to error handling */
+
+                /* only allow tags, whitespace at the start */
+            default:
+                mlparse_wrap_delete(parser);
+                psettings_delete(pset);
+                return NULL;
+            }
+        } while (!((ret == MLPARSE_TAG) && !str_cmp(buf, "/psettings")));
+
+        /* have read closing junk, now finish file */
+        do {
+            ret = parse(parser, buf, &len, 1);
+
+            switch (ret) {
+            case MLPARSE_EOF:
+                break;
+
+            default:
+                mlparse_wrap_delete(parser);
+                psettings_delete(pset);
+                return NULL;
+            }
+        } while (ret != MLPARSE_EOF);
+
+        mlparse_wrap_delete(parser);
+        return pset;
+    } else {
+        if (pset) {
+            psettings_delete(pset);
+        }
+        return NULL;
+    }
+}
+
+struct tmptag {
+    char *name;
+    unsigned int settings;
+};
+
+int tmptag_cmp(const void *vone, const void *vtwo) {
+    const struct tmptag *one = vone,
+                        *two = vtwo;
+
+    return str_cmp(one->name, two->name);
+}
+
+enum psettings_attr psettings_default(struct psettings *pset) {
+    return pset->def;
+}
+
+enum psettings_ret psettings_write_code(struct psettings *pset, FILE *output) {
+    unsigned int i;
+    struct chash_iter *iter;
+
+    fprintf(output, "/* code generated by psettings_write_code() to produce a "
+      "psettings object with \n * default settings */\n\n");
+
+    fprintf(output, "#include \"firstinclude.h\"\n");
+    fprintf(output, "#include <assert.h>\n");
+    fprintf(output, "#include <stdlib.h>\n\n");
+    fprintf(output, "#include \"psettings.h\"\n\n");
+
+    fprintf(output, "struct psettings *psettings_new_default(enum "
+      "psettings_attr def) {\n");
+    fprintf(output, "    struct psettings *pset = psettings_new(def);\n");
+    fprintf(output, "    enum psettings_ret ret;\n\n");
+    fprintf(output, "    if (pset) {\n");
+
+    /* load index names in object, by iterating over names hashtable.  Types
+     * will have the same numbers as they currently do */
+
+    /* iterate over types */
+    for (i = 0; i < pset->types; i++) {
+        struct chash *curr = pset->type[i].tags;
+        struct tmptag *tags = NULL;
+
+        if (chash_size(curr) || (pset->type[i].flags & TYPE_FLAG_DEFSET)) {
+            fprintf(output, "        if ((ret = psettings_type_default(pset, "
+              "%u, %u))\n", i, pset->type[i].def);
+            fprintf(output, "          != PSETTINGS_OK) {\n");
+            fprintf(output, "            psettings_delete(pset);\n");
+            fprintf(output, "            return NULL;\n");
+            fprintf(output, "        }\n");
+
+            if ((iter = chash_iter_new(curr)) 
+              && (tags = malloc(sizeof(*tags) * chash_size(curr)))) {
+                unsigned int j;
+                const void *key;
+                unsigned long int *data;
+
+                j = 0;
+                while (chash_iter_ptr_luint_next(iter, &key, &data) 
+                  == CHASH_OK) {
+                    assert(j < chash_size(curr));
+                    tags[j].name = (char *) key;
+                    tags[j++].settings = *data;
+                }
+
+                qsort(tags, chash_size(curr), sizeof(*tags), tmptag_cmp);
+
+                for (j = 0; j < chash_size(curr); j++) {
+                    fprintf(output, "        if ((ret = psettings_set(pset, "
+                      "%u, \"%s\", %u))\n", 
+                      i, tags[j].name, tags[j].settings);
+                    fprintf(output, "          != PSETTINGS_OK) {\n");
+                    fprintf(output, "            psettings_delete(pset);\n");
+                    fprintf(output, "            return NULL;\n");
+                    fprintf(output, "        }\n");
+                }
+
+                free(tags);
+                chash_iter_delete(iter);
+            } else {
+                if (iter) {
+                    chash_iter_delete(iter);
+                }
+                return PSETTINGS_ENOMEM;
+            }
+        }
+        /* otherwise its empty, just ignore it */
+    }
+
+    fprintf(output, "    }\n\n");
+    fprintf(output, "    return pset;\n");
+    fprintf(output, "}\n\n");
+
+    fprintf(output, "#ifdef PSETTINGS_DEFAULT_TEST\n\n");
+
+    fprintf(output, "int main() {\n");
+    fprintf(output, "    struct psettings *pset "
+      "= psettings_new_default(PSETTINGS_ATTR_INDEX);\n");
+    fprintf(output, "\n");
+
+    fprintf(output, "    psettings_write_code(pset, stdout);\n\n");
+
+    fprintf(output, "    psettings_delete(pset);\n");
+    fprintf(output, "    return EXIT_SUCCESS;\n\n");
+    fprintf(output, "}\n\n");
+
+    fprintf(output, "#endif\n\n");
+
+    return PSETTINGS_OK;
+}
+
+#ifdef PSETTINGS_MAIN
+
+int main(int argc, char **argv) {
+    struct psettings *pset;
+    FILE *fp,
+         *outfp;
+
+    if (argc > 3) {
+        fprintf(stderr, "usage: %s [file] [outfile]\n", *argv);
+        return EXIT_FAILURE;
+    }
+
+    if (argc > 2) {
+        outfp = fopen(argv[2], "wb");
+
+        if (!outfp) {
+            perror(*argv);
+            return EXIT_FAILURE;
+        }
+    } else {
+        outfp = stdout;
+    }
+
+    if (argc > 1) {
+        fp = fopen(argv[1], "rb");
+
+        if (!fp) {
+            perror(*argv);
+            fclose(outfp);
+            return EXIT_FAILURE;
+        }
+    } else {
+        fp = stdin;
+    }
+
+    if ((pset = psettings_read(fp, PSETTINGS_ATTR_INDEX))) {
+        fclose(fp);
+        psettings_write_code(pset, outfp);
+        fclose(outfp);
+        psettings_delete(pset);
+        return EXIT_SUCCESS;
+    } else {
+        fclose(fp);
+        fclose(outfp);
+        fprintf(stderr, "failed to create psettings object from stream\n");
+        return EXIT_FAILURE;
+    }
+}
+
+#endif
+
diff --git a/src/psettings_default.c b/src/psettings_default.c
new file mode 100644 (file)
index 0000000..393a2c4
--- /dev/null
@@ -0,0 +1,878 @@
+/* code generated by psettings_write_code() to produce a psettings object with 
+ * default settings */
+
+#include "firstinclude.h"
+#include <assert.h>
+#include <stdlib.h>
+
+#include "psettings.h"
+
+struct psettings *psettings_new_default(enum psettings_attr def) {
+    struct psettings *pset = psettings_new(def);
+    enum psettings_ret ret;
+
+    if (pset) {
+        if ((ret = psettings_type_default(pset, 0, 1))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/a", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/acronym", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/address", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/b", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/bdo", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/big", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/cite", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/code", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/del", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/dfn", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/em", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/font", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/i", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/javascript", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/kbd", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/link", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/meta", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/q", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/s", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/samp", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/script", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/sgmlcomment", 144))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/small", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/span", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/strike", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/strong", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/style", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/sub", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/sup", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/tt", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/u", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/var", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "/vbscript", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "a", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "acronym", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "address", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "b", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "bdo", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "big", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "cite", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "code", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "del", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "dfn", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "dochdr", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "em", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "font", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "i", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "javascript", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "kbd", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "link", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "meta", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "profile", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "q", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "s", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "samp", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "script", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "sgmlcomment", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "small", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "span", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "strike", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "strong", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "style", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "sub", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "sup", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "title", 256))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "tt", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "u", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "var", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 0, "vbscript", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_type_default(pset, 2, 1))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "/article", 2))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "/javascript", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "/script", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "/sgmlcomment", 144))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "/style", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "/vbscript", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "dirpath", 4))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "dochdr", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "javascript", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "profile", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "script", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "sgmlcomment", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "style", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "title", 256))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 2, "vbscript", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_type_default(pset, 3, 1))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/a", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/acronym", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/address", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/b", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/bdo", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/big", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/cite", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/code", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/del", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/dfn", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/doc", 2))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/dochdr", 8))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/em", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/font", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/i", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/javascript", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/kbd", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/link", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/meta", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/q", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/s", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/samp", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/script", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/sgmlcomment", 144))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/small", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/span", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/strike", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/strong", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/style", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/sub", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/sup", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/tt", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/u", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/var", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "/vbscript", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "a", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "acronym", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "address", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "au", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "b", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "bdo", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "big", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "byline", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "cite", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "code", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "dateline", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "del", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "dfn", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "dochdr", 64))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "docid", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "docno", 4))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "docoldno", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "em", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "fileid", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "first", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "font", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "ht", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "i", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "javascript", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "kbd", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "link", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "meta", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "parent", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "profile", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "q", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "s", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "samp", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "script", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "second", 0))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "sgmlcomment", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "small", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "span", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "strike", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "strong", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "style", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "sub", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "sup", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "title", 256))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "tt", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "u", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "var", 129))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+        if ((ret = psettings_set(pset, 3, "vbscript", 128))
+          != PSETTINGS_OK) {
+            psettings_delete(pset);
+            return NULL;
+        }
+    }
+
+    return pset;
+}
+
+#ifdef PSETTINGS_DEFAULT_TEST
+
+int main() {
+    struct psettings *pset = psettings_new_default(PSETTINGS_ATTR_INDEX);
+
+    psettings_write_code(pset, stdout);
+
+    psettings_delete(pset);
+    return EXIT_SUCCESS;
+
+}
+
+#endif
+
diff --git a/src/pyramid.c b/src/pyramid.c
new file mode 100644 (file)
index 0000000..09040f1
--- /dev/null
@@ -0,0 +1,1041 @@
+/* pyramid.c implements the object declared in pyramid.h
+ *
+ * written nml 2003-03-3
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "pyramid.h"
+
+#include "def.h"
+#include "fdset.h"
+#include "freemap.h"
+#include "merge.h"
+#include "storagep.h"
+#include "str.h"
+#include "timings.h"
+#include "error.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* absolute minimum size of an input buffer during a merge */
+#define MIN_INPUT 100
+
+/* struct to represent a file that is waiting to be merged */
+struct file {
+    unsigned int fileno;          /* number of file in fdset */
+    unsigned int level;           /* how many times this fileset has merged */
+    int limited;                  /* whether this entry is at maximum size */
+    int fd;                       /* file descriptor for this file, 
+                                   * typically closed */
+};
+
+/* struct to manage a bunch of files waiting to be merged, which
+ * maintains reception order during merging */
+struct pyramid {
+    unsigned int nextfile;        /* what fileid next file will receive */
+
+    struct file *file;            /* array of files */
+    unsigned int files;           /* how many in array */
+    unsigned int capacity;        /* how many array can handle */
+    unsigned int width;           /* how many files can be on each level 
+                                     before we need to merge them */
+
+    struct fdset *fds;            /* temporary files */
+    unsigned int tmp_type;        /* type number for temporary files */
+    unsigned int final_type;      /* type number of final files */
+    unsigned int vocab_type;      /* type number of vocab files */
+
+    struct storagep *storagep;    /* storage parameters for final merge */
+    struct freemap *map;          /* freemap to remove stuff from in final 
+                                   * merge */
+    struct freemap *vmap;         /* vocab freemap to remove stuff from in 
+                                   * final merger */
+
+    int finished;                 /* whether the merger object has performed a 
+                                   * final merge or not */
+};
+
+struct pyramid* pyramid_new(struct fdset *fds, unsigned int tmp_type, 
+  unsigned int final_type, unsigned int vocab_type,
+  unsigned int maxfiles, struct storagep *storagep, 
+  struct freemap *map, struct freemap *vmap) {
+    struct pyramid* p = malloc(sizeof(*p));
+
+    if (p) {
+        p->fds = fds;
+        p->tmp_type = tmp_type;
+        p->final_type = final_type;
+        p->vocab_type = vocab_type;
+        p->file = NULL;
+        p->files = p->capacity = p->nextfile = 0;
+        p->width = maxfiles;
+        p->finished = 0;
+        p->storagep = storagep;
+        p->map = map;
+        p->vmap = vmap;
+    }
+
+    return p;
+}
+
+/* internal function to check whether partial merge is required,
+ * returns the first file requiring merging in entry, and the number
+ * of files requiring merging in count.  Returns true if pyramid is
+ * required. */
+static int pyramid_merge_required(struct pyramid* pyramid, unsigned int* entry, 
+  unsigned int* count) {
+    unsigned int pos = 0,          /* our position in the array */
+                 level = UINT_MAX, /* current level, starts highest level */
+                 consecutive = 0,  /* number of consecutive mergeable files */
+                 lastlimit = 0;    /* the last limited file + 1 */
+    struct file *pf;               /* current file */
+
+    /* the logic here is that either a too long sequential run of same
+     * level files, or any multiple files prior to a filesize-limited
+     * file require merging */
+    while (pos < pyramid->files) {
+        pf = &pyramid->file[pos];
+
+        /* check for a limited size file */
+        if (pf->limited) {
+            if (consecutive > 1) {
+                /* got to merge everything before a limited file to
+                 * maintain merging order */
+                *entry = lastlimit;
+                *count = consecutive;
+                return 1;
+            } else {
+                lastlimit = pos + 1;
+                consecutive = 0;
+                level = pf->level;
+            }
+
+        /* else check for a level change, cos we have to reset state then */
+        } else if (pf->level != level) {
+            /* if we have a same-level consecutive run of greater than our 
+             * width parameter, we need to merge */
+            if (consecutive >= pyramid->width) {
+                *entry = pos - consecutive;
+                *count = consecutive;
+                return 1;
+            }
+            level = pf->level;
+            consecutive = 1;
+        } else {
+            assert(pf->level == level);
+            consecutive++;
+        }
+        pos++;
+    }
+
+    /* final check for too many consecutive entries */
+    if (consecutive >= pyramid->width) {
+        *entry = pos - consecutive;
+        *count = consecutive;
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+/* internal function to grow the dynamic array */
+static int pyramid_expand(struct pyramid* pyramid) {
+    unsigned int newcapacity = pyramid->capacity * 2 + 1;
+    void* ptr = realloc(pyramid->file, sizeof(*pyramid->file) * newcapacity);
+
+    if (ptr) {
+        pyramid->file = ptr;
+        pyramid->capacity = newcapacity;
+        return 1;
+    }
+
+    assert(!CRASH);
+    return 0;
+}
+
+void pyramid_delete(struct pyramid* pyramid) {
+    unsigned int i;
+    struct file* pf;
+
+    for (i = 0; i < pyramid->files; i++) {
+        pf = &pyramid->file[i];
+
+        if (pf->fd >= 0) {
+            fdset_unpin(pyramid->fds, pyramid->tmp_type, pf->fileno, pf->fd);
+            pf->fd = -1;
+        }
+    }
+
+    for (i = 0; i <= pyramid->nextfile; i++) {
+        /* unlink files (best effort) */
+        fdset_unlink(pyramid->fds, pyramid->tmp_type, i);
+    }
+
+    pyramid->files = 0;
+
+    if (pyramid->file) {
+        free(pyramid->file);
+    }
+
+    free(pyramid);
+    return;
+}
+
+#define MERGE_FAIL(pyramid, entry, count, ofd, vfd, fileno, vf, fm, imerge) \
+  (ERROR("merge failed"), \
+   merge_fail(pyramid, entry, count, ofd, vfd, fileno, vf, fm, imerge))
+
+/* internal function to clean up after failed merging */
+static void merge_fail(struct pyramid *pyramid, unsigned int entry, 
+  unsigned int count, int outfd, int vfd, unsigned int fileno, 
+  unsigned int vfileno, struct merge_final *fmerge, 
+  struct merge_inter *imerge) {
+    unsigned int i;
+
+    if (outfd >= 0) {
+        fdset_unpin(pyramid->fds, pyramid->tmp_type, fileno, outfd);
+    }
+
+    if (vfd >= 0) {
+        fdset_unpin(pyramid->fds, pyramid->vocab_type, vfileno, vfd);
+    }
+
+    for (i = 0; i < count; i++) {
+        if (pyramid->file[entry + i].fd >= 0) {
+            fdset_unpin(pyramid->fds, pyramid->tmp_type, 
+              pyramid->file[entry + i].fileno, 
+              pyramid->file[entry + i].fd);
+            pyramid->file[entry + i].fd = -1;
+        }
+    }
+    if (fmerge) {
+        merge_final_delete(fmerge);
+    }
+    if (imerge) {
+        merge_inter_delete(imerge);
+    }
+}
+
+int pyramid_merge(struct pyramid *pyramid, unsigned int *files, 
+  unsigned int *vocabs, unsigned long int *dterms, unsigned int *terms_high, 
+  unsigned int *terms_low, unsigned int *root_fileno, 
+  unsigned long int *root_offset, void *buf, unsigned int bufsize) {
+    struct merge_final merge;            /* merge object */
+    struct merge_input *inputs = buf;    /* inputs array for merge */
+    char *inbuf,                         /* input buffers */
+         *outbuf,                        /* output buffer */
+         *bigbuf,                        /* buffer for big reads */
+         *tmp;                           /* writing location, so we don't 
+                                          * move buf_out */
+    unsigned int inbufsz,                /* size of each input buffer */
+                 outbufsz,               /* size of output buffer */
+                 bigbufsz;               /* size of big buffer */
+    int len;                             /* length of write */
+    enum merge_ret ret;                  /* return value from merge_final */
+    unsigned int file = 0,               /* file we're writing to */ 
+                 vfile = 0,              /* vocab file we're writing to */
+                 i, 
+                 input,                  /* id of the input we need to renew */
+                 next_read;              /* how big the next read will be */
+    int outfd = -1,                      /* output file descriptor */
+        voutfd = -1;                     /* vocab output file descriptor */
+    unsigned long int start,             /* where we began writing current 
+                                          * file */
+                      end,               /* where we ended writing current 
+                                          * file */
+                      vpos = 0;          /* where we are in vocab output file */
+
+    /* save the number of pinned file descriptors, since it should be the same
+     * when we exit */
+    unsigned int pinned = fdset_pinned(pyramid->fds);
+
+    TIMINGS_DECL();
+    TIMINGS_START();
+
+    /* can't full merge after a previous full merge */
+    if (pyramid->finished) {
+        assert(!CRASH);
+        return -EINVAL;
+    }
+
+    if (bufsize < sizeof(*inputs) * pyramid->files) {
+        assert(!CRASH);
+        return -ENOMEM;
+    }
+
+    /* split up the remaining buffer evenly (one third for regular input,
+     * one third for output, one third for large reads)  */
+    inbufsz = outbufsz = bigbufsz 
+      = (bufsize - (sizeof(*inputs) * pyramid->files)) / 3;
+
+    if (pyramid->files) {
+        inbufsz /= pyramid->files;
+    }
+
+    bigbuf = ((char *) buf) + sizeof(*inputs) * pyramid->files;
+    outbuf = bigbuf + bigbufsz;
+    inbuf = outbuf + outbufsz;
+
+    /* ensure that we have enough space to do a decent merge */
+    if (inbufsz < MIN_INPUT) {
+        assert(!CRASH);
+        return -ENOMEM;
+    }
+
+    /* pin all required fds */
+    i = 0;
+    while ((i < pyramid->files) 
+      && ((pyramid->file[i].fd 
+        = fdset_pin(pyramid->fds, pyramid->tmp_type, 
+          pyramid->file[i].fileno, 0, SEEK_SET)) >= 0)) {
+        inputs[i].next_in = inbuf + inbufsz * i;
+        inputs[i].avail_in = 0;
+        i++;
+    }
+
+    /* we may not have opened all of the files, fail (could possibly partial 
+     * merge here, although what good it would do is questionable) */
+    if (i < pyramid->files) {
+        unsigned int j;
+
+        assert(!CRASH);
+
+        for (j = 0; j < i; j++) {
+            fdset_unpin(pyramid->fds, pyramid->tmp_type, 
+              pyramid->file[i].fileno, pyramid->file[i].fd);
+        }
+
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return -EMFILE;
+    } else if (!i) {
+        assert(!CRASH);
+        MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, vfile, 
+          NULL, NULL);
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return -EINVAL;
+    }
+
+    merge.input = inputs;
+    merge.inputs = pyramid->files;
+
+    if (!(merge_final_new(&merge, NULL, NULL, NULL, pyramid->storagep, 
+        outbuf, outbufsz))) {
+
+        assert(!CRASH);
+        MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, vfile, 
+          NULL, NULL);
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return -EINVAL;
+    }
+
+    /* pin output fd and seek it to start */
+    if (((outfd = fdset_create_seek(pyramid->fds, pyramid->final_type, file, 
+        merge.out.offset_out)) < 0) 
+      && ((outfd != -EEXIST) 
+        || ((outfd = fdset_pin(pyramid->fds, pyramid->final_type, file, 
+            merge.out.offset_out, SEEK_SET)) < 0))) {
+
+        unsigned int j;
+
+        ERROR1("unable to open output file number %u for final merge", file);
+        assert(!CRASH);
+
+        for (j = 0; j < i; j++) {
+            fdset_unpin(pyramid->fds, pyramid->tmp_type, 
+              pyramid->file[i].fileno, pyramid->file[i].fd);
+        }
+        MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, vfile, 
+          &merge, NULL);
+
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return outfd;
+    }
+
+    if ((voutfd = fdset_create_seek(pyramid->fds, pyramid->vocab_type, vfile,
+        0)) < 0) {
+
+        ERROR1("unable to open vocab output file number %u for final merge", 
+          vfile);
+        assert(!CRASH);
+        MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, vfile, 
+          &merge, NULL);
+
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return outfd;
+    }
+
+    file = merge.out.fileno_out;
+    start = end = merge.out.offset_out;
+
+    /* ok, now merge them */
+    while ((ret = merge_final(&merge, &input, &next_read)) != MERGE_OK) {
+        switch (ret) {
+        case MERGE_INPUT:
+            if ((bigbufsz > inbufsz) && (next_read > inbufsz)) {
+                /* ensure that the big buffer is not in use */
+                for (i = 0; i < pyramid->files; i++) {
+                    assert(((merge.input[i].next_in < bigbuf) 
+                        || (merge.input[i].next_in 
+                          > bigbuf + bigbufsz)) 
+                      || (merge.input[i].avail_in == 0));
+                }
+
+                /* use the big buffer */
+                merge.input[input].next_in = bigbuf;
+
+                /* ensure we don't try to read too much into the buffer */
+                if (next_read > bigbufsz) {
+                    next_read = bigbufsz;
+                }
+            } else {
+                next_read = inbufsz;
+                merge.input[input].next_in = inbuf + input * inbufsz;
+            }
+
+            /* use the normal buffer */
+            errno = 0;
+            if ((len = read(pyramid->file[input].fd, 
+                merge.input[input].next_in, next_read)) > 0) {
+
+                /* read succeeded (note that we can't assign to avail_in
+                 * directly, because its an unsigned int) */
+                merge.input[input].avail_in = len;
+
+            /* reached EOF, let the merge module know */
+            } else if (!len && !errno && (merge.input[input].next_in != bigbuf)
+              && (merge_final_input_finish(&merge, input) == MERGE_OK)
+
+              /* unlink file */
+              && (fdset_unpin(pyramid->fds, pyramid->tmp_type, 
+                  pyramid->file[input].fileno, pyramid->file[input].fd)
+                == FDSET_OK)
+              && ((pyramid->file[input].fd = -1), 1)
+              && (fdset_unlink(pyramid->fds, pyramid->tmp_type, 
+                  pyramid->file[input].fileno) == FDSET_OK)) {
+
+                /* succeeded, do nothing */
+            } else {
+                assert(!CRASH);
+                MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, 
+                  vfile, &merge, NULL);
+                assert(pinned == fdset_pinned(pyramid->fds));
+                return errno ? -errno : -EINVAL;
+            }
+            break;
+
+        case MERGE_OUTPUT_BTREE:
+            /* watch for switch of output file */
+            if (vfile == merge.out_btree.fileno_out) {
+                /* everything is fine, do nothing */
+            } else if (vfile + 1 == merge.out_btree.fileno_out) {
+                /* need to switch to the next file */
+                unsigned int tmp = (unsigned int) vpos;
+
+                /* allocate space used in current file */
+                if (!pyramid->vmap 
+                  || freemap_malloc(pyramid->vmap, &vfile, &vpos, &tmp, 
+                    FREEMAP_OPT_EXACT | FREEMAP_OPT_LOCATION, vfile, 0)) {
+                    /* allocation succeeded, do nothing */
+                } else {
+                    assert(!CRASH);
+                    MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, 
+                      file, vfile, &merge, NULL);
+                    assert(pinned == fdset_pinned(pyramid->fds));
+                    return errno ? -errno : -EINVAL;
+                }
+                vpos = 0;
+
+                /* unpin existing output file */
+                if ((fdset_unpin(pyramid->fds, pyramid->vocab_type, 
+                    vfile, voutfd) == FDSET_OK) 
+                  && ((voutfd = fdset_create_seek(pyramid->fds, 
+                      pyramid->vocab_type, ++vfile, 
+                      merge.out_btree.offset_out)) >= 0)) {
+
+                } else {
+                    assert(!CRASH);
+                    MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file,
+                      vfile, &merge, NULL);
+                    assert(pinned == fdset_pinned(pyramid->fds));
+                    return errno ? -errno : -EINVAL;
+                }
+            } else {
+                /* don't know whats going on */
+                assert(0);
+
+                MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, 
+                  vfile, &merge, NULL);
+                assert(pinned == fdset_pinned(pyramid->fds));
+                return -EINVAL;
+            }
+
+            assert(vfile == merge.out_btree.fileno_out);
+            assert((off_t) merge.out_btree.offset_out 
+              == lseek(voutfd, 0, SEEK_CUR));
+
+            /* write output to file */
+            tmp = merge.out_btree.buf_out;
+            while (merge.out_btree.size_out 
+              && ((len = write(voutfd, tmp, merge.out_btree.size_out)) >= 0)) {
+                merge.out_btree.size_out -= len;
+                tmp += len;
+                merge.out_btree.offset_out += len;
+                vpos += len;
+            }
+
+            if (merge.out_btree.size_out) {
+                assert(!CRASH);
+                MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, 
+                  vfile, &merge, NULL);
+                assert(pinned == fdset_pinned(pyramid->fds));
+                return errno ? -errno : -EINVAL;
+            }
+            break;
+
+        case MERGE_OUTPUT:
+            /* watch for switch of output file */
+            if (file == merge.out.fileno_out) {
+                /* everything is fine, do nothing */
+            } else if (file + 1 == merge.out.fileno_out) {
+                /* need to switch to the next file */
+                unsigned int tmpsize = end - start;
+
+                /* allocate space used in current file */
+                if (!pyramid->map 
+                  || freemap_malloc(pyramid->map, &file, &start, &tmpsize, 
+                    FREEMAP_OPT_EXACT | FREEMAP_OPT_LOCATION, file, start)) {
+                    /* allocation succeeded, do nothing */
+                } else {
+                    assert(!CRASH);
+                    MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file,
+                      vfile, &merge, NULL);
+                    assert(pinned == fdset_pinned(pyramid->fds));
+                    return errno ? -errno : -EINVAL;
+                }
+
+                /* unpin existing output file */
+                if ((fdset_unpin(pyramid->fds, pyramid->final_type, 
+                    file, outfd) == FDSET_OK) 
+                  && ((outfd = fdset_create_seek(pyramid->fds, 
+                      pyramid->final_type, ++file, 
+                      merge.out.offset_out)) >= 0)) {
+
+                    start = merge.out.offset_out;
+                } else {
+                    assert(!CRASH);
+                    MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file,
+                      vfile, &merge, NULL);
+                    assert(pinned == fdset_pinned(pyramid->fds));
+                    return errno ? -errno : -EINVAL;
+                }
+            } else {
+                /* don't know whats going on */
+                assert(0);
+
+                MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, 
+                  vfile, &merge, NULL);
+                assert(pinned == fdset_pinned(pyramid->fds));
+                return -EINVAL;
+            }
+
+            end = merge.out.offset_out + merge.out.size_out;
+
+            assert(file == merge.out.fileno_out);
+            assert((off_t) merge.out.offset_out == lseek(outfd, 0, SEEK_CUR));
+
+            /* write output to file */
+            tmp = merge.out.buf_out;
+            while (merge.out.size_out 
+              && ((len = write(outfd, tmp, merge.out.size_out)) >= 0)) {
+                merge.out.size_out -= len;
+                tmp += len;
+                merge.out.offset_out += len;
+            }
+
+            if (merge.out.size_out) {
+                assert(!CRASH);
+                MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, 
+                  vfile, &merge, NULL);
+                assert(pinned == fdset_pinned(pyramid->fds));
+                return errno ? -errno : -EINVAL;
+            }
+            break;
+
+        default:
+            assert(!CRASH);
+            MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, vfile, 
+              &merge, NULL);
+            assert(pinned == fdset_pinned(pyramid->fds));
+            return -EINVAL;
+            break;
+        }
+    }
+
+    /* allocate space used in current files */
+    i = end - start;
+    if (!pyramid->map 
+      || freemap_malloc(pyramid->map, &file, &start, &i, 
+        FREEMAP_OPT_EXACT | FREEMAP_OPT_LOCATION, file, start)) {
+        /* allocation succeeded, do nothing */
+    } else {
+        assert(!CRASH);
+        MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, vfile, 
+          &merge, NULL);
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return errno ? -errno : -EINVAL;
+    }
+    i = vpos;
+    if (!pyramid->vmap 
+      || freemap_malloc(pyramid->vmap, &vfile, &vpos, &i, 
+        FREEMAP_OPT_EXACT | FREEMAP_OPT_LOCATION, vfile, 0)) {
+        /* allocation succeeded, do nothing */
+    } else {
+        assert(!CRASH);
+        MERGE_FAIL(pyramid, 0, pyramid->files, outfd, voutfd, file, vfile, 
+          &merge, NULL);
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return errno ? -errno : -EINVAL;
+    }
+
+    *files = file + 1;
+    *vocabs = vfile + 1;
+    if (merge_final_finish(&merge, root_fileno, root_offset, dterms, 
+        terms_high, terms_low) == MERGE_OK) {
+
+        merge_final_delete(&merge);
+
+        /* unpin fds */
+        for (i = 0; i < pyramid->files; i++) {
+            if (pyramid->file[i].fd >= 0) {
+                fdset_unpin(pyramid->fds, pyramid->tmp_type, 
+                  pyramid->file[i].fileno, pyramid->file[i].fd);
+                pyramid->file[i].fd = -1;
+            }
+        }
+        fdset_unpin(pyramid->fds, pyramid->final_type, file, outfd);
+        fdset_unpin(pyramid->fds, pyramid->vocab_type, vfile, voutfd);
+        outfd = -1;
+        voutfd = -1;
+
+        TIMINGS_END("final merging");
+
+        /* use btsibling to apply sibling threading to btree leaves */
+        pyramid->finished = 1;
+        pyramid->nextfile = 0;      /* prevent attempted unlinking in delete */
+        if (pinned == fdset_pinned(pyramid->fds)) {
+            return PYRAMID_OK;
+        } else {
+            assert(!CRASH);
+            return -EINVAL;
+        }
+    } else {
+        assert(!CRASH);
+
+        merge_final_delete(&merge);
+
+        /* unpin fds */
+        for (i = 0; i < pyramid->files; i++) {
+            fdset_unpin(pyramid->fds, pyramid->tmp_type, 
+              pyramid->file[i].fileno, pyramid->file[i].fd);
+            pyramid->file[i].fd = -1;
+        }
+        fdset_unpin(pyramid->fds, pyramid->final_type, file, outfd);
+        outfd = -1;
+
+        pyramid->finished = 1;
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return errno ? -errno : -EINVAL;
+    }
+}
+
+int pyramid_pin_next(struct pyramid *pyramid) {
+    if (!pyramid->finished) {
+        int retval = fdset_create(pyramid->fds, pyramid->tmp_type, 
+          pyramid->nextfile);
+        if (retval < 0) {
+            ERROR2("error pinning next file (number %u, type %u)", 
+              pyramid->nextfile, pyramid->tmp_type);
+            assert(!CRASH);
+        }
+        return retval; 
+
+    } else {
+        assert(!CRASH);
+        return -1;
+    }
+}
+
+int pyramid_unpin_next(struct pyramid *pyramid, int fd) {
+    if (!pyramid->finished) {
+        return fdset_unpin(pyramid->fds, pyramid->tmp_type, pyramid->nextfile, 
+          fd);
+    } else {
+        assert(!CRASH);
+        return -1;
+    }
+}
+
+/* XXX: somewhat hacky struct to allow us to access merging state from
+ * intermediate merge newfile callback */
+struct pyramid_state {
+    struct pyramid *p;      /* merging pyramid */
+    int fd;                 /* fd we're merging into */
+    unsigned int pos;       /* position in files array in pyramid we're 
+                             * inserting to */
+    int err;                /* last error code or 0 */
+    unsigned int level;     /* level that highest level fd we're merging is */
+};
+
+void pyramid_change_file(void *opaque) {
+    struct pyramid_state *state = opaque;
+    struct pyramid *pyramid = state->p;
+    int newfd;
+
+    /* XXX: have a bit of a problem in that error reporting isn't really
+     * possible from here.  Workaround is to have err and check it at
+     * the end of the merge.  As a result, ensure that fd is rewound and 
+     * working whenever we leave, even though that could produce funny 
+     * results. */
+
+    /* add this file into the merging pyramid */
+
+    /* copy other files up to make room */
+    assert(pyramid->files >= state->pos);
+    if ((pyramid->capacity <= pyramid->files) && !pyramid_expand(pyramid)) {
+        assert(!CRASH);
+        state->err = ENOMEM;
+        lseek(state->fd, 0, SEEK_SET);      
+        return;
+    }
+    memcpy(&pyramid->file[state->pos + 1], &pyramid->file[state->pos],
+      sizeof(*pyramid->file) * (pyramid->files - state->pos));
+
+    /* pin new fd */
+    if (((newfd = fdset_create_seek(pyramid->fds, pyramid->tmp_type, 
+        pyramid->nextfile + 1, 0)) >= 0)) {
+
+        /* unpin old fd */
+        fdset_unpin(pyramid->fds, pyramid->tmp_type, pyramid->nextfile, 
+          state->fd);
+        state->fd = newfd;
+        pyramid->file[state->pos].fileno = pyramid->nextfile++;
+        pyramid->file[state->pos].level = state->level + 1;
+        pyramid->file[state->pos].limited = 1;
+        pyramid->file[state->pos].fd = -1;
+
+        pyramid->files++;
+        state->pos++;
+    } else {
+        assert(!CRASH);
+        state->err = -newfd;
+        lseek(state->fd, 0, SEEK_SET);      
+    }
+}
+
+/* hint: the most common error i've made in this function is to address entries
+ * in the pyramid->file array without using [entry + ...] */
+int pyramid_partial_merge(struct pyramid* pyramid, unsigned int entry, 
+  unsigned int count, void *buf, unsigned int bufsize) {
+    struct merge_inter merge;            /* merge object */
+    struct merge_input *inputs = buf;    /* inputs array for merge */
+    char *inbuf,                         /* input buffers */
+         *outbuf,                        /* output buffer */
+         *bigbuf,                        /* buffer for big reads */
+         *tmp;                           /* writing location, so we don't 
+                                          * move buf_out */
+    unsigned int inbufsz,                /* size of each input buffer */
+                 outbufsz,               /* size of output buffer */
+                 bigbufsz,               /* size of big buffer */
+                 i,
+                 input,                  /* index of input we need to renew */
+                 next_read;              /* how big the next read will be */
+    struct pyramid_state state;          /* some bits and pieces of merge 
+                                          * state */
+    int len;                             /* length of write */
+    enum merge_ret ret;                  /* return value from merge_inter */
+
+    /* keep number of pinned fds, should be the same when we exit */
+    unsigned int pinned = fdset_pinned(pyramid->fds);
+
+    assert(count && (count + entry <= pyramid->files));
+
+    if (bufsize < sizeof(*inputs) * count) {
+        assert(!CRASH);
+        return -ENOMEM;
+    }
+
+    /* split up the remaining buffer evenly (one third for regular input,
+     * one third for output, one third for large reads)  */
+    inbufsz = outbufsz = bigbufsz 
+      = (bufsize - (sizeof(*inputs) * count)) / 3;
+
+    inbufsz /= count;
+
+    bigbuf = ((char *) buf) + sizeof(*inputs) * count;
+    outbuf = bigbuf + bigbufsz;
+    inbuf = outbuf + outbufsz;
+
+    assert(sizeof(*inputs) * count + bigbufsz + outbufsz + inbufsz <= bufsize);
+
+    /* ensure that we have enough space to do a decent merge */
+    if (inbufsz < MIN_INPUT) {
+        assert(!CRASH);
+        return -ENOMEM;
+    }
+
+    /* create output fd */
+    state.p = pyramid;
+    if ((state.fd = fdset_create(pyramid->fds, pyramid->tmp_type, 
+        pyramid->nextfile)) < 0) {
+
+        assert(!CRASH);
+        return state.fd;
+    }
+    state.pos = entry + count;
+    state.level = 0;
+    state.err = 0;
+
+    /* pin all required fds */
+    i = 0;
+    while ((i < count) 
+      && ((pyramid->file[entry + i].fd 
+        = fdset_pin(pyramid->fds, pyramid->tmp_type, 
+          pyramid->file[entry + i].fileno, 0, SEEK_SET)) >= 0)) {
+
+        if (pyramid->file[entry + i].level > state.level) {
+            state.level = pyramid->file[entry + i].level;
+        }
+
+        inputs[i].next_in = inbuf + inbufsz * i;
+        inputs[i].avail_in = 0;
+        i++;
+    }
+
+    /* we may not have opened all of the files, thats (probably) ok */
+    if (i < count) {
+        /* check we didn't leak fd if lseek failed above */
+        if (pyramid->file[entry + i].fd >= 0) {
+            fdset_unpin(pyramid->fds, pyramid->tmp_type, 
+              pyramid->file[entry + i].fileno, 
+              pyramid->file[entry + i].fd);
+            pyramid->file[entry + i].fd = -1;
+        }
+
+        count = i;
+    } else if (!i) {
+        assert(!CRASH);
+        MERGE_FAIL(pyramid, entry, count, state.fd, -1, pyramid->nextfile, 0, 
+          NULL, NULL);
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return errno ? -errno : -EINVAL;
+    }
+
+    merge.input = inputs;
+    merge.inputs = count;
+
+    if (!(merge_inter_new(&merge, NULL, NULL, NULL, outbuf, outbufsz, 
+        pyramid->storagep->max_termlen, &state, pyramid_change_file, 
+        pyramid->storagep->max_filesize))) {
+
+        assert(!CRASH);
+        MERGE_FAIL(pyramid, entry, count, state.fd, -1, pyramid->nextfile, 0,
+          NULL, NULL);
+        assert(pinned == fdset_pinned(pyramid->fds));
+        return -EINVAL;
+    }
+
+    /* ok, now merge them */
+    while ((ret = merge_inter(&merge, &input, &next_read)) != MERGE_OK) {
+        switch (ret) {
+        case MERGE_INPUT:
+            if ((bigbufsz > inbufsz) && (next_read > inbufsz)) {
+                /* ensure that the big buffer is not in use */
+                for (i = 0; i < count; i++) {
+                    assert(((merge.input[i].next_in + merge.input[i].avail_in 
+                          <= bigbuf) 
+                        || (merge.input[i].next_in 
+                          > bigbuf + bigbufsz)) 
+                      || (merge.input[i].avail_in == 0));
+                }
+
+                /* use the big buffer */
+                merge.input[input].next_in = bigbuf;
+
+                /* ensure we don't try to read too much into the buffer */
+                /* note that we restrict our read to size next_read so as to
+                 * ensure that the big buffer is available next time we need it
+                 * (otherwise it may still have stuff in it) */
+                if (next_read > bigbufsz) {
+                    next_read = bigbufsz;
+                }
+            } else {
+                /* use the normal buffer */
+                merge.input[input].next_in = inbuf + input * inbufsz;
+
+                next_read = inbufsz;
+
+                /* ensure that nothing else is using the normal buffer for this
+                 * input */
+                for (i = 0; i < count; i++) {
+                    assert(((i == input) 
+                      || ((merge.input[i].next_in + merge.input[i].avail_in
+                          <= merge.input[input].next_in)
+                        || (merge.input[i].next_in 
+                          >= merge.input[input].next_in + inbufsz))));
+                    assert((outbuf + outbufsz <= merge.input[i].next_in) 
+                      || (outbuf >= merge.input[i].next_in + inbufsz));
+                }
+            }
+
+            errno = 0;
+            if ((len = read(pyramid->file[entry + input].fd, 
+                merge.input[input].next_in, next_read)) > 0) {
+
+                /* read succeeded (note that we can't assign to avail_in
+                 * directly, because its an unsigned int, which hides 
+                 * errors returned as negative numbers) */
+                merge.input[input].avail_in = len;
+
+            /* reached EOF, let the merge module know (its an error for the 
+             * bigbuf, since we only tried to read an expected amount) */
+            } else if (!len && !errno && (merge.input[input].next_in != bigbuf)
+              && (merge_inter_input_finish(&merge, input) == MERGE_OK)
+
+              /* unlink file */
+              && (fdset_unpin(pyramid->fds, pyramid->tmp_type, 
+                  pyramid->file[entry + input].fileno, 
+                  pyramid->file[entry + input].fd) == FDSET_OK)
+              && ((pyramid->file[entry + input].fd = -1), 1)
+              && (fdset_unlink(pyramid->fds, pyramid->tmp_type, 
+                  pyramid->file[entry + input].fileno) == FDSET_OK)) {
+
+                /* succeeded, do nothing */
+            } else {
+                assert(!CRASH);
+                MERGE_FAIL(pyramid, entry, count, state.fd, -1, 
+                  pyramid->nextfile, 0, NULL, &merge);
+                assert(pinned == fdset_pinned(pyramid->fds));
+                return errno ? -errno : -EINVAL;
+            }
+            break;
+
+        case MERGE_OUTPUT:
+            /* write output to file */
+            tmp = merge.buf_out;
+            while (merge.size_out 
+              && ((len = write(state.fd, tmp, merge.size_out)) >= 0)) {
+                merge.size_out -= len;
+                tmp += len;
+            }
+
+            if (merge.size_out) {
+                assert(!CRASH);
+                MERGE_FAIL(pyramid, entry, count, state.fd, -1, 
+                  pyramid->nextfile, 0, NULL, &merge);
+                assert(pinned == fdset_pinned(pyramid->fds));
+                return errno ? -errno : -EINVAL;
+            }
+            break;
+
+        default:
+            assert(!CRASH);
+            MERGE_FAIL(pyramid, entry, count, state.fd, -1, 
+              pyramid->nextfile, 0, NULL, &merge);
+            assert(pinned == fdset_pinned(pyramid->fds));
+            return -EINVAL;
+            break;
+        }
+    }
+
+    merge_inter_delete(&merge);
+
+    /* add final new file */
+
+    /* copy other files up to make room */
+    assert(pyramid->files >= state.pos);
+    if ((pyramid->capacity <= pyramid->files) && !pyramid_expand(pyramid)) {
+        assert(!CRASH);
+        MERGE_FAIL(pyramid, entry, count, state.fd, -1, pyramid->nextfile, 0, 
+          NULL, &merge);
+        return errno ? -errno : -EINVAL;
+    }
+    memcpy(&pyramid->file[state.pos + 1], &pyramid->file[state.pos],
+      sizeof(*pyramid->file) * (pyramid->files - state.pos));
+
+    fdset_unpin(pyramid->fds, pyramid->tmp_type, pyramid->nextfile, state.fd);
+    pyramid->file[state.pos].fileno = pyramid->nextfile++;
+    pyramid->file[state.pos].level = state.level + 1;
+    pyramid->file[state.pos].limited = 0;
+    pyramid->file[state.pos].fd = -1;
+    pyramid->files++;
+
+    /* source fds should have already been unpinned */
+    for (i = 0; i < count; i++) {
+        assert(pyramid->file[entry + i].fd < 0);
+    }
+
+    /* remove old files */
+    memmove(&pyramid->file[entry], &pyramid->file[entry + count], 
+      (pyramid->files - entry - count) * sizeof(*pyramid->file));
+    pyramid->files -= count;
+
+    /* check that we didn't get any errors */
+    if (state.err) {
+        assert(!CRASH);
+        return -state.err;
+    }
+
+    if (pinned == fdset_pinned(pyramid->fds)) {
+        return PYRAMID_OK;
+    } else {
+        assert(!CRASH);
+        return -EINVAL;
+    }
+}
+
+int pyramid_add_file(struct pyramid* pyramid, int allow, void *buf, 
+  unsigned int bufsize) {
+    unsigned int entry,
+                 count;
+    int ret;
+
+    TIMINGS_DECL();
+    TIMINGS_START();
+
+    if (pyramid->finished) {
+        assert(!CRASH);
+        return -EINVAL;
+    }
+
+    if ((pyramid->capacity <= pyramid->files) && !pyramid_expand(pyramid)) {
+        assert(!CRASH);
+        return -ENOMEM;
+    }
+
+    pyramid->file[pyramid->files].fileno = pyramid->nextfile++;
+    pyramid->file[pyramid->files].level = 0;
+    pyramid->file[pyramid->files].limited = 0;
+    pyramid->file[pyramid->files].fd = -1;
+    pyramid->files++;
+
+    while (allow && pyramid_merge_required(pyramid, &entry, &count)) {
+        if ((ret = pyramid_partial_merge(pyramid, entry, count, buf, bufsize)) 
+          != PYRAMID_OK) {
+            assert(!CRASH);
+            ERROR("performing pyramid partial merge");
+            return ret;
+        }
+    }
+
+    TIMINGS_END("merging");
+    return PYRAMID_OK;
+}
+
diff --git a/src/pyzet/pzet.py b/src/pyzet/pzet.py
new file mode 100644 (file)
index 0000000..7d1720e
--- /dev/null
@@ -0,0 +1,212 @@
+import zet
+import string
+import tempfile
+import os
+import sys
+import copy_reg
+import re
+
+# register de-pickler
+copy_reg.constructor(zet.unpickle_search_result)
+
+class ZetIndex(zet.Index):
+    """Extends C-wrapper index."""
+
+    DEFAULT_LEN=20
+
+    def __init__(self, prefix="index"):
+        zet.Index.__init__(self, prefix)
+        self.prefix = prefix
+
+    def search(self, query, *args, **kys):
+        baseResults = zet.Index.search(self, query, *args, **kys)
+        return ZetSearchResults(list(baseResults.results), 
+                baseResults.total_results)
+
+    def trec_search(self, trec_query, len, *args, **kys):
+        return self.search(trec_query.query, 0, 
+                len, *args, **kys).to_trec_eval_list(trec_query.topic_num)
+
+    def __getitem__(self, key):
+        return self.search(key)
+
+class TrecResult:
+    """Data for single line of a trec result.
+    This contains the topic number, trec docid, score, and run-id."""
+
+    def __init__(self, topic_number, trec_doc_id, score=0.0, run_id="zettair"):
+        self.topic_number = topic_number
+        self.trec_doc_id = trec_doc_id
+        self.score = score
+        self.run_id = run_id
+
+    def fmt(self):
+        """Return as formatted string in trec_eval format"""
+        return "%s\tQ0\t%s\t0\t%f\t%s" % (self.topic_number, 
+                self.trec_doc_id, self.score, self.run_id)
+
+class ZetSearchResults:
+    """Wrapper for C-module SearchResults."""
+
+    def __init__(self, results, total_results):
+        self.results = results
+        self.total_results = total_results
+
+    def __iter__(self):
+        return self.results.__iter__()
+
+    def __getitem__(self, index):
+        return self.results[index]
+
+    def add_results(self, results):
+        self.results = self.results + results
+
+    def to_trec_eval_list(self, topic_num, run_id="zettair"):
+        "Convert to a list of TrecResults"
+        trec_results = []
+        for result in self.results:
+            trec_results.append(TrecResult(topic_num, result.auxiliary,
+                    result.score, run_id))
+        return trec_results
+
+    def order_by_score(self):
+        """Order results by score."""
+        self.results.sort(lambda r1, r2: int((r2.score - r1.score) * 1000))
+
+    def order_by_auxiliary(self):
+        """Order results by auxiliary field."""
+        self.results.sort(lambda r1, r2: cmp(r1.auxiliary, r2.auxiliary))
+
+class Query:
+
+    def __init__(self, query):
+        self.query = query
+        self.terms = None
+
+class TrecQuery(Query):
+    """A query annotated with a topic number, as per TREC."""
+
+    def __init__(self, topic_num, query):
+        Query.__init__(self, query)
+        self.topic_num = topic_num
+
+    def __str__(self):
+        return "topic# %s, query \"%s\"" % (self.topic_num, self.query)
+
+    def __repr__(self):
+        return "<pzet.TrecQuery:: topic# %s, query \"%s\">" \
+                % (self.topic_num, self.query)
+
+class TrecEvalResult:
+    """Result of running trec eval over the output of a zet_trec run"""
+
+    # currently we only capture total precision
+    def __init__(self, average_precision, r_precision,
+            at_docs_precision):
+        self.average_precision = average_precision
+        self.r_precision = r_precision
+        self.at_docs_precision = at_docs_precision
+
+class ZetMLParser(zet.MLParser):
+    """Extends MLParser.
+    Brings MLParse token identifiers into Python."""
+
+    # token types, copied from mlparse.h
+
+    TAG = 2 << 2
+    WORD = 3 << 2
+    PARAM = 4 << 2
+    PARAMVAL = 5 << 2
+    COMMENT = 6 << 2
+    WHITESPACE = 7 << 2
+    CDATA = 8 << 2
+
+class CachedPostingsIterator:
+    """Wrapper for postings iterator.
+    Stores current posting in current_posting field."""
+
+    def __init__(self, postings_iterator):
+        self.postings_iterator = postings_iterator
+        self.current_posting = None
+
+    def __iter__(self):
+        return self
+
+    def next(self):
+        self.current_posting = self.postings_iterator.next()
+        return self.current_posting
+
+    def skip_to(self, docno):
+        self.postings_iterator.skip_to(docno)
+
+def parse_trec_eval_output(trec_eval_proc):
+    """Parse the output from a run of trec_eval into a TrecEvalResult object"""
+    state="START"
+    at_re = re.compile("  At *(\d+) docs: *(\d+\.\d+)")
+    at_docs_precision = {}
+    for line in trec_eval_proc:
+        if state == "START":
+            if line.startswith("Average precision"):
+                state = "AVERAGE"
+        elif state == "AVERAGE":
+            average_precision = float(line)
+            state = "AFTER AVERAGE"
+        elif state == "AFTER AVERAGE":
+            mo = at_re.match(line)
+            if mo != None:
+                docs = int(mo.group(1))
+                precision = float(mo.group(2))
+                at_docs_precision[docs] = precision
+            elif line.startswith("R-Precision"):
+                state = "R-PRECISION"
+        elif state == "R-PRECISION":
+            r_precision = float(line.split()[1])
+            state = "END"
+        else:
+            raise StandardError, "invalid parse state"
+    if (state != "END"):
+        raise StandardError, "didn't reach end"
+    return TrecEvalResult(average_precision, r_precision, at_docs_precision)
+
+# FIXME when called, should normally pass in wordlen, lookahead
+# used to build index.
+def extract_words(buf, limit=-1, wordlen=49, lookahead=999):
+    return zet.extract_words(buf, limit, wordlen, lookahead)
+
+def trec_queries_from_short_topic_file(filename):
+    trec_queries = []
+    fp = open(filename)
+    for line in fp:
+        (topicnum, query) = string.split(line.rstrip(), " ", 1)
+        trec_query = TrecQuery(topicnum, query)
+        trec_queries.append(trec_query)
+    fp.close()
+    return trec_queries
+
+def trec_results_from_trec_query_list(index, queries, len, *args, **kys):
+    results = []
+    for tq in queries:
+        result = index.trec_search(tq, len, *args, **kys)
+        results.append(result)
+    return results
+
+def trec_results_from_short_topic_file(index, filename, len, *args, **kys):
+    """Get a nested list of trec results for a topic file.
+    The outer list contains the results for each topic.
+    Each inner list contains TrecResult objects."""
+    queries = trec_queries_from_short_topic_file(filename)
+    return trec_results_from_trec_query_list(index, queries, len,
+            *args, **kys)
+
+def trec_eval_results(results, qrels, trec_eval_cmd="trec_eval", 
+        results_fn=tempfile.mktemp()):
+    """Execute trec_eval on the results of a trec run."""
+    results_fp = open(results_fn, 'w')
+    for result_set in results:
+        results_fp.writelines(map(lambda x: x.fmt() +"\n", result_set))
+    results_fp.close()
+    trec_eval_proc = os.popen("%s %s %s" % (trec_eval_cmd, 
+        qrels, results_fn))
+    trec_eval_out = parse_trec_eval_output(trec_eval_proc)
+    trec_eval_proc.close()
+    return trec_eval_out
diff --git a/src/pyzet/zetmodule.c b/src/pyzet/zetmodule.c
new file mode 100644 (file)
index 0000000..8eb6e98
--- /dev/null
@@ -0,0 +1,1617 @@
+#include <Python.h>
+#include <structmember.h>  /* for PyMemberDef */
+
+#include "firstinclude.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "def.h"
+#include "fdset.h"
+#include "vec.h"
+#include "index.h"
+#include "_index.h"
+#include "iobtree.h"
+#include "vocab.h"
+#include "mlparse.h"
+#include "str.h"
+#include "ndocmap.h"
+
+/* 
+ *  Utility function forward declarations.
+ */
+static PyObject * index_result_to_PyObject(struct index_result * result);
+static PyObject * index_results_to_PyObject(struct index_result * results,
+  unsigned int num_results, unsigned long int total_results);
+
+/* *****************************************************************
+ *
+ *  P A R S E R   O B J E C T
+ *
+ * *****************************************************************/
+
+/*
+ *  The actual object.
+ */
+typedef struct {
+    PyObject_HEAD
+    struct mlparse parser;
+    /* next two are read-only once the parser is created */
+    unsigned int wordlen;
+    unsigned int lookahead;
+    /* buffer that parser works off */
+    char * buf;
+    unsigned int buflen;
+    /* entity buffer, of length wordlen, contents length entity_len */
+    char * token;
+    unsigned int toklen;
+    /* flag to signify that current input is all there is.  This can be
+       set at any time. */
+    int eof;
+} zet_MLParserObject;
+
+/*
+ *  Method forward declarations.
+ */
+static void MLParser_dealloc(zet_MLParserObject * self);
+static int MLParser_init(zet_MLParserObject * self, PyObject * args,
+  PyObject * kwds);
+
+static PyObject * MLParser_add_input(PyObject * self, PyObject * args);
+static PyObject * MLParser_parse(PyObject * self, PyObject * args);
+static PyObject * MLParser_eof(PyObject * self, PyObject * args);
+
+/*
+ *  Methods visible from Python.
+ */
+static PyMethodDef MLParser_methods[] = {
+    {"add_input", MLParser_add_input, METH_VARARGS,
+        "Add input to the current input buffer"},
+    {"parse", MLParser_parse, METH_VARARGS,
+        "Parse another token from the input"},
+    {"eof", MLParser_eof, METH_NOARGS, 
+        "Notify parser that current input is all there is"},
+    {NULL}
+};
+
+/*
+ *  Type definition.
+ */
+static PyTypeObject zet_MLParserType = {
+    PyObject_HEAD_INIT(NULL)
+    .tp_name         = "zet.MLParser",
+    .tp_basicsize    = sizeof(zet_MLParserObject),
+    .tp_flags        = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    .tp_doc          = "(SG|X|HT)ML parser",
+    .tp_methods      = MLParser_methods,
+    .tp_init         = (initproc) MLParser_init,
+    .tp_dealloc      = (destructor) MLParser_dealloc
+};
+
+/*
+ *  Method definitions.
+ */
+
+static int MLParser_init(zet_MLParserObject * self, PyObject * args,
+  PyObject * kwds) {
+    /* Python paramlist is:
+       wordlen = 32, lookahead = 999 */
+    static char * kwlist[] = {"wordlen", "lookahead", NULL };
+    self->wordlen = 32;
+    self->lookahead = 999;
+    self->buflen = 0;
+    self->buf = NULL;
+    self->eof = 0;
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|II", kwlist,
+          &self->wordlen, &self->lookahead))
+        return -1;
+    if (!mlparse_new(&self->parser, self->wordlen, self->lookahead)) {
+        PyErr_SetString(PyExc_StandardError,
+          "error initialising parser");
+        return -1;
+    }
+    if ( (self->token = malloc(self->wordlen)) == NULL) {
+        PyErr_SetString(PyExc_MemoryError, 
+          "out of memory allocating word buffer");
+        mlparse_delete(&self->parser);
+        return -1;
+    }
+    self->toklen = 0;
+    self->parser.next_in = self->buf;
+    self->parser.avail_in = 0;
+    return 0;
+}
+
+static void MLParser_dealloc(zet_MLParserObject * self) {
+    if (self->buf != NULL)
+        free(self->buf);
+    mlparse_delete(&self->parser);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+static PyObject * MLParser_add_input(PyObject * self, PyObject * args) {
+    char * input;
+    int input_len;
+    unsigned int new_len;
+    char * new_buf;
+    zet_MLParserObject * parser = (zet_MLParserObject *) self;
+
+    if (!PyArg_ParseTuple(args, "s#", &input, &input_len))
+        return NULL;
+    /* FIXME if old buffer is finished, free it */
+    new_len = (unsigned) input_len + parser->buflen;
+    if ( (new_buf = realloc(parser->buf, new_len)) == NULL) {
+        PyErr_SetString(PyExc_MemoryError, 
+          "Out of memory extending parser buffer");
+    }
+    memcpy(new_buf + parser->buflen, input, input_len);
+    parser->parser.avail_in += input_len;
+    parser->parser.next_in = new_buf 
+        + (parser->parser.next_in - parser->buf);
+    parser->buflen = new_len;
+    parser->buf = new_buf;
+    return Py_BuildValue("i", new_len);
+}
+
+static PyObject * MLParser_parse(PyObject * self, PyObject * args) {
+    int parse_ret;
+    zet_MLParserObject * parser = (zet_MLParserObject *) self;
+    int strip = 1;  /* FIXME settable */
+    int end = 0;
+    int cont = 0;
+
+    parse_ret = mlparse_parse(&parser->parser, parser->token,
+      &parser->toklen, strip);
+    if (parse_ret == MLPARSE_INPUT) {
+        if (parser->eof) {
+            mlparse_eof(&parser->parser);
+            parse_ret = mlparse_parse(&parser->parser, parser->token,
+              &parser->toklen, strip);
+        } else {
+            /* FIXME need special-purpose exception */
+            PyErr_SetString(PyExc_IOError, "out of input");
+            return NULL;
+        }
+    }
+    if (parse_ret == MLPARSE_EOF) {
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+    if (parse_ret & MLPARSE_END) {
+        end = 1;
+        parse_ret ^= MLPARSE_END;
+    }
+    if (parse_ret & MLPARSE_CONT) {
+        cont = 1;
+        parse_ret ^= MLPARSE_CONT;
+    }
+    /* returns tuple:
+         (type, token, end?, cont?)
+       type has the end and cont flags filtered out.
+     */
+    return Py_BuildValue("(is#ii)", parse_ret, parser->token,
+      parser->toklen, end, cont);
+}
+
+static PyObject * MLParser_eof(PyObject * self, PyObject * args) {
+    ((zet_MLParserObject *) self)->eof = 1;
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+/* *****************************************************************
+ *
+ *  S E A R C H   R E S U L T   O B J E C T
+ *
+ * *****************************************************************/
+
+/*
+ *  The actual object.
+ */
+typedef struct {
+    PyObject_HEAD
+    unsigned long int docno;
+    double score;
+    PyObject * summary;
+    PyObject * title;
+    PyObject * auxiliary;
+} zet_SearchResultObject;
+
+/*
+ *  Members as visible from Python.
+ */
+static PyMemberDef SearchResult_members[] = {
+    {"docno", T_ULONG, offsetof(zet_SearchResultObject, docno), 0,
+        "docno"},
+    {"score", T_DOUBLE, offsetof(zet_SearchResultObject, score), 0,
+        "score"},
+    {"summary", T_OBJECT_EX, offsetof(zet_SearchResultObject, summary), 0,
+        "summary"},
+    {"title", T_OBJECT_EX, offsetof(zet_SearchResultObject, title), 0,
+        "title"},
+    {"auxiliary", T_OBJECT_EX, offsetof(zet_SearchResultObject, auxiliary), 0,
+        "auxiliary"},
+    {NULL}
+};
+
+/*
+ *  Method forward declarations.
+ */
+static void SearchResult_dealloc(zet_SearchResultObject * self);
+static PyObject * SearchResult_reduce(PyObject * self,
+  PyObject * ignored_args);
+static PyObject * SearchResult_str(zet_SearchResultObject * self);
+
+/*
+ *  Methods as visible from Python.
+ */
+static PyMethodDef SearchResult_methods[] = {
+    {"__reduce__", SearchResult_reduce, METH_NOARGS,
+        "Used for pickling a search result"},
+    {NULL}
+};
+
+/*
+ *  Type definition.
+ */
+static PyTypeObject zet_SearchResultType = {
+    PyObject_HEAD_INIT(NULL)
+    .tp_name        = "zet.SearchResult",
+    .tp_basicsize   = sizeof(zet_SearchResultObject),
+    .tp_flags       = Py_TPFLAGS_DEFAULT,
+    .tp_doc         = "Simple wrapper for an individual document "
+                      "search result",
+    .tp_methods     = SearchResult_methods,
+    .tp_members     = SearchResult_members,
+    .tp_dealloc     = (destructor) SearchResult_dealloc,
+    .tp_str         = (reprfunc) SearchResult_str,
+    .tp_repr        = (reprfunc) SearchResult_str,
+};
+
+/*
+ *  Method definitions.
+ */
+static void SearchResult_dealloc(zet_SearchResultObject * self) {
+    Py_DECREF(self->summary);
+    Py_DECREF(self->title);
+    Py_DECREF(self->auxiliary);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+static PyObject * SearchResult_reduce(PyObject * self,
+  PyObject * ignored_args) {
+    zet_SearchResultObject * result = (zet_SearchResultObject *) self;
+    PyObject * zetModule = PyImport_ImportModule("zet");
+    if (zetModule == NULL)
+        return NULL;
+    PyObject * fn_name = Py_BuildValue("s", "unpickle_search_result");
+    if (fn_name == NULL)
+        return NULL;
+    PyObject * unpickler = PyDict_GetItem(PyModule_GetDict(zetModule),
+      fn_name);
+    if (unpickler == NULL) {
+        Py_DECREF(fn_name);
+        PyErr_SetString(PyExc_NameError, 
+          "Can't find zet.unpickle_search_result");
+    }
+    return Py_BuildValue("O(kdOOO)", unpickler, result->docno, result->score,
+      result->summary, result->title, result->auxiliary);
+}
+
+static PyObject * SearchResult_str(zet_SearchResultObject * self) {
+    PyObject * args_tuple = Py_BuildValue("(kdOOO)", self->docno, 
+      self->score, self->summary, self->title, self->auxiliary);
+    PyObject * format = PyString_InternFromString("<SearchResult:: docno: %u, "
+      "score: %f, summary: %s, title: %s, auxiliary: %s>");
+    PyObject * str = PyString_Format(format, args_tuple);
+    Py_DECREF(format);
+    Py_DECREF(args_tuple);
+    return str;
+}
+
+/* *****************************************************************
+ *
+ *  S E A R C H   R E S U L T S   O B J E C T
+ *
+ * *****************************************************************/
+
+/*
+ *  The actual object.
+ */
+typedef struct {
+    PyObject_HEAD
+    unsigned long int total_results;
+    PyObject * results;
+} zet_SearchResultsObject;
+
+/*
+ *  Members as visible from Python.
+ */
+static PyMemberDef SearchResults_members[] = {
+    {"total_results", T_ULONG, offsetof(zet_SearchResultsObject, 
+      total_results), 0, "total results"},
+    {"results", T_OBJECT_EX, offsetof(zet_SearchResultsObject, 
+      results), 0, "results" },
+    {NULL}
+};
+
+/*
+ *  Method forward declarations.
+ */
+static void SearchResults_dealloc(zet_SearchResultsObject * self);
+
+/*
+ *  Methods as visible from Python.
+ */
+static PyMethodDef SearchResults_methods[] = {
+    {NULL}
+};
+
+/**
+ *  Type definition.
+ */
+static PyTypeObject zet_SearchResultsType = {
+    PyObject_HEAD_INIT(NULL)
+    .tp_name        = "zet.SearchResults",
+    .tp_basicsize   = sizeof(zet_SearchResultsObject),
+    .tp_flags       = Py_TPFLAGS_DEFAULT,
+    .tp_doc         = "Simple wrapper for search results",
+    .tp_methods     = SearchResults_methods,
+    .tp_members     = SearchResults_members,
+    .tp_dealloc     = (destructor) SearchResults_dealloc
+};
+
+/*
+ *  Method definitions. 
+ */
+static void SearchResults_dealloc(zet_SearchResultsObject * self) {
+    Py_DECREF(self->results);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+/* *****************************************************************
+ *
+ *  P O S T I N G   O B J E C T
+ *
+ * *****************************************************************/
+
+/*
+ *  The actual object.
+ */
+typedef struct {
+    PyObject_HEAD
+    unsigned long docno;
+    unsigned long f_dt;
+    PyObject * offsets;
+} zet_PostingObject;
+
+/*
+ *  Members as visible from Python.
+ */
+static PyMemberDef Posting_members[] = {
+    {"docno", T_ULONG, offsetof(zet_PostingObject, docno), 0, 
+        "document number"},
+    {"f_dt", T_ULONG, offsetof(zet_PostingObject, f_dt), 0,
+        "frequency of term in document"},
+    {"offsets", T_OBJECT_EX, offsetof(zet_PostingObject, offsets), 0,
+        "offsets of term in document, as a tuple"},
+    {NULL}
+};
+
+/*
+ *  Method forward declarations.
+ */
+static void Posting_dealloc(zet_PostingObject * self);
+
+/*
+ *  Object methods as visible from Python.
+ */
+static PyMethodDef Posting_methods[] = {
+    {NULL}
+};
+
+/*
+ *  Type definition.
+ */
+static PyTypeObject zet_PostingType = {
+    PyObject_HEAD_INIT(NULL)
+    .tp_name        = "zet.Posting",
+    .tp_basicsize   = sizeof(zet_PostingObject),
+    .tp_flags       = Py_TPFLAGS_DEFAULT,
+    .tp_doc         = "Wrapper for individual term/doc posting",
+    .tp_methods     = Posting_methods,
+    .tp_members     = Posting_members,
+    .tp_dealloc     = (destructor) Posting_dealloc
+};
+
+/*
+ *  Method definitions.
+ */
+static void Posting_dealloc(zet_PostingObject * self) {
+    Py_DECREF(self->offsets);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+/* *****************************************************************
+ *
+ *  P O S T I N G S   I T E R A T O R   O B J E C T
+ *
+ * *****************************************************************/
+
+/*
+ *  The postings object.
+ *
+ *  Must be forward-declared here because the iterator needs to
+ *  see its internals (and vice versa).
+ */
+typedef struct {
+    PyObject_HEAD
+    char * vec;
+    unsigned long size;
+    unsigned long docs;
+    unsigned long last;
+} zet_PostingsObject;
+
+/*
+ *  The iterator object.
+ */
+typedef struct {
+    PyObject_HEAD
+    unsigned long last_docno;
+    unsigned long vec_offset;
+    zet_PostingsObject * postings;
+} zet_PostingsIteratorObject;
+
+
+/*
+ *  Method forward declarations.
+ */
+static void PostingsIterator_dealloc(zet_PostingsIteratorObject * self);
+static PyObject * 
+PostingsIterator_iterator(zet_PostingsIteratorObject * self);
+static PyObject * PostingsIterator_next(zet_PostingsIteratorObject * self);
+static PyObject * PostingsIterator_get_last_docno(PyObject * self, 
+  PyObject * args);
+static PyObject * PostingsIterator_skip_to(PyObject * self,
+  PyObject * args);
+
+/*
+ *  Object methods visible from Python.
+ */
+static PyMethodDef PostingsIterator_methods[] = {
+    {"get_last_docno", PostingsIterator_get_last_docno, METH_NOARGS, 
+        "Get the last docno returned by iterator, or None if not started"},
+    {"skip_to", PostingsIterator_skip_to, METH_VARARGS,
+        "Seek forward to the next posting at or after the given docno"},
+    {NULL}
+};
+
+/*
+ *  Type definition.
+ */
+static PyTypeObject zet_PostingsIteratorType = {
+    PyObject_HEAD_INIT(NULL)
+    .tp_name         = "zet.PostingsIterator",
+    .tp_basicsize    = sizeof(zet_PostingsIteratorObject),
+    .tp_flags        = Py_TPFLAGS_DEFAULT,
+    .tp_doc          = "Iterator over a postings list",
+    .tp_methods      = PostingsIterator_methods,
+    .tp_dealloc      = (destructor) PostingsIterator_dealloc,
+    .tp_iter         = (getiterfunc) PostingsIterator_iterator,
+    .tp_iternext     = (iternextfunc) PostingsIterator_next
+};
+
+/*
+ *  Method definitions.
+ */
+static void PostingsIterator_dealloc(zet_PostingsIteratorObject * self) {
+    Py_DECREF((PyObject *) self->postings);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+static PyObject * 
+PostingsIterator_iterator(zet_PostingsIteratorObject * self) {
+    Py_INCREF(self);
+    return (PyObject *) self;
+}
+
+static PyObject * PostingsIterator_next(zet_PostingsIteratorObject * self) {
+    zet_PostingObject * posting;
+    struct vec vec;
+    unsigned long docno_d;
+    unsigned long f_dt;
+    unsigned long int offset = 0;
+    int i;
+
+    if (self->last_docno != (unsigned long) -1 && 
+      self->last_docno >= self->postings->last) {
+        return NULL;
+    }
+    if ( (posting = PyObject_New(zet_PostingObject, &zet_PostingType))
+          == NULL)
+        return NULL;
+    if (PyObject_Init((PyObject *) posting, &zet_PostingType) == NULL) {
+        PyObject_Del(posting);
+        return NULL;
+    }
+    /* ok, now we have to start reading through the vector */
+
+    vec.pos = self->postings->vec + self->vec_offset;
+    vec.end = vec.pos + self->postings->size;
+    vec_vbyte_read_unchecked(&vec, &docno_d);
+
+    if (self->last_docno == (unsigned long) -1)
+        posting->docno = docno_d;
+    else 
+        posting->docno = self->last_docno + docno_d + 1;
+    vec_vbyte_read_unchecked(&vec, &f_dt);
+    posting->f_dt = f_dt;
+    posting->offsets = PyTuple_New(f_dt);
+    if (posting->offsets == NULL) {
+        PyObject_Del(posting);
+        return NULL;
+    }
+
+    for (i = 0; i < f_dt; i++) {
+        unsigned long int offset_d;
+        PyObject * pyOffset;
+        vec_vbyte_read_unchecked(&vec, &offset_d);
+        if (i == 0)
+            offset = offset_d;
+        else
+            offset = offset + offset_d + 1;
+        pyOffset = Py_BuildValue("k", offset);
+        if (pyOffset == NULL) {
+            Py_DECREF(posting->offsets);
+            PyObject_Del(posting);
+            return NULL;
+        }
+        PyTuple_SET_ITEM(posting->offsets, i, pyOffset);
+    }
+
+    self->last_docno = posting->docno;
+    self->vec_offset = vec.pos - self->postings->vec;
+    return (PyObject *) posting;
+}
+
+static PyObject * 
+PostingsIterator_get_last_docno(PyObject * self, PyObject * args) {
+    return Py_BuildValue("k", 
+      ((zet_PostingsIteratorObject *) self)->last_docno);
+}
+
+static PyObject * PostingsIterator_skip_to(PyObject * self,
+  PyObject * args) {
+    unsigned long to_docno;
+    zet_PostingsIteratorObject * iterator 
+        = (zet_PostingsIteratorObject *) self;
+    struct vec vec;
+    unsigned long curr_docno;
+    unsigned long prev_docno;
+
+    if (!PyArg_ParseTuple(args, "k", &to_docno))
+        return NULL;
+    if (iterator->last_docno != (unsigned long) -1 
+      && to_docno <= iterator->last_docno) {
+        PyErr_SetString(PyExc_IndexError, "Already past specified docno");
+        return NULL;
+    }
+    vec.pos = iterator->postings->vec + iterator->vec_offset;
+    vec.end = vec.pos + iterator->postings->size;
+
+    prev_docno = curr_docno = iterator->last_docno;
+    while (curr_docno == (unsigned long) -1 
+      || (curr_docno < to_docno && curr_docno < iterator->postings->last)) {
+        unsigned long docno_d;
+        unsigned long vec_save_pos;
+
+        vec_save_pos = vec.pos - iterator->postings->vec;
+        vec_vbyte_read_unchecked(&vec, &docno_d);
+        prev_docno = curr_docno;
+        if (curr_docno == (unsigned long) -1)
+            curr_docno = docno_d;
+        else
+            curr_docno += (docno_d + 1);
+        if (curr_docno < to_docno) {
+            /* skip the offsets */
+            unsigned long f_dt;
+            unsigned int scanned;
+            vec_vbyte_read_unchecked(&vec, &f_dt);
+            vec_vbyte_scan_unchecked(&vec, f_dt, &scanned);
+        } else {
+            vec.pos = iterator->postings->vec + vec_save_pos;
+        }
+    }
+    iterator->vec_offset = vec.pos - iterator->postings->vec;
+    if (curr_docno >= to_docno)
+        iterator->last_docno = prev_docno;
+    else
+        iterator->last_docno = curr_docno;
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+/* *****************************************************************
+ * 
+ *  P O S T I N G S   O B J E C T
+ *
+ * *****************************************************************/
+
+/* See above under PostingsIterator for the object definition */
+
+/*
+ *  Members as visible from Python.
+ */
+/*static PyMemberDef Postings_members[] = {
+    {NULL}
+}; */
+
+/*
+ *  Method forward declarations.
+ */
+static void Postings_dealloc(zet_PostingsObject * self);
+static PyObject * Postings_iterator(zet_PostingsObject * self);
+
+/*
+ *  Methods as visible from Python.
+ */
+static PyMethodDef Postings_methods[] = {
+    {NULL}
+};
+
+/*
+ *  Type definition.
+ */
+static PyTypeObject zet_PostingsType = {
+    PyObject_HEAD_INIT(NULL)
+    .tp_name        = "zet.Postings",
+    .tp_basicsize   = sizeof(zet_PostingsObject),
+    .tp_flags       = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    .tp_doc         = "Wrapper for postings list",
+    .tp_methods     = Postings_methods,
+    .tp_dealloc     = (destructor) Postings_dealloc,
+    .tp_iter        = (getiterfunc) Postings_iterator
+};
+
+/*
+ *  Method definitions.
+ */
+static void Postings_dealloc(zet_PostingsObject * self) {
+    if (self->vec != NULL)
+        free(self->vec);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+static PyObject * Postings_iterator(zet_PostingsObject * self) {
+    zet_PostingsIteratorObject * iterator = PyObject_New
+        (zet_PostingsIteratorObject, &zet_PostingsIteratorType);
+    if (iterator == NULL)
+        return NULL;
+    if (PyObject_Init((PyObject *) iterator, 
+          &zet_PostingsIteratorType) == NULL) {
+        PyObject_Del(iterator);
+        return NULL;
+    }
+    iterator->last_docno = (unsigned long) -1;
+    iterator->vec_offset = 0;
+    iterator->postings = self;
+    Py_INCREF(self);
+    return (PyObject *) iterator;
+}
+
+/* *****************************************************************
+ *
+ *  V O C A B   E N T R Y
+ *
+ *  Returned by the VocabIterator (see next).
+ *
+ * *****************************************************************/
+
+typedef struct {
+    PyObject_HEAD
+    PyObject * term;  /* a python string */
+    unsigned long int size;
+    unsigned long int docs;
+    unsigned long int occurs;
+    unsigned long int last;
+} zet_VocabEntryObject;
+
+static PyMemberDef VocabEntry_members[] = {
+    { "term", T_OBJECT_EX, offsetof(zet_VocabEntryObject, term), 0, "term" },
+    { "size", T_ULONG, offsetof(zet_VocabEntryObject, size), 0, "size" },
+    { "docs", T_ULONG, offsetof(zet_VocabEntryObject, docs), 0, "docs" },
+    { "occurs", T_ULONG, offsetof(zet_VocabEntryObject, occurs), 0, "occurs" },
+    { "last", T_ULONG, offsetof(zet_VocabEntryObject, last), 0, "last" },
+    { NULL }
+};
+
+/*
+ *  Method forward declarations.
+ */
+static void VocabEntry_dealloc(zet_VocabEntryObject * self);
+static PyObject * VocabEntry_get_term(PyObject * self, PyObject * args);
+static PyObject * VocabEntry_get_size(PyObject * self, PyObject * args);
+static PyObject * VocabEntry_get_occurs(PyObject * self, PyObject * args);
+
+/*
+ *  Object methods as visible from Python.
+ */
+static PyMethodDef VocabEntry_methods[] = {
+    {"get_term", VocabEntry_get_term, METH_NOARGS, "Get the term"},
+    {"get_size", VocabEntry_get_size, METH_NOARGS, "Get the size"},
+    {"get_occurs", VocabEntry_get_occurs, METH_NOARGS, "Get the occurs"},
+    {NULL}
+};
+
+/*
+ *  Type definition.
+ */
+static PyTypeObject zet_VocabEntryType = {
+    PyObject_HEAD_INIT(NULL)
+    .tp_name        = "zet.VocabEntry",
+    .tp_basicsize   = sizeof(zet_VocabEntryObject),
+    .tp_flags       = Py_TPFLAGS_DEFAULT,
+    .tp_doc         = "Wrapper for vocab entry",
+    .tp_methods     = VocabEntry_methods,
+    .tp_members     = VocabEntry_members,
+    .tp_dealloc     = (destructor) VocabEntry_dealloc
+};
+
+/*
+ *  Method definitions.
+ */
+static void VocabEntry_dealloc(zet_VocabEntryObject * self) {
+    Py_DECREF(self->term);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+static PyObject * VocabEntry_get_term(PyObject * self,
+  PyObject * args) {
+    zet_VocabEntryObject * ref = (zet_VocabEntryObject *) self;
+    Py_INCREF(ref->term);
+    return ref->term;
+}
+
+static PyObject * VocabEntry_get_size(PyObject * self, PyObject * args) {
+    zet_VocabEntryObject * ref = (zet_VocabEntryObject *) self;
+    return Py_BuildValue("k", ref->size);
+}
+
+static PyObject * VocabEntry_get_occurs(PyObject * self, PyObject * args) {
+    zet_VocabEntryObject * ref = (zet_VocabEntryObject *) self;
+    return Py_BuildValue("k", ref->occurs);
+}
+
+/* *****************************************************************
+ *
+ *  V O C A B   I T E R A T O R
+ *
+ *  NOTE: currently, this only returns the first vocab entry for
+ *  each term, and it assumes that vocab entry is for a doc-ordered
+ *  list with word positions.
+ *
+ * *****************************************************************/
+
+typedef struct zet_IndexObject {
+    PyObject_HEAD
+    struct index * idx;
+} zet_IndexObject;
+
+typedef struct {
+    PyObject_HEAD
+    unsigned int state[3];
+    struct zet_IndexObject * idx;
+} zet_VocabIteratorObject;
+
+/*
+ *  Method forward declarations.
+ *  
+ *  NOTE: no allocator, because these can only be made by Index
+ *  objects.
+ */
+static void VocabIterator_dealloc(zet_VocabIteratorObject * self);
+static PyObject * VocabIterator_iterator(zet_VocabIteratorObject * self);
+static PyObject * VocabIterator_next(zet_VocabIteratorObject * self);
+
+/*
+ *  Object methods visible from Python.
+ */
+static PyMethodDef VocabIterator_methods[] = {
+    {NULL}
+};
+
+/*
+ *  Type definition.
+ */
+static PyTypeObject zet_VocabIteratorType = {
+    PyObject_HEAD_INIT(NULL)
+    .tp_name           = "zet.VocabIterator",
+    .tp_basicsize      = sizeof(zet_VocabIteratorObject),
+    .tp_flags          = Py_TPFLAGS_DEFAULT,
+    .tp_doc            = "Iterator over an index's vocab",
+    .tp_methods        = VocabIterator_methods,
+    .tp_dealloc        = (destructor) VocabIterator_dealloc,
+    .tp_iter           = (getiterfunc) VocabIterator_iterator,
+    .tp_iternext       = (iternextfunc) VocabIterator_next
+};
+
+/*
+ *  Method definitions.
+ */
+static void VocabIterator_dealloc(zet_VocabIteratorObject * self) {
+    Py_DECREF((PyObject *) self->idx);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+static PyObject * VocabIterator_iterator(zet_VocabIteratorObject * self) {
+    /* GOTCHA you must return a _new_ reference to self in this method. */
+    Py_INCREF(self);
+    return (PyObject *) self;
+}
+
+static PyObject * VocabIterator_next(zet_VocabIteratorObject * self) {
+    zet_VocabEntryObject * py_vocab_entry;
+    const char * term;
+    unsigned int termlen;
+    void * data;
+    unsigned int datalen;
+    struct vocab_vector vocab_entry;
+    struct vec vec;
+
+    term = iobtree_next_term(self->idx->idx->vocab, self->state, &termlen,
+      &data, &datalen);
+    if (term == NULL)
+        return NULL;
+
+    vec.pos = data;
+    vec.end = vec.pos + datalen;
+    if ( (vocab_decode(&vocab_entry, &vec)) != VOCAB_OK) {
+        PyErr_SetString(PyExc_StandardError, "Unable to decode vocab entry");
+        return NULL;
+    }
+
+    if ((py_vocab_entry = PyObject_New(zet_VocabEntryObject, 
+              &zet_VocabEntryType)) == NULL)
+        return NULL;
+    if (PyObject_Init((PyObject *) py_vocab_entry, 
+          &zet_VocabEntryType) == NULL) {
+        PyObject_Del(py_vocab_entry);
+        return NULL;
+    }
+    py_vocab_entry->term = Py_BuildValue("s#", term, (int) termlen);
+    if (py_vocab_entry->term == NULL) {
+        PyObject_Del(py_vocab_entry);
+        return NULL;
+    }
+    py_vocab_entry->size = vocab_entry.size;
+    py_vocab_entry->docs = vocab_docs(&vocab_entry);
+    py_vocab_entry->occurs = vocab_occurs(&vocab_entry);
+    py_vocab_entry->last = vocab_last(&vocab_entry);
+    return (PyObject *) py_vocab_entry;
+}
+
+/* *****************************************************************
+ *
+ *  I N D E X   O B J E C T
+ *
+ * *****************************************************************/
+
+/*
+ *  The actual object.
+ *
+ *  Forward-declared before the VocabIterator.
+ */
+
+/*
+ *  Members as visible from Python.
+ */
+static PyMemberDef Index_members[] = {
+    {NULL}
+};
+
+/* 
+ *  Method forward declarations.
+ */
+static int Index_init(zet_IndexObject * self, PyObject * args, PyObject * kwds);
+static void Index_dealloc(zet_IndexObject * self);
+
+static PyObject * Index_search(PyObject * self, PyObject * args,
+  PyObject * kwds); 
+static PyObject * Index_retrieve(PyObject * self, PyObject * args, 
+  PyObject * kwds);
+static PyObject * Index_term_info(PyObject * self, PyObject * args);
+static PyObject * Index_term_postings(PyObject * self, PyObject * args);
+static PyObject * Index_vocab_iterator(PyObject * self, PyObject * args);
+static PyObject * Index_num_docs(PyObject * self, PyObject * args);
+static PyObject * Index_vocab_size(PyObject * self, PyObject * args);
+static PyObject * Index_doc_aux(PyObject * self, PyObject * args);
+
+/*
+ *  Object methods as visible from Python.
+ */
+static PyMethodDef Index_methods[] = {
+    {"search", (PyCFunction) Index_search, METH_VARARGS | METH_KEYWORDS, 
+        "Execute search upon an Index object"},
+    {"retrieve", (PyCFunction) Index_retrieve, METH_VARARGS | METH_KEYWORDS,
+        "Retrieve a document, or portion thereof, from the cache"},
+    {"term_info", Index_term_info, METH_VARARGS,
+        "Retrieve stats on a term within the index"},
+    {"term_postings", Index_term_postings, METH_VARARGS,
+        "Retrieve postings for a term"},
+    {"vocab_iterator", Index_vocab_iterator, METH_VARARGS,
+        "Get an iterator over the vocab of the index"},
+    {"num_docs", Index_num_docs, METH_NOARGS, 
+        "Get the total number of documents in the indexed collection"},
+    {"vocab_size", Index_vocab_size, METH_NOARGS,
+        "Get the number of terms in the index vocab" },
+    {"doc_aux", Index_doc_aux, METH_VARARGS,
+        "Get the auxiliary information for a document."},
+    {NULL}
+};
+
+/*
+ *  Type definition.
+ */
+static PyTypeObject zet_IndexType = {
+    /* NB: C99-style initialisation */
+    PyObject_HEAD_INIT(NULL)
+    .tp_name        = "zet.Index",
+    .tp_basicsize   = sizeof(zet_IndexObject),
+    .tp_flags       = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    .tp_doc         = "Wrapper for Zettair index object",
+    .tp_methods     = Index_methods,
+    .tp_members     = Index_members,
+    .tp_init        = (initproc) Index_init,
+    .tp_dealloc     = (destructor) Index_dealloc
+};
+
+/*
+ *  Method definitions.
+ */
+static void Index_dealloc(zet_IndexObject * self) {
+    if (self->idx != NULL)
+        index_delete(self->idx);
+    self->ob_type->tp_free((PyObject *) self);
+}
+
+static int Index_init(zet_IndexObject * self, PyObject * args, 
+  PyObject * kwds) {
+    char * prefix = "index";
+    struct index * idx = NULL;
+    int lopts = INDEX_LOAD_NOOPT;
+    struct index_load_opt lopt;
+    static char * kwlist[] = { "prefix", NULL };
+
+    lopts |= INDEX_LOAD_IGNORE_VERSION;  /* quick hack */
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|s", kwlist,
+          &prefix))
+        return -1;
+    if ( (idx = index_load(prefix, MEMORY_DEFAULT, lopts, &lopt)) == NULL) {
+        PyErr_SetString(PyExc_StandardError, "Unable to load index");
+        return -1;
+    }
+    self->idx = idx;
+    return 0;
+}
+
+static PyObject * Index_search(PyObject * self, PyObject * args, 
+  PyObject * kwds) {
+    char * query;
+    char * optType = NULL;
+    PyObject * optArgsTuple = NULL;
+    unsigned long startdoc;
+    unsigned long len;
+    zet_IndexObject * Index = (zet_IndexObject *) self;
+    struct index_result * result;
+    unsigned int results;
+    unsigned long int total_results;
+    unsigned int accumulator_limit = 0;
+    int opts = INDEX_SEARCH_NOOPT;
+    struct index_search_opt opt;
+    static char * kwlist[] = {"query", "start_doc", "len", "opt_type",
+        "opt_args", "accumulator_limit", NULL};
+    PyObject * pyResults;
+
+    opt.u.okapi_k3.k1 = 1.2;
+    opt.u.okapi_k3.k3 = 1e10;
+    opt.u.okapi_k3.b = 0.75;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, "skk|sOk", kwlist, &query,
+          &startdoc, &len, &optType, &optArgsTuple, &accumulator_limit))
+        return NULL;
+    if ( (result = malloc(sizeof(*result) * len)) == NULL) {
+        PyErr_SetString(PyExc_MemoryError, "Unable to allocate results");
+        return NULL;
+    }
+    if (optType != NULL) {
+        if (strcmp(optType, "COSINE") == 0) {
+            opts = INDEX_SEARCH_COSINE_RANK;
+        } else if (strcmp(optType, "OKAPI") == 0) {
+            opts = INDEX_SEARCH_OKAPI_RANK;
+        } else if (strcmp(optType, "OKAPI_K3") == 0) {
+            if (optArgsTuple == NULL) {
+                PyErr_SetString(PyExc_StandardError, "Must supply args to "
+                  "search type");
+                return NULL;
+            }
+            opts = INDEX_SEARCH_OKAPI_RANK;
+            if (!PyArg_ParseTuple(optArgsTuple, "ddd",
+                  &opt.u.okapi_k3.k1, &opt.u.okapi_k3.k3, &opt.u.okapi_k3.b)) {
+                return NULL;
+            }
+        } else if (strcmp(optType, "HAWKAPI") == 0) {
+            if (optArgsTuple == NULL) {
+                PyErr_SetString(PyExc_StandardError, "Must supply args to "
+                  "search type");
+                return NULL;
+            }
+            opts = INDEX_SEARCH_HAWKAPI_RANK;
+            if (!PyArg_ParseTuple(optArgsTuple, "dd", &opt.u.hawkapi.alpha,
+                  &opt.u.hawkapi.k3)) {
+                return NULL;
+            }
+        } else if (strcmp(optType, "DIRICHLET") == 0) {
+            opts = INDEX_SEARCH_DIRICHLET_RANK;
+            if (optArgsTuple == NULL || PyTuple_Size(optArgsTuple) == 0) {
+                opt.u.dirichlet.mu = 2500.0;
+            } else if (!PyArg_ParseTuple(optArgsTuple, "f",
+                  &opt.u.dirichlet.mu)) {
+                return NULL;
+            }
+        } else {
+            PyErr_SetString(PyExc_StandardError, "Unknown search type");
+            return NULL;
+        }
+    }
+    if (accumulator_limit != 0) {
+        opts |= INDEX_SEARCH_ACCUMULATOR_LIMIT;
+        opt.accumulator_limit = accumulator_limit;
+    }
+    if (!index_search(Index->idx, query, startdoc, len,
+          result, &results, &total_results, opts, &opt)) {
+        char err_buf[1024];
+        snprintf(err_buf, 1024, "Unable to perform search for query '%s'; "
+           "system error is '%s'\n", query, strerror(errno));
+        PyErr_SetString(PyExc_StandardError, err_buf);
+        free(result);
+        return NULL;
+    }
+    pyResults = index_results_to_PyObject(result, results, total_results);
+    free(result);
+    return pyResults;
+}
+
+static PyObject * Index_retrieve(PyObject * self, PyObject * args, 
+  PyObject * kwds) {
+    unsigned long int docno;
+    unsigned long int offset = 0;
+    char * dst = NULL;
+    unsigned int len = 0;
+    unsigned int retrieved_len;
+    PyObject * doc = NULL;
+    static char * kwlist[] = { "docno", "offset", "len", NULL };
+    zet_IndexObject * Index = (zet_IndexObject *) self;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, "k|kI", kwlist, &docno,
+          &offset, &len)) 
+        return NULL;
+    if (len == 0) {
+        unsigned int bytes;
+
+        bytes = index_retrieve_doc_bytes(Index->idx, docno);
+        if (bytes == UINT_MAX) {
+            PyErr_SetString(PyExc_StandardError, 
+              "Unable to retrieve doc stats");
+            return NULL;
+        }
+        len = bytes - offset;
+    }
+    if ( (dst = malloc(len)) == NULL) {
+        PyErr_SetString(PyExc_MemoryError, "Out of memory");
+        return NULL;
+    }
+    retrieved_len = index_retrieve(Index->idx, docno, offset,
+       dst, len);
+    if (retrieved_len == (unsigned int) -1) {
+        PyErr_SetString(PyExc_StandardError, "Error retrieving document");
+    } else {
+        doc = Py_BuildValue("s#", dst, (int) retrieved_len);
+    }
+
+    free(dst);
+    return doc;
+}
+
+/* XXX should return the VocabEntry object defined above for the
+ * vocab iterator */
+static PyObject * Index_term_info(PyObject * self, PyObject * args) {
+    zet_IndexObject * Index = (zet_IndexObject *) self;
+    struct iobtree * vocab = Index->idx->vocab;
+    char * term;
+    unsigned int termlen;
+    void * term_data;
+    unsigned int veclen;
+    struct vocab_vector ve;
+    struct vec vec;
+
+    if (!PyArg_ParseTuple(args, "s", &term))
+        return NULL;
+    termlen = strlen(term);
+    term_data = iobtree_find(vocab, term, termlen, 0, &veclen);
+    if (term_data == NULL) {
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+    vec.pos = term_data;
+    vec.end = term_data + veclen;
+    if (vocab_decode(&ve, &vec) != VOCAB_OK) {
+        PyErr_SetString(PyExc_StandardError, "Error decoding vocab vector");
+        return NULL;
+    }
+    /* XXX handle other types of vocab vector */
+    if (ve.type != VOCAB_VTYPE_DOCWP) {
+        PyErr_SetString(PyExc_StandardError, "Expected first vocab vector "
+          "entry to be doc-ordered with word positions, but this was not "
+          "the case");
+        return NULL;
+    }
+    return Py_BuildValue("(kkkk)", ve.header.docwp.docs, 
+      ve.header.docwp.occurs, ve.header.docwp.last, ve.size);
+}
+
+static PyObject * Index_term_postings(PyObject * self, PyObject * args) {
+    zet_IndexObject * Index = (zet_IndexObject *) self;
+    struct index * idx = Index->idx;
+    struct iobtree * vocab = idx->vocab;
+    char * term;
+    unsigned int termlen;
+    struct vocab_vector ve;
+    struct vec vec;
+    void * term_data;
+    unsigned int veclen;
+    int fd;
+    zet_PostingsObject * postings;
+
+    /* FIXME copy of above */
+    if (!PyArg_ParseTuple(args, "s", &term))
+        return NULL;
+    termlen = strlen(term);
+    term_data = iobtree_find(vocab, term, termlen, 0, &veclen);
+    if (term_data == NULL) {
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+    vec.pos = term_data;
+    vec.end = term_data + veclen;
+    if (vocab_decode(&ve, &vec) != VOCAB_OK) {
+        PyErr_SetString(PyExc_StandardError, "Error decoding vocab entry");
+        return NULL;
+    }
+    /* XXX handle other types of vocab vector */
+    if (ve.type != VOCAB_VTYPE_DOCWP) {
+        PyErr_SetString(PyExc_StandardError, "Expected first vocab vector "
+          "entry to be doc-ordered with word positions, but this was not "
+          "the case");
+        return NULL;
+    }
+    if (ve.location != VOCAB_LOCATION_FILE) {
+        PyErr_SetString(PyExc_StandardError, 
+          "I only handle on-file vectors");
+        return NULL;
+    }
+    if ( (postings = PyObject_New(zet_PostingsObject, 
+              &zet_PostingsType)) == NULL) {
+        return NULL;
+    }
+    if (PyObject_Init((PyObject *) postings, &zet_PostingsType) == NULL) {
+        PyObject_Del(postings);
+        return NULL;
+    }
+    postings->size = ve.size;
+    postings->docs = ve.header.docwp.docs;
+    postings->last = ve.header.docwp.last;
+    if ( (postings->vec = malloc(ve.size)) == NULL) {
+        PyErr_SetString(PyExc_MemoryError, 
+          "Out of memory allocating vector buffer");
+        PyObject_Del(postings);
+        return NULL;
+    }
+    fd = fdset_pin(idx->fd, idx->index_type, ve.loc.file.fileno, 
+      ve.loc.file.offset, SEEK_SET);
+    if (fd == -1 || read(fd, postings->vec, ve.size) < ve.size) {
+        PyErr_SetString(PyExc_IOError, "Unable to read from vector file");
+        free(postings->vec);
+        PyObject_Del(postings);
+        return NULL;
+    }
+    fdset_unpin(idx->fd, idx->index_type, ve.loc.file.fileno, fd);
+    return (PyObject *) postings;
+}
+
+static PyObject * Index_vocab_iterator(PyObject * self, PyObject * args) {
+    zet_VocabIteratorObject * iterator = PyObject_New
+        (zet_VocabIteratorObject, &zet_VocabIteratorType);
+    if (iterator == NULL)
+        return NULL;
+    if (PyObject_Init((PyObject *) iterator, &zet_VocabIteratorType) == NULL) {
+        PyObject_Del(iterator);
+        return NULL;
+    }
+
+    iterator->state[0] = 0;
+    iterator->state[1] = 0;
+    iterator->state[2] = 0;
+    iterator->idx = (zet_IndexObject *) self;
+    Py_INCREF(self);
+    return (PyObject *) iterator;
+}
+
+static PyObject * Index_num_docs(PyObject * self, PyObject * args) {
+    zet_IndexObject * Index = (zet_IndexObject *) self;
+    struct index * idx = Index->idx;
+    unsigned long num_docs;
+
+    num_docs = ndocmap_entries(idx->map);
+    return Py_BuildValue("k", num_docs);
+}
+
+static PyObject * Index_vocab_size(PyObject * self, PyObject * args) {
+    zet_IndexObject * Index = (zet_IndexObject *) self;
+    struct index * idx = Index->idx;
+    unsigned long vocab_size;
+
+    vocab_size = iobtree_size(idx->vocab);
+    return Py_BuildValue("k", vocab_size);
+}
+
+#define AUX_BUF_LEN 1024
+
+static PyObject * Index_doc_aux(PyObject * self, PyObject * args) {
+    zet_IndexObject * Index = (zet_IndexObject *) self;
+    struct index * idx = Index->idx;
+    struct ndocmap * docmap = idx->map;
+    char aux_buf[AUX_BUF_LEN];
+    unsigned aux_len;
+    unsigned long int docno;
+    enum ndocmap_ret ret;
+
+    if (!PyArg_ParseTuple(args, "k", &docno))
+        return NULL;
+    ret = ndocmap_get_aux(docmap, docno, aux_buf, AUX_BUF_LEN, &aux_len);
+    if (ret != NDOCMAP_OK) {
+        /* error might be NDOCMAP_BUFSIZE_ERROR, but life is too short... */
+        PyErr_SetString(PyExc_IOError, "Unable to read aux info");
+        return NULL;
+    }
+    return Py_BuildValue("s#", aux_buf, (int) aux_len);
+}
+
+/* *****************************************************************
+ *
+ * U T I L I T Y   F U N C T I O N S
+ *
+ * *****************************************************************/
+
+static PyObject * index_result_to_PyObject(struct index_result * result) {
+    zet_SearchResultObject * pyResult = PyObject_New(zet_SearchResultObject,
+      &zet_SearchResultType);
+    if (pyResult == NULL)
+        return NULL;
+    if (PyObject_Init((PyObject *) pyResult, 
+          &zet_SearchResultType) == NULL) {
+        PyObject_Del(pyResult); /* not DECREF, as not fully initialised */
+        return NULL;
+    }
+    pyResult->docno = result->docno;
+    pyResult->score = result->score;
+    if ((pyResult->summary = Py_BuildValue("z", result->summary)) == NULL) {
+        PyObject_Del(pyResult);
+        return NULL;
+    }
+    if ((pyResult->title = Py_BuildValue("z", result->title)) == NULL) {
+        Py_DECREF(pyResult->summary);
+        PyObject_Del(pyResult);
+        return NULL;
+    }
+    if ((pyResult->auxiliary = Py_BuildValue("z", 
+              result->auxilliary)) == NULL) {
+        Py_DECREF(pyResult->summary);
+        Py_DECREF(pyResult->auxiliary);
+        PyObject_Del(pyResult);
+        return NULL;
+    }
+    return (PyObject *) pyResult;
+    /*PyObject * tuple = Py_BuildValue("(kdsss)", result->docno,
+      result->score, result->summary, result->title, result->auxilliary);
+    return tuple; */
+}
+
+static PyObject * index_results_to_PyObject(struct index_result * results,
+  unsigned int num_results, unsigned long int total_results) {
+    int i;
+    zet_SearchResultsObject * pyResult = PyObject_New(zet_SearchResultsObject,
+      &zet_SearchResultsType);
+    if (pyResult == NULL)
+        return NULL;
+    if (PyObject_Init((PyObject *) pyResult, 
+          &zet_SearchResultsType) == NULL) {
+        PyObject_Del(pyResult); /* not DECREF, as not fully initialised */
+        return NULL;
+    }
+    PyObject * results_tuple = PyTuple_New(num_results);
+    if (results_tuple == NULL) {
+        PyObject_Del(pyResult); /* not DECREF, as not fully initialised */
+        return NULL;
+    }
+    pyResult->results = results_tuple;
+    pyResult->total_results = total_results;
+    /* from here, pyResult is fully initialised */
+    for (i = 0; i < num_results; i++) {
+        PyObject * result_tuple = index_result_to_PyObject(&results[i]);
+        if (result_tuple == NULL) {
+            Py_DECREF(pyResult);
+            return NULL;
+        }
+        PyTuple_SET_ITEM(results_tuple, i, result_tuple);
+    }
+    return (PyObject *) pyResult;
+}
+
+/* *****************************************************************
+ *
+ * Z E T   M O D U L E
+ *
+ * *****************************************************************/
+
+/*
+ *  Module method forward declarations.
+ */
+static PyObject * zet_search(PyObject *self, PyObject *args);
+static PyObject * zet_extract_words(PyObject *self, PyObject *args);
+static PyObject * zet_unpickle_search_result(PyObject * self, PyObject * args);
+static PyObject * zet_hash(PyObject * self, PyObject * args);
+
+/*
+ *  Methods as visible from Python.
+ */
+static PyMethodDef ZetMethods[] = {
+    {"search", zet_search, METH_VARARGS, "Execute a zettair search."},
+    {"extract_words", zet_extract_words, METH_VARARGS, 
+        "Extract a list of words from a string, using the Zettair parser"},
+    {"unpickle_search_result", zet_unpickle_search_result, METH_VARARGS,
+        "Constructor called when unpickling search results"},
+    {"hash", zet_hash, METH_VARARGS, 
+        "Hash a string according to the zettair's hash algorithm"},
+    { NULL, NULL, 0, NULL }
+};
+
+/*
+ *  Method definitions.
+ */
+static PyObject *
+zet_search(PyObject *self, PyObject *args) {
+    char * prefix;
+    char * query;
+    unsigned long startdoc;
+    unsigned long len;
+    struct index * idx;
+    struct index_result * result;
+    unsigned int results;
+    unsigned long int total_results;
+    int opts = INDEX_SEARCH_NOOPT;
+    struct index_search_opt opt;
+
+    if (!PyArg_ParseTuple(args, "sskk", &prefix, &query, &startdoc,
+          &len))
+        return NULL;
+    if ( (idx = index_load(prefix, MEMORY_DEFAULT,
+              INDEX_LOAD_NOOPT, NULL)) == NULL) {
+        PyErr_SetString(PyExc_StandardError, "Unable to load index");
+        return NULL;
+    }
+    if ( (result = malloc(sizeof(*result) * len)) == NULL) {
+        PyErr_SetString(PyExc_MemoryError, "Unable to allocate results");
+        index_delete(idx);
+        return NULL;
+    }
+    if (!index_search(idx, query, startdoc, len, result, 
+          &results, &total_results, opts, &opt)) {
+        PyErr_SetString(PyExc_StandardError, "Unable to perform search");
+        free(result);
+        index_delete(idx);
+        return NULL;
+    }
+    PyObject * results_tuple = index_results_to_PyObject(result, results,
+      total_results);
+    free(result);
+    index_delete(idx);
+    return results_tuple;
+}
+
+static PyObject * zet_extract_words(PyObject *self, PyObject *args) {
+    char * buf;
+    unsigned int wordlen = TERMLEN_DEFAULT;
+    unsigned int lookahead = LOOKAHEAD;
+    int limit = -1;
+    int word_count = 0;
+    struct mlparse parser;
+    char * word_buf;
+    unsigned int len;
+    int buflen;
+    int parse_ret;
+    PyObject * word_list;
+
+    if (!PyArg_ParseTuple(args, "s#|iII", &buf, &buflen, &limit, 
+          &wordlen, &lookahead))
+        return NULL;
+    if ( (word_list = PyList_New(0)) == NULL)
+        return NULL;
+    if ( (word_buf = malloc(wordlen + 1)) == NULL) {
+        PyErr_SetString(PyExc_MemoryError, "Allocating word buffer");
+        Py_DECREF(word_list);
+        return NULL;
+    }
+    if (!mlparse_new(&parser, wordlen, lookahead)) {
+        PyErr_SetString(PyExc_StandardError, "Unable to initialise parser");
+        free(word_buf);
+        Py_DECREF(word_list);
+        return NULL;
+    }
+    parser.next_in = buf;
+    parser.avail_in = buflen;
+    while ( (parse_ret = mlparse_parse(&parser, word_buf, &len, 1)) 
+      != MLPARSE_EOF && (limit < 0 || word_count < limit)) {
+        if (parse_ret == MLPARSE_WORD || parse_ret == (MLPARSE_WORD
+          | MLPARSE_END)) {
+            PyObject * pyWord = Py_BuildValue("s#", word_buf, len);
+            if (pyWord == NULL || PyList_Append(word_list, pyWord) < 0) {
+                free(word_buf);
+                Py_DECREF(word_list);
+                if (pyWord != NULL) {
+                    Py_DECREF(pyWord);
+                }
+                return NULL;
+            }
+            word_count++;
+            Py_DECREF(pyWord);
+        } else if (parse_ret == MLPARSE_INPUT) {
+            mlparse_eof(&parser);
+        }
+    }
+    mlparse_delete(&parser);
+    return word_list;
+}
+
+/* NOTE: this is a module method, _NOT_ a class method */
+static PyObject * zet_unpickle_search_result(PyObject * self, PyObject * args) {
+    unsigned long docno;
+    double score;
+    PyObject * summary;
+    PyObject * title;
+    PyObject * auxiliary;
+    zet_SearchResultObject * pyResult;
+
+    if (!PyArg_ParseTuple(args, "kdSSS", &docno, &score, &summary,
+          &title, &auxiliary))
+        return NULL;
+    if ( (pyResult = PyObject_New(zet_SearchResultObject, 
+              &zet_SearchResultType)) == NULL)
+        return NULL;
+    pyResult->docno = docno;
+    pyResult->score = score;
+    pyResult->summary = summary;
+    pyResult->title = title;
+    pyResult->auxiliary = auxiliary;
+    Py_INCREF(summary);
+    Py_INCREF(title);
+    Py_INCREF(auxiliary);
+    return (PyObject *) pyResult;
+}
+
+static PyObject *
+zet_hash(PyObject *self, PyObject *args) {
+    char * string;
+    unsigned hval;
+    int modulus = -1;
+    if (!PyArg_ParseTuple(args, "s|k", &string, &modulus))
+        return NULL;
+    hval = str_hash(string);
+    if (modulus > 0)
+        hval %= modulus;
+    return Py_BuildValue("i", hval);
+}
+
+/*
+ *  Module initialization.
+ */
+PyMODINIT_FUNC initzet(void) {
+    PyObject * m;
+
+    /* Index type initialisation */
+    zet_IndexType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_IndexType) < 0)
+        return;
+
+    /* SearchResult type initialisation */
+    zet_SearchResultType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_SearchResultType) < 0)
+        return;
+
+    /* SearchResults type initialisation */
+    zet_SearchResultsType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_SearchResultsType) < 0)
+        return;
+
+    /* Posting type initialisation */
+    zet_PostingType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_PostingType) < 0)
+        return;
+
+    /* Postings type initialisation */
+    zet_PostingsType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_PostingsType) < 0)
+        return;
+
+    /* PostingsIterator type initialisation */
+    zet_PostingsIteratorType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_PostingsIteratorType) < 0)
+        return;
+
+    /* VocabEntry type initialisation */
+    zet_VocabEntryType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_VocabEntryType) < 0)
+        return;
+
+    /* VocabIterator type initialisation */
+    zet_VocabIteratorType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_VocabIteratorType) < 0)
+        return;
+
+    /* MLParser type initialisation */
+    zet_MLParserType.tp_new = PyType_GenericNew;
+    if (PyType_Ready(&zet_MLParserType) < 0)
+        return;
+
+    /* Module initialisation */
+    m = Py_InitModule3("zet", ZetMethods, "Module that wraps Zettair");
+    if (m == NULL)
+        return;
+
+    /* Adding Index type to module */
+    Py_INCREF(&zet_IndexType);
+    PyModule_AddObject(m, "Index", (PyObject *) &zet_IndexType);
+
+    /* Adding SearchResults type to module */
+    Py_INCREF(&zet_SearchResultType);
+    PyModule_AddObject(m, "SearchResult", (PyObject *) &zet_SearchResultType);
+
+    /* Adding SearchResults type to module */
+    Py_INCREF(&zet_SearchResultsType);
+    PyModule_AddObject(m, "SearchResults", (PyObject *) &zet_SearchResultsType);
+
+    /* Adding Posting type to module */
+    Py_INCREF(&zet_PostingType);
+    PyModule_AddObject(m, "Posting", (PyObject *) &zet_PostingType);
+
+    /* Adding Postings type to module */
+    Py_INCREF(&zet_PostingsType);
+    PyModule_AddObject(m, "Postings", (PyObject *) &zet_PostingsType);
+
+    /* Adding PostingsIterator type to module */
+    Py_INCREF(&zet_PostingsIteratorType);
+    PyModule_AddObject(m, "PostingsIterator", 
+      (PyObject *) &zet_PostingsIteratorType);
+
+    /* Adding VocabEntry type to module */
+    Py_INCREF(&zet_VocabEntryType);
+    PyModule_AddObject(m, "VocabEntry", (PyObject *) &zet_VocabEntryType);
+
+    /* Adding VocabIterator type to module */
+    Py_INCREF(&zet_VocabIteratorType);
+    PyModule_AddObject(m, "VocabIterator", (PyObject *) &zet_VocabIteratorType);
+
+    /* Adding MLParser type to module */
+    Py_INCREF(&zet_MLParserType);
+    PyModule_AddObject(m, "MLParser", (PyObject *) &zet_MLParserType);
+}
diff --git a/src/queryparse.c b/src/queryparse.c
new file mode 100644 (file)
index 0000000..3f11b17
--- /dev/null
@@ -0,0 +1,1223 @@
+/* queryparse.c implements a parser to parse google-style queries.  See
+ * queryparse.h for more detail
+ *
+ * note that although queryparse currently only supports parsing the
+ * whole query in-place, it was written to allow fairly easy conversion
+ * to more flexible parsing schemes.
+ *
+ * written nml 2003-07-08
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "queryparse.h"
+
+#include "ascii.h"
+#include "def.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* literals for the operators. note that AND and OR must be
+ * uppercase alpha characters.  Other characters cannot be alpha-numeric. */
+#define AND_OP "AND"
+#define OR_OP "OR"
+#define NOSTOP_OP '+'
+#define EXCLUDE_OP '-'
+#define PHRASE_DELIM '"'
+#define MOD_START '['
+#define MOD_STRING_END ':'
+#define MOD_END ']'
+
+struct queryparse {
+    const char *buf;          /* buffer we're parsing from */
+    const char *end;          /* end of the buffer */
+    unsigned int maxwordlen;  /* maximum word len */
+    int state;                /* parsing state we're in */
+    unsigned int bytes;       /* number of bytes parsed thus far */
+    int err;                  /* last error to occur or 0 */
+    unsigned int warn;        /* accumulated warnings */
+};
+
+/* parser states */
+enum {
+    ERR = 0,                  /* error */
+    ENDFILE = 1,              /* hit end-of-file (or string in this case) */
+    TOPLEVEL = 2,             /* not in any entities */
+    INWORD = 3,               /* in a word */
+    INWORD_PUNC = 5,          /* in a word, after punctuation */
+    INWORD_NOSTOP = 6,        /* in a word that shouldn't be stopped */
+    INWORD_NOSTOP_PUNC = 8,   /* in a no-stop word, after punctuation */
+    INWORD_EXCLUDE = 9,       /* in word that should be excluded from results*/
+    INWORD_EXCLUDE_PUNC = 11, /* in neg-word after punctuation */
+    INOR = 12,                /* in an OR operator */
+    INAND = 13,               /* in an AND operator */
+    INPHRASE = 14,            /* in a " delimited phrase */
+    INPHRASE_WORD = 15,       /* in a word in a phrase */
+    INPHRASE_WORD_PUNC = 17,  /* in a word in a phrase after punctuation */
+    INPHRASE_END = 18,        /* in a phrase that has ended */
+    ENDSENTENCE = 19,         /* in the end of a sentence in a phrase */
+    ENDSENTENCE_END = 20,     /* in a sentence that has ended */
+    INMOD_MOD = 21,           /* parsing the query modifier */
+    INMOD = 22,               /* in a query modifier */
+    INMOD_WORD = 23,          /* in word in query modifier */
+    INMOD_END = 26            /* in a modifier that has ended */
+};
+
+struct queryparse *queryparse_new(unsigned int maxwordlen, 
+  const char *query, unsigned int querylen) {
+    struct queryparse *parser = malloc(sizeof(*parser));
+
+    if (parser) {
+        parser->buf = query;
+        parser->end = query + querylen;
+        parser->bytes = 0;
+        parser->state = TOPLEVEL;
+        parser->maxwordlen = maxwordlen;
+    }
+
+    return parser;
+}
+
+#define CASE_END_SENTENCE                                                     \
+         '.': case '!': case '?'
+
+/* jump table */
+#define JUMP(state)                                                           \
+    if (1) {                                                                  \
+        switch (state) {                                                      \
+        case TOPLEVEL: goto toplevel_label;                                   \
+        case INWORD: goto inword_label;                                       \
+        case INWORD_PUNC: goto punc_label;                                    \
+        case INWORD_NOSTOP: goto inword_nostop_label;                         \
+        case INWORD_NOSTOP_PUNC: goto inword_nostop_punc_label;               \
+        case INWORD_EXCLUDE: goto inword_exclude_label;                       \
+        case INWORD_EXCLUDE_PUNC: goto inword_exclude_punc_label;             \
+        case INOR: goto inor_label;                                           \
+        case INAND: goto inand_label;                                         \
+        case INPHRASE: goto inphrase_label;                                   \
+        case INPHRASE_WORD: goto inphrase_word_label;                         \
+        case INPHRASE_WORD_PUNC: goto inphrase_word_punc_label;               \
+        case INPHRASE_END: goto inphrase_end_label;                           \
+        case ENDSENTENCE: goto endsentence_label;                             \
+        case ENDSENTENCE_END: goto endsentence_end_label;                     \
+        case INMOD_MOD: goto inmod_mod_label;                                 \
+        case INMOD: goto inmod_label;                                         \
+        case INMOD_WORD: goto inmod_word_label;                               \
+        case INMOD_END: goto inmod_end_label;                                 \
+        case ENDFILE: goto endfile_label;                                     \
+        default: goto err_label;                                              \
+        }                                                                     \
+    } else /* dangling else to allow function-like syntax */
+
+enum queryparse_ret queryparse_parse(struct queryparse *parser, 
+  char *word, unsigned int *len) {
+    char c;
+    *len = 0;
+
+    JUMP(parser->state);
+
+/* not in any entities yet */
+toplevel_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            /* note: AND and OR could be more efficiently detected by special
+             * casing their first values, but that would make them harder to
+             * change */
+
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = ASCII_TOLOWER(c);
+            } else {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL;
+                return QUERYPARSE_WORD;
+            }
+
+            if (c == AND_OP[0]) {
+                /* it could be an AND op */
+                goto inand_label;
+            } else if (c == OR_OP[0]) {
+                /* it could be an OR op */
+                goto inor_label;
+            } else {
+                /* start of a normal word */
+                goto inword_label;
+            }
+            break;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL;
+                return QUERYPARSE_WORD;
+            }
+
+            /* start of a normal word */
+            goto inword_label;
+            break;
+
+        case NOSTOP_OP:
+            /* start of a non-stopping word */
+            goto inword_nostop_label;
+            break;
+
+        case EXCLUDE_OP:
+            /* start of an excluded word */
+            goto inword_exclude_label;
+            break;
+
+        case PHRASE_DELIM:
+            parser->state = INPHRASE;
+            return QUERYPARSE_START_PHRASE;
+            break;
+
+        case MOD_START:
+            goto inmod_mod_label;
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* silently eat whitespace */
+            break;
+
+        case '(':
+            parser->warn |= QUERYPARSE_WARN_PARENS_BOOLEAN; /*warn,fallthrough*/
+        default:
+        case ASCII_CASE_EXTENDED:
+            /* anything else we don't record in the word, but go to inword 
+             * anyway (so we know when a string of junk characters occurred) */
+            goto inword_label;
+            break;
+        }
+    }
+    /* if we end in toplevel we just EOF */
+    goto endfile_label;
+
+/* in a normal word, we may or may not have actually pushed any characters onto
+ * the return word */
+inword_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            }
+            break;
+
+        case '-':
+        default:
+            /* break across two punctuation marks in a row */
+            goto punc_label;
+
+        case ASCII_CASE_CONTROL:
+        case ASCII_CASE_EXTENDED:
+            /* ignore junk characters */
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* word ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+        }
+    }
+    /* if we end in a word, we have to return it */
+    if (*len) {
+        word[*len] = '\0';
+        parser->state = ENDFILE; /* transition to eof */
+        return QUERYPARSE_WORD;
+    } else {
+        /* it was empty, so warn them of that */
+        parser->warn |= QUERYPARSE_WARN_NONWORD;
+    }
+    goto endfile_label;
+
+punc_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            }
+            goto inword_label;
+
+        case ASCII_CASE_PUNCTUATION:
+            /* break across two punctuation marks in a row */
+            word[*len] = '\0';
+            parser->state = TOPLEVEL; /* transition back to toplevel */
+            return QUERYPARSE_WORD;
+
+        default:
+        case ASCII_CASE_CONTROL:
+        case ASCII_CASE_EXTENDED:
+            /* ignore junk characters */
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* word ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+        }
+    }
+    /* if we end in a word, we have to return it */
+    if (*len) {
+        word[*len] = '\0';
+        parser->state = ENDFILE; /* transition to eof */
+        return QUERYPARSE_WORD;
+    } else {
+        /* it was empty, so warn them of that */
+        parser->warn |= QUERYPARSE_WARN_NONWORD;
+    }
+    goto endfile_label;
+
+/* in a word that shouldn't be stopped (pretty much the same as normal word) */
+inword_nostop_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD_NOSTOP;
+            }
+            break;
+
+        case ASCII_CASE_CONTROL:
+        case ASCII_CASE_EXTENDED:
+            /* ignore */
+            break;
+
+        default:
+            goto inword_nostop_punc_label;
+
+        case ASCII_CASE_SPACE:
+            /* word ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD_NOSTOP;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+        }
+    }
+    /* if we end in a word, we have to return it */
+    if (*len) {
+        word[*len] = '\0';
+        parser->state = ENDFILE; /* transition to eof */
+        return QUERYPARSE_WORD_NOSTOP;
+    } else {
+        /* it was empty, so warn them of that */
+        parser->warn |= QUERYPARSE_WARN_NONWORD;
+    }
+    goto endfile_label;
+
+/* in a word that shouldn't be stopped (pretty much the same as normal word) */
+inword_nostop_punc_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD_NOSTOP;
+            }
+            goto inword_nostop_label;
+
+        case ASCII_CASE_CONTROL:
+        case ASCII_CASE_EXTENDED:
+            /* ignore */
+            break;
+
+        case '-':
+        default: /* break across punctuation */
+        case ASCII_CASE_SPACE:
+            /* word ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD_NOSTOP;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+        }
+    }
+    /* if we end in a word, we have to return it */
+    if (*len) {
+        word[*len] = '\0';
+        parser->state = ENDFILE; /* transition to eof */
+        return QUERYPARSE_WORD_NOSTOP;
+    } else {
+        /* it was empty, so warn them of that */
+        parser->warn |= QUERYPARSE_WARN_NONWORD;
+    }
+    goto endfile_label;
+
+/* in a word that should be excluded (pretty much the same as normal word) */
+inword_exclude_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD_EXCLUDE;
+            }
+            break;
+
+        case ASCII_CASE_CONTROL:
+        case ASCII_CASE_EXTENDED:
+            /* ignore */
+            break;
+
+        default: 
+            goto inword_exclude_punc_label;
+
+        case ASCII_CASE_SPACE:
+            /* word ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD_EXCLUDE;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+        }
+    }
+    /* if we end in a word, we have to return it */
+    if (*len) {
+        word[*len] = '\0';
+        parser->state = ENDFILE; /* transition to eof */
+        return QUERYPARSE_WORD_EXCLUDE;
+    } else {
+        /* it was empty, so warn them of that */
+        parser->warn |= QUERYPARSE_WARN_NONWORD;
+    }
+    goto endfile_label;
+
+/* in a word that should be excluded (pretty much the same as normal word) */
+inword_exclude_punc_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD_EXCLUDE;
+            }
+            break;
+
+        case ASCII_CASE_CONTROL:
+        case ASCII_CASE_EXTENDED:
+            /* ignore */
+            break;
+
+        case '-':
+        default: /* break across junk characters */
+        case ASCII_CASE_SPACE:
+            /* word ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD_EXCLUDE;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+        }
+    }
+    /* if we end in a word, we have to return it */
+    if (*len) {
+        word[*len] = '\0';
+        parser->state = ENDFILE; /* transition to eof */
+        return QUERYPARSE_WORD_EXCLUDE;
+    } else {
+        /* it was empty, so warn them of that */
+        parser->warn |= QUERYPARSE_WARN_NONWORD;
+    }
+    goto endfile_label;
+
+/* in what may be an OR operator */
+inor_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = ASCII_TOLOWER(c);
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            }
+
+            if (c != OR_OP[*len - 1]) {
+                /* it turned out not to be OR, go back to regular word 
+                 * parsing */
+                goto inword_label;
+            }
+            break;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            }
+            /* it turned out not to be OR, go back to regular word parsing */
+            goto inword_label;
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            goto inword_label;
+        
+        case '-':
+        default:
+            goto punc_label;
+
+        case ASCII_CASE_SPACE:
+            /* word ended */
+            if (!OR_OP[*len]) {
+                /* whitespace ended OR operator */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_OR;
+            } else if (*len) {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+        }
+    }
+    /* if we end in an unfinished OR, return it as word */
+    assert(*len);
+    word[*len] = '\0';
+    parser->state = ENDFILE;
+    return QUERYPARSE_WORD;
+
+/* in what may be an AND operator */
+inand_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = ASCII_TOLOWER(c);
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            }
+
+            if (c != AND_OP[*len - 1]) {
+                /* it turned out not to be AND, go back to regular word 
+                 * parsing */
+                goto inword_label;
+            }
+            break;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            }
+            /* it turned out not to be AND, go back to regular word parsing */
+            goto inword_label;
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            goto inword_label;
+
+        case '-':
+        default:
+            goto punc_label;
+
+        case ASCII_CASE_SPACE:
+            /* word ended */
+            if (!AND_OP[*len]) {
+                /* whitespace ended OR operator */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_AND;
+            } else if (*len) {
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+        }
+    }
+    /* if we end in an unfinished AND, return it as word */
+    assert(*len);
+    word[*len] = '\0';
+    parser->state = ENDFILE;
+    return QUERYPARSE_WORD;
+
+/* inside a phrase */
+inphrase_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = INPHRASE; /* transition back to phrase */
+                return QUERYPARSE_WORD;
+            }
+
+            /* phrase word started */
+            goto inphrase_word_label;
+            break;
+
+        case PHRASE_DELIM:
+            /* phrase ended */
+            goto inphrase_end_label;
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* silently eat whitespace characters */
+            break;
+
+        case ASCII_CASE_CONTROL:
+        default:
+        case ASCII_CASE_EXTENDED:
+            /* phrase word started */
+            goto inphrase_word_label;
+            break;
+        }
+    }
+    /* if we end in an unfinished phrase, warn them */
+    parser->warn |= QUERYPARSE_WARN_QUOTES_UNMATCHED;
+    goto endfile_label;
+/* in a word, inside a phrase */
+inphrase_word_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = INPHRASE; /* transition back to phrase */
+                return QUERYPARSE_WORD;
+            }
+            break;
+
+        case PHRASE_DELIM:
+            /* phrase ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = INPHRASE_END;
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto inphrase_end_label;
+            }
+            break;
+
+        case '-':
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = INPHRASE; /* transition back to phrase */
+                return QUERYPARSE_WORD;
+            }
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+            /* ignore */
+            break;
+
+        default: 
+            goto inphrase_word_punc_label;
+
+        case ASCII_CASE_SPACE:
+            /* phrase word ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = INPHRASE;
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+
+        case CASE_END_SENTENCE:
+            /* watch out for the end of sentences */
+            goto endsentence_label;
+            break;
+        }
+    }
+    /* if we end in a word in an unfinished phrase, warn them and return word */
+    parser->warn |= QUERYPARSE_WARN_QUOTES_UNMATCHED;
+    assert(*len);
+    word[*len] = '\0';
+    parser->state = ENDFILE;
+    return QUERYPARSE_WORD;
+inphrase_word_punc_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = INPHRASE; /* transition back to phrase */
+                return QUERYPARSE_WORD;
+            }
+
+            /* phrase word started */
+            goto inphrase_word_label;
+            break;
+
+        case PHRASE_DELIM:
+            /* phrase ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = INPHRASE_END;
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto inphrase_end_label;
+            }
+            break;
+
+        case ASCII_CASE_CONTROL:
+        case ASCII_CASE_EXTENDED:
+            /* ignore */
+            break;
+
+        default: /* break across junk characters */
+        case ASCII_CASE_SPACE:
+            /* phrase word ended */
+            if (*len) {
+                word[*len] = '\0';
+                parser->state = INPHRASE;
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto toplevel_label;
+            }
+            break;
+
+        case CASE_END_SENTENCE:
+            /* watch out for the end of sentences */
+            goto endsentence_label;
+            break;
+        }
+    }
+    /* if we end in a word in an unfinished phrase, warn them and return word */
+    parser->warn |= QUERYPARSE_WARN_QUOTES_UNMATCHED;
+    assert(*len);
+    word[*len] = '\0';
+    parser->state = ENDFILE;
+    return QUERYPARSE_WORD;
+
+/* need to return phrase end and then continue */
+inphrase_end_label:
+    parser->state = TOPLEVEL;
+    return QUERYPARSE_END_PHRASE;
+
+/* need to return sentence end and then continue */
+endsentence_end_label:
+    parser->state = INPHRASE;
+    return QUERYPARSE_END_SENTENCE;
+
+/* in what might be the end of a sentence */
+endsentence_label:
+    while (parser->buf < parser->end) {
+        /* don't consume this character (yet) */
+        c = *parser->buf;
+        switch (c) {
+        case ASCII_CASE_SPACE:
+            /* it was the end of a sentence */
+            parser->buf++;        /* consume the byte */
+            parser->bytes++;
+            assert(*len);
+            word[*len] = '\0';
+            parser->state = ENDSENTENCE_END;
+            return QUERYPARSE_WORD;
+
+        default:
+            /* back to a normal phrase word */
+            goto inphrase_word_label;
+            break;
+        }
+    }
+    /* finishing in endsentence means we need to return the phrase word */
+    assert(*len);
+    word[*len] = '\0';
+    parser->state = INPHRASE;
+    return QUERYPARSE_WORD;
+
+/* parsing the modifier of a modifier */
+inmod_mod_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case '-':
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+        case ASCII_CASE_EXTENDED:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = TOPLEVEL; /* transition back to toplevel */
+                return QUERYPARSE_WORD;
+            }
+            break;
+
+        case MOD_STRING_END:
+            /* end of the modifier in the mod */
+            word[*len] = '\0';
+            parser->state = INMOD;        /* transition to inmod */
+            return QUERYPARSE_START_MODIFIER;
+            break;
+
+        case MOD_START:
+            parser->warn |= QUERYPARSE_WARN_PARENS_NESTED; /* warn,fallthrough*/
+        default:
+        case ASCII_CASE_SPACE:
+            /* it wasn't a mod after all (return word) */
+            word[*len] = '\0';
+            parser->state = TOPLEVEL;     /* transition back to toplevel */
+            return QUERYPARSE_WORD;
+            break;
+        }
+    }
+    /* if we end in a mod, return as word */
+    parser->warn |= QUERYPARSE_WARN_PARENS_UNMATCHED;
+    assert(*len);
+    word[*len] = '\0';
+    parser->state = ENDFILE;
+    return QUERYPARSE_WORD;
+
+/* in the parameters of a modifier */
+inmod_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+        case ASCII_CASE_EXTENDED:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = INMOD; /* transition to this state */
+                return QUERYPARSE_WORD;
+            }
+
+            /* start parsing word */
+            goto inmod_word_label;
+            break;
+
+        case MOD_END:
+            goto inmod_end_label;
+            break;
+
+        case ASCII_CASE_SPACE:
+            /* silently eat whitespace */
+            break;
+
+        case MOD_START:
+            parser->warn |= QUERYPARSE_WARN_PARENS_NESTED; /* warn,fallthrough*/
+        default:
+            /* anything else starts a word, but isn't recorded */
+            goto inmod_word_label;
+            break;
+        }
+    }
+    /* if we end in a mod, return as word */
+    parser->warn |= QUERYPARSE_WARN_PARENS_UNMATCHED;
+    goto endfile_label;
+
+/* in a word, in a modifier */
+inmod_word_label:
+    while (parser->buf < parser->end) {
+        c = *parser->buf++;
+        parser->bytes++;
+        switch (c) {
+        case ASCII_CASE_UPPER:
+            c = ASCII_TOLOWER(c);
+        case '-':
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* push character onto word */
+            if (*len < parser->maxwordlen) {
+                word[(*len)++] = c;
+            } else {
+                /* word finished due to length constraint */
+                word[*len] = '\0';
+                parser->state = INMOD; /* transition back to inmod */
+                return QUERYPARSE_WORD;
+            }
+            break;
+
+        case MOD_END:
+            if (*len) {
+                /* return recorded word */
+                word[*len] = '\0';
+                parser->state = INMOD_END; 
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto inmod_end_label;
+            }
+            break;
+
+        case '\'':
+            /* don't break across apostrophe */
+            break;
+
+        case MOD_START:
+            parser->warn |= QUERYPARSE_WARN_PARENS_NESTED; /* warn,fallthrough*/
+        default: /* break across other crap */
+        case ASCII_CASE_SPACE:
+            if (*len) {
+                /* return recorded word */
+                word[*len] = '\0';
+                parser->state = INMOD; 
+                return QUERYPARSE_WORD;
+            } else {
+                /* it was empty, so warn them of that */
+                parser->warn |= QUERYPARSE_WARN_NONWORD;
+                goto inmod_label;
+            }
+            break;
+        }
+    }
+    /* if we end in a mod, return as word */
+    parser->warn |= QUERYPARSE_WARN_PARENS_UNMATCHED;
+    assert(*len);
+    word[*len] = '\0';
+    parser->state = ENDFILE;
+    return QUERYPARSE_WORD;
+
+/* modifier has ended */
+inmod_end_label:
+    parser->state = TOPLEVEL;
+    return QUERYPARSE_END_MODIFIER;
+
+endfile_label:
+    parser->state = ENDFILE;
+    return QUERYPARSE_EOF;
+
+err_label:
+    if (!parser->err) {
+        parser->err = EINVAL;
+    }
+    return ERR;
+}
+
+void queryparse_delete(struct queryparse *parser) {
+    free(parser);
+    return;
+}
+
+unsigned int queryparse_bytes(struct queryparse *parser) {
+    return parser->bytes;
+}
+
+int queryparse_err(struct queryparse *parser) {
+    return parser->err;
+}
+
+unsigned int queryparse_warn(struct queryparse *parser) {
+    unsigned int tmp = parser->warn;
+    parser->warn = 0;
+    return tmp;
+}
+
+#ifdef QUERYPARSE_TEST
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "str.h"
+
+const char *warn_mesg(unsigned int *warn) {
+    if (*warn & QUERYPARSE_WARN_PARENS_BOOLEAN) {
+        *warn ^= QUERYPARSE_WARN_PARENS_BOOLEAN;
+        return "where you attempting a boolean query?";
+    } else if (*warn & QUERYPARSE_WARN_PARENS_NESTED) {
+        *warn ^= QUERYPARSE_WARN_PARENS_NESTED;
+        return "attempt to nest square parentheses";
+    } else if (*warn & QUERYPARSE_WARN_PARENS_UNMATCHED) {
+        *warn ^= QUERYPARSE_WARN_PARENS_UNMATCHED;
+        return "square parentheses aren't matched";
+    } else if (*warn & QUERYPARSE_WARN_QUOTES_UNMATCHED) {
+        *warn ^= QUERYPARSE_WARN_QUOTES_UNMATCHED;
+        return "quotes aren't matched";
+    } else if (*warn & QUERYPARSE_WARN_EMPTY_OP) {
+        *warn ^= QUERYPARSE_WARN_EMPTY_OP;
+        return "empty operation";
+    } else if (*warn & QUERYPARSE_WARN_NONWORD) {
+        *warn ^= QUERYPARSE_WARN_NONWORD;
+        return "a string of junk was encountered";
+    } else if (*warn) {
+        *warn = 0;
+        return "unexpected warning";
+    } else {
+        return NULL;
+    }
+}
+
+int main() {
+    char buf[BUFSIZ + 1];
+    struct queryparse *qp;
+    int ret;
+    char word[100];
+    unsigned int len,
+                 warn;
+
+    while (fgets(buf, BUFSIZ, stdin)) {
+        str_rtrim(buf);
+        printf("query: %s\n", buf);
+
+        if (!(qp = queryparse_new(50, buf, str_len(buf)))) {
+            fprintf(stderr, "couldn't initialise parser\n");
+            return EXIT_FAILURE;
+        }
+
+        do {
+            ret = queryparse_parse(qp, word, &len);
+            warn = queryparse_warn(qp);
+
+            switch (ret) {
+            case QUERYPARSE_ERR:
+                fprintf(stderr, "queryparse got error %d %s\n", 
+                  queryparse_err(qp), strerror(queryparse_err(qp)));
+                ret = QUERYPARSE_EOF;
+                break;
+
+            case QUERYPARSE_WORD:
+                assert(len == str_len(word));
+                printf("WORD: %s\n", word);
+                break;
+
+            case QUERYPARSE_WORD_NOSTOP:
+                assert(len == str_len(word));
+                printf("WORD_NS: %s\n", word);
+                break;
+
+            case QUERYPARSE_WORD_EXCLUDE:
+                assert(len == str_len(word));
+                printf("WORD_EX: %s\n", word);
+                break;
+
+            case QUERYPARSE_OR:
+                printf("OR\n");
+                break;
+
+            case QUERYPARSE_AND:
+                printf("AND\n");
+                break;
+
+            case QUERYPARSE_START_PHRASE:
+                printf("PHRASE \"\n");
+                break;
+
+            case QUERYPARSE_END_PHRASE:
+                printf("\" PHRASE\n");
+                break;
+
+            case QUERYPARSE_START_MODIFIER:
+                assert(len == str_len(word));
+                printf("MOD %s [\n", word);
+                break;
+
+            case QUERYPARSE_END_MODIFIER:
+                printf("] MOD \n");
+                break;
+
+            case QUERYPARSE_END_SENTENCE:
+                printf("ENDSENT\n");
+                break;
+
+            case QUERYPARSE_EOF:
+                break;
+
+            default:
+                fprintf(stderr, "unexpected output!\n");
+                ret = QUERYPARSE_EOF;
+                break;
+            }
+
+            while (warn) {
+                printf("%s\n", warn_mesg(&warn));
+            }
+        } while ((ret != QUERYPARSE_EOF));
+
+        queryparse_delete(qp);
+    }
+
+    return EXIT_SUCCESS;
+}
+#endif
+
diff --git a/src/rbtree.c b/src/rbtree.c
new file mode 100644 (file)
index 0000000..9e273ea
--- /dev/null
@@ -0,0 +1,1243 @@
+/* rbtree.c implements a red-black tree as described in rbtree.h
+ *
+ * note that our implementation of a red-black tree uses a single
+ * sentinal NIL value for algorithmic convenience, instead of checking
+ * NULL values.  We also use parent pointers, since they seemed easier than
+ * maintaining a stack in this instance.
+ *
+ * if DEAR_DEBUG is set to 1, and NDEBUG is left undefined, then the red-black
+ * tree will consume potentially a lot of time and stack space recursively
+ * checking that it is a valid red-black tree.  This is useful for debugging,
+ * but you'll probably want to turn this off in production.
+ *
+ * written nml 2004-07-12
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "rbtree.h"
+
+#include "def.h"
+#include "bit.h"
+#include "stack.h"
+#include "objalloc.h"
+
+#include <assert.h>
+#include <stdlib.h>                     /* for NULL, malloc, free */
+#include <stdio.h> 
+
+enum rbtree_child {
+    RBTREE_LEFT = 0,
+    RBTREE_RIGHT = 1
+};
+
+/* the type of the red-black tree */
+enum rbtree_type {
+    RBTREE_TYPE_UNKNOWN,
+    RBTREE_TYPE_LUINT,
+    RBTREE_TYPE_PTR
+};
+
+struct rbtree_node {
+    struct rbtree_node *parent;         /* parent of this node */
+    struct rbtree_node *child[2];       /* left and right children, as indexed 
+                                         * by rbtree_child enum (i'd use left
+                                         * and right symbolic names, but this
+                                         * makes it easy to switch them for
+                                         * symmetrical algorithms) */
+    union {
+        unsigned long int k_luint;
+        void *k_ptr;
+        /* add other types as needed */
+    } key;                              /* lookup key */
+
+    union {
+        unsigned long int d_luint;
+        void *d_ptr;
+        double d_dbl;
+        /* add other types as needed */
+    } data;                             /* data associated with key */
+
+    int red;                            /* whether this node is red */
+};
+
+struct rbtree {
+    unsigned int size;                  /* number of non-NIL nodes */
+    struct rbtree_node *root;           /* root node */
+    struct rbtree_node nil;             /* sentinal NIL node for this tree */
+
+    /* comparison function */
+    int (*cmp)(const void *key1, const void *key2);
+
+    enum rbtree_type key_type;
+    enum rbtree_type data_type;
+
+    unsigned int timestamp;             /* allows checks that rbtree doesn't 
+                                         * get modified during iteration */
+
+    struct objalloc *alloc;             /* node allocator */
+};
+
+struct rbtree_iter {
+    struct rbtree *rb;                  /* red-black tree in iteration */
+    struct stack *stack;                /* stack of nodes left to visit */
+    struct rbtree_node *curr;           /* ptr to current node */
+    enum rbtree_child left;             /* logical left child, to allow 
+                                         * symmetrically reversed iteration */
+    enum rbtree_iter_order order;       /* order in which we iterate over the 
+                                         * tree (pre, post or in) */
+    struct rbtree_node *last;           /* last visited node (in postorder) */
+    unsigned int timestamp;             /* timestamp of rbtree when iteration 
+                                         * started */
+};
+
+void rbtree_print_node(const struct rbtree *rb, const struct rbtree_node *node, 
+  FILE *output, unsigned int depth, int left) {
+    assert(node);
+    if (node != &rb->nil) {
+        unsigned int i;
+
+        for (i = 0; i < depth; i++) {
+            fprintf(output, "  ");
+        }
+        fprintf(output, "%lu %lu %s %s depth %u\n", node->key.k_luint, 
+          node->data.d_luint, node->red ? "red" : "black", 
+          left ? "left" : "right", depth);
+        rbtree_print_node(rb, node->child[RBTREE_LEFT], output, depth + 1, 1);
+        rbtree_print_node(rb, node->child[RBTREE_RIGHT], output, depth + 1, 0);
+    }
+}
+
+void rbtree_print(const struct rbtree *rb, FILE *output) {
+    if (rb->root == &rb->nil) {
+
+    } else {
+        fprintf(output, "%lu %lu %s root\n", rb->root->key.k_luint, 
+          rb->root->data.d_luint, rb->root->red ? "red" : "black");
+        rbtree_print_node(rb, rb->root->child[RBTREE_LEFT], output, 1, 1);
+        rbtree_print_node(rb, rb->root->child[RBTREE_RIGHT], output, 1, 0);
+    }
+}
+
+/* invariant checking stuff */
+
+static enum rbtree_ret rbtree_node_not_under(const struct rbtree *rb, 
+  const struct rbtree_node *node, const struct rbtree_node *banned) {
+    enum rbtree_ret ret;
+
+    if (DEAR_DEBUG) {
+
+        assert(node);
+
+        if (node == banned) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        if (node->parent == banned) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        if (node->child[RBTREE_LEFT] == banned) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        if (node->child[RBTREE_RIGHT] == banned) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        if (node != &rb->nil) {
+            if ((ret 
+              = rbtree_node_not_under(rb, node->child[RBTREE_LEFT], banned)) 
+                != RBTREE_OK) {
+
+                assert(!CRASH);
+                return ret;
+            }
+
+            if ((ret 
+              = rbtree_node_not_under(rb, node->child[RBTREE_RIGHT], banned)) 
+                != RBTREE_OK) {
+
+                assert(!CRASH);
+                return ret;
+            }
+        }
+
+        return RBTREE_OK;
+    } else {
+        return RBTREE_OK;
+    }
+}
+
+/* internal function to recursively find the maximum height of a node */
+static unsigned int rbtree_node_max_height(const struct rbtree *rb, 
+  const struct rbtree_node *node) {
+    assert(node);
+    if (node == &rb->nil) {
+        return 0;
+    } else {
+        unsigned int l = rbtree_node_max_height(rb, node->child[RBTREE_LEFT]),
+                     r = rbtree_node_max_height(rb, node->child[RBTREE_RIGHT]);
+
+        if (r > l) {
+            return r;
+        } else {
+            return l;
+        }
+    }
+}
+
+/* internal function to recursively find the minimum height of a node */
+static unsigned int rbtree_node_min_height(const struct rbtree *rb, 
+  const struct rbtree_node *node) {
+    assert(node);
+    if (node == &rb->nil) {
+        return 0;
+    } else {
+        unsigned int l = rbtree_node_min_height(rb, node->child[RBTREE_LEFT]),
+                     r = rbtree_node_min_height(rb, node->child[RBTREE_RIGHT]);
+
+        if (r < l) {
+            return r;
+        } else {
+            return l;
+        }
+    }
+}
+
+/* internal function to recursively check that all links are internally
+ * consistent */
+static enum rbtree_ret rbtree_node_check_links(const struct rbtree *rb, 
+  const struct rbtree_node *node, enum rbtree_child side) {
+    enum rbtree_ret ret;
+
+    assert(node);
+
+    if (node == &rb->nil) {
+        return RBTREE_OK;
+    }
+
+    if (node->parent->child[side] != node) {
+        assert(!CRASH);
+        return RBTREE_EINVAL;
+    }
+
+    if ((ret 
+      = rbtree_node_check_links(rb, node->child[RBTREE_LEFT], RBTREE_LEFT))
+        != RBTREE_OK) {
+
+        return ret;
+    }
+    if ((ret 
+      = rbtree_node_check_links(rb, node->child[RBTREE_RIGHT], RBTREE_RIGHT))
+        != RBTREE_OK) {
+
+        return ret;
+    }
+
+    return RBTREE_OK;
+}
+
+/* internal function to recursively check the red-black tree invariant that all
+ * paths from a node to its children involve the same number of black nodes */
+static enum rbtree_ret rbtree_node_check_black(const struct rbtree *rb, 
+  const struct rbtree_node *node, unsigned int *black_height) {
+    assert(node);
+
+    /* check that red nodes have only black children */
+    if (node->red) {
+        if (node->child[RBTREE_LEFT]->red || node->child[RBTREE_RIGHT]->red) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+    }
+
+    /* check black node count */
+    if (node == &rb->nil) {
+        *black_height = 1;
+        return RBTREE_OK;
+    } else {
+        unsigned int l, 
+                     r;
+        enum rbtree_ret ret;
+
+        if (((ret = rbtree_node_check_black(rb, node->child[RBTREE_LEFT], &l)) 
+            == RBTREE_OK)
+          && ((ret = rbtree_node_check_black(rb, node->child[RBTREE_RIGHT], &r))
+            == RBTREE_OK)
+
+          /* return value is EINVAL if we get this far but fail final check */
+          && ((ret = RBTREE_EINVAL), (l == r))) {
+            *black_height = r + !node->red;
+            return RBTREE_OK;
+        } else {
+            printf("l %u r %u node %lu\n", l, r, node->key.k_luint);
+            rbtree_print(rb, stdout);
+            assert(!CRASH);
+            return ret;
+        }
+    }
+}
+
+/* internal function (not static to avoid warnings) to check red-black tree
+ * invariants */
+enum rbtree_ret rbtree_invariant(const struct rbtree *rb) {
+    unsigned int max,
+                 min,
+                 bh;
+    enum rbtree_ret ret;
+
+    if (DEAR_DEBUG) {
+        /* check that link structure is sane */
+        if ((rb->nil.parent != &rb->nil)
+          || (rb->nil.child[RBTREE_LEFT] != &rb->nil)
+          || (rb->nil.child[RBTREE_RIGHT] != &rb->nil)) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        if (rb->root->parent != &rb->nil) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        ret = rbtree_node_check_links(rb, rb->root->child[RBTREE_LEFT], 
+            RBTREE_LEFT);
+        if (ret != RBTREE_OK) {
+            assert(!CRASH);
+            return ret;
+        }
+
+        ret = rbtree_node_check_links(rb, rb->root->child[RBTREE_RIGHT], 
+            RBTREE_RIGHT);
+        if (ret != RBTREE_OK) {
+            assert(!CRASH);
+            return ret;
+        }
+
+        /* check red-black invariants */
+
+        if (rb->root->red) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        if (rb->nil.red) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        max = rbtree_node_max_height(rb, rb->root);
+        min = rbtree_node_min_height(rb, rb->root);
+
+        if (max > 2 * min) {
+            assert(!CRASH);
+            return RBTREE_EINVAL;
+        }
+
+        ret = rbtree_node_check_black(rb, rb->root, &bh);
+        if (ret != RBTREE_OK) {
+            assert(!CRASH);
+        }
+        return ret;
+    } else {
+        return RBTREE_OK;
+    }
+}
+
+/* generic operations */
+
+static struct rbtree *rbtree_new() {
+    struct rbtree *rb;
+
+    if ((rb = malloc(sizeof(*rb))) 
+      && (rb->alloc = objalloc_new(sizeof(struct rbtree_node), 0, 
+          !!DEAR_DEBUG, 4096, NULL))) {
+
+        rb->size = 0;
+        rb->nil.red = 0;
+        rb->nil.child[RBTREE_LEFT] = rb->nil.child[RBTREE_RIGHT]
+          = rb->nil.parent = &rb->nil;
+        rb->root = &rb->nil;
+        rb->cmp = NULL;
+        rb->data_type = RBTREE_TYPE_UNKNOWN;
+        rb->key_type = RBTREE_TYPE_UNKNOWN;
+        rb->timestamp = 0;
+
+        assert(rbtree_invariant(rb) == RBTREE_OK);
+    } else {
+        if (rb) {
+            free(rb);
+            rb = NULL;
+        }
+    }
+
+    return rb;
+}
+
+struct rbtree *rbtree_ptr_new(int (*cmp)(const void *key1, const void *key2)) {
+    struct rbtree *rb = rbtree_new();
+
+    if (rb) {
+        rb->cmp = cmp;
+        rb->key_type = RBTREE_TYPE_PTR;
+    }
+
+    return rb;
+}
+
+struct rbtree *rbtree_luint_new() {
+    struct rbtree *rb = rbtree_new();
+
+    if (rb) {
+        rb->key_type = RBTREE_TYPE_LUINT;
+    }
+
+    return rb;
+}
+
+enum rbtree_ret rbtree_delete(struct rbtree *rb) {
+    enum rbtree_ret ret = rbtree_clear(rb);
+    objalloc_delete(rb->alloc);
+    free(rb);
+    return ret;
+}
+
+unsigned int rbtree_size(struct rbtree *rb) {
+    return rb->size;
+}
+
+/* forward declaration of node iterator function */
+static enum rbtree_ret rbtree_iter_node_next(struct rbtree_iter *rbi,
+  struct rbtree_node **key);
+
+enum rbtree_ret rbtree_clear(struct rbtree *rb) {
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+
+    /* delete all nodes */
+    objalloc_clear(rb->alloc);
+    rb->root = &rb->nil;
+    rb->size = 0;
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+
+    return RBTREE_OK;
+}
+
+struct rbtree_iter *rbtree_iter_new(struct rbtree *rb, 
+  enum rbtree_iter_order order, int reversed) {
+    struct rbtree_iter *rbi = malloc(sizeof(*rbi));
+
+    if (rbi) {
+        if ((rbi->stack = stack_new(bit_log2(rb->size) + 1))) {
+            rbi->last = &rb->nil;
+            rbi->curr = rb->root;
+            rbi->rb = rb;
+            rbi->order = order;
+            rbi->timestamp = rb->timestamp;
+            if (reversed) {
+                rbi->left = RBTREE_RIGHT;
+            } else {
+                rbi->left = RBTREE_LEFT;
+            }
+            return rbi;
+        } else {
+            free(rbi);
+        }
+    }
+
+    return NULL;
+}
+
+void rbtree_iter_delete(struct rbtree_iter *rbi) {
+    stack_delete(rbi->stack);
+    free(rbi);
+}
+
+/* generic stuff needed for maintaining the red-black-ness of the tree */
+
+/* rotation to rebalance red-black tree.  left indicates logical left, whether 
+ * it is a left or right rotation.  With step numbers from Cormen pg 278. */
+void rbtree_rotate(struct rbtree *rb, struct rbtree_node *x, 
+  enum rbtree_child left) {
+    enum rbtree_child right = !left;
+
+    struct rbtree_node *y = x->child[right];      /* 1: Set y */
+
+    assert(y != &rb->nil);
+    assert(rb->root->parent == &rb->nil);
+
+    x->child[right] = y->child[left];             /* 2: Turn y's left subtree 
+                                                   * into x's right subtree */
+
+    y->child[left]->parent = x;                   /* 3 */
+    y->parent = x->parent;                        /* 4: Link x's parent to y */
+
+    if (x->parent == &rb->nil) {                  /* 5 */
+        rb->root = y;                             /* 6 */
+    } else {
+        if ((x == x->parent->child[left])) {      /* 7 */
+            x->parent->child[left] = y;           /* 8 */
+        } else {
+            assert(x->parent->child[right] == x);
+            x->parent->child[right] = y;          /* 9 */
+        }
+    }
+
+    y->child[left] = x;                           /* 10: Put x on y's left */
+    x->parent = y;
+
+    /* ensure we haven't changed child NIL pointers (note that we need to be
+     * able to change NIL's parent to make some of the fixup cases work) */
+    assert(rb->nil.child[left] == &rb->nil);
+    assert(rb->nil.child[right] == &rb->nil);
+}
+
+/* internal function to restore the red-black tree property to a tree that has
+ * had node z inserted.  With step numbers from Cormen pg 281. */
+static void rbtree_insert_fixup(struct rbtree *rb, struct rbtree_node *z) {
+    enum rbtree_child left,               /* logical left */
+                      right;              /* logical right */
+    struct rbtree_node *y;
+
+    while (z->parent->red) {                                        /* 1 */
+
+        assert(z->red);
+        assert((z->parent != rb->root) || !rb->root->red);
+            
+        assert(z->parent->parent->red == 0);
+
+        /* figure out which side of the grandparent parent is on */
+        if (z->parent->parent->child[RBTREE_LEFT] == z->parent) {   /* 2 */
+            left = RBTREE_LEFT;
+        } else {
+            left = RBTREE_RIGHT;
+        }
+        right = !left;
+
+        y = z->parent->parent->child[right];                        /* 3 */
+        if (y->red) {                                               /* 4 */
+            z->parent->red = 0;                                     /* 5 */
+            y->red = 0;                                             /* 6 */
+            z->parent->parent->red = 1;                             /* 7 */
+            z = z->parent->parent;                                  /* 8 */
+        } else {
+            if (z == z->parent->child[right]) {                     /* 9 */
+                z = z->parent;                                      /* 10 */
+                rbtree_rotate(rb, z, left);                         /* 11 */
+            }
+            z->parent->red = 0;                                     /* 12 */
+            z->parent->parent->red = 1;                             /* 13 */
+            rbtree_rotate(rb, z->parent->parent, right);            /* 14 */
+        }
+    }
+    rb->nil.parent = &rb->nil;
+}
+
+/* internal function to restore the red-black tree property to a tree that has
+ * had a node deleted.  With step numbers from Cormen pg 289. */
+static void rbtree_remove_fixup(struct rbtree *rb, struct rbtree_node *x) {
+    struct rbtree_node *w,
+                       *xparent;          /* x's parent */
+    enum rbtree_child left,               /* logical left */
+                      right;              /* logical right */
+
+    /* note that if x is NIL, we need to save its parent where cases can follow
+     * a rotate, since rotation can change the parent of the NIL pointer */
+
+    while (!x->red && (x != rb->root)) {                        /* 1 */
+        if (x == x->parent->child[RBTREE_LEFT]) {               /* 2 */
+            /* perform step with logical left as left */
+            left = RBTREE_LEFT;
+        } else {
+            /* perform step symmetrically with right as logical left */
+            left = RBTREE_RIGHT;
+        }
+        right = !left;
+
+        w = x->parent->child[right];                            /* 3 */
+        assert(w != &rb->nil);
+        if (w->red) {                                           /* 4 */
+            /* case 1 */
+            xparent = x->parent;
+            w->red = 0;                                         /* 5 */
+            x->parent->red = 1;                                 /* 6 */
+            rbtree_rotate(rb, x->parent, left);                 /* 7 */
+            x->parent = xparent;     /* rotate can change x's parent */
+            w = x->parent->child[right];                        /* 8 */
+        }
+
+        /* w can't be red after case 1 has been dealt with */
+        assert(!w->red);
+
+        if (!w->child[left]->red && !w->child[right]->red) {    /* 9 */
+            /* case 2 */
+            w->red = 1;                                         /* 10 */
+            x = x->parent;                                      /* 11 */
+        } else {
+            if (!w->child[right]->red) {                        /* 12 */
+                /* case 3 */
+                xparent = x->parent;
+                w->child[left]->red = 0;                        /* 13 */
+                w->red = 1;                                     /* 14 */
+                rbtree_rotate(rb, w, right);                    /* 15 */
+                x->parent = xparent;  /* rotate can change x's parent */
+                w = x->parent->child[right];                    /* 16 */
+            }
+            /* case 4 */
+            w->red = x->parent->red;                            /* 17 */
+            x->parent->red = 0;                                 /* 18 */
+            w->child[right]->red = 0;                           /* 19 */
+            rbtree_rotate(rb, x->parent, left);                 /* 20 */
+            x = rb->root;                                       /* 21 */
+        }
+    }
+
+    x->red = 0;                                                 /* 23 */
+}
+
+/* templates */
+
+/* template for iteration over a red-black tree.  Note that this version
+ * doesn't take advantage of the parent pointers in the red-black tree.
+ * nodeiter indicates whether key should have nodes or their values assigned.
+ * nodetype is a hack to cast nodes to other values to avoid warnings (note
+ * that the type can't be surrounded in parens). */
+#define RBTREE_ITER_NEXT(rbi, ky, kytype, dta, dtatype, nodeiter, nodetype)   \
+    do {                                                                      \
+        enum stack_ret sret;                                                  \
+        void *ptr;                                                            \
+        enum rbtree_child left = rbi->left,                                   \
+                          right = !rbi->left;                                 \
+                                                                              \
+        /* ensure that tree hasn't changed since iteration */                 \
+        assert(rbi->timestamp == rbi->rb->timestamp);                         \
+                                                                              \
+        do {  /* infinite loop, only needed for POSTORDER */                  \
+                                                                              \
+            switch (rbi->order) {                                             \
+            case RBTREE_ITER_INORDER:                                         \
+                /* refer knuth vol 1 pg 320 (3rd ed) */                       \
+                                                                              \
+                while (rbi->curr != &rbi->rb->nil) {                          \
+                    if ((sret = stack_ptr_push(rbi->stack, rbi->curr)         \
+                      == STACK_OK)) {                                         \
+                        rbi->curr = rbi->curr->child[left];                   \
+                    } else {                                                  \
+                        return sret;                                          \
+                    }                                                         \
+                }                                                             \
+                                                                              \
+                if ((sret = stack_ptr_pop(rbi->stack, &ptr)) == STACK_OK) {   \
+                    /* visit node */                                          \
+                    rbi->curr = ptr;                                          \
+                    if (nodeiter) {                                           \
+                        *ky = (nodetype) rbi->curr;                           \
+                    } else {                                                  \
+                        *ky = rbi->curr->key.k_##kytype;                      \
+                        *dta = &rbi->curr->data.d_##dtatype;                  \
+                    }                                                         \
+                                                                              \
+                    rbi->curr = rbi->curr->child[right];                      \
+                                                                              \
+                    return RBTREE_OK;                                         \
+                } else {                                                      \
+                    if ((sret == STACK_ENOENT) && !stack_size(rbi->stack)) {  \
+                        return RBTREE_ITER_END;                               \
+                    } else {                                                  \
+                        return sret;                                          \
+                    }                                                         \
+                }                                                             \
+                assert(0);  /* can't get here */                              \
+                break;                                                        \
+                                                                              \
+            case RBTREE_ITER_PREORDER:                                        \
+                do {                                                          \
+                    if (rbi->curr != &rbi->rb->nil) {                         \
+                        /* visit node */                                      \
+                        if (nodeiter) {                                       \
+                            *ky = (nodetype) rbi->curr;                       \
+                        } else {                                              \
+                            *ky = rbi->curr->key.k_##kytype;                  \
+                            *dta = &rbi->curr->data.d_##dtatype;              \
+                        }                                                     \
+                                                                              \
+                        /* follow left subtree, and push right subtree */     \
+                        if ((sret = stack_ptr_push(rbi->stack,                \
+                            rbi->curr->child[right]))                         \
+                          == STACK_OK) {                                      \
+                                                                              \
+                            rbi->curr = rbi->curr->child[left];               \
+                            return RBTREE_OK;                                 \
+                        } else {                                              \
+                            return sret;                                      \
+                        }                                                     \
+                    }                                                         \
+                } while (((sret = stack_ptr_pop(rbi->stack, &ptr))            \
+                    == STACK_OK)                                              \
+                  && (rbi->curr = ptr));                                      \
+                                                                              \
+                if ((sret == STACK_ENOENT) && !stack_size(rbi->stack)) {      \
+                    return RBTREE_ITER_END;                                   \
+                } else {                                                      \
+                    return sret;                                              \
+                }                                                             \
+                assert(0);  /* can't get here */                              \
+                break;                                                        \
+                                                                              \
+            case RBTREE_ITER_POSTORDER:                                       \
+                 /* see knuth vol 1 (3rd ed) pg 565 */                        \
+                 /* this label corresponds with t2 in knuth vol 1 pg 565,     \
+                  * ex 13 */                                                  \
+                                                                              \
+                while (rbi->curr != &rbi->rb->nil) {                          \
+                    if ((sret = stack_ptr_push(rbi->stack, rbi->curr)         \
+                      == STACK_OK)) {                                         \
+                        rbi->curr = rbi->curr->child[left];                   \
+                    } else {                                                  \
+                        return sret;                                          \
+                    }                                                         \
+                }                                                             \
+                                                                              \
+                /* fallthrough (this is a hack to get around the difficulty   \
+                 * of writing this algorithm using structure constructs,      \
+                 * because we *eed two seperate entry points) */              \
+                                                                              \
+            case RBTREE_ITER_POSTORDER + 1:                                   \
+                /* this label corresponds with t4 in knuth vol 1 pg 565,      \
+                 * ex 13 */                                                   \
+                                                                              \
+                if ((sret = stack_ptr_pop(rbi->stack, &ptr)) == STACK_OK) {   \
+                    rbi->curr = ptr;                                          \
+                                                                              \
+                    if ((rbi->curr->child[right] == &rbi->rb->nil)            \
+                      || (rbi->curr->child[right] == rbi->last)) {            \
+                        /* visit node */                                      \
+                        if (nodeiter) {                                       \
+                            *ky = (nodetype) rbi->curr;                       \
+                        } else {                                              \
+                            *ky = rbi->curr->key.k_##kytype;                  \
+                            *dta = &rbi->curr->data.d_##dtatype;              \
+                        }                                                     \
+                                                                              \
+                        rbi->last = rbi->curr;                                \
+                        rbi->order = RBTREE_ITER_POSTORDER + 1;               \
+                        return RBTREE_OK; /* return at t4 */                  \
+                    } else {                                                  \
+                        if ((sret = stack_ptr_push(rbi->stack, rbi->curr))    \
+                          == STACK_OK) {                                      \
+                                                                              \
+                            rbi->curr = rbi->curr->child[right];              \
+                            rbi->order = RBTREE_ITER_POSTORDER;               \
+                            break; /* loop to t2 */                           \
+                        } else {                                              \
+                            return sret;                                      \
+                        }                                                     \
+                    }                                                         \
+                } else {                                                      \
+                    if ((sret == STACK_ENOENT) && !stack_size(rbi->stack)) {  \
+                        rbi->order = RBTREE_ITER_POSTORDER + 1;               \
+                        return RBTREE_ITER_END;                               \
+                    } else {                                                  \
+                        return sret;                                          \
+                    }                                                         \
+                }                                                             \
+                assert(0);  /* can't get here */                              \
+                                                                              \
+            default: return RBTREE_EINVAL;                                    \
+            }                                                                 \
+        } while (1);                                                          \
+    } while (0)
+
+/* find function, pretty simple as its the same as any binary-search-tree 
+ * search.  Note that it has a superfluous (for finding) parent pointer and
+ * side indication, which can be used for a 'find-or-insert' function.  
+ * It also falls through if finding fails, for the same purpose. */
+#define RBTREE_FIND(rb, ky, kytype, dta, dtatype, isptr)                      \
+    do {                                                                      \
+        struct rbtree_node *curr = rb->root,                                  \
+                           *parent = &rb->nil;                                \
+        enum rbtree_child side;                                               \
+                                                                              \
+        while (curr != &rb->nil) {                                            \
+            int cmp;                                                          \
+                                                                              \
+            parent = curr;                                                    \
+                                                                              \
+            if ((isptr                                                        \
+                && ((cmp = rb->cmp((void *) ky, curr->key.k_ptr)) < 0))       \
+              || ((!isptr) && (ky < curr->key.k_##kytype))) {                 \
+                /* key is less than, take left child */                       \
+                side = RBTREE_LEFT;                                           \
+                curr = curr->child[RBTREE_LEFT];                              \
+            } else if ((isptr && (cmp > 0))                                   \
+              || (!isptr && (ky > curr->key.k_##kytype))) {                   \
+                /* key is greater than, take right child */                   \
+                side = RBTREE_RIGHT;                                          \
+                curr = curr->child[RBTREE_RIGHT];                             \
+            } else {                                                          \
+                /* found it */                                                \
+                assert((isptr && (cmp == 0))                                  \
+                  || (!isptr && (ky == curr->key.k_##kytype)));               \
+                cmp = 0; /* stop complaints about unused variable */          \
+                *data = &curr->data.d_##dtatype;                              \
+                return RBTREE_OK;                                             \
+            }                                                                 \
+        }                                                                     \
+    } while (0)
+
+/* find near function, same as find function except that it'll stop on smallest
+ * entry greater than or equal to key */
+#define RBTREE_FIND_NEAR(rb, ky, fkey, kytype, dta, dtatype, isptr)           \
+    do {                                                                      \
+        struct rbtree_node *curr = rb->root,                                  \
+                           *candidate = &rb->nil;                             \
+                                                                              \
+        while (curr != &rb->nil) {                                            \
+            int cmp;                                                          \
+                                                                              \
+            if ((isptr                                                        \
+                && ((cmp = rb->cmp((void *) ky, curr->key.k_ptr)) < 0))       \
+              || ((!isptr) && (ky < curr->key.k_##kytype))) {                 \
+                /* key is less than, take left child.  Candidate doesn't      \
+                 * change, because this node is greater than key */           \
+                curr = curr->child[RBTREE_LEFT];                              \
+            } else if ((isptr && (cmp > 0))                                   \
+              || (!isptr && (ky > curr->key.k_##kytype))) {                   \
+                /* key is greater than, take right child, set candidate to    \
+                 * this node */                                               \
+                candidate = curr;                                             \
+                curr = curr->child[RBTREE_RIGHT];                             \
+            } else {                                                          \
+                /* found it */                                                \
+                assert((isptr && (cmp == 0))                                  \
+                  || (!isptr && (ky == curr->key.k_##kytype)));               \
+                cmp = 0; /* stop complaints about unused variable */          \
+                *fkey = curr->key.k_##kytype;                                 \
+                *dta = &curr->data.d_##dtatype;                               \
+                return RBTREE_OK;                                             \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        if (candidate != &rb->nil) {                                          \
+            /* found a suitable candidate, return it */                       \
+            *fkey = candidate->key.k_##kytype;                                \
+            *dta = &candidate->data.d_##dtatype;                              \
+            return RBTREE_OK;                                                 \
+        } else {                                                              \
+            /* couldn't find anything less than or equal to key,              \
+             * (have taken left-most path through tree) return not found */   \
+            return RBTREE_EEXIST;                                             \
+        }                                                                     \
+    } while (0)
+
+/* template to execute a function for each node in the red-black tree */
+#define RBTREE_FOREACH(rb, keytype, datatype, opaque, fn)                     \
+    do {                                                                      \
+        struct rbtree_node *node;        /* current node */                   \
+        struct rbtree_iter *iter;        /* node iterator */                  \
+        enum rbtree_ret ret;                                                  \
+                                                                              \
+        if (!(iter = rbtree_iter_new(rb, RBTREE_ITER_INORDER, 0))) {          \
+            return RBTREE_ENOMEM;                                             \
+        }                                                                     \
+                                                                              \
+        while ((ret = rbtree_iter_node_next(iter, &node)) == RBTREE_OK) {     \
+            /* visit node */                                                  \
+            fn(opaque, node->key.k_##keytype, &node->data.d_##datatype);      \
+        }                                                                     \
+                                                                              \
+        rbtree_iter_delete(iter);                                             \
+                                                                              \
+        if (ret == RBTREE_ITER_END) {                                         \
+            return RBTREE_OK;                                                 \
+        } else {                                                              \
+            return ret;                                                       \
+        }                                                                     \
+    } while (0)
+
+/* template to insert a new node into the red-black tree.  Parent
+ * points to place of insertion, and side indicates which side new node is
+ * supposed to be inserted on. */
+#define RBTREE_INSERT_NODE(rb, ky, kytype, dta, dtatype, parent, side)        \
+    do {                                                                      \
+        struct rbtree_node *newnode;                                          \
+                                                                              \
+        if ((newnode = objalloc_malloc(rb->alloc, sizeof(*child)))) {         \
+            /* allocation succeeded */                                        \
+            newnode->child[RBTREE_LEFT] = newnode->child[RBTREE_RIGHT]        \
+              = &rb->nil;                                                     \
+            newnode->red = 1;                                                 \
+            newnode->parent = (parent);                                       \
+            newnode->key.k_##kytype = ky;                                     \
+            newnode->data.d_##dtatype = dta;                                  \
+                                                                              \
+            if ((parent) == &rb->nil) {                                       \
+                /* need to insert new root node */                            \
+                rb->root = newnode;                                           \
+            } else {                                                          \
+                assert((parent)->child[(side)] == &rb->nil);                  \
+                (parent)->child[(side)] = newnode;                            \
+                rbtree_insert_fixup(rb, newnode);                             \
+            }                                                                 \
+                                                                              \
+            rb->root->red = 0;                                                \
+            rb->size++;                                                       \
+            assert(rbtree_invariant(rb) == RBTREE_OK);                        \
+            return RBTREE_OK;                                                 \
+        } else {                                                              \
+            return RBTREE_ENOMEM;                                             \
+        }                                                                     \
+    } while (0)
+
+/* template to perform insertion into a red-black tree.  Uses
+ * RBTREE_INSERT_NODE to actually insert the new node once its found the
+ * correct location. */
+#define RBTREE_INSERT(rb, ky, kytype, dta, dtatype, isptr)                    \
+    do {                                                                      \
+        struct rbtree_node *child = rb->root,                                 \
+                           *parent = &rb->nil;                                \
+        enum rbtree_child side = RBTREE_LEFT;                                 \
+                                                                              \
+        rb->timestamp++;                          /* update timestamp */      \
+                                                                              \
+        while (child != &rb->nil) {                                           \
+            int cmp;                                                          \
+                                                                              \
+            parent = child;                                                   \
+                                                                              \
+            if ((isptr                                                        \
+                && ((cmp = rb->cmp((void *) ky, child->key.k_ptr)) < 0))      \
+              || ((!isptr) && (ky < child->key.k_##kytype))) {                \
+                /* key is less than, take left child */                       \
+                side = RBTREE_LEFT;                                           \
+                child = child->child[RBTREE_LEFT];                            \
+            } else if ((isptr && (cmp > 0))                                   \
+              || (!isptr && (ky > child->key.k_##kytype))) {                  \
+                /* key is greater than, take right child */                   \
+                side = RBTREE_RIGHT;                                          \
+                child = child->child[RBTREE_RIGHT];                           \
+            } else {                                                          \
+                /* found a duplicate */                                       \
+                cmp = 0; /* stop complaints about unused variable */          \
+                return RBTREE_EEXIST;                                         \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        RBTREE_INSERT_NODE(rb, ky, kytype, dta, dtatype, parent, side);       \
+    } while (0)
+
+/* template to remove items from a red-black tree */
+#define RBTREE_REMOVE(rb, ky, kytype, dta, dtatype, isptr)                    \
+    do {                                                                      \
+        enum rbtree_child side = RBTREE_LEFT;                                 \
+        struct rbtree_node *child = rb->root,                                 \
+                           *parent = &rb->nil;                                \
+                                                                              \
+        rb->timestamp++;                          /* update timestamp */      \
+                                                                              \
+        while (child != &rb->nil) {                                           \
+            int cmp;                                                          \
+                                                                              \
+            parent = child;                                                   \
+                                                                              \
+            if ((isptr                                                        \
+                && ((cmp = rb->cmp((void *) ky, child->key.k_ptr)) < 0))      \
+              || ((!isptr) && (ky < child->key.k_##kytype))) {                \
+                /* key is less than, take left child */                       \
+                side = RBTREE_LEFT;                                           \
+                child = child->child[side];                                   \
+            } else if ((isptr && (cmp > 0))                                   \
+              || (!isptr && (ky > child->key.k_##kytype))) {                  \
+                /* key is greater than, take right child */                   \
+                side = RBTREE_RIGHT;                                          \
+                child = child->child[side];                                   \
+            } else {                                                          \
+                /* found a match at child, remove that item */                \
+                struct rbtree_node *x,                                        \
+                                   *y;                                        \
+                                                                              \
+                assert((isptr && (cmp == 0))                                  \
+                  || (!isptr && (ky == child->key.k_##kytype)));              \
+                cmp = 0; /* stop complaints about unused variable */          \
+                                                                              \
+                *dta = child->data.d_##dtatype;                               \
+                                                                              \
+                /* this comes pretty much directly from cormen pg 288 */      \
+                                                                              \
+                if ((child->child[RBTREE_LEFT] == &rb->nil)                   \
+                  || (child->child[RBTREE_RIGHT] == &rb->nil)) {              \
+                    y = child;                                                \
+                } else {                                                      \
+                    /* has both children, find next node in right subtree     \
+                     * that has no left children, so we can splice that in */ \
+                    for (y = child->child[RBTREE_RIGHT];                      \
+                      y->child[RBTREE_LEFT] != &rb->nil;                      \
+                      y = y->child[RBTREE_LEFT]) ;                            \
+                }                                                             \
+                                                                              \
+                assert(y != &rb->nil);                                        \
+                                                                              \
+                if (y->child[RBTREE_LEFT] == &rb->nil) {                      \
+                    x = y->child[RBTREE_RIGHT];                               \
+                } else {                                                      \
+                    x = y->child[RBTREE_LEFT];                                \
+                }                                                             \
+                                                                              \
+                /* note that this can change NIL's parent */                  \
+                x->parent = y->parent;                                        \
+                                                                              \
+                if (y->parent == &rb->nil) {                                  \
+                    assert(child == y);                                       \
+                    rb->root = x;                                             \
+                } else {                                                      \
+                    if (y == y->parent->child[RBTREE_LEFT]) {                 \
+                        y->parent->child[RBTREE_LEFT] = x;                    \
+                    } else {                                                  \
+                        y->parent->child[RBTREE_RIGHT] = x;                   \
+                    }                                                         \
+                                                                              \
+                    if (y != child) {                                         \
+                        int tmpred;                                           \
+                        struct rbtree_node *nilparent = rb->nil.parent;       \
+                                                                              \
+                        /* splice y into the position occupied by child.      \
+                         * Cormen recommends copying the data from y into     \
+                         * child, which is implmented with:                   \
+                         *                                                    \
+                         *   child->key.k_##kytype = y->key.k_##kytype;       \
+                         *   child->data.d_##dtatype = y->data.d_##dtatype;   \
+                         *                                                    \
+                         * however, the problem with that is that it          \
+                         * invalidates data pointers to y, which could be     \
+                         * a source of (very) subtle bugs.  We get around     \
+                         * this by laboriously changing all pointers from     \
+                         * child to y, which has a number of traps. */        \
+                                                                              \
+                        /* splice y in to allow removal of child */           \
+                                                                              \
+                        /* preserve y's red value, we'll need it below */     \
+                        tmpred = y->red;                                      \
+                        y->red = child->red;                                  \
+                                                                              \
+                        /* copy over y's pointers */                          \
+                        y->parent = child->parent;                            \
+                        y->child[RBTREE_LEFT] = child->child[RBTREE_LEFT];    \
+                        y->child[RBTREE_RIGHT] = child->child[RBTREE_RIGHT];  \
+                                                                              \
+                        /* set pointers to y */                               \
+                        assert((y->parent->child[side] == child)              \
+                          || (y->parent->child[side] == &rb->nil));           \
+                        if (y->parent == &rb->nil) {                          \
+                            /* nasty case where child was root, need to       \
+                             * set new root to y */                           \
+                            rb->root = y;                                     \
+                        } else {                                              \
+                            y->parent->child[side] = y;                       \
+                        }                                                     \
+                        y->child[RBTREE_LEFT]->parent = y;                    \
+                        y->child[RBTREE_RIGHT]->parent = y;                   \
+                                                                              \
+                        /* correct nil's parent, as we may have changed it */ \
+                        if (nilparent != child) {                             \
+                            rb->nil.parent = nilparent;                       \
+                        } else {                                              \
+                            /* nasty case where nil's parent was child, has   \
+                             * to stay changed, pointing to y */              \
+                            assert(rb->nil.parent == y);                      \
+                        }                                                     \
+                                                                              \
+                        /* make child the new y, so that the code below       \
+                         * still works */                                     \
+                        y = child;                                            \
+                        y->red = tmpred;                                      \
+                                                                              \
+                        assert(y != &rb->nil);                                \
+                    }                                                         \
+                }                                                             \
+                                                                              \
+                /* make sure we've removed all links to deleted node */       \
+                assert(rbtree_node_not_under(rb, rb->root, y) == RBTREE_OK);  \
+                                                                              \
+                if (!y->red) {                                                \
+                    rbtree_remove_fixup(rb, x);                               \
+                }                                                             \
+                                                                              \
+                objalloc_free(rb->alloc, y);                                  \
+                rb->nil.parent = &rb->nil;    /* fix NIL parent pointer */    \
+                rb->nil.red = 0;              /* and NIL colour */            \
+                rb->size--;                                                   \
+                                                                              \
+                assert(rbtree_invariant(rb) == RBTREE_OK);                    \
+                return RBTREE_OK;                                             \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        return RBTREE_ENOENT;                                                 \
+    } while (0)
+
+/* templated operations */
+
+enum rbtree_ret rbtree_luint_luint_remove(struct rbtree *rb, 
+  unsigned long int key, unsigned long int *data) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_LUINT);
+    assert((rb->data_type == RBTREE_TYPE_LUINT) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_LUINT;
+
+    RBTREE_REMOVE(rb, key, luint, data, luint, 0);
+}
+
+enum rbtree_ret rbtree_luint_luint_insert(struct rbtree *rb, 
+  unsigned long int key, unsigned long int data) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_LUINT);
+    assert((rb->data_type == RBTREE_TYPE_LUINT) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_LUINT;
+
+    RBTREE_INSERT(rb, key, luint, data, luint, 0);
+}
+
+enum rbtree_ret rbtree_luint_luint_find(struct rbtree *rb, 
+  unsigned long int key, unsigned long int **data) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_LUINT);
+    assert((rb->data_type == RBTREE_TYPE_LUINT) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_LUINT;
+
+    RBTREE_FIND(rb, key, luint, data, luint, 0);
+
+    return RBTREE_ENOENT;
+}
+
+enum rbtree_ret rbtree_luint_luint_find_near(struct rbtree *rb, 
+  unsigned long int key, unsigned long int *found_key, 
+  unsigned long int **data) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_LUINT);
+    assert((rb->data_type == RBTREE_TYPE_LUINT) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_LUINT;
+
+    RBTREE_FIND_NEAR(rb, key, found_key, luint, data, luint, 0); 
+}
+
+enum rbtree_ret rbtree_luint_luint_foreach(struct rbtree *rb, void *opaque, 
+  void (*fn)(void *opaque, unsigned long int key, unsigned long int *data)) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_LUINT);
+    assert((rb->data_type == RBTREE_TYPE_LUINT) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_LUINT;
+
+    RBTREE_FOREACH(rb, luint, luint, opaque, fn);
+}
+
+enum rbtree_ret rbtree_iter_luint_luint_next(struct rbtree_iter *rbi, 
+  unsigned long int *key, unsigned long int **data) {
+
+    assert(rbi->rb->key_type == RBTREE_TYPE_LUINT);
+    assert((rbi->rb->data_type == RBTREE_TYPE_LUINT) 
+      || (rbi->rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rbi->rb->data_type = RBTREE_TYPE_LUINT;
+
+    RBTREE_ITER_NEXT(rbi, key, luint, data, luint, 0, unsigned long int);
+}
+
+
+enum rbtree_ret rbtree_ptr_ptr_remove(struct rbtree *rb, 
+  void *key, void **data) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_PTR);
+    assert((rb->data_type == RBTREE_TYPE_PTR) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_PTR;
+
+    RBTREE_REMOVE(rb, key, ptr, data, ptr, 1);
+}
+
+enum rbtree_ret rbtree_ptr_ptr_insert(struct rbtree *rb, 
+  void *key, void *data) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_PTR);
+    assert((rb->data_type == RBTREE_TYPE_PTR) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_PTR;
+
+    RBTREE_INSERT(rb, key, ptr, data, ptr, 1); 
+}
+
+enum rbtree_ret rbtree_ptr_ptr_find(struct rbtree *rb, 
+  void *key, void ***data) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_PTR);
+    assert((rb->data_type == RBTREE_TYPE_PTR) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_PTR;
+
+    RBTREE_FIND(rb, key, ptr, data, ptr, 1);
+
+    return RBTREE_ENOENT;
+}
+
+enum rbtree_ret rbtree_ptr_ptr_find_near(struct rbtree *rb, 
+  void *key, void **found_key, void ***data) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_PTR);
+    assert((rb->data_type == RBTREE_TYPE_PTR) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_PTR;
+
+    RBTREE_FIND_NEAR(rb, key, found_key, ptr, data, ptr, 1);
+}
+
+enum rbtree_ret rbtree_ptr_ptr_foreach(struct rbtree *rb, void *opaque, 
+  void (*fn)(void *opaque, void *key, void **data)) {
+
+    assert(rbtree_invariant(rb) == RBTREE_OK);
+    assert(rb->key_type == RBTREE_TYPE_PTR);
+    assert((rb->data_type == RBTREE_TYPE_PTR) 
+      || (rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rb->data_type = RBTREE_TYPE_PTR;
+
+    RBTREE_FOREACH(rb, ptr, ptr, opaque, fn);
+}
+
+enum rbtree_ret rbtree_iter_ptr_ptr_next(struct rbtree_iter *rbi, 
+  void **key, void ***data) {
+
+    assert(rbi->rb->key_type == RBTREE_TYPE_PTR);
+    assert((rbi->rb->data_type == RBTREE_TYPE_PTR) 
+      || (rbi->rb->data_type == RBTREE_TYPE_UNKNOWN));
+    rbi->rb->data_type = RBTREE_TYPE_PTR;
+
+    RBTREE_ITER_NEXT(rbi, key, ptr, data, ptr, 0, void *);
+}
+
+static enum rbtree_ret rbtree_iter_node_next(struct rbtree_iter *rbi,
+  struct rbtree_node **key) {
+    unsigned long int **data = NULL;
+
+    /* note that keytype and datatype lie (about being luint), but they have to
+     * be something valid */
+    RBTREE_ITER_NEXT(rbi, key, ptr, data, luint, 1, struct rbtree_node *); 
+}
+
diff --git a/src/remerge.c b/src/remerge.c
new file mode 100644 (file)
index 0000000..6bb4c5a
--- /dev/null
@@ -0,0 +1,799 @@
+/* remerge.c implements update via merging new postings with the old index
+ *
+ * written nml 2003-06-01 
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "index.h"
+#include "_index.h"
+
+#include "def.h"
+#include "btbulk.h"
+#include "fdset.h"
+#include "_postings.h"
+#include "postings.h"
+#include "iobtree.h"
+#include "str.h"
+#include "vec.h"
+#include "vocab.h"
+
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* pointer to a file within the index */
+struct filep {
+    int fd;
+    unsigned int type;
+    unsigned int fileno;
+    unsigned long int offset;
+    char *buf;
+    unsigned int bufpos;
+    unsigned int bufsize;
+    unsigned int buflen;
+};
+
+static ssize_t outbuf(struct filep *out, char *buf, unsigned int len, 
+  struct fdset *fd) {
+    unsigned int bufspace = out->bufsize - out->buflen;
+    ssize_t ret;
+
+    assert(out->buflen <= out->bufsize);
+    if (len >= bufspace) {
+        if (len >= out->bufsize) {
+            /* too big for the buffer, write current contents of buffer then 
+             * out buffer to file */
+            if (out->buflen) {
+                if ((ret = index_atomic_write(out->fd, out->buf, out->buflen)) 
+                  == (ssize_t) out->buflen) {
+                    out->offset += out->buflen;
+                } else {
+                    assert(ret < 0);
+                    return ret;
+                }
+            }
+            if ((ret = index_atomic_write(out->fd, buf, len)) 
+              == (ssize_t) len) {
+                out->offset += len;
+            } else {
+                assert(ret < 0);
+                return ret;
+            }
+            out->buflen = out->bufpos = 0;
+        } else {
+            /* small enough for buffer individually, fill buffer to limit, 
+             * write it out and buffer rest */
+            assert(bufspace <= len);
+            assert(out->buflen == out->bufpos);
+            memcpy(out->buf + out->bufpos, buf, bufspace);
+            if ((ret = index_atomic_write(out->fd, out->buf, out->bufsize)) 
+              == (ssize_t) out->bufsize) {
+                out->offset += out->bufsize;
+            } else {
+                assert(ret < 0);
+                return ret;
+            }
+            memcpy(out->buf, buf + bufspace, len - bufspace);
+            out->buflen = out->bufpos = len - bufspace;
+        }
+    } else {
+        /* small enough to fit into buffer now */
+        assert(out->buflen == out->bufpos);
+        memcpy(out->buf + out->bufpos, buf, len);
+        out->buflen += len;
+        out->bufpos += len;
+        assert(out->buflen <= out->bufsize);
+    }
+
+    return len;
+}
+
+/* internal function to load next vocab entry */
+static enum btbulk_ret vocab_load(struct btbulk_read *vocab, struct filep *fp, 
+  struct fdset *fdset, unsigned int pagesize) {
+    enum btbulk_ret ret;
+    int fdret;
+
+    do {
+        ret = btbulk_read(vocab);
+        switch (ret) {
+        case BTBULK_READ:
+            if (vocab->output.read.fileno != fp->fileno) {
+                /* switch to new fd */
+
+                /* unpin old fd, if necessary */
+                if (fp->fd >= 0) {
+                    if ((fdret 
+                      = fdset_unpin(fdset, fp->type, fp->fileno, fp->fd)) 
+                        != FDSET_OK) {
+
+                        assert(!CRASH);
+                        return BTBULK_ERR;
+                    }
+                }
+
+                /* pin new fd */
+                fp->fileno = vocab->output.read.fileno;
+                if ((fp->fd = fdset_pin(fdset, fp->type, fp->fileno, 
+                    vocab->output.read.offset, SEEK_SET)) >= 0) {
+
+                    fp->offset = vocab->output.read.offset;
+                    vocab->fileno_in = fp->fileno;
+                } else {
+                    fp->fileno = -1;
+                    return BTBULK_ERR;
+                }
+            }
+
+            /* seek to appropriate offset */
+            if (vocab->output.read.offset != fp->offset) {
+                if (lseek(fp->fd, vocab->output.read.offset, SEEK_SET) 
+                  == (ssize_t) vocab->output.read.offset) {
+                    fp->offset = vocab->output.read.offset;
+                } else {
+                    assert(!CRASH);
+                    return BTBULK_ERR;
+                }
+            }
+
+            /* read from fd */
+            if ((vocab->avail_in = read(fp->fd, fp->buf, fp->bufsize)) 
+              >= pagesize) {
+                fp->bufpos = 0;
+                fp->buflen = vocab->avail_in;
+                vocab->next_in = fp->buf;
+                vocab->offset_in = fp->offset;
+                fp->offset += vocab->avail_in;
+            } else {
+                vocab->avail_in = 0;
+                fp->buflen = fp->bufpos = 0;
+                fp->offset = -1;
+                return BTBULK_ERR;
+            }
+            break;
+
+        case BTBULK_OK:
+        case BTBULK_FINISH:
+        default:
+            return ret;
+        }
+    } while (1);
+}
+
+/* internal function to perform remerge, since the real function had too much
+ * other crap in it.  Returns number of vector files created, or 0 on error */
+static unsigned int actual_remerge(struct index *idx, struct filep *in, 
+  struct filep *vin, struct btbulk_read *old_vocab, struct filep *out, 
+  struct filep *vout, struct btbulk *new_vocab, 
+  struct fdset *fd, struct postings_node **posting, unsigned int postings,
+  unsigned long int *nt, unsigned int *root_fileno,
+  unsigned long int *root_offset) {
+    struct postings_node **posting_end = posting + postings;
+    enum btbulk_ret readret,
+                    btret;
+    int cmp;
+    unsigned long int terms = 0;
+    struct vocab_vector nve,
+                        ve;
+    const unsigned int pagesize = idx->storage.pagesize;
+    ssize_t sizeret;
+
+    /* load first entry from old vocab */
+    if ((readret = vocab_load(old_vocab, vin, fd, pagesize)) != BTBULK_OK 
+      && readret != BTBULK_FINISH) {
+        assert(!CRASH);
+        return 0;
+    }
+
+    /* these properties are invariant over all new vocab entries written out */
+    nve.attr = VOCAB_ATTRIBUTES_NONE;
+    nve.type = VOCAB_VTYPE_DOCWP;
+    nve.location = VOCAB_LOCATION_FILE;
+
+    while ((posting < posting_end) || (readret != BTBULK_FINISH)) {
+        if (posting < posting_end) {
+            new_vocab->termlen = str_len((*posting)->term);
+            if (readret == BTBULK_OK) {
+                cmp = str_nncmp(old_vocab->output.ok.term, 
+                    old_vocab->output.ok.termlen, 
+                    (*posting)->term, new_vocab->termlen);
+            } else {
+                /* use new postings only */
+                cmp = 1;
+            }
+        } else {
+            /* use old postings only */
+            assert(readret == BTBULK_OK);
+            cmp = -1;
+        }
+
+        terms++;
+        nve.size = 0;
+        nve.header.docwp.docs = 0;
+        nve.header.docwp.occurs = 0;
+        new_vocab->datasize = 0;
+        nve.header.docwp.last = -1;
+        nve.loc.file.fileno = out->fileno;
+        nve.loc.file.offset = out->offset + out->buflen;
+
+        if (cmp <= 0) {
+            struct vec vv;
+            enum vocab_ret vret;
+            unsigned int bytes;
+
+            new_vocab->term = old_vocab->output.ok.term;
+            new_vocab->termlen = old_vocab->output.ok.termlen;
+
+            vv.pos = (void *) old_vocab->output.ok.data;
+            vv.end = vv.pos + old_vocab->output.ok.datalen;
+            while ((vret = vocab_decode(&ve, &vv)) == VOCAB_OK) {
+                switch (ve.type) {
+                case VOCAB_VTYPE_DOC:
+                case VOCAB_VTYPE_DOCWP:
+                    /* must be the only vector available */
+                    assert(nve.size == 0);
+                    assert(nve.location == VOCAB_LOCATION_FILE);
+
+                    /* copy it to the new index */
+                    nve.size += ve.size;
+                    nve.header.doc.docs += ve.header.doc.docs;
+                    nve.header.doc.occurs += ve.header.doc.occurs;
+                    nve.header.doc.last = ve.header.doc.last;
+
+                    /* check whether we're about to go above file size 
+                     * limit for output file */
+                    if (((cmp == 0) 
+                        && (out->offset + out->buflen 
+                          > idx->storage.max_filesize - nve.size 
+                            - ((*posting)->vec.pos - (*posting)->vecmem)))
+                      || ((cmp < 0) 
+                        && (out->offset + out->buflen
+                          > idx->storage.max_filesize - nve.size))) {
+                        /* unpin old fd */
+                        if (out->fd >= 0) {
+                            /* flush buffer */
+                            if (out->buflen && index_atomic_write(out->fd, 
+                                out->buf, out->buflen) 
+                              == (ssize_t) out->buflen) {
+
+                                out->buflen = out->bufpos = 0;
+                            } else {
+                                assert(!CRASH);
+                                return 0;
+                            }
+                            fdset_unpin(fd, out->type, out->fileno, out->fd);
+                        }
+
+                        /* pin new fd */
+                        if ((out->fd 
+                          = fdset_create(fd, out->type, out->fileno + 1)) 
+                            >= 0) {
+
+                            out->fileno++;
+                            out->offset = 0;
+                        } else {
+                            out->offset = -1;
+                            assert(!CRASH);
+                            return 0;
+                        }
+
+                        nve.loc.file.fileno = out->fileno;
+                        nve.loc.file.offset = out->offset + out->buflen;
+                    }
+
+                    /* pin correct in fd */
+                    assert((in->fd < 0) 
+                      || lseek(in->fd, 0, SEEK_CUR) 
+                        == (ssize_t) in->offset);
+                    if (ve.loc.file.fileno != in->fileno) {
+                        if (in->fd >= 0) {
+                            fdset_unpin(fd, in->type, in->fileno, in->fd);
+                            in->fd = -1;
+                        }
+                        if ((in->fd = fdset_pin(fd, in->type, in->fileno + 1, 
+                            ve.loc.file.offset, SEEK_SET)) >= 0) {
+
+                            in->fileno++;
+                            in->offset = ve.loc.file.offset;
+                        } else {
+                            assert(!CRASH);
+                            return 0;
+                        }
+                    }
+
+                    /* seek to correct in position */
+                    assert(lseek(in->fd, 0, SEEK_CUR) 
+                      == (ssize_t) in->offset);
+                    assert(ve.loc.file.offset 
+                      == in->offset + in->bufpos - in->buflen);
+                    if (ve.loc.file.offset < in->offset - in->buflen
+                      || (ve.loc.file.offset > in->offset)) {
+                        if (lseek(in->fd, ve.loc.file.offset, SEEK_SET) 
+                          == (ssize_t) ve.loc.file.offset) {
+                            in->offset = ve.loc.file.offset;
+                        } else {
+                            assert(!CRASH);
+                            return 0;
+                        }
+                    }
+                    assert(lseek(in->fd, 0, SEEK_CUR) 
+                      == (ssize_t) in->offset);
+
+                    /* copy (possibly partially) buffered segment from input to
+                     * output */
+                    bytes = nve.size;
+                    if (ve.size && (ve.size >= (in->buflen - in->bufpos))) {
+                        if (outbuf(out, in->buf + in->bufpos, 
+                            in->buflen - in->bufpos, fd)
+                          == (ssize_t) (in->buflen - in->bufpos)) {
+                            ve.size -= in->buflen - in->bufpos;
+                            in->buflen = in->bufpos = 0;
+                        } else {
+                            assert(!CRASH);
+                            return 0;
+                        }
+                    }
+
+                    /* copy full bufferloads from input to output */
+                    while (ve.size > in->bufsize) {
+                        assert(in->buflen == 0);
+                        assert(in->bufpos == 0);
+                        if (((in->buflen
+                          = read(in->fd, in->buf, in->bufsize)) > 0)
+                          && (outbuf(out, in->buf, in->buflen, fd)) 
+                            == (ssize_t) in->buflen) {
+
+                            ve.size -= in->buflen;
+                            in->offset += in->buflen;
+                            assert(lseek(in->fd, 0, SEEK_CUR) 
+                              == (ssize_t) in->offset);
+                        } else {
+                            assert(!CRASH);
+                            return 0;
+                        }
+                    }
+                    assert((ve.size < (in->buflen - in->bufpos)) 
+                      || !in->buflen);
+
+                    /* read in last bufferload if necessary */
+                    if (ve.size && !in->buflen 
+                      && (bytes = read(in->fd, in->buf, in->bufsize)) 
+                          != -1) {
+
+                        in->buflen = bytes;
+                        in->offset += in->buflen;
+                        assert(lseek(in->fd, 0, SEEK_CUR) 
+                          == (ssize_t) in->offset);
+                    } else if (ve.size && !in->buflen) {
+                        assert(!CRASH);
+                        return 0;
+                    }
+
+                    /* copy last buffered segment from input to output */
+                    assert(ve.size <= (in->buflen - in->bufpos));
+                    if (ve.size 
+                      && (outbuf(out, in->buf + in->bufpos, ve.size, fd) 
+                        == (ssize_t) ve.size)) {
+
+                        in->bufpos += ve.size;
+                    } else if (ve.size) {
+                        assert(!CRASH);
+                        return 0;
+                    }
+                    break;
+
+                case VOCAB_VTYPE_IMPACT:
+                    /* impacts are now out-of-date, remove them from the 
+                     * index */
+                    break;
+                }
+            }
+            assert(vret == VOCAB_END);
+            assert(vec_len(&vv) == 0);
+        } else {
+            assert(cmp > 0);
+
+            assert(new_vocab->termlen == str_len((*posting)->term));
+            new_vocab->term = (*posting)->term;
+
+            /* check whether we're about to go above file size 
+             * limit for output file */
+            if (out->offset + out->buflen > idx->storage.max_filesize 
+                  - ((*posting)->vec.pos - (*posting)->vecmem)) {
+                /* unpin old fd */
+                if (out->fd >= 0) {
+                    /* flush buffer */
+                    if (out->buflen && index_atomic_write(out->fd, 
+                        out->buf, out->buflen) 
+                      == (ssize_t) out->buflen) {
+
+                        out->buflen = out->bufpos = 0;
+                    } else {
+                        assert(!CRASH);
+                        return 0;
+                    }
+                    fdset_unpin(fd, out->type, out->fileno, out->fd);
+                }
+
+                /* pin new fd */
+                if ((out->fd 
+                  = fdset_create(fd, out->type, out->fileno + 1))
+                    >= 0) {
+
+                    out->fileno++;
+                    out->offset = 0;
+                } else {
+                    out->offset = -1;
+                    assert(!CRASH);
+                    return 0;
+                }
+
+                nve.loc.file.fileno = out->fileno;
+                nve.loc.file.offset = out->offset + out->buflen;
+            }
+        }
+
+        if (cmp >= 0) {
+            struct vec front;
+            unsigned long int first;
+            unsigned int bytes;
+
+            /* re-encode first docno in in-memory vector */
+            front.pos = (*posting)->vecmem;
+            front.end = (*posting)->vec.pos;
+
+            bytes = vec_vbyte_read(&front, &first);
+            assert(bytes);
+            first -= (nve.header.doc.last + 1);
+            bytes = vec_vbyte_len(first);
+            front.pos -= bytes;
+            vec_vbyte_write(&front, first);
+            front.pos -= bytes;
+
+            nve.size += vec_len(&front);
+            nve.header.doc.docs += (*posting)->docs;
+            nve.header.doc.occurs += (*posting)->occurs;
+            nve.header.doc.last = (*posting)->last_docno;
+
+            /* write in-memory vector to output */
+            bytes = vec_len(&front);
+            if (outbuf(out, front.pos, bytes, fd) == (ssize_t) bytes) {
+                /* do nothing */
+            } else {
+                assert(!CRASH);
+                return 0;
+            }
+        }
+
+        /* insert new vocab entry */
+        nve.loc.file.capacity = nve.size;
+        new_vocab->datasize = vocab_len(&nve);
+        do {
+            struct vec datav;
+            enum vocab_ret vret;
+
+            switch ((btret = btbulk_insert(new_vocab))) {
+            case BTBULK_WRITE:
+                /* seek to correct location */
+                assert(vout->fileno == new_vocab->fileno);
+                if (new_vocab->offset != vout->offset) {
+                    if (lseek(vout->fd, new_vocab->offset, SEEK_SET) 
+                      == (ssize_t) new_vocab->offset) {
+                        vout->offset = new_vocab->offset;
+                    } else {
+                        assert(!CRASH);
+                        return 0;
+                    }
+                }
+
+                /* write new output */
+                if ((sizeret = index_atomic_write(vout->fd, 
+                      new_vocab->output.write.next_out, 
+                      new_vocab->output.write.avail_out)) 
+                    == (ssize_t) new_vocab->output.write.avail_out) {
+
+                    new_vocab->offset += sizeret;
+                } else {
+                    assert(!CRASH);
+                    return 0;
+                }
+                break;
+
+            case BTBULK_FLUSH:
+                /* need to start a new file */
+
+                /* unpin previous fd */
+                if (vout->fd >= 0) {
+                    fdset_unpin(fd, vout->type, vout->fileno, vout->fd);
+                    vout->fd = -1;
+                }
+
+                /* pin new fd */
+                if ((vout->fd 
+                  = fdset_create(fd, vout->type, vout->fileno + 1)) 
+                    >= 0) {
+
+                    vout->fileno++;
+                    new_vocab->offset = vout->offset = 0;
+                    new_vocab->fileno = vout->fileno;
+                } else {
+                    assert(!CRASH);
+                    return 0;
+                }
+                break;
+
+            case BTBULK_OK:
+                /* insertion succeeded, write vocab entry in */
+                datav.pos = new_vocab->output.ok.data;
+                datav.end = datav.pos + new_vocab->datasize;
+                vret = vocab_encode(&nve, &datav);
+                assert(vret == VOCAB_OK);
+                assert(vec_len(&datav) == 0);
+                break;
+
+            default:
+                assert(!CRASH);
+                return 0;
+            }
+        } while (btret != BTBULK_OK);
+
+        if (cmp <= 0) {
+            /* advance to next entry from old vocab */
+            if ((readret = vocab_load(old_vocab, vin, fd, pagesize)) 
+                != BTBULK_OK 
+              && readret != BTBULK_FINISH) {
+                assert(!CRASH);
+                return 0;
+            }
+        }
+        if (cmp >= 0) {
+            /* advance to next entry from new postings */
+            posting++;
+        }
+    }
+
+    /* finalise vocabulary */
+    do {
+        switch ((btret 
+          = btbulk_finalise(new_vocab, root_fileno, root_offset))) {
+        case BTBULK_WRITE:
+            /* seek to correct location */
+            assert(vout->fileno == new_vocab->fileno);
+            if (new_vocab->offset != vout->offset) {
+                if (lseek(vout->fd, new_vocab->offset, SEEK_SET) 
+                  == (ssize_t) new_vocab->offset) {
+                    vout->offset = new_vocab->offset;
+                } else {
+                    assert(!CRASH);
+                    return 0;
+                }
+            }
+
+            /* write new output */
+            if ((sizeret = index_atomic_write(vout->fd, 
+                  new_vocab->output.write.next_out, 
+                  new_vocab->output.write.avail_out)) 
+                == (ssize_t) new_vocab->output.write.avail_out) {
+
+                new_vocab->offset += sizeret;
+            } else {
+                assert(!CRASH);
+                return 0;
+            }
+            break;
+
+        case BTBULK_FLUSH:
+            /* need to start a new file */
+
+            /* unpin previous fd */
+            if (vout->fd >= 0) {
+                fdset_unpin(fd, vout->type, vout->fileno, vout->fd);
+                vout->fd = -1;
+            }
+
+            /* pin new fd */
+            if ((vout->fd 
+              = fdset_create(fd, vout->type, vout->fileno + 1))
+                >= 0) {
+
+                vout->fileno++;
+                new_vocab->offset = vout->offset = 0;
+                new_vocab->fileno = vout->fileno;
+            } else {
+                assert(!CRASH);
+                return 0;
+            }
+            break;
+
+        case BTBULK_FINISH:
+        case BTBULK_OK:
+            btret = BTBULK_FINISH;
+            break;
+
+        default:
+            assert(!CRASH);
+            return 0;
+        }
+    } while (btret != BTBULK_FINISH);
+
+    /* flush output buffer */
+    if (out->bufpos) {
+        if ((sizeret = index_atomic_write(out->fd, out->buf, out->bufpos)) 
+            != (ssize_t) out->bufpos) {
+            assert(!CRASH);
+            return 0;
+        }
+    }
+
+    *nt = terms;
+    return out->fileno + 1;
+}
+
+int index_remerge(struct index *idx, unsigned int opts, 
+  struct index_commit_opt *opt) {
+    struct filep in = {-1, -1, -1, -1, NULL, 0, 0, 0},
+                 out = {-1, -1, -1, -1, NULL, 0, 0, 0},
+                 vin = {-1, -1, -1, -1, NULL, 0, 0, 0},
+                 vout = {-1, -1, -1, -1, NULL, 0, 0, 0};
+    struct postings_node **posting = NULL,
+                         *node;
+    struct btbulk new_vocab,
+                  *new_vocab_ptr = NULL;
+    struct btbulk_read old_vocab;
+    unsigned int i,
+                 j,
+                 vectors = idx->vectors,
+                 len,
+                 bufsize,
+                 root_fileno,
+                 postings = postings_distinct_terms(idx->post);
+    unsigned long int terms,
+                      root_offset;
+    struct iobtree *tmpbtree;
+
+    assert(!postings_needs_update(idx->post));
+
+    if (opts & INDEX_COMMIT_DUMPBUF) {
+        bufsize = opt->dumpbuf;
+
+        /* minimum of a page for each buffer */
+        if (bufsize < 4 * idx->storage.pagesize) {
+            bufsize = 4 * idx->storage.pagesize;
+        }
+    } else {
+        /* default is for 5 pages per buffer */
+        bufsize = 5 * 4 * idx->storage.pagesize;
+    }
+
+    vin.type = idx->vocab_type;
+    vout.type = idx->vtmp_type;
+    in.type = idx->index_type;
+    out.type = idx->tmp_type;
+
+    /* first, need to create a new set of index files */
+    if ((posting = malloc(sizeof(*posting) * postings))
+      /* note that vout gets a buffer within btbulk */
+      && (in.bufsize = bufsize / 4)
+      && (in.buf = malloc(in.bufsize))
+      && (out.bufsize = bufsize / 4)
+      && (out.buf = malloc(out.bufsize))
+      && (vin.bufsize = bufsize / 4)
+      && (vin.buf = malloc(vin.bufsize))
+      /* pin first vocab output fd, for convenience later */
+      && ((vout.fd = fdset_create(idx->fd, vout.type, 0)) >= 0)
+      && (new_vocab_ptr = btbulk_new(idx->storage.pagesize, 
+          idx->storage.max_filesize, idx->storage.btleaf_strategy, 
+          idx->storage.btnode_strategy, 1.0, 
+          bufsize / (4 * idx->storage.pagesize), &new_vocab))
+      && btbulk_read_new(idx->storage.pagesize, idx->storage.btleaf_strategy, 
+          0, 0, &old_vocab)) {
+
+        new_vocab.fileno = 0;
+        new_vocab.offset = 0;
+
+        vout.fileno = 0;
+        vout.offset = 0;
+
+        /* copy nodes into array */
+        j = 0;
+        for (i = 0; i < idx->post->tblsize; i++) {
+            node = idx->post->hash[i];
+            while (node) {
+                posting[j++] = node;
+                node = node->next;
+            }
+        }
+        assert(j == postings);
+
+        /* sort postings lexographically by term and perform merge */
+        qsort(posting, postings, sizeof(*posting), post_cmp);
+        idx->vectors
+          = actual_remerge(idx, &in, &vin, &old_vocab, &out, &vout, &new_vocab,
+            idx->fd, posting, postings, &terms, &root_fileno, &root_offset);
+
+        btbulk_delete(&new_vocab);
+        btbulk_read_delete(&old_vocab);
+        free(posting);
+        free(vin.buf);
+        free(in.buf);
+        free(out.buf);
+
+        /* unpin fds */
+        if (vin.fd >= 0) {fdset_unpin(idx->fd, vin.type, vin.fileno, vin.fd);}
+        if (vout.fd >= 0) {
+            fdset_unpin(idx->fd, vout.type, vout.fileno, vout.fd);
+        }
+        if (in.fd >= 0) {fdset_unpin(idx->fd, in.type, in.fileno, in.fd);}
+        if (out.fd >= 0) {fdset_unpin(idx->fd, out.type, out.fileno, out.fd);}
+
+        /* quickload new vocab */
+        if (idx->vectors 
+          && (tmpbtree = iobtree_load_quick(idx->storage.pagesize, 
+            idx->storage.btleaf_strategy, idx->storage.btnode_strategy, 
+            NULL, idx->fd, idx->vtmp_type, root_fileno, root_offset, terms))) {
+
+            assert(iobtree_size(tmpbtree) >= iobtree_size(idx->vocab));
+            iobtree_delete(idx->vocab);
+            for (i = 0; fdset_unlink(idx->fd, idx->vocab_type, i) == FDSET_OK; 
+              i++) ;
+            idx->vocab = tmpbtree;
+            len = idx->vocab_type;
+            idx->vocab_type = idx->vtmp_type;
+            idx->vtmp_type = len;
+            idx->vocabs = vout.fileno + 1;
+        } else {
+            assert(!CRASH);
+            return 0;
+        }
+
+        if (idx->vectors) {
+            /* swap index and tmp types so that queries/updates start 
+             * occurring from new index */
+            len = idx->index_type;
+            idx->index_type = idx->tmp_type;
+            idx->tmp_type = len;
+
+            /* unlink all of the old files */
+            for (i = 0; i < vectors; i++) {
+                if (fdset_unlink(idx->fd, idx->tmp_type, i) == FDSET_OK) {
+                    /* successful, do nothing */
+                } else {
+                    /* unexpected error */
+                    assert(!CRASH);
+                    return 0;
+                }
+            }
+
+            return 1;
+        } else {
+            idx->vectors = vectors;
+            assert(!CRASH);
+            return 0;
+        }
+    } else {
+        assert(!CRASH);
+        if (vout.fd >= 0) {
+            fdset_unpin(idx->fd, vout.type, 0, vout.fd);
+        }
+        if (in.buf) {
+            free(in.buf);
+        }
+        if (out.buf) {
+            free(out.buf);
+        }
+        if (vin.buf) {
+            free(vin.buf);
+        }
+        if (new_vocab_ptr) {
+            btbulk_delete(new_vocab_ptr);
+        }
+        if (posting) {
+            free(posting);
+        }
+    }
+
+    return 0;
+}
+
diff --git a/src/reposset.c b/src/reposset.c
new file mode 100644 (file)
index 0000000..f6b7e53
--- /dev/null
@@ -0,0 +1,391 @@
+/* reposset.c implements an object that manages the set of
+ * repositories, as declared in reposset.h.
+ *
+ * FIXME: There is a problem with the strategy of saving/loading through the
+ * docmap, which is that there is no way of determining where checkpoints go 
+ * via the information in the docmap (???).
+ *
+ * written nml 2006-04-26
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "reposset.h"
+#include "_reposset.h"
+
+#include "def.h"
+#include "binsearch.h"
+#include "mime.h"
+#include "vec.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define INIT_ARRAY_SIZE 4
+
+struct reposset {
+    unsigned int entries;              /* number of repositories in set */
+
+    struct reposset_record *rec;       /* sorted array of records */
+    unsigned int rec_size;             /* size of records array */
+    unsigned int rec_len;              /* number of records currently in rec */
+
+    struct reposset_check *check;      /* sorted array of checkpoints */
+    unsigned int check_size;           /* size of checkpoint array */
+    unsigned int check_len;            /* entries currently in check */
+};
+
+static int check_cmp(const void *vone, const void *vtwo) {
+    const struct reposset_check *one = vone,
+                                *two = vtwo;
+
+    if (one->reposno < two->reposno) {
+        return -1;
+    } else if (one->reposno > two->reposno) {
+        return 1;
+    } else if (one->offset < two->offset) {
+        return -1;
+    } else if (one->offset > two->offset) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+static int rec_docno_cmp(const void *vone, const void *vtwo) {
+    const struct reposset_record *one = vone,
+                                 *two = vtwo;
+    unsigned int one_end = one->docno + one->quantity,
+                 two_end = two->docno + two->quantity;
+
+    /* have to detect overlaps between the two ranges so that searching works
+     * properly.  bugger :o( */
+    if (one->docno < two->docno) {
+        if (one_end > two->docno) {
+            return 0;
+        } else {
+            return -1;
+        }
+    } else if (one->docno > two->docno) {
+        if (two_end > one->docno) {
+            return 0;
+        } else {
+            return 1;
+        }
+    } else {
+        return 0;
+    }
+}
+
+struct reposset *reposset_new() {
+    struct reposset *rset = malloc(sizeof(*rset));
+
+    if (rset && (rset->rec = malloc(sizeof(*rset->rec) * INIT_ARRAY_SIZE))
+      && (rset->check = malloc(sizeof(*rset->check) * INIT_ARRAY_SIZE))) {
+
+        rset->rec_size = rset->check_size = INIT_ARRAY_SIZE;
+        reposset_clear(rset);
+    } else if (rset) {
+        if (rset->rec) {
+            free(rset->rec);
+        }
+        if (rset->check) {
+            free(rset->check);
+        }
+        free(rset);
+        rset = NULL;
+    }
+
+    return rset;
+}
+
+void reposset_print(struct reposset *rset, FILE *out) {
+    unsigned int i;
+
+    for (i = 0; i < rset->rec_len; i++) {
+        if (rset->rec[i].rectype == REPOSSET_MANY_FILES) {
+            printf("files %u - %u contain docnos %u - %u\n", 
+              rset->rec[i].reposno,
+              rset->rec[i].reposno + rset->rec[i].quantity - 1,
+              rset->rec[i].docno,
+              rset->rec[i].docno + rset->rec[i].quantity - 1);
+        } else {
+            printf("file %u contains docnos %u - %u\n", 
+              rset->rec[i].reposno,
+              rset->rec[i].docno,
+              rset->rec[i].docno + rset->rec[i].quantity - 1);
+        }
+    }
+    if (rset->rec_len) {
+        printf("\n");
+    }
+
+    for (i = 0; i < rset->check_len; i++) {
+        printf("checkpoint %u %lu: %s\n", rset->check[i].reposno,
+          rset->check[i].offset, mime_string(rset->check[i].comp));
+    }
+}
+
+void reposset_delete(struct reposset *rset) {
+    assert(rset->rec);
+    assert(rset->check);
+    free(rset->rec);
+    free(rset->check);
+    free(rset);
+}
+
+enum reposset_ret reposset_append(struct reposset *rset, 
+  unsigned int start_docno, unsigned int *reposno) {
+    if (rset->entries 
+      && rset->rec[rset->rec_len - 1].rectype == REPOSSET_MANY_FILES
+      && rset->rec[rset->rec_len - 1].docno 
+        + rset->rec[rset->rec_len - 1].quantity == start_docno) {
+
+        /* just append this record onto the last many-files record */
+        rset->rec[rset->rec_len - 1].quantity++;
+    } else {
+        /* have to add a new record */
+        if (rset->rec_len >= rset->rec_size) {
+            void *ptr 
+              = realloc(rset->rec, sizeof(*rset->rec) * rset->rec_size * 2);
+
+            if (ptr) {
+                rset->rec = ptr;
+                rset->rec_size *= 2;
+                assert(rset->rec_len < rset->rec_size);
+            } else {
+                return REPOSSET_ENOMEM;
+            }
+        }
+
+        rset->rec[rset->rec_len].rectype = REPOSSET_MANY_FILES;
+        rset->rec[rset->rec_len].docno = start_docno;
+        rset->rec[rset->rec_len].reposno = rset->entries;
+        rset->rec[rset->rec_len].quantity = 1;
+        rset->rec_len++;
+    }
+
+    *reposno = rset->entries++;
+    return REPOSSET_OK;
+}
+
+enum reposset_ret reposset_append_docno(struct reposset *rset, 
+  unsigned int docno, unsigned int docs) {
+    assert(docs);
+    if (rset->entries 
+      && rset->rec[rset->rec_len - 1].docno 
+        + rset->rec[rset->rec_len - 1].quantity - 1 == docno) {
+        /* first docno in the file, ignore */
+    } else if (rset->entries
+      && rset->rec[rset->rec_len - 1].docno 
+        + rset->rec[rset->rec_len - 1].quantity == docno
+      && (rset->rec[rset->rec_len - 1].rectype == REPOSSET_SINGLE_FILE
+        || (rset->rec[rset->rec_len - 1].rectype == REPOSSET_MANY_FILES
+          && (rset->rec[rset->rec_len - 1].quantity == 1)))) {
+
+        /* just add the docnos onto the existing record */
+        rset->rec[rset->rec_len - 1].rectype = REPOSSET_SINGLE_FILE;
+        rset->rec[rset->rec_len - 1].quantity += docs;
+    } else if (rset->entries
+      && rset->rec[rset->rec_len - 1].rectype == REPOSSET_MANY_FILES
+      && rset->rec[rset->rec_len - 1].docno 
+        + rset->rec[rset->rec_len - 1].quantity == docno) {
+
+        /* have to add a new record */
+        if (rset->rec_len >= rset->rec_size) {
+            void *ptr 
+              = realloc(rset->rec, sizeof(*rset->rec) * rset->rec_size * 2);
+
+            if (ptr) {
+                rset->rec = ptr;
+                rset->rec_size *= 2;
+                assert(rset->rec_len < rset->rec_size);
+            } else {
+                return REPOSSET_ENOMEM;
+            }
+        }
+
+        /* adjust previous entry */
+        rset->rec[rset->rec_len - 1].quantity--;
+
+        /* insert new entry */
+        rset->rec[rset->rec_len].rectype = REPOSSET_SINGLE_FILE;
+        rset->rec[rset->rec_len].docno = docno - 1;
+        rset->rec[rset->rec_len].reposno = rset->entries - 1;
+        rset->rec[rset->rec_len].quantity = docs + 1;
+        rset->rec_len++;
+    } else {
+        assert("can't get here" && 0);
+        return REPOSSET_EINVAL;
+    }
+
+    return REPOSSET_OK;
+}
+
+enum reposset_ret reposset_add_checkpoint(struct reposset *rset, 
+  unsigned int reposno, enum mime_types comp, unsigned long int point) {
+    /* XXX: technically, reposno should be below the number of
+     * entries, but we'll allow checkpoints to be entered for the
+     * coming repository as well, for convenience sake.  Also, we
+     * should probably maintain the sorting of the array explicitly,
+     * but we assume that they come in sorted order. */
+    assert(comp == MIME_TYPE_APPLICATION_X_GZIP 
+      || comp == MIME_TYPE_APPLICATION_X_BZIP2);
+
+    assert(!rset->check_len 
+      || rset->check[rset->check_len - 1].reposno < reposno);
+
+    if (rset->check_len >= rset->check_size) {
+        void *ptr = realloc(rset->check, 
+            sizeof(*rset->check) * rset->check_size * 2);
+
+        if (ptr) {
+            rset->check = ptr;
+            rset->check_size *= 2;
+            assert(rset->check_len < rset->check_size);
+        } else {
+            return REPOSSET_ENOMEM;
+        }
+    }
+
+    rset->check[rset->check_len].reposno = reposno;
+    rset->check[rset->check_len].offset = point;
+    rset->check[rset->check_len].comp = comp;
+    assert(!rset->check_len || check_cmp(&rset->check[rset->check_len - 1], 
+      &rset->check[rset->check_len]) < 0);  /* ensure ordering is correct */
+    rset->check_len++;
+    return REPOSSET_OK;
+}
+
+unsigned int reposset_reposno_rec(struct reposset_record *rec, 
+  unsigned int docno) {
+    if (rec->rectype == REPOSSET_SINGLE_FILE) {
+        return rec->reposno;
+    } else {
+        return rec->reposno + docno - rec->docno;
+    }
+}
+
+enum reposset_ret reposset_reposno(struct reposset *rset, unsigned int docno, 
+  unsigned int *reposno) {
+    struct reposset_record *find,
+                           target;
+
+    target.docno = docno;
+    target.quantity = 1;
+
+    /* find the correct page in the map */
+    find = binsearch(&target, rset->rec, rset->rec_len, sizeof(target), 
+        rec_docno_cmp);
+
+    if (find < rset->rec + rset->rec_len && find->docno <= docno 
+      && find->docno + find->quantity > docno) {
+        *reposno = reposset_reposno_rec(find, docno);
+        return REPOSSET_OK;
+    } else {
+        return REPOSSET_ENOENT;
+    }
+}
+
+unsigned int reposset_entries(struct reposset *rset) {
+    return rset->entries;
+}
+
+struct reposset_record *reposset_record_last(struct reposset *rset) {
+    if (rset->rec_len) {
+        return &rset->rec[rset->rec_len - 1];
+    } else {
+        return NULL;
+    }
+}
+
+struct reposset_record *reposset_record(struct reposset *rset, 
+  unsigned int docno) {
+    struct reposset_record *find,
+                           target;
+
+    target.docno = docno;
+    target.quantity = 1;
+
+    /* find the correct page in the map */
+    find = binsearch(&target, rset->rec, rset->rec_len, sizeof(target), 
+        rec_docno_cmp);
+
+    if (find < rset->rec + rset->rec_len && find->docno <= docno 
+      && find->docno + find->quantity > docno) {
+        return find;
+    } else {
+        return NULL;
+    }
+}
+
+enum reposset_ret reposset_set_record(struct reposset *rset, 
+  struct reposset_record *rec) {
+    unsigned int max = rec->reposno + 1;
+
+    /* XXX: again, can't be bothered actively sorting entries here,
+     * ensure that they come sorted */
+    assert(!rset->entries 
+      || rec_docno_cmp(&rset->rec[rset->rec_len - 1], rec) < 0);
+    assert(!rset->entries 
+      || rset->rec[rset->rec_len - 1].reposno < rec->reposno);
+
+    /* have to add a new record */
+    if (rset->rec_len >= rset->rec_size) {
+        void *ptr 
+          = realloc(rset->rec, sizeof(*rset->rec) * rset->rec_size * 2);
+
+        if (ptr) {
+            rset->rec = ptr;
+            rset->rec_size *= 2;
+            assert(rset->rec_len < rset->rec_size);
+        } else {
+            return REPOSSET_ENOMEM;
+        }
+    }
+
+    /* update entries */
+    if (rec->rectype == REPOSSET_MANY_FILES) {
+        max += rec->quantity;
+    }
+    if (max > rset->entries) {
+        rset->entries = max;
+    }
+
+    rset->rec[rset->rec_len++] = *rec;
+    return REPOSSET_OK;
+}
+
+void reposset_clear(struct reposset *rset) {
+    rset->entries = rset->rec_len = rset->check_len = 0;
+}
+
+struct reposset_check *reposset_check(struct reposset *rset, 
+  unsigned int reposno) {
+    struct reposset_check *find,
+                          target;
+
+    target.reposno = reposno;
+    target.offset = 0;
+
+    /* find the correct page in the map */
+    find = binsearch(&target, rset->check, rset->check_len, sizeof(target), 
+        check_cmp);
+
+    if (find < rset->check + rset->check_len && find->reposno == reposno) {
+        return find;
+    } else {
+        return NULL;
+    }
+}
+
+struct reposset_check *reposset_check_first(struct reposset *rset) {
+    return rset->check;
+}
+
+unsigned int reposset_checks(struct reposset *rset) {
+    return rset->check_len;
+}
+
diff --git a/src/search.c b/src/search.c
new file mode 100644 (file)
index 0000000..b5b8221
--- /dev/null
@@ -0,0 +1,1723 @@
+/* search.c implements operations needed to search an index
+ *
+ * written nml 2003-06-02
+ *
+ */
+
+#include "firstinclude.h"
+#include "search.h"
+
+#include "_index.h"
+
+#include "bit.h"
+#include "binsearch.h"
+#include "bucket.h"
+#include "chash.h"
+#include "_chash.h"
+#include "def.h"
+#include "heap.h"
+#include "impact.h"
+#include "index.h"
+#include "index_querybuild.h"
+#include "queryparse.h"
+#include "str.h"
+#include "vocab.h"
+#include "objalloc.h"
+#include "poolalloc.h"
+#include "docmap.h"
+#include "vec.h"
+#include "fdset.h"
+#include "metric.h"
+#include "postings.h"
+#include "summarise.h"
+#include "error.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+
+/* number of significant digits in estimated results */
+#define RESULTS_SIGDIGITS 3
+
+/* functions to return sources from terms and conjuncts */
+struct search_list_src *memsrc_new_fromdisk(struct index *idx, 
+  unsigned int type, unsigned int fileno, unsigned long int offset, 
+  unsigned int size, struct alloc *alloc, void **retbuf);
+struct search_list_src *search_term_src(struct index *idx, struct term *term,
+  struct alloc *alloc, unsigned int memlimit);
+struct search_list_src *search_conjunct_src(struct index *idx, 
+  struct conjunct *conj, struct alloc *alloc, unsigned int memlimit);
+
+/* internal function to compare phrase term pointers by frequency/estimated
+ * frequency */
+static int f_t_cmp(const void *one, const void *two) {
+    const struct conjunct *done = one,
+                          *dtwo = two;
+
+    if (done->f_t < dtwo->f_t) {
+        return -1;
+    } else if (done->f_t > dtwo->f_t) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+/* internal function to compare phrase term pointers by frequency/estimated
+ * frequency */
+static int F_t_cmp(const void *one, const void *two) {
+    const struct conjunct *done = one,
+                          *dtwo = two;
+
+    if (done->F_t < dtwo->F_t) {
+        return -1;
+    } else if (done->F_t > dtwo->F_t) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+/* internal function to compare accumulators based on accumulated weight */
+static int accumulator_cmp(const void *vone, const void *vtwo) {
+    const struct search_acc *one = vone,
+                            *two = vtwo;
+
+    if (one->weight < two->weight) {
+        return -1;
+    } else if (one->weight > two->weight) {
+        return 1;
+    } else {
+        /* sub-rank by docid, so that at least we impose a clear, deterministic
+         * order upon the results.  Two accumulators with the same score are
+         * unlikely anyway. */
+        if (one->docno < two->docno) {
+            return -1;
+        } else if (one->docno > two->docno) {
+            return 1;
+        } else {
+            /* shouldn't get two accumulators with the same docno */
+            assert(0);
+            return 0;
+        }
+    }
+}
+
+/* internal functions to sort accumulators in a list into an array */
+static void sort_list(struct search_acc *heap, unsigned int heapsize, 
+  struct search_acc_cons *acc) {
+    unsigned int i;
+    struct search_acc *lowest;
+    float lowest_weight;
+
+    /* fill heap with accumulators in the order they occur */
+    for (i = 0; i < heapsize; i++, acc = acc->next) {
+        assert(acc);
+        heap[i] = acc->acc;
+    }
+
+    /* heapify heap, so the we know what the lowest accumulator in it is */
+    heap_heapify(heap, heapsize, sizeof(*heap), accumulator_cmp);
+    lowest = heap_peek(heap, heapsize, sizeof(*heap));
+    lowest_weight = lowest->weight;
+
+    /* continue traversing accumulators, replacing lowest element whenever we 
+     * find one higher than it */
+    while (acc) {
+        if (acc->acc.weight > lowest_weight) {
+            /* replace smallest element in heap with a larger one */
+            heap_replace(heap, heapsize, sizeof(*heap), 
+              accumulator_cmp, &acc->acc);
+            lowest = heap_peek(heap, heapsize, sizeof(*heap));
+            lowest_weight = lowest->weight;
+        }
+        acc = acc->next;
+    }
+
+    /* we now have all of the largest accumulators.  Continue heaping, taking
+     * the smallest element from the back of the array and copying it to the
+     * front. */
+    while (heapsize > 1) {
+        /* note: shrink heapsize by one, copy smallest element into space
+         * we just past */
+        heap_pop(heap, &heapsize, sizeof(*heap), accumulator_cmp);
+    }
+}
+
+/* internal functions to sort accumulators in a list into an array */
+static void sort_hash(struct search_acc *heap, unsigned int heapsize, 
+  struct chash *acc) {
+    unsigned int i,
+                 j,
+                 hashsize = chash_size(acc);
+    struct chash_link *link = NULL;
+    struct search_acc *lowest,
+                      tmp;
+    float lowest_weight;
+
+    /* fill heap with accumulators in the order they occur */
+    for (i = 0, j = 0; j < heapsize; i++) {
+        link = acc->table[i];
+        while (link && (j < heapsize)) {
+            heap[j].docno = link->key.k_luint;
+            heap[j].weight = (float) link->data.d_luint;
+
+            j++;
+            link = link->next;
+        }
+    }
+
+    /* heapify heap, so the we know what the lowest accumulator in it is */
+    heap_heapify(heap, heapsize, sizeof(*heap), accumulator_cmp);
+    lowest = heap_peek(heap, heapsize, sizeof(*heap));
+    lowest_weight = lowest->weight;
+
+    /* continue traversing hashtable, replacing lowest element whenever we find
+     * one higher than it (note this loop finishes last chain as well) */
+    do {
+        while (link) {
+            if (link->data.d_luint > lowest_weight) {
+                /* replace smallest element in heap with a larger one */
+                tmp.docno = link->key.k_luint;
+                tmp.weight = (float) link->data.d_luint;
+                heap_replace(heap, heapsize, sizeof(*heap), 
+                  accumulator_cmp, &tmp);
+                lowest = heap_peek(heap, heapsize, sizeof(*heap));
+                lowest_weight = lowest->weight;
+            }
+            j++;
+            link = link->next;
+        }
+    } while ((j < hashsize)
+      && ((link = acc->table[i++]), 1)); /* get next entry and cont */
+
+    assert((j == chash_size(acc)) && (j == hashsize));
+
+    /* we now have all of the largest accumulators.  Continue heaping, taking
+     * the smallest element from the back of the array and copying it to the
+     * front. */
+    while (heapsize > 1) {
+        /* note: shrink heapsize by one, copy smallest element into space
+         * we just past */
+        heap_pop(heap, &heapsize, sizeof(*heap), accumulator_cmp);
+    }
+}
+
+/* internal function to select the top len results, starting from startdoc, 
+ * into the results array from accumulators, either hashed or in a list. */
+static unsigned int index_heap_select(struct index *idx, 
+  struct index_result *results, unsigned int startdoc, unsigned int len, 
+  struct search_acc_cons *acc, unsigned int accs, struct chash *hashacc) {
+    struct search_acc *heap;
+    unsigned int i,
+                 numdocs = startdoc + len,
+                 heapsize;
+
+    if (accs <= startdoc) {
+        /* not enough accumulators to get to desired result */
+        return 0;
+    } else if (numdocs > accs) {
+        /* not enough accumulators to get all of desired results */
+        numdocs = accs;
+    }
+
+    /* allocate a heap of startdoc + len elements */
+    if (!(heap = malloc(sizeof(*heap) * numdocs))) {
+        return 0;
+    }
+    heapsize = numdocs;
+
+    if (!hashacc) {
+        /* accumulators as list */
+        sort_list(heap, heapsize, acc);
+    } else {
+        /* accumulators as hash table */
+        sort_hash(heap, heapsize, hashacc);
+    }
+
+    /* copy relevant accumulators into results (this loop form works properly 
+     * if less than startdoc + len documents match the query - think before 
+     * changing it) */ 
+    for (i = startdoc; i < numdocs; i++) {
+        unsigned aux_len = 0;
+        enum docmap_ret ret;
+
+        results[i - startdoc].docno = heap[i].docno;
+        results[i - startdoc].score = heap[i].weight;
+
+        /* lookup document auxilliary */
+        ret = docmap_get_trecno(idx->map, heap[i].docno, 
+          results[i - startdoc].auxilliary, INDEX_AUXILIARYLEN, &aux_len);
+        if (ret != DOCMAP_OK) {
+            return 0;
+        }
+        if (aux_len > INDEX_AUXILIARYLEN) {
+            aux_len = INDEX_AUXILIARYLEN;
+        }
+        results[i - startdoc].auxilliary[aux_len] = '\0';
+
+        /* summary and title provided later */
+        results[i - startdoc].summary[0] = '\0';
+        results[i - startdoc].title[0] = '\0';
+    }
+
+    free(heap);                        /* free heap */
+    return i - startdoc;
+}
+
+/* conjunct processing stuff */
+
+/* structure to hold information to process phrases/conjuncts */
+struct phrase_pos {
+    unsigned long int docno;         /* document number */
+    unsigned long int term;          /* term number of start of phrase in doc */
+    unsigned long int f_dt;          /* number of occurances left in document */
+    unsigned int term_offset;        /* offset of term from start of phrase */
+    struct vec vec;                  /* currently available vector */
+    struct search_list_src *src;     /* list source */
+    unsigned int bytes;              /* total size of vector */
+    unsigned int slop;               /* how exact the phrase matching has to 
+                                      * be */
+    struct term *src_term;            /* term that this pos refers to */
+};
+
+/* internal function to increment a phrase position to at least minpos offset
+ * within mindoc document */
+static int phrase_inc(struct phrase_pos *pp, unsigned long int mindoc, 
+  unsigned long int minpos) {
+    unsigned int bytes;
+    unsigned long int tmp,
+                      tmp2;
+    void *startpos = pp->vec.pos;
+
+    /* increment past docs we know we're not interested in */
+    while ((pp->docno < mindoc) 
+      /* read a docno if we haven't got one yet */
+      || (pp->docno == -1)) {
+        if (!pp->f_dt 
+          || ((tmp = vec_vbyte_scan(&pp->vec, pp->f_dt, &bytes)) == pp->f_dt)) {
+            pp->f_dt = 0;
+            startpos = pp->vec.pos;   /* we can start from this point again */
+        } else {
+            /* need more data */
+            pp->f_dt -= tmp;
+            return 0;
+        }
+
+        assert(!pp->f_dt);
+        if (vec_vbyte_read(&pp->vec, &tmp) 
+          && vec_vbyte_read(&pp->vec, &pp->f_dt) 
+          && vec_vbyte_read(&pp->vec, &pp->term)) {
+            assert(pp->f_dt);
+            pp->term += pp->term_offset;
+            pp->docno += tmp + 1;        /* + 1 to negate encoding */
+            pp->f_dt--;
+        } else {
+            /* need more data */
+            pp->f_dt = 0;
+            pp->vec.pos = startpos;
+            return 0;
+        }
+    }
+
+    /* don't increment offsets if we've passed the minimum document needed */
+    if (pp->docno > mindoc) {
+        return 1;
+    }
+
+    /* increment past offsets we know we're not interested in */
+    assert(pp->docno == mindoc);
+    while (pp->term < minpos) {
+        startpos = pp->vec.pos;
+        if (pp->f_dt && vec_vbyte_read(&pp->vec, &tmp)) {
+            pp->term += tmp + 1;    /* + 1 to negate encoding */
+            pp->f_dt--;
+        } else if (!pp->f_dt && vec_vbyte_read(&pp->vec, &tmp) 
+          && vec_vbyte_read(&pp->vec, &tmp2) 
+          && vec_vbyte_read(&pp->vec, &pp->term)) {
+            /* skipped to new document, so we're no longer interested in
+             * incrementing offsets */
+            pp->term += pp->term_offset;
+            pp->docno += tmp + 1;        /* + 1 to negate encoding */
+            pp->f_dt = tmp2 - 1;
+            return 1;
+        } else {
+            /* need more data */
+            pp->vec.pos = startpos;
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+/* internal function to compare phrase positions */
+static int pp_cmp(const void *vone, const void *vtwo) {
+    const struct phrase_pos *one = vone,
+                            *two = vtwo;
+
+    if (one->docno < two->docno) {
+        return -1;
+    } else if (one->docno > two->docno) {
+        return 1;
+    } else {
+        return one->term - two->term;
+    }
+}
+
+/* internal function to compare phrase positions with slop factor */
+static int slop_cmp(const void *vone, const void *vtwo) {
+    const struct phrase_pos *one = vone,
+                            *two = vtwo;
+
+    if (one->docno < two->docno) {
+        return -1;
+    } else if (one->docno > two->docno) {
+        return 1;
+    } else {
+        if (one->term < two->term) {
+            if (one->term < two->term - two->slop) {
+                return -1;
+            } else {
+                return 0;
+            }
+        } else {
+            if (one->term > two->term + two->slop) {
+                return 1;
+            } else {
+                return 0;
+            }
+        }
+    }
+}
+
+/* internal function to compare conjunctive AND positions */
+static int and_cmp(const void *vone, const void *vtwo) {
+    const struct phrase_pos *one = vone,
+                            *two = vtwo;
+
+    if (one->docno < two->docno) {
+        return -1;
+    } else if (one->docno > two->docno) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+/* internal function to compare phrase positions based on total list size */
+static int pp_size_cmp(const void *vone, const void *vtwo) {
+    const struct phrase_pos *one = vone,
+                            *two = vtwo;
+
+    return (int) (one->bytes - two->bytes);
+}
+
+static void phrase_cleanup(struct phrase_pos *pp, unsigned int len) {
+    unsigned int i;
+
+    for (i = 0; i < len; i++) {
+        if (pp[i].src) {
+            pp[i].src->delet(pp[i].src);
+            pp[i].src = NULL;
+        }
+    }
+    free(pp);
+}
+
+/* internal function to read more data into a phrase pos structure */
+static enum search_ret phrase_read(struct phrase_pos *pp) {
+    /* should never leave more than 3 vbytes (docno, f_dt, first offset) */
+    if (VEC_LEN(&pp->vec) < 3 * VEC_VBYTE_MAX) {
+        enum search_ret sret;
+        void *buf;
+        unsigned int remaining = VEC_LEN(&pp->vec),
+                     bytes;
+
+        if ((sret = pp->src->readlist(pp->src, remaining, &buf, &bytes)) 
+          == SEARCH_OK) {
+            /* buf read succeeded, reset vector to read from new stuff */
+            pp->vec.pos = buf;
+            pp->vec.end = pp->vec.pos + bytes;
+            return SEARCH_OK;
+        } else if ((sret == SEARCH_OK && !bytes && !remaining) 
+          || sret == SEARCH_FINISH) {
+            return SEARCH_FINISH;
+        } else {
+            /* failed to read next chunk */
+            return sret;
+        }
+    } else {
+        /* huh? vbyte overflowed, which is bad */
+        return SEARCH_EINVAL;
+    }
+}
+
+static enum search_ret phrase_write(struct conjunct *conj, struct vec *match, 
+  unsigned long int match_docno, unsigned long int *last_docno, 
+  unsigned long int f_dt) {
+    /* ensure that we have enough memory to encode match_docno, f_dt and 
+     * offsets */
+    while (VEC_LEN(match) < 2 * VEC_VBYTE_MAX + f_dt) {
+        unsigned int pos = match->pos - conj->vecmem;
+        unsigned int len = pos + VEC_LEN(match);
+        void *ptr = realloc(conj->vecmem, 2 * len);
+
+        if (ptr) {
+            conj->vecmem = match->pos = ptr;
+            match->end = match->pos + 2 * len;
+            match->pos += pos;
+        } else {
+            return SEARCH_ENOMEM;
+        }
+    }
+
+    conj->f_t++;
+    conj->F_t += f_dt;
+    vec_vbyte_write(match, match_docno - (*last_docno + 1));
+    *last_docno = match_docno;
+    vec_vbyte_write(match, f_dt);
+    /* just encode 0 offset gaps, as this is easy and we don't need the
+     * offsets anywhere else.  In theory the offsets might be interesting
+     * for phrase matches, but this is complex enough without worrying about
+     * that as well.  We should really produce vectors without offsets, but we
+     * can't handle that yet. */
+    while (f_dt--) {
+        vec_vbyte_write(match, 0);
+    }
+
+    conj->vecsize = match->pos - conj->vecmem;
+    return SEARCH_OK;
+}
+
+/* internal function to return the maximum amount of memory required to
+ * evaluate a conjunct */
+unsigned int process_conjunct_mem(struct conjunct *conj) {
+    struct term *currterm;
+    unsigned int mem = 0;
+
+    for (currterm = &conj->term; currterm; currterm = currterm->next) {
+        mem += currterm->vocab.size;
+    }
+
+    return mem;
+}
+
+/* internal function to process a phrase into an in-memory return 
+ * vector (retvec, of length retlen).  Returns SEARCH_OK on success or an error
+ * indication.  alloc is an object used to allocate vector memory, and mem the
+ * amount of memory available from that allocation source. */
+static enum search_ret process_conjunct(struct index *idx, 
+  struct conjunct *conj, struct alloc *alloc, unsigned int mem) {
+    struct phrase_pos *pp;                 /* array of phrase terms */
+    unsigned int i;
+    struct vec match;                     /* vector that we are producing */
+    unsigned long int match_docno,
+                      last_docno = -1;
+    unsigned int f_dt,
+                 and_mask;
+    int (*cmp)(const void *one, const void *two);
+    enum search_ret sret;
+    struct term *currterm;
+
+/* macro to perform reads into the phrase position structure buffers */
+#define READ(pp, inmatch, arr)                                                \
+    if (1) {                                                                  \
+        sret = phrase_read(pp);                                               \
+                                                                              \
+        switch (sret) {                                                       \
+        case SEARCH_OK:                                                       \
+            /* read succeeded, continue on */                                 \
+            break;                                                            \
+                                                                              \
+        case SEARCH_FINISH:                                                   \
+            if (inmatch) {                                                    \
+                if ((sret                                                     \
+                  = phrase_write(conj, &match, match_docno, &last_docno,      \
+                      f_dt))                                                  \
+                    != SEARCH_OK) {                                           \
+                    phrase_cleanup(arr, conj->terms);                         \
+                    free(conj->vecmem);                                       \
+                    conj->vecmem = NULL;                                      \
+                    return sret;                                              \
+                }                                                             \
+            }                                                                 \
+            phrase_cleanup(arr, conj->terms);                                 \
+            return SEARCH_OK;                                                 \
+                                                                              \
+        default:                                                              \
+            phrase_cleanup(arr, conj->terms);                                 \
+            free(conj->vecmem);                                               \
+            conj->vecmem = NULL;                                              \
+            return sret;                                                      \
+        }                                                                     \
+    } else 
+
+    /* shouldn't conjunctively process one term phrases */
+    if (conj->terms == 1) {
+        /* dodgy, but simplest fix is just to mark it as non-conjunctive */
+        conj->type = CONJUNCT_TYPE_WORD;
+        conj->f_t = conj->term.vocab.header.docwp.docs;
+        conj->F_t = conj->term.vocab.header.docwp.occurs;
+        return SEARCH_OK;
+    }
+
+    if (!conj->terms || (((conj->type != CONJUNCT_TYPE_PHRASE)) 
+      && (conj->type != CONJUNCT_TYPE_AND))) {
+        return SEARCH_EINVAL;
+    } else if (!(pp = malloc(sizeof(*pp) * conj->terms)) 
+      || !(match.pos = conj->vecmem = malloc(INITVECLEN))) {
+        if (pp) {
+            free(pp);
+        }
+        return SEARCH_ENOMEM;
+    }
+
+    if (!conj->cutoff) {
+        /* translate 0 (no limit) to highest possible number */
+        conj->cutoff = UINT_MAX;
+    }
+
+    conj->vecsize = 0;
+    match.end = match.pos + INITVECLEN;
+    conj->f_t = conj->F_t = 0;
+    and_mask = 0;
+    cmp = and_cmp;
+    if (conj->type == CONJUNCT_TYPE_PHRASE) {
+        and_mask = BIT_LMASK(BIT_FROM_BYTE(sizeof(unsigned long int)));
+        cmp = pp_cmp;
+        if (conj->sloppiness) {
+            cmp = slop_cmp;
+        }
+    }
+
+    /* initialise each of the phrasepos structures */
+    for (currterm = &conj->term, i = 0; (i < conj->terms) && currterm; 
+      i++, currterm = currterm->next) {
+        pp[i].f_dt = 0;
+        pp[i].docno = -1;   /* note: remove excess + 1 from decoding method */
+        pp[i].term = 0;
+        pp[i].term_offset = conj->terms - (i + 1);
+        pp[i].bytes = currterm->vocab.size;
+        pp[i].slop = conj->sloppiness;
+        pp[i].src = NULL;
+        pp[i].vec.pos = pp[i].vec.end = NULL;
+        pp[i].src_term = currterm;
+    }
+
+    /* sort by list size */
+    qsort(pp, conj->terms, sizeof(*pp), pp_size_cmp);
+
+    /* allocate memory to individual members of the phrase on the basis that
+     * lists should have approximately the same memory allocation (not
+     * propotionally to size), except when they're too short to require it. */
+    for (i = 0; i < conj->terms; i++) {
+        unsigned int size = mem / (conj->terms - i);
+
+        if (pp[i].bytes < size) {
+            size = pp[i].bytes;
+        }
+
+        sret = SEARCH_ENOMEM;
+        if ((pp[i].src = search_term_src(idx, pp[i].src_term, alloc, size)) 
+          && (sret = pp[i].src->reset(pp[i].src->opaque)) == SEARCH_OK) {
+            /* read data into the buffer */
+            do {
+                /* need more data */
+                READ(&pp[i], 0, pp);
+            } while (!phrase_inc(&pp[i], 0, 0));
+            mem -= size;
+        } else {
+            /* failed, free resources */
+            if (pp[i].src) {
+                pp[i].src->delet(pp[i].src);
+            }
+            free(conj->vecmem); conj->vecmem = NULL;
+            phrase_cleanup(pp, conj->terms);
+            return sret;
+        }
+    }
+
+    /* resolve the phrase by repeatedly find the highest element in the set and
+     * incrementing all the other terms past this point.  Detect the case when
+     * they're all equal.  We could use a heap to find the highest element, but
+     * this doesn't seem useful, as we destroy and would be forced to rebuild
+     * the heap for each iteration, at NlogN cost. */
+    while (1) {
+        struct phrase_pos *highest = &pp[0];
+        unsigned int min_f_dt = pp[0].f_dt;
+        int equal = 1;
+        int cmpval;
+        int cutoff = 0;
+
+        /* don't accept matches over the cutoff */
+        if (pp[0].term >= conj->cutoff) {
+            equal = 0;
+            cutoff = 1;
+        }
+
+        for (i = 1; i < conj->terms; i++) {
+            if ((cmpval = cmp(highest, &pp[i])) < 0) {
+                /* current element is new highest */
+                equal = 0;
+                highest = &pp[i];
+            } else if (cmpval > 0) {
+                equal = 0;
+            } else {
+                if (pp[i].f_dt < min_f_dt) {
+                    /* keep the minimum f_dt value for AND conjuncts */
+                    min_f_dt = pp[i].f_dt;
+                }
+                if (pp[i].term >= conj->cutoff) {
+                    equal = 0;
+                    cutoff = 1;
+                }
+            }
+        }
+
+        if (!equal || (conj->type == CONJUNCT_TYPE_AND)) {
+            /* we either need to increment everything up to the highest current
+             * docno/term, or we've matched an AND and need to increment
+             * everything *over* the current docno so that we'll resume 
+             * matching after this docno. */
+            unsigned long int docno = match_docno = highest->docno;
+            f_dt = min_f_dt + 1;
+
+            if (equal) {
+                assert(conj->type == CONJUNCT_TYPE_AND);
+                /* we matched an AND - increment over this doc */
+                docno++;
+
+                /* have to write match out now, so that it occurs before
+                 * incrementing */
+                if ((sret 
+                  = phrase_write(conj, &match, match_docno, &last_docno, f_dt)) 
+                    != SEARCH_OK) {
+
+                    phrase_cleanup(pp, conj->terms);
+                    free(conj->vecmem);
+                    conj->vecmem = NULL;
+                    return sret;
+                }
+                equal = 0;  /* ensure we don't rewrite answer below */
+            } else if (cutoff) {
+                /* must go to next doc if we've reached the cutoff, else we 
+                 * risk infinite looping */
+                docno++;
+            }
+
+            /* increment all positions */
+            for (i = 0; i < conj->terms; i++) {
+                while (!phrase_inc(&pp[i], docno, highest->term & and_mask)) {
+                    /* need more data */
+                    READ(&pp[i], 0, pp);
+                }
+            }
+        } else {
+            /* matched a phrase conjunct, use the same approach as above to 
+             * establish how many times the match occurs in the document */
+            assert(equal && (conj->type != CONJUNCT_TYPE_AND));
+            match_docno = highest->docno;
+            f_dt = 0;
+
+            while (1) {
+                unsigned long int term;
+
+                highest = &pp[0];
+                equal = 1;
+
+                for (i = 0; i < conj->terms; i++) {
+                    if (pp[i].docno != match_docno) {
+                        /* finished match */
+                        break;
+                    } else if ((cmpval = cmp(highest, &pp[i])) < 0) {
+                        /* current element is new highest */
+                        equal = 0;
+                        highest = &pp[i];
+                    } else if (cmpval > 0) {
+                        equal = 0;
+                    }
+                }
+
+                if (i != conj->terms) {
+                    /* broke during loop, finished match, now break outer 
+                     * loop */
+                    break;
+                }
+
+                if (!equal) {
+                    term = highest->term;
+                } else {
+                    f_dt++;
+                    term = highest->term + 1;
+                }
+
+                /* increment all positions up to the current highest */
+                for (i = 0; i < conj->terms; i++) {
+                    while (!phrase_inc(&pp[i], match_docno, term)) {
+                        /* need more data */
+                        READ(&pp[i], 1, pp);
+                    }
+                }
+            }
+        }
+
+        if (equal) {
+            /* now we know the match document number and f_dt of the match, 
+             * just have to encode it */
+            if ((sret 
+              = phrase_write(conj, &match, match_docno, &last_docno, f_dt)) 
+                != SEARCH_OK) {
+
+                phrase_cleanup(pp, conj->terms);
+                free(conj->vecmem);
+                conj->vecmem = NULL;
+                return sret;
+            }
+        }
+    }
+    /* note that the loop above terminates only when the end of one of the 
+     * sources is reached */
+#undef READ
+}
+
+struct termsrc {
+    struct conjunct *term;
+    struct search_list_src *src;
+};
+
+/* internal function to compare phrase term pointers by frequency/estimated
+ * frequency */
+static int loc_cmp(const void *one, const void *two) {
+    const struct termsrc *done = one,
+                         *dtwo = two;
+
+    /* order terms that have already been read toward the bottom */
+    if (done->term->vecmem || dtwo->term->vecmem) {
+        if (done->term->vecmem) {
+            return 1;
+        } else {
+            return -1;
+        }
+    }
+
+    assert(done->term->term.vocab.location == VOCAB_LOCATION_FILE);
+    assert(dtwo->term->term.vocab.location == VOCAB_LOCATION_FILE);
+
+    if (done->term->term.vocab.loc.file.fileno 
+      == dtwo->term->term.vocab.loc.file.fileno) {
+        if (done->term->term.vocab.loc.file.offset 
+          < dtwo->term->term.vocab.loc.file.offset) {
+            return -1;
+        } else if (done->term->term.vocab.loc.file.offset 
+          > dtwo->term->term.vocab.loc.file.offset) {
+            return 1;
+        } else {
+            assert("can't get here" && 0);
+            return 0;
+        }
+    } else {
+        return dtwo->term->term.vocab.loc.file.fileno
+          - done->term->term.vocab.loc.file.fileno;
+    }
+}
+
+static int term_cmp(const void *one, const void *two) {
+    const struct termsrc *done = one,
+                         *dtwo = two;
+    return done->term - dtwo->term;
+}
+
+static struct search_list_src *memsrc_new_from_disk(struct index *idx, 
+  unsigned int type, unsigned int fileno, unsigned long int offset, 
+  unsigned int size, void *mem);
+
+/* internal function to evaluate a query structure using document ordered
+ * inverted lists and place the results into an accumulator linked list */
+enum search_ret doc_ord_eval(struct index *idx, struct query *query,
+  struct poolalloc *list_alloc, unsigned int list_mem_limit,
+  struct search_metric_results *results,
+  int opts, struct index_search_opt *opt) {
+    unsigned int i,
+                 small,
+                 memsum;
+    enum search_ret ret;
+    const struct search_metric *sm;
+    struct search_list_src *src;
+    struct alloc alloc = {NULL, (alloc_mallocfn) poolalloc_malloc, 
+                          (alloc_freefn) poolalloc_free};
+    int (*selectivity_cmp)(const void *one, const void *two) = f_t_cmp;
+    struct termsrc *srcarr = malloc(sizeof(*srcarr) * query->terms);
+    struct index_search_opt spareopt;
+
+    if (!srcarr) {
+        return SEARCH_ENOMEM;
+    }
+
+    alloc.opaque = list_alloc;
+
+    /* choose metric */
+    if (opts & INDEX_SEARCH_DIRICHLET_RANK) {
+        selectivity_cmp = F_t_cmp;
+        sm = dirichlet();
+    } else if (opts & INDEX_SEARCH_OKAPI_RANK) {
+        sm = okapi_k3();
+    } else if (opts & INDEX_SEARCH_PCOSINE_RANK) {
+        sm = pcosine();
+    } else if (opts & INDEX_SEARCH_COSINE_RANK) {
+        sm = cosine();
+    } else if (opts & INDEX_SEARCH_HAWKAPI_RANK) {
+        sm = hawkapi();
+    } else {
+        /* default is dirichlet with mu = 1500.  Fiddle with opt structure to
+         * ensure everything works ok even if people pass a NULL */
+        selectivity_cmp = F_t_cmp;
+        sm = dirichlet();
+        if (!opt) {
+            opt = &spareopt;
+            opts |= INDEX_SEARCH_DIRICHLET_RANK;
+        }
+        opt->u.dirichlet.mu = 1500;
+    }
+
+    if ((ret = sm->pre(idx, query, opts, opt)) != SEARCH_OK) {
+        free(srcarr);
+        return ret;
+    }
+
+    /* sort by selectivity */
+    qsort(query->term, query->terms, sizeof(*query->term), selectivity_cmp);
+
+    /* see how many will fit simultaneously in the amount of memory we have */
+    for (small = 0, memsum = 0; small < query->terms; small++) {
+        srcarr[small].term = &query->term[small];
+        srcarr[small].src = NULL;
+        if (query->term[small].type == CONJUNCT_TYPE_WORD 
+          && query->term[small].term.vocab.location == VOCAB_LOCATION_FILE) {
+            if (memsum + query->term[small].term.vocab.size > list_mem_limit) {
+                break;
+            }
+            memsum += query->term[small].term.vocab.size;
+        }
+    }
+
+    /* initialise the rest of the sources to NULL */
+    for (i = small; i < query->terms; i++) {
+        srcarr[i].term = NULL;
+        srcarr[i].src = NULL;
+    }
+
+    /* sort small vectors by disk location */
+    qsort(srcarr, small, sizeof(*srcarr), loc_cmp);
+
+    /* read them all off of disk, in location order.  This speeds disk transfer,
+     * by minimising the amount of seeking that needs to be done. */
+    for (i = 0; i < small; i++) {
+        void *mem;
+
+        if ((srcarr[i].term->type == CONJUNCT_TYPE_WORD)
+          && (srcarr[i].term->term.vocab.location == VOCAB_LOCATION_FILE)
+          && (mem 
+            = poolalloc_malloc(list_alloc, srcarr[i].term->term.vocab.size))
+          && (srcarr[i].src = memsrc_new_from_disk(idx, idx->index_type, 
+              srcarr[i].term->term.vocab.loc.file.fileno, 
+              srcarr[i].term->term.vocab.loc.file.offset, 
+              srcarr[i].term->term.vocab.size, mem))) {
+            /* succeeded, do nothing */
+        } else if ((srcarr[i].term->type == CONJUNCT_TYPE_WORD)
+          && (srcarr[i].term->term.vocab.location == VOCAB_LOCATION_FILE)) {
+            /* failed to allocate or read new source */
+            free(srcarr);
+            return SEARCH_ENOMEM;
+        }
+    }
+
+    /* sort by term again */
+    qsort(srcarr, small, sizeof(*srcarr), term_cmp);
+
+    /* process terms that have no chance of overflowing the accumulator limit 
+     * in OR mode */
+    for (i = 0; (i < query->terms) 
+        && (results->accs + query->term[i].f_t < results->acc_limit); i++) {
+
+        /* reserve enough accumulators for the entire list */
+        if (objalloc_reserve(results->alloc, query->term[i].f_t) 
+          < query->term[i].f_t) {
+            free(srcarr);
+            return SEARCH_ENOMEM;
+        }
+
+        assert(srcarr[i].term == &query->term[i] || !srcarr[i].term);
+        if (((src = srcarr[i].src) 
+            || (src = search_conjunct_src(idx, &query->term[i], &alloc, 
+                list_mem_limit)))
+          && (ret = sm->or_decode(idx, query, i, SEARCH_DOCNO_START, results,
+            src, opts, opt)) == SEARCH_OK) {
+            src->delet(src);
+            if (list_alloc && (i + 1 >= small)) {
+                poolalloc_clear(list_alloc);
+            }
+        } else {
+            if (src) {
+                src->delet(src);
+                free(srcarr);
+                return ret;
+            } else {
+                free(srcarr);
+                return SEARCH_ENOMEM;
+            }
+        }
+    }
+    assert((i == query->terms) 
+      || (results->accs + query->term[i].f_t >= results->acc_limit));
+
+    /* process terms that may overflow the accumulator limit in THRESH mode */
+    ret = SEARCH_OK;
+    for (; (i < query->terms) && (ret == SEARCH_OK); i++) {
+        /* don't perform thresholding for a small number of 
+         * accumulators... */
+        if ((((results->acc_limit - results->accs) / (float) results->acc_limit)
+            < SEARCH_SAMPLES_MIN)
+          /* where it's also a small percentage of the list */
+          && (((results->acc_limit - results->accs) 
+              / (float) query->term[i].f_t) 
+            < SEARCH_SAMPLES_MIN)) {
+            break;
+        }
+
+        assert(srcarr[i].term == &query->term[i] || !srcarr[i].term);
+        if (((src = srcarr[i].src) 
+            || (src 
+              = search_conjunct_src(idx, &query->term[i], &alloc, 
+                  list_mem_limit)))
+          && (((ret = sm->thresh_decode(idx, query, i, SEARCH_DOCNO_START, 
+              results, src, query->term[i].f_t, opts, opt)) 
+            == SEARCH_OK)
+          || (ret == SEARCH_FINISH))) {
+            src->delet(src);
+            if (list_alloc && (i + 1 >= small)) {
+                poolalloc_clear(list_alloc);
+            }
+        } else {
+            if (src) {
+                src->delet(src);
+                free(srcarr);
+                return ret;
+            } else {
+                free(srcarr);
+                return SEARCH_ENOMEM;
+            }
+        }
+    }
+
+    /* process terms after accumulator limit has been reached in AND mode */
+    for (; i < query->terms; i++) {
+        assert(srcarr[i].term == &query->term[i] || !srcarr[i].term);
+        if (((src = srcarr[i].src) 
+            || (src 
+              = search_conjunct_src(idx, &query->term[i], &alloc, 
+                  list_mem_limit)))
+          && (ret = sm->and_decode(idx, query, i, SEARCH_DOCNO_START, results,
+            src, opts, opt)) 
+          == SEARCH_OK) {
+            src->delet(src);
+            if (list_alloc) {
+                poolalloc_clear(list_alloc);
+            }
+        } else {
+            if (src) {
+                src->delet(src);
+                free(srcarr);
+                return ret;
+            } else {
+                free(srcarr);
+                return SEARCH_ENOMEM;
+            }
+        }
+    }
+    free(srcarr);
+
+    /* post-process accumulators */
+    if (sm->post 
+      && (ret = sm->post(idx, query, results->acc, opts, opt)) != SEARCH_OK) {
+        return ret;
+    }
+
+    if (results->estimated) {
+        unsigned int lg 
+          = (unsigned int) ceil(log10(results->total_results));
+
+        /* remove superfluous significant digits from the estimate */
+        if (lg > RESULTS_SIGDIGITS) {
+            results->total_results = ((unsigned int) (results->total_results 
+              / pow(10, lg - RESULTS_SIGDIGITS))) 
+                * pow(10, lg - RESULTS_SIGDIGITS);
+        }
+    }
+
+    return SEARCH_OK;
+}
+
+static int res_docno_cmp(const void *vone, const void *vtwo) {
+    const struct index_result *one = vone, 
+                              *two = vtwo;
+
+    if (one->docno < two->docno) {
+        return -1;
+    } else if (one->docno > two->docno) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+static int res_score_cmp(const void *vone, const void *vtwo) {
+    const struct index_result *one = vone, 
+                              *two = vtwo;
+
+    /* note reverse sorting */
+    if (one->score < two->score) {
+        return 1;
+    } else if (one->score > two->score) {
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int index_search(struct index *idx, const char *querystr, 
+  unsigned long int startdoc, unsigned long int len, 
+  struct index_result *result, unsigned int *results, 
+  double *total_results, int *tr_est, int opts, struct index_search_opt *opt) {
+    struct query query;                  /* list of query terms/phrases */
+    struct objalloc *acc_alloc;          /* allocator for accumulators */
+    struct alloc list_alloc;             /* memory allocator for query 
+                                          * resolution */
+    struct search_acc_cons *acc = NULL;  /* accumulators */
+    struct chash *hashacc = NULL;        /* hashed accumulators */
+    unsigned int accs = 0,               /* number of accumulators */
+                 acc_limit,              /* accumulator limit */
+                 mem,                    /* amount of memory required */
+                 memsum = 0;             /* total memory required */
+    int ret;                             /* return value */
+    unsigned int i,                      /* counter */
+                 query_words;            /* number of words allowed in query */
+    int summary_type;
+
+    /* variables needed for bucket processing */
+    void *bucketmem = NULL;              /* memory for holding a bucket */
+
+    /* find out what our query word limit is */
+    query_words = QUERY_WORDS;
+    if (opts & INDEX_SEARCH_WORD_LIMIT) {
+        query_words = opt->word_limit;
+    }
+    
+    if (opts & INDEX_SEARCH_SUMMARY_TYPE) {
+        summary_type = opt->summary_type;
+    } else {
+        summary_type = INDEX_SUMMARISE_NONE;
+    }
+
+    if (!(query.term = malloc(sizeof(*query.term) * query_words))) {
+        return 0;
+    }
+
+    if (opts & INDEX_SEARCH_ACCUMULATOR_LIMIT) {
+        acc_limit = opt->accumulator_limit;
+    } else {
+        /* set default acc_limit (but assign more for deep queries) */
+        acc_limit = ACCUMULATOR_LIMIT;   
+
+        /* up accumulator limit for big collections */
+        if (acc_limit < docmap_entries(idx->map) / 100) {
+            acc_limit = docmap_entries(idx->map) / 100;
+        }
+
+        /* up accumulator limit for large requests (this is counter-intuitive,
+         * in that the results set can depend on the number of results
+         * requested, but is necessary to handle situations where
+         * they request large numbers of documents) */
+        if (BIT_DIV2(acc_limit, 1) < startdoc + len) {
+            acc_limit = BIT_MUL2(startdoc + len, 1);
+        }
+    }
+
+    /* construct a query structure */
+    query.terms = 0;
+    if (!(index_querybuild(idx, &query, querystr, str_len(querystr), 
+        query_words, idx->storage.max_termlen, 
+        opts & INDEX_SEARCH_ANH_IMPACT_RANK))) {
+
+        /* query construction failed */
+        free(query.term);
+        ERROR1("building query '%s'", querystr);
+        return 0;
+    }
+
+    /* calculate the amount of memory required and create an allocator */
+    mem = 0;
+    for (i = 0; i < query.terms; i++) {
+        unsigned int tmpmem;
+
+        switch (query.term[i].type) {
+        case CONJUNCT_TYPE_PHRASE:
+        case CONJUNCT_TYPE_AND:
+            tmpmem = process_conjunct_mem(&query.term[i]);
+            if (tmpmem > mem) {
+                mem = tmpmem;
+            }
+            break;
+            
+        case CONJUNCT_TYPE_WORD:
+            mem = query.term[i].term.vocab.size;
+            break;
+
+        default:
+            assert("not implemented yet" && 0);
+            free(query.term);
+            return 0;
+        }
+        if (mem > UINT_MAX - memsum) {
+            /* prevent overflow */
+            memsum = UINT_MAX;
+        } else {
+            memsum += mem;
+        }
+    }
+    /* limit memory usage */
+    if (memsum > idx->params.memory) {
+        mem = idx->params.memory;
+    } else {
+        mem = memsum;
+    }
+
+    /* initialise list allocator */
+    list_alloc.opaque = NULL;
+    if (!(list_alloc.opaque 
+      = poolalloc_new(0, mem + poolalloc_overhead_first(), NULL))) {
+        free(query.term);
+        return 0;
+    }
+    list_alloc.malloc = (alloc_mallocfn) poolalloc_malloc;
+    list_alloc.free = (alloc_freefn) poolalloc_free;
+
+    /* process phrases and AND conjuncts */
+    for (i = 0; i < query.terms; i++) {
+        if (query.term[i].type == CONJUNCT_TYPE_PHRASE 
+          || query.term[i].type == CONJUNCT_TYPE_AND) {
+            /* assign custom vector and process terms into it */
+            query.term[i].vecmem = NULL;
+            query.term[i].vecsize = 0;
+            /* note that we can't process conjuncts using impacts */
+            if (!(opts & INDEX_SEARCH_ANH_IMPACT_RANK) 
+              && process_conjunct(idx, &query.term[i], &list_alloc, mem) 
+              == SEARCH_OK) {
+                if (list_alloc.opaque) {
+                    poolalloc_clear(list_alloc.opaque);
+                }
+            } else {
+                /* phrase processing failed */
+                if (bucketmem) {
+                    free(bucketmem);
+                }
+                free(query.term);
+                ERROR("processing phrase");
+                return 0;
+            }
+        }
+    }
+
+    /* initialise accumulator memory allocator */
+    if (!(acc_alloc 
+      = objalloc_new(sizeof(struct search_acc_cons), 0, 0, 4096, NULL))) {
+        if (bucketmem) {
+            free(bucketmem);
+        }
+        free(query.term);
+        return 0;
+    }
+
+    /* evaluate the query */
+    if (opts & INDEX_SEARCH_ANH_IMPACT_RANK) {
+        ret = SEARCH_EINVAL;
+        if ((hashacc = chash_luint_new(bit_log2(acc_limit), 2.0)) 
+          && ((ret = impact_ord_eval(idx, &query, hashacc, acc_limit, 
+              &list_alloc, mem)) 
+            == SEARCH_OK)) {
+            /* impact ordered evaluation succeeded */
+            accs = chash_size(hashacc);
+        } else {
+            if (hashacc) {
+                chash_delete(hashacc);
+                free(query.term);
+                return 0;
+            }
+        }
+        /* XXX: set total results because we don't do it in impact_ord_eval */
+        *total_results = accs; 
+        *tr_est = 1;
+    } else {
+        struct search_metric_results results 
+          = {NULL, 0, 0, NULL, FLT_MIN, 0, 0.0};
+        results.acc_limit = acc_limit;
+        results.alloc = acc_alloc;
+        ret = doc_ord_eval(idx, &query, list_alloc.opaque, mem, &results, 
+            opts, opt);
+        accs = results.accs;
+        acc = results.acc;
+        *total_results = results.total_results; 
+        *tr_est = results.estimated;
+    }
+    if (list_alloc.opaque) {
+        poolalloc_delete(list_alloc.opaque);
+    }
+
+    /* free all vectors produced by phrase/AND processing */
+    for (i = 0; i < query.terms; i++) {
+        if (query.term[i].vecmem
+          && ((query.term[i].type == CONJUNCT_TYPE_PHRASE)
+            || (query.term[i].type == CONJUNCT_TYPE_AND))) {
+
+            free(query.term[i].vecmem);
+        }
+    }
+
+    if (ret == SEARCH_OK) {
+        /* select top accumulators as results */
+        *results 
+          = index_heap_select(idx, result, startdoc, len, acc, accs, hashacc);
+        assert(*results <= len);
+        if (hashacc) {
+            chash_delete(hashacc);
+        }
+
+        /* summarise the selected results if necessary */
+        if (summary_type != INDEX_SUMMARISE_NONE) {
+            /* sort the results by docno, which sorts them by repository
+             * location, improving the efficiency of summarisation */
+            qsort(result, *results, sizeof(*result), res_docno_cmp);
+
+            for (i = 0; i < *results; i++) {
+                struct summary res;
+
+                res.summary = result[i].summary;
+                res.summary_len = INDEX_SUMMARYLEN;
+                res.title = result[i].title;
+                res.title_len = INDEX_TITLELEN;
+
+                if (summarise(idx->sum, result[i].docno, &query, 
+                    summary_type, &res) != SUMMARISE_OK) {
+
+                    ERROR1("creating summary for document %ul", 
+                      result[i].docno);
+                }
+            }
+
+            /* resort the results by score */
+            qsort(result, *results, sizeof(*result), res_score_cmp);
+        }
+    }
+
+    /* free terms allocated */
+    for (i = 0; i < query.terms; i++) {
+        struct term *currterm = &query.term[i].term;
+
+        while (currterm) {
+            if (currterm->term) {
+                free(currterm->term);
+            }
+            currterm = currterm->next;
+        }
+    }
+
+    /* get rid of the accumulators */
+    objalloc_delete(acc_alloc);
+
+    /* free dynamic memory */
+    free(query.term);
+    if (bucketmem) {
+        free(bucketmem);
+    }
+
+    return ret == SEARCH_OK;
+}
+
+/* structure to allow sourcing of a list from a single, contiguous
+ * location in memory */
+struct memsrc {
+    struct search_list_src src;
+    void *mem;
+    unsigned int len;
+    int returned;
+};
+
+static enum search_ret memsrc_reset(struct search_list_src *src) {
+    struct memsrc *msrc = src->opaque;
+
+    msrc->returned = 0;
+    return SEARCH_OK;
+}
+
+static enum search_ret memsrc_read(struct search_list_src *src, 
+  unsigned int leftover, void **retbuf, unsigned int *retlen) {
+    struct memsrc *msrc = src->opaque;
+
+    if (leftover) {
+        return SEARCH_EINVAL;
+    }
+
+    if (msrc->returned || !msrc->len) {
+        return SEARCH_FINISH;
+    }
+
+    msrc->returned = 1;
+    *retbuf = msrc->mem;
+    *retlen = msrc->len;
+    return SEARCH_OK;
+}
+
+static void memsrc_delete(struct search_list_src *src) {
+    free(src);
+}
+
+static struct search_list_src *memsrc_new(void *mem, unsigned int len) {
+    struct memsrc *msrc = malloc(sizeof(*msrc));
+
+    if (msrc) {
+        msrc->mem = mem;
+        msrc->len = len;
+        msrc->returned = 0;
+        msrc->src.opaque = msrc;
+        msrc->src.delet = memsrc_delete;
+        msrc->src.reset = memsrc_reset;
+        msrc->src.readlist = memsrc_read;
+    }
+    return &msrc->src;
+}
+
+static struct search_list_src *memsrc_new_from_disk(struct index *idx, 
+  unsigned int type, unsigned int fileno, unsigned long int offset, 
+  unsigned int size, void *mem) {
+    unsigned int bytes = size;
+    char *pos;
+    int fd = fdset_pin(idx->fd, type, fileno, offset, SEEK_SET);
+    ssize_t read_bytes;
+
+    if ((fd >= 0) && (pos = mem)) {
+        do {
+            read_bytes = read(fd, pos, bytes);
+        } while ((read_bytes != -1) 
+          && (pos += read_bytes, bytes -= read_bytes));
+
+        fdset_unpin(idx->fd, type, fileno, fd);
+        if (!bytes) {
+            return memsrc_new(mem, size);
+        }
+    } else {
+        if (fd >= 0) {
+            fdset_unpin(idx->fd, type, fileno, fd);
+        }
+    }
+    return NULL;
+}
+/* FIXME: structure to allow sourcing of a list from a bucket on disk */
+
+/* structure to allow sourcing of a list from an fd */
+struct disksrc {
+    struct search_list_src src;      /* parent source structure */
+    struct alloc alloc;              /* buffer allocation object */
+    char *buf;                       /* available buffer */
+    unsigned int bufsize;            /* size of stuff in buffer */
+    unsigned int bufcap;             /* capacity of buffer */
+    unsigned long int bufpos;        /* position buffer was read from */
+    unsigned int size;               /* size of the list */
+    unsigned int pos;                /* position in list */
+
+    struct index *idx;               /* index we're using */
+    int fd;                          /* pinned fd */
+    unsigned int type;               /* the type of the fd */
+    unsigned int fileno;             /* the file number of the fd */
+    unsigned long int offset;        /* starting offset of the list */
+};
+
+static enum search_ret disksrc_reset(struct search_list_src *src) {
+    struct disksrc *dsrc = src->opaque;
+    dsrc->pos = 0;
+    return SEARCH_OK;
+}
+
+static enum search_ret disksrc_read(struct search_list_src *src, 
+  unsigned int leftover, void **retbuf, unsigned int *retlen) {
+    struct disksrc *dsrc = src->opaque;
+
+    /* this routine is somewhat complex because we'd like to handle cases where
+     * an initial read, a reset, followed by another read incur only one seek
+     * and one read. */
+
+    if (leftover > dsrc->bufsize || leftover >= dsrc->bufcap 
+      /* if we're requesting leftover bytes, we should just have read a
+       * bufferload */
+      || (leftover && dsrc->bufpos + dsrc->bufsize != dsrc->pos)) {
+        assert("can't get here" && 0);
+        return SEARCH_EINVAL;
+    }
+
+    if (dsrc->pos >= dsrc->bufpos 
+      && (dsrc->pos < dsrc->bufpos + dsrc->bufsize)) {
+        unsigned int len;
+        /* buffer can be used to answer request */
+        assert(!leftover);
+
+        len = dsrc->pos - dsrc->bufpos;
+        *retbuf = dsrc->buf + len;
+        *retlen = dsrc->bufsize - len;
+        dsrc->pos += *retlen;
+        return SEARCH_OK;
+    } else {
+        ssize_t bytes,
+                cap = dsrc->size - dsrc->pos;
+
+        if (dsrc->pos != dsrc->bufpos + dsrc->bufsize) {
+            /* need to seek before reading */
+            off_t newoff;
+            assert(!leftover);
+
+            dsrc->bufsize = 0;
+            if ((newoff = lseek(dsrc->fd, dsrc->offset + dsrc->pos, SEEK_SET)) 
+              != (off_t) dsrc->offset) {
+                return SEARCH_EINVAL;
+            }
+        }
+
+        dsrc->bufpos = dsrc->pos - leftover;
+
+        if (leftover) {
+            /* preserve leftover bytes */
+            memmove(dsrc->buf, dsrc->buf + dsrc->bufsize - leftover, leftover);
+        }
+        dsrc->bufsize = leftover;
+
+        if (!cap) {
+            if (leftover) {
+                *retbuf = dsrc->buf;
+                *retlen = dsrc->bufsize;
+                return SEARCH_OK;
+            } else {
+                return SEARCH_FINISH;
+            }
+        }
+
+        /* limit amount we try to read to available buffer size */
+        if ((unsigned int) cap > dsrc->bufcap - dsrc->bufsize) {
+            cap = dsrc->bufcap - dsrc->bufsize;
+        }
+
+        while ((bytes = read(dsrc->fd, dsrc->buf + dsrc->bufsize, cap)) == -1) {
+            switch (errno) {
+            case EINTR: /* do nothing, try again */ break;
+            case EIO: return SEARCH_EIO;
+            default: return SEARCH_EINVAL;
+            }
+        }
+        dsrc->bufsize += bytes;
+        dsrc->pos += bytes;
+
+        *retbuf = dsrc->buf;
+        *retlen = dsrc->bufsize;
+
+        if (dsrc->bufsize) {
+            return SEARCH_OK;
+        } else {
+            return SEARCH_FINISH;
+        }
+    }
+}
+
+static void disksrc_delete(struct search_list_src *src) {
+    struct disksrc *dsrc = src->opaque;
+
+    dsrc->alloc.free(dsrc->alloc.opaque, dsrc->buf);
+    fdset_unpin(dsrc->idx->fd, dsrc->type, dsrc->fileno, dsrc->fd);
+    free(src);
+    return;
+}
+
+static struct search_list_src *disksrc_new(struct index *idx, 
+  unsigned int type, unsigned int fileno, unsigned long int offset, 
+  unsigned int size, struct alloc *alloc, unsigned int mem) {
+    int fd = fdset_pin(idx->fd, type, fileno, offset, SEEK_SET);
+
+    if (mem > size) {
+        mem = size;
+    }
+
+    if (fd >= 0) {
+        struct disksrc *dsrc = malloc(sizeof(*dsrc));
+
+        if (dsrc && (dsrc->buf = alloc->malloc(alloc->opaque, mem))) {
+            dsrc->src.opaque = dsrc;
+            dsrc->src.delet = disksrc_delete;
+            dsrc->src.reset = disksrc_reset;
+            dsrc->src.readlist = disksrc_read;
+
+            /* ensure that nothing gets served out of the buffer first time */
+            dsrc->bufpos = -1;  
+            dsrc->bufsize = 0;
+
+            dsrc->alloc = *alloc;
+            dsrc->bufcap = mem;
+            dsrc->pos = 0;
+            dsrc->fd = fd;
+            dsrc->idx = idx;
+            dsrc->type = type;
+            dsrc->fileno = fileno;
+            dsrc->offset = offset;
+            dsrc->size = size;
+            return &dsrc->src;
+        } else {
+            if (dsrc) {
+                free(dsrc);
+            }
+            fdset_unpin(idx->fd, type, fileno, fd);
+        }
+    }
+
+    return NULL;
+}
+
+/* structure to break up the reads from an underlying source into smaller 
+ * chunks so that we can test behaviour for discontiguous reads.  This should
+ * never be used in production code. */
+struct debufsrc {
+    struct search_list_src src;      /* parent source structure */
+    struct search_list_src *srcsrc;  /* underlying source */
+    char *pos;                       /* position in current read */
+    unsigned int len;                /* remaining buffer */
+    unsigned int debuflen;           /* maximuum return length */
+};
+
+static enum search_ret debufsrc_reset(struct search_list_src *src) {
+    struct debufsrc *dsrc = src->opaque;
+    dsrc->len = 0;
+    return dsrc->srcsrc->reset(dsrc->srcsrc);
+}
+
+static enum search_ret debufsrc_read(struct search_list_src *src, 
+  unsigned int leftover, void **retbuf, unsigned int *retlen) {
+    struct debufsrc *dsrc = src->opaque;
+    enum search_ret sret;
+
+    assert(dsrc->debuflen);
+    if (dsrc->len >= dsrc->debuflen) {
+        *retbuf = dsrc->pos - leftover;
+        *retlen = dsrc->debuflen + leftover;
+        dsrc->pos += dsrc->debuflen;
+        dsrc->len -= dsrc->debuflen;
+        return SEARCH_OK;
+    }
+
+    assert(dsrc->len < dsrc->debuflen);
+    /* read more from underlying source.  XXX: note that we're potentially
+     * destroying current buffer on failure here */
+    if ((sret = dsrc->srcsrc->readlist(dsrc->srcsrc, dsrc->len, 
+        (void **) &dsrc->pos, &dsrc->len)) == SEARCH_OK) {
+
+        *retbuf = dsrc->pos;
+        if (dsrc->len > dsrc->debuflen) {
+            *retlen = dsrc->debuflen;
+        } else {
+            *retlen = dsrc->len;
+        }
+        assert(*retlen);
+        dsrc->pos += *retlen;
+        dsrc->len -= *retlen;
+        return SEARCH_OK;
+    } else {
+        return sret;
+    }
+}
+
+static void debufsrc_delete(struct search_list_src *src) {
+    struct debufsrc *dsrc = src->opaque;
+
+    dsrc->srcsrc->delet(dsrc->srcsrc);
+    free(src);
+}
+
+struct search_list_src *debufsrc_new(struct search_list_src *src, 
+  unsigned int debuflen) {
+    struct debufsrc *dsrc = malloc(sizeof(*dsrc));
+
+    if (dsrc) {
+        dsrc->src.readlist = debufsrc_read;
+        dsrc->src.reset = debufsrc_reset;
+        dsrc->src.delet = debufsrc_delete;
+        dsrc->src.opaque = dsrc;
+
+        dsrc->srcsrc = src;
+        dsrc->pos = NULL;
+        dsrc->len = 0;
+        dsrc->debuflen = debuflen + !debuflen;
+        return &dsrc->src;
+    } else {
+        return NULL;
+    }
+}
+
+struct search_list_src *search_term_src(struct index *idx, struct term *term,
+  struct alloc *alloc, unsigned int mem) {
+    if (term->vecmem) {
+        /* memory source */
+        assert(term->vocab.location == VOCAB_LOCATION_VOCAB);
+        return memsrc_new(term->vecmem, term->vocab.size);
+    } else {
+        /* disk source */
+        assert(term->vocab.location == VOCAB_LOCATION_FILE);
+        return disksrc_new(idx, idx->index_type, 
+            term->vocab.loc.file.fileno, term->vocab.loc.file.offset, 
+            term->vocab.size, alloc, mem);
+    }
+}
+
+/* internal function to return the correct source for a given term */
+struct search_list_src *search_conjunct_src(struct index *idx, 
+  struct conjunct *conj, struct alloc *alloc, unsigned int memlimit) {
+    if (conj->vecmem) {
+        /* memory source */
+        return memsrc_new(conj->vecmem, conj->vecsize);
+    } else {
+        /* source from term */
+        return search_term_src(idx, &conj->term, alloc, memlimit);
+    }
+}
+
+unsigned int search_qterms(struct query *q) {
+    unsigned int i,
+                 sum = 0;
+
+    for (i = 0; i < q->terms; i++) {
+        sum += q->term[i].f_qt;
+    }
+
+    return sum;
+}
+
+float search_qweight(struct query *q) {
+    double weight = 0.0,
+           fqt_log;
+    unsigned int i;
+
+    for (i = 0; i < q->terms; i++) {
+        fqt_log = log(q->term[i].f_qt) + 1;
+        weight += fqt_log * fqt_log;
+    }
+
+    return (float) sqrtf(weight);
+}
+
diff --git a/src/signals.c b/src/signals.c
new file mode 100644 (file)
index 0000000..f64a8a3
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *  Code for handling signals in a reasonable way.
+ *
+ *  The main thing we need to do upon receiving a signal is clean up
+ *  any incomplete index files or temporary files made during a build
+ *  process.  Zettair is fairly strict about not overwriting existing
+ *  files, so if files are left over from an aborted earlier build,
+ *  then the next Zettair build will generally fail.  This can be
+ *  confusing for the user.
+ *
+ *  In normal operation, the files that can need to be cleared up
+ *  are:
+ *
+ *   a.) index files, of type FDSET_TYPE_INDEX.  The number of
+ *       these is held in index->vectors, although as a special
+ *       case a single index file may created at startup to
+ *       determine the maximum filesize, without being recorded
+ *       in index->vectors.
+ *   b.) the docmap file.  This is currently not managed by the
+ *       fdset.
+ *   c.) temporary files used during the merge process.  The index
+ *       itself doesn't know how many of these there are; they
+ *       are held in the pyramid structure.
+ *
+ *  The docmap and the pyramid are accessible through the
+ *  index structure.   Thus, the signal handler only needs to have 
+ *  access to the index  currently under construction (if any).
+ */
+
+#include "firstinclude.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "signals.h"
+#include "_index.h"
+
+static struct index * constr_idx = NULL;
+
+void signals_set_index_under_construction(struct index * index) {
+    constr_idx = index;
+}
+
+void signals_clear_index_under_construction(void) {
+    constr_idx = NULL;
+}
+
+void signals_cleanup_handler(int signal) {
+    fprintf(stderr, "Signal %d received, cleaning up...\n", signal);
+
+    if (constr_idx != NULL) {
+        if (constr_idx->merger!= NULL) {
+            pyramid_delete(constr_idx->merger);
+            constr_idx->merger = NULL;
+        }
+        index_rm(constr_idx);
+        constr_idx = NULL;
+    }
+    exit(1);
+}
diff --git a/src/stack.c b/src/stack.c
new file mode 100644 (file)
index 0000000..f03af4b
--- /dev/null
@@ -0,0 +1,189 @@
+/* stack.c implements a generic stack as specified in stack.h
+ *
+ * written nml 2004-07-12
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "stack.h"
+
+#include <stdlib.h>  /* for malloc and free */
+
+union stack_node {
+    void *d_ptr;
+    unsigned long int d_luint;
+    double d_dbl;
+};
+
+struct stack {
+    unsigned int size;
+    unsigned int capacity;
+    union stack_node *stack;
+};
+
+struct stack *stack_new(unsigned int sizehint) {
+    struct stack *stk;
+
+    if ((stk = malloc(sizeof(*stk)))) {
+        stk->size = stk->capacity = 0;
+        stk->stack = NULL;
+
+        if (!sizehint 
+          || (stk->stack = malloc(sizeof(*stk->stack) * sizehint))) {
+            stk->capacity = sizehint;
+        }
+    }
+
+    return stk;
+}
+
+void stack_delete(struct stack *stk) {
+    if (stk->stack) {
+        free(stk->stack);
+    }
+    free(stk);
+}
+
+unsigned int stack_size(struct stack *stk) {
+    return stk->size;
+}
+
+/* push template */
+#define STACK_PUSH(stk, data, type)                                           \
+    do {                                                                      \
+        /* check for enough stack space */                                    \
+        if ((stk)->size >= (stk)->capacity) {                                 \
+            void *ptr;                                                        \
+                                                                              \
+            if ((ptr = realloc((stk)->stack,                                  \
+                sizeof(*(stk)->stack) * ((stk)->capacity * 2 + 1)))) {        \
+                                                                              \
+                (stk)->stack = ptr;                                           \
+                (stk)->capacity = (stk)->capacity * 2 + 1;                    \
+            } else {                                                          \
+                return STACK_ENOMEM;                                          \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        (stk)->stack[(stk)->size++].d_##type = (data);                        \
+        return STACK_OK;                                                      \
+    } while (0)
+
+/* pop template */
+#define STACK_POP(stk, pointer, type)                                         \
+    do {                                                                      \
+        if ((stk)->size) {                                                    \
+            *(pointer) = (stk)->stack[--(stk)->size].d_##type;                \
+            return STACK_OK;                                                  \
+        } else {                                                              \
+            return STACK_ENOENT;                                              \
+        }                                                                     \
+    } while (0)
+
+/* peek template */
+#define STACK_PEEK(stk, pointer, type)                                        \
+    do {                                                                      \
+        if ((stk)->size) {                                                    \
+            *(pointer) = (stk)->stack[(stk)->size - 1].d_##type;              \
+            return STACK_OK;                                                  \
+        } else {                                                              \
+            return STACK_ENOENT;                                              \
+        }                                                                     \
+    } while (0)
+
+/* foreach template */
+#define STACK_FOREACH(stk, opaque, fn, type)                                  \
+    do {                                                                      \
+        unsigned int i;                                                       \
+                                                                              \
+        for (i = 0; i < (stk)->size; i++) {                                   \
+            (fn)((opaque), &(stk)->stack[i].d_##type);                        \
+        }                                                                     \
+                                                                              \
+        return STACK_OK;                                                      \
+    } while (0)
+
+/* fetch template */
+#define STACK_FETCH(stk, index, pointer, type)                                \
+    do {                                                                      \
+        if ((index) < (stk)->size) {                                          \
+            *(pointer) = (stk)->stack[index].d_##type;                        \
+            return STACK_OK;                                                  \
+        } else {                                                              \
+            return STACK_ENOENT;                                              \
+        }                                                                     \
+    } while (0)
+
+/* luint functions */
+
+enum stack_ret stack_luint_push(struct stack *stk, unsigned long int ptr) {
+    STACK_PUSH(stk, ptr, luint);
+}
+
+enum stack_ret stack_luint_pop(struct stack *stk, unsigned long int *ptr) {
+    STACK_POP(stk, ptr, luint);
+}
+
+enum stack_ret stack_luint_peek(struct stack *stk, unsigned long int *ptr) {
+    STACK_PEEK(stk, ptr, luint);
+}
+
+enum stack_ret stack_luint_foreach(struct stack *stk, void *opaque,
+  void (*fn)(void *opaque, unsigned long int *data)) {
+    STACK_FOREACH(stk, opaque, fn, luint);
+}
+
+enum stack_ret stack_luint_fetch(struct stack *stk, unsigned int index, 
+  unsigned long int *ptr) {
+    STACK_FETCH(stk, index, ptr, luint);
+}
+
+/* ptr functions */
+
+enum stack_ret stack_ptr_push(struct stack *stk, void *ptr) {
+    STACK_PUSH(stk, ptr, ptr);
+}
+
+enum stack_ret stack_ptr_pop(struct stack *stk, void **ptr) {
+    STACK_POP(stk, ptr, ptr);
+}
+
+enum stack_ret stack_ptr_peek(struct stack *stk, void **ptr) {
+    STACK_PEEK(stk, ptr, ptr);
+}
+
+enum stack_ret stack_ptr_foreach(struct stack *stk, void *opaque,
+  void (*fn)(void *opaque, void **data)) {
+    STACK_FOREACH(stk, opaque, fn, ptr);
+}
+
+enum stack_ret stack_ptr_fetch(struct stack *stk, unsigned int index, 
+  void **ptr) {
+    STACK_FETCH(stk, index, ptr, ptr);
+}
+
+/* dbl functions */
+
+enum stack_ret stack_dbl_push(struct stack *stk, double ptr) {
+    STACK_PUSH(stk, ptr, dbl);
+}
+
+enum stack_ret stack_dbl_pop(struct stack *stk, double *ptr) {
+    STACK_POP(stk, ptr, dbl);
+}
+
+enum stack_ret stack_dbl_peek(struct stack *stk, double *ptr) {
+    STACK_PEEK(stk, ptr, dbl);
+}
+
+enum stack_ret stack_dbl_foreach(struct stack *stk, void *opaque,
+  void (*fn)(void *opaque, double *data)) {
+    STACK_FOREACH(stk, opaque, fn, dbl);
+}
+
+enum stack_ret stack_dbl_fetch(struct stack *stk, unsigned int index, 
+  double *ptr) {
+    STACK_FETCH(stk, index, ptr, dbl);
+}
+
diff --git a/src/staticalloc.c b/src/staticalloc.c
new file mode 100644 (file)
index 0000000..5eac5dd
--- /dev/null
@@ -0,0 +1,140 @@
+/* staticalloc.c implements a simple allocator that provides access to a single,
+ * chunk of memory, without attempting to portion it at all.
+ *
+ * written nml 2005-03-10
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "staticalloc.h"
+
+#include "def.h"
+#include "mem.h"
+#include "_mem.h"
+#include "zvalgrind.h"
+#include "zstdint.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <limits.h>
+
+struct staticalloc {
+    union {
+        int size;                   /* size of available memory.  The sign 
+                                     * indicates whether it is currently 
+                                     * allocated or not - negative indicates 
+                                     * allocated, positive indicates not */
+        void *dummy;                /* here to ensure that staticalloc is one 
+                                     * word in size, in a world of LP64 and
+                                     * LLP64 stupidity */
+    } u;
+};
+
+struct staticalloc *staticalloc_new(void *area, unsigned int size) {
+    struct staticalloc *alloc = NULL;
+
+    /* can't handle size of > INT_MAX because we use the sign bit to track
+     * allocation.  Seems like a good tradeoff. */
+    if ((size <= INT_MAX) && (size > sizeof(*alloc))) {
+        alloc = area;
+        alloc->u.size = ((int) size) - sizeof(*alloc);
+        VALGRIND_MAKE_NOACCESS(MEM_PTRADD(alloc, sizeof(*alloc)), 
+          alloc->u.size);
+        assert(alloc->u.size);
+    }
+
+    return alloc;
+}
+
+void staticalloc_delete(struct staticalloc *alloc) {
+    assert(alloc->u.size);
+    VALGRIND_MAKE_WRITABLE(MEM_PTRADD(alloc, sizeof(*alloc)), alloc->u.size);
+    alloc->u.size = 0;  /* zero out memory, so it can't be reused */
+    return;
+}
+
+void *staticalloc_malloc(struct staticalloc *alloc, unsigned int size) {
+    void *ptr;
+
+    assert(alloc->u.size);
+
+    if ((alloc->u.size > 0) && (((unsigned int) alloc->u.size) >= size)) {
+        VALGRIND_MAKE_WRITABLE(MEM_PTRADD(alloc, sizeof(*alloc)), 
+          alloc->u.size);
+        alloc->u.size *= -1;  /* indicate that the chunk is allocated */
+        ptr = MEM_PTRADD(alloc, sizeof(*alloc));
+        VALGRIND_MALLOCLIKE_BLOCK(ptr, size, 0, 0);
+        return ptr;
+    } else {
+        /* our memory chunk is currently out, please come again... */
+        return NULL;
+    }
+}
+
+void staticalloc_free(struct staticalloc *alloc, void *ptr) {
+    assert(alloc->u.size);
+    if (alloc->u.size < 0 && (ptr == MEM_PTRADD(alloc, sizeof(*alloc)))) {
+        alloc->u.size *= -1;   /* indicate that the chunk is free */
+        VALGRIND_FREELIKE_BLOCK(ptr, 0);
+        VALGRIND_MAKE_NOACCESS(MEM_PTRADD(alloc, sizeof(*alloc)), 
+          alloc->u.size);
+    } else {
+        assert(!CRASH);      /* user error, it's already free */
+    }
+}
+
+unsigned int staticalloc_allocated(struct staticalloc *alloc) {
+    assert(alloc->u.size);
+    return (alloc->u.size < 0);
+}
+
+int staticalloc_is_managed(struct staticalloc *alloc, void *ptr) {
+    assert(alloc->u.size);
+    return (ptr == MEM_PTRADD(alloc, sizeof(*alloc)));
+}
+
+unsigned int staticalloc_overhead() {
+    return sizeof(struct staticalloc);
+}
+
+#ifdef STATICALLOC_TEST
+
+#define BYTES sizeof(int)
+
+int main() {
+    STATICALLOC_DECL(alloc, BYTES);
+    void *ptr;
+    int *intptr;
+
+    ptr = staticalloc_malloc(alloc, BYTES);
+    assert(ptr);                            /* allocated should have worked */
+    assert(ptr == &alloc_stackspace[1]);    /* should give us address one word 
+                                             * from the start of the space */
+    assert(!staticalloc_malloc(alloc, 1));  /* shouldn't be able to allocated 
+                                             * again */
+    intptr = ptr;
+    *intptr = 0;                            /* access it */
+
+    staticalloc_free(alloc, ptr);
+
+    /* invalid stuff */
+#if 0
+    *intptr = 0;                            /* access it when we don't own it */
+    do {
+        STATICALLOC_DECL(leak, 1);
+        assert(staticalloc_malloc(leak, 1));
+    } while (0);
+#endif
+
+    assert(staticalloc_malloc(alloc, 1) == ptr);
+    assert(!staticalloc_malloc(alloc, 1));
+    staticalloc_free(alloc, ptr);
+
+    staticalloc_delete(alloc);
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
diff --git a/src/stem.c b/src/stem.c
new file mode 100644 (file)
index 0000000..64b2ccb
--- /dev/null
@@ -0,0 +1,1350 @@
+/* stem.c implements a basic caching stemming framework.  The memory
+ * management behind this could be much improved (with custom memory
+ * management).
+ *
+ * written nml 2004-06-17
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "stem.h"
+
+#include "bit.h"
+#include "chash.h"
+#include "str.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+/* constant used to approximate LRU algorithm with clock algorithm */
+#define LRU_DEFAULT 2
+
+struct stem_entry {
+    unsigned int length;        /* length of term */
+    unsigned int count;         /* clock algorithm count */
+    char *src;                  /* term pre-stemming */
+    char *dst;                  /* term post-stemming */
+};
+
+struct stem_cache {
+    void (*stem) (void*, char*);/* stemming algorithm */
+    void *opaque;               /* opaque stemmer data */
+    unsigned int capacity;      /* maximum number of entries */
+    unsigned int size;          /* current number of entries */
+    struct chash *lookup;       /* hashtable lookup for entries */
+    struct stem_entry **arr;    /* array of entries for clock algorithm */
+    unsigned int clock_pos;     /* clock position in array */
+    unsigned int stemmed;       /* number of terms stemmed */
+    unsigned int cached;        /* number of terms stemmed from cache */
+};
+
+struct stem_cache *stem_cache_new(void (*stemmer) (void *opaque, char *term),
+  void *opaque, unsigned int entries) {
+    struct stem_cache *cache;
+
+    if ((cache = malloc(sizeof(*cache)))
+      && (cache->arr = malloc(sizeof(*cache->arr) * entries))
+      && (cache->lookup = chash_ptr_new(bit_log2(entries) + 1, 2.0, 
+          (unsigned int (*)(const void *)) str_hash,
+          (int (*)(const void *, const void *)) str_cmp))) {
+
+        cache->capacity = entries;
+        cache->size = 0;
+        cache->stem = stemmer;
+        cache->opaque = opaque;
+        cache->clock_pos = 0;
+        cache->stemmed = cache->cached = 0;
+    } else {
+        if (cache) {
+            if (cache->arr) {
+                free(cache->arr);
+            }
+            free(cache);
+            cache = NULL;
+        }
+    }
+
+    return cache;
+}
+
+void stem_cache_delete(struct stem_cache *cache) {
+    unsigned int i;
+
+    for (i = 0; i < cache->size; i++) {
+        free(cache->arr[i]->src);
+        free(cache->arr[i]->dst);
+        free(cache->arr[i]);
+    }
+
+    chash_delete(cache->lookup);
+    free(cache->arr);
+    free(cache);
+}
+
+static struct stem_entry *clock_select(struct stem_cache *cache) {
+    unsigned int i;
+
+    assert(cache->size);
+
+    do {
+        for (i = cache->clock_pos; i < cache->size; i++) {
+            if (!cache->arr[i]->count) {
+                /* selected one */
+                cache->clock_pos = i + 1;
+                return cache->arr[i];
+            } else {
+                cache->arr[i]->count--;
+            }
+        }
+
+        for (i = 0; i < cache->clock_pos; i++) {
+            if (!cache->arr[i]->count) {
+                /* selected one */
+                cache->clock_pos = i + 1;
+                return cache->arr[i];
+            } else {
+                cache->arr[i]->count--;
+            }
+        }
+    } while (1);
+}
+
+unsigned int stem_cache_capacity(struct stem_cache *cache) {
+    return cache->capacity;
+}
+
+void stem_cache_stem(struct stem_cache *cache, char *term) {
+    struct stem_entry *target;
+    void **find;
+    unsigned int len;
+
+    cache->stemmed++;
+
+    /* lookup term in stem cache */
+    if (chash_ptr_ptr_find(cache->lookup, term, &find) == CHASH_OK) {
+        /* found it, copy term in and return */
+        target = *find;
+        assert(str_len(target->dst) <= str_len(term));
+        str_cpy(term, target->dst);
+        cache->cached++;
+        return;
+    } else {
+        /* didn't find it, find a stem_entry to use */
+        if (cache->size < cache->capacity) {
+            len = str_len(term) + 1;
+
+            if ((target = malloc(sizeof(*target)))
+              && (target->src = malloc(len))
+              && (target->dst = malloc(len))) {
+                target->count = LRU_DEFAULT;
+                target->length = len;
+                memcpy(target->src, term, len);
+                memcpy(target->dst, term, len);
+                cache->stem(cache->opaque, target->dst);
+                str_cpy(term, target->dst);
+
+                if (chash_ptr_ptr_insert(cache->lookup, 
+                    target->src, target) == CHASH_OK) {
+
+                    /* finished inserting new entry */
+                    cache->arr[cache->size++] = target;
+                    return;
+                } else {
+                    /* couldn't insert entry */
+                    free(target->src);
+                    free(target->dst);
+                    free(target);
+                }
+            } else {
+                if (target) {
+                    if (target->src) {
+                        free(target->src);
+                    }
+                    free(target);
+                }
+            }
+        }
+
+        /* couldn't allocate another entry for whatever reason. Remove an
+           existing one using clock algorithm and reuse it */
+        if (cache->size) {
+            void *ptr_one,
+                 *ptr_two;
+
+            target = clock_select(cache);
+            assert(target);
+
+            len = str_len(term) + 1;
+
+            /* obtained suitable entry, remove it under old string */
+            if (chash_ptr_ptr_remove(cache->lookup, target->src, &ptr_one) 
+              == CHASH_OK) {
+                assert(ptr_one == target);
+
+                if (target->length < len) {
+                    if ((ptr_one = realloc(target->src, len))
+                      && (ptr_two = realloc(target->dst, len))) {
+                        target->src = ptr_one;
+                        target->dst = ptr_two;
+                        target->length = len;
+                    } else {
+                        unsigned int i;
+
+                        if (ptr_one) {
+                            target->src = ptr_one;
+                        }
+
+                        /* remove it from the array (by linear search) */
+                        cache->size--;
+                        for (i = 0; i <= cache->size; i++) {
+                            if (target == cache->arr[i]) {
+                                memcpy(cache->arr[i], cache->arr[i + 1],
+                                  sizeof(cache->arr[0]) * (cache->size - i));
+                                break;
+                            }
+                        }
+
+                        free(target->src);
+                        free(target->dst);
+                        free(target);
+                        target = NULL;
+
+                        cache->stem(cache->opaque, term);
+                        return;
+                    }
+                }
+
+                memcpy(target->src, term, len);
+                memcpy(target->dst, term, len);
+                cache->stem(cache->opaque, target->dst);
+                target->count = LRU_DEFAULT;
+
+                assert(str_len(target->dst) < len);
+                str_cpy(term, target->dst);
+
+                /* insert new entry back into hashtable */
+                if (chash_ptr_ptr_insert(cache->lookup, target->src, 
+                    target) == CHASH_OK) {
+
+                    /* our work here is done... */
+                    return;
+                } else {
+                    /* removed an entry, but couldn't put it back (?) */
+                    unsigned int i;
+
+                    /* remove it from the array (by linear search) */
+                    cache->size--;
+                    for (i = 0; i <= cache->size; i++) {
+                        if (target == cache->arr[i]) {
+                            memcpy(cache->arr[i], cache->arr[i + 1],
+                              sizeof(cache->arr[0]) * (cache->size - i));
+                            break;
+                        }
+                    }
+
+                    free(target->src);
+                    free(target->dst);
+                    free(target);
+                    target = NULL;
+                }
+            }
+        }
+
+        /* couldn't do anything efficient, just stem the term and send it 
+         * back */
+        cache->stem(cache->opaque, term);
+        return;
+    }
+}
+
+/* This is the Porter stemming algorithm, coded up as thread-safe ANSI C
+   by the author.
+
+   It may be be regarded as cononical, in that it follows the algorithm
+   presented in
+
+   Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
+   no. 3, pp 130-137,
+
+   only differing from it at the points maked --DEPARTURE-- below.
+
+   See also http://www.tartarus.org/~martin/PorterStemmer
+
+   The algorithm as described in the paper could be exactly replicated
+   by adjusting the points of DEPARTURE, but this is barely necessary,
+   because (a) the points of DEPARTURE are definitely improvements, and
+   (b) no encoding of the Porter stemmer I have seen is anything like
+   as exact as this version, even with the points of DEPARTURE!
+
+   The algorithm as encoded here is particularly fast.
+
+   Release 2 (the more old-fashioned, non-thread-safe version may be
+   regarded as release 1.)
+*/
+
+#include <stdlib.h>  /* for malloc, free */
+#include <string.h>  /* for memcmp, memmove */
+
+/* You will probably want to move the following declarations to a central
+   header file.
+*/
+
+struct stemmer;
+
+extern struct stemmer * create_stemmer(void);
+extern void free_stemmer(struct stemmer * z);
+
+extern int stem(struct stemmer * z, char * b, int k);
+
+/* The main part of the stemming algorithm starts here.
+*/
+
+#define TRUE 1
+#define FALSE 0
+
+/* stemmer is a structure for a few local bits of data,
+*/
+
+struct stemmer {
+   char * b;       /* buffer for word to be stemmed */
+   int k;          /* offset to the end of the string */
+   int j;          /* a general offset into the string */
+};
+
+/* Member b is a buffer holding a word to be stemmed. The letters are in
+   b[0], b[1] ... ending at b[z->k]. Member k is readjusted downwards as
+   the stemming progresses. Zero termination is not in fact used in the
+   algorithm.
+
+   Note that only lower case sequences are stemmed. Forcing to lower case
+   should be done before stem(...) is called.
+
+
+   Typical usage is:
+
+       struct stemmer * z = create_stemmer();
+       char b[] = "pencils";
+       int res = stem(z, b, 6);
+           /- stem the 7 characters of b[0] to b[6]. The result, res,
+              will be 5 (the 's' is removed). -/
+       free_stemmer(z);
+*/
+
+extern struct stemmer * create_stemmer(void)
+{
+    return (struct stemmer *) malloc(sizeof(struct stemmer));
+    /* assume malloc succeeds */
+}
+
+extern void free_stemmer(struct stemmer * z)
+{
+    free(z);
+}
+
+/* cons(z, i) is TRUE <=> b[i] is a consonant. ('b' means 'z->b', but here
+   and below we drop 'z->' in comments.
+*/
+
+static int cons(struct stemmer * z, int i)
+{  switch (z->b[i])
+   {  case 'a': case 'e': case 'i': case 'o': case 'u': return FALSE;
+      case 'y': return (i == 0) ? TRUE : !cons(z, i - 1);
+      default: return TRUE;
+   }
+}
+
+/* m(z) measures the number of consonant sequences between 0 and j. if c is
+   a consonant sequence and v a vowel sequence, and <..> indicates arbitrary
+   presence,
+
+      <c><v>       gives 0
+      <c>vc<v>     gives 1
+      <c>vcvc<v>   gives 2
+      <c>vcvcvc<v> gives 3
+      ....
+*/
+
+static int m(struct stemmer * z)
+{  int n = 0;
+   int i = 0;
+   int j = z->j;
+   while(TRUE)
+   {  if (i > j) return n;
+      if (! cons(z, i)) break; i++;
+   }
+   i++;
+   while(TRUE)
+   {  while(TRUE)
+      {  if (i > j) return n;
+            if (cons(z, i)) break;
+            i++;
+      }
+      i++;
+      n++;
+      while(TRUE)
+      {  if (i > j) return n;
+         if (! cons(z, i)) break;
+         i++;
+      }
+      i++;
+   }
+}
+
+/* vowelinstem(z) is TRUE <=> 0,...j contains a vowel */
+
+static int vowelinstem(struct stemmer * z)
+{
+   int j = z->j;
+   int i; for (i = 0; i <= j; i++) if (! cons(z, i)) return TRUE;
+   return FALSE;
+}
+
+/* doublec(z, j) is TRUE <=> j,(j-1) contain a double consonant. */
+
+static int doublec(struct stemmer * z, int j)
+{
+   char * b = z->b;
+   if (j < 1) return FALSE;
+   if (b[j] != b[j - 1]) return FALSE;
+   return cons(z, j);
+}
+
+/* cvc(z, i) is TRUE <=> i-2,i-1,i has the form consonant - vowel - consonant
+   and also if the second c is not w,x or y. this is used when trying to
+   restore an e at the end of a short word. e.g.
+
+      cav(e), lov(e), hop(e), crim(e), but
+      snow, box, tray.
+
+*/
+
+static int cvc(struct stemmer * z, int i)
+{  if (i < 2 || !cons(z, i) || cons(z, i - 1) || !cons(z, i - 2)) return FALSE;
+   {  int ch = z->b[i];
+      if (ch  == 'w' || ch == 'x' || ch == 'y') return FALSE;
+   }
+   return TRUE;
+}
+
+/* ends(z, s) is TRUE <=> 0,...k ends with the string s. */
+
+static int ends(struct stemmer * z, char * s)
+{  int length = s[0];
+   char * b = z->b;
+   int k = z->k;
+   if (s[length] != b[k]) return FALSE; /* tiny speed-up */
+   if (length > k + 1) return FALSE;
+   if (memcmp(b + k - length + 1, s + 1, length) != 0) return FALSE;
+   z->j = k-length;
+   return TRUE;
+}
+
+/* setto(z, s) sets (j+1),...k to the characters in the string s, readjusting
+   k. */
+
+static void setto(struct stemmer * z, char * s)
+{  int length = s[0];
+   int j = z->j;
+   memmove(z->b + j + 1, s + 1, length);
+   z->k = j+length;
+}
+
+/* r(z, s) is used further down. */
+
+static void r(struct stemmer * z, char * s) { if (m(z) > 0) setto(z, s); }
+
+/* step1ab(z) gets rid of plurals and -ed or -ing. e.g.
+
+       caresses  ->  caress
+       ponies    ->  poni
+       ties      ->  ti
+       caress    ->  caress
+       cats      ->  cat
+
+       feed      ->  feed
+       agreed    ->  agree
+       disabled  ->  disable
+
+       matting   ->  mat
+       mating    ->  mate
+       meeting   ->  meet
+       milling   ->  mill
+       messing   ->  mess
+
+       meetings  ->  meet
+
+*/
+
+static void step1ab(struct stemmer * z)
+{
+   char * b = z->b;
+   if (b[z->k] == 's')
+   {  if (ends(z, "\04" "sses")) z->k -= 2; else
+      if (ends(z, "\03" "ies")) setto(z, "\01" "i"); else
+      if (b[z->k - 1] != 's') z->k--;
+   }
+   if (ends(z, "\03" "eed")) { if (m(z) > 0) z->k--; } else
+   if ((ends(z, "\02" "ed") || ends(z, "\03" "ing")) && vowelinstem(z))
+   {  z->k = z->j;
+      if (ends(z, "\02" "at")) setto(z, "\03" "ate"); else
+      if (ends(z, "\02" "bl")) setto(z, "\03" "ble"); else
+      if (ends(z, "\02" "iz")) setto(z, "\03" "ize"); else
+      if (doublec(z, z->k))
+      {  z->k--;
+         {  int ch = b[z->k];
+            if (ch == 'l' || ch == 's' || ch == 'z') z->k++;
+         }
+      }
+      else if (m(z) == 1 && cvc(z, z->k)) setto(z, "\01" "e");
+   }
+}
+
+/* step1c(z) turns terminal y to i when there is another vowel in the stem. */
+
+static void step1c(struct stemmer * z)
+{
+   if (ends(z, "\01" "y") && vowelinstem(z)) z->b[z->k] = 'i';
+}
+
+/* step2(z) maps double suffices to single ones. so -ization ( = -ize plus
+   -ation) maps to -ize etc. note that the string before the suffix must give
+   m(z) > 0. */
+
+static void step2(struct stemmer * z) { switch (z->b[z->k-1])
+{
+   case 'a': if (ends(z, "\07" "ational")) { r(z, "\03" "ate"); break; }
+             if (ends(z, "\06" "tional")) { r(z, "\04" "tion"); break; }
+             break;
+   case 'c': if (ends(z, "\04" "enci")) { r(z, "\04" "ence"); break; }
+             if (ends(z, "\04" "anci")) { r(z, "\04" "ance"); break; }
+             break;
+   case 'e': if (ends(z, "\04" "izer")) { r(z, "\03" "ize"); break; }
+             break;
+   case 'l': if (ends(z, "\03" "bli")) { r(z, "\03" "ble"); break; } /*-DEPARTURE-*/
+
+ /* To match the published algorithm, replace this line with
+    case 'l': if (ends(z, "\04" "abli")) { r(z, "\04" "able"); break; } */
+
+             if (ends(z, "\04" "alli")) { r(z, "\02" "al"); break; }
+             if (ends(z, "\05" "entli")) { r(z, "\03" "ent"); break; }
+             if (ends(z, "\03" "eli")) { r(z, "\01" "e"); break; }
+             if (ends(z, "\05" "ousli")) { r(z, "\03" "ous"); break; }
+             break;
+   case 'o': if (ends(z, "\07" "ization")) { r(z, "\03" "ize"); break; }
+             if (ends(z, "\05" "ation")) { r(z, "\03" "ate"); break; }
+             if (ends(z, "\04" "ator")) { r(z, "\03" "ate"); break; }
+             break;
+   case 's': if (ends(z, "\05" "alism")) { r(z, "\02" "al"); break; }
+             if (ends(z, "\07" "iveness")) { r(z, "\03" "ive"); break; }
+             if (ends(z, "\07" "fulness")) { r(z, "\03" "ful"); break; }
+             if (ends(z, "\07" "ousness")) { r(z, "\03" "ous"); break; }
+             break;
+   case 't': if (ends(z, "\05" "aliti")) { r(z, "\02" "al"); break; }
+             if (ends(z, "\05" "iviti")) { r(z, "\03" "ive"); break; }
+             if (ends(z, "\06" "biliti")) { r(z, "\03" "ble"); break; }
+             break;
+   case 'g': if (ends(z, "\04" "logi")) { r(z, "\03" "log"); break; } /*-DEPARTURE-*/
+
+ /* To match the published algorithm, delete this line */
+
+} }
+
+/* step3(z) deals with -ic-, -full, -ness etc. similar strategy to step2. */
+
+static void step3(struct stemmer * z) { switch (z->b[z->k])
+{
+   case 'e': if (ends(z, "\05" "icate")) { r(z, "\02" "ic"); break; }
+             if (ends(z, "\05" "ative")) { r(z, "\00" ""); break; }
+             if (ends(z, "\05" "alize")) { r(z, "\02" "al"); break; }
+             break;
+   case 'i': if (ends(z, "\05" "iciti")) { r(z, "\02" "ic"); break; }
+             break;
+   case 'l': if (ends(z, "\04" "ical")) { r(z, "\02" "ic"); break; }
+             if (ends(z, "\03" "ful")) { r(z, "\00" ""); break; }
+             break;
+   case 's': if (ends(z, "\04" "ness")) { r(z, "\00" ""); break; }
+             break;
+} }
+
+/* step4(z) takes off -ant, -ence etc., in context <c>vcvc<v>. */
+
+static void step4(struct stemmer * z)
+{  switch (z->b[z->k-1])
+   {  case 'a': if (ends(z, "\02" "al")) break; return;
+      case 'c': if (ends(z, "\04" "ance")) break;
+                if (ends(z, "\04" "ence")) break; return;
+      case 'e': if (ends(z, "\02" "er")) break; return;
+      case 'i': if (ends(z, "\02" "ic")) break; return;
+      case 'l': if (ends(z, "\04" "able")) break;
+                if (ends(z, "\04" "ible")) break; return;
+      case 'n': if (ends(z, "\03" "ant")) break;
+                if (ends(z, "\05" "ement")) break;
+                if (ends(z, "\04" "ment")) break;
+                if (ends(z, "\03" "ent")) break; return;
+      case 'o': if (ends(z, "\03" "ion") && (z->b[z->j] == 's' || z->b[z->j] == 't')) break;
+                if (ends(z, "\02" "ou")) break; return;
+                /* takes care of -ous */
+      case 's': if (ends(z, "\03" "ism")) break; return;
+      case 't': if (ends(z, "\03" "ate")) break;
+                if (ends(z, "\03" "iti")) break; return;
+      case 'u': if (ends(z, "\03" "ous")) break; return;
+      case 'v': if (ends(z, "\03" "ive")) break; return;
+      case 'z': if (ends(z, "\03" "ize")) break; return;
+      default: return;
+   }
+   if (m(z) > 1) z->k = z->j;
+}
+
+/* step5(z) removes a final -e if m(z) > 1, and changes -ll to -l if
+   m(z) > 1. */
+
+static void step5(struct stemmer * z)
+{
+   char * b = z->b;
+   z->j = z->k;
+   if (b[z->k] == 'e')
+   {  int a = m(z);
+      if (a > 1 || (a == 1 && !cvc(z, z->k - 1))) z->k--;
+   }
+   if (b[z->k] == 'l' && doublec(z, z->k) && m(z) > 1) z->k--;
+}
+
+/* nml: this function slightly modified to not require external stemmer 
+ * structure or length count (accepts NUL-terminated term) */
+void stem_porters(void *opaque, char *term) {
+   struct stemmer z;
+
+   z.b = term; z.k = str_len(term) - 1; /* copy the parameters into z */
+   if (z.k <= 1) return; /*-DEPARTURE-*/
+
+   /* With this line, strings of length 1 or 2 don't go through the
+      stemming process, although no mention is made of this in the
+      published algorithm. Remove the line to match the published
+      algorithm. */
+
+   step1ab(&z); step1c(&z); step2(&z); step3(&z); step4(&z); step5(&z);
+   term[z.k + 1] = '\0';  /* zero-terminate string */
+}
+
+/* stem_eds implements a function to stem terms by removing (from the end)
+ * 'e', 'ed', and 's'.  Its also intended to be very fast, stemming via a
+ * single pass through the term. */
+void stem_eds(void *opaque, char *term) {
+    char *suffix;
+
+    /* don't stem away first or second letters of terms */
+    if (!*term++ || !*term++) {
+        return;
+    }
+
+    /* fallthrough to suffixless state */
+
+suffixless_label:
+    /* no suffixes currently recognised */
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+    
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+    
+        case '\0':
+            return;
+    
+        default: 
+            term++;
+            break;
+        }
+    } while (1);
+    
+e_label:
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            break;
+
+        case 'd':
+        case 'D':
+            /* continue recognising potential ed suffix */
+            term++;
+            goto ed_label;
+
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+
+        case '\0':
+            /* stem e suffix away */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+ed_label:
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+
+        case '\0':
+            /* stem ed suffix away */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+s_label:
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            break;
+
+        case '\0':
+            /* stem s suffix away */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+}
+
+/* stem_light implements a function to lightly stem english terms by 
+ *  - removing suffix -e -es -s -ed -ing -ly -ingly
+ *  - replacing suffix -ies, -ied  with -y
+ * Its also intended to be very fast, stemming via a single pass through the 
+ * term. */
+void stem_light(void *opaque, char *term) {
+    char *suffix;
+
+    /* don't stem away first or second letters of terms */
+    if (!*term++ || !*term++) {
+        return;
+    }
+
+    /* fallthrough to suffixless state */
+
+suffixless_label:
+    /* no suffixes currently recognised */
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+    
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+    
+        case '\0':
+            return;
+    
+        default: 
+            term++;
+            break;
+        }
+    } while (1);
+
+l_label:
+    do {
+        switch (*term) {
+        case 'y':
+        case 'Y':
+            /* continue recognising ly suffix */
+            term++;
+            goto ly_label;
+
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+    
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+    
+        case '\0':
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+ly_label:
+     do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+    
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+    
+        case '\0':
+            /* stem away -ly suffix */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+  
+i_label:
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* continue recognise potential ies, ied suffixes */
+            term++;
+            goto ie_label;
+
+        case 'n':
+        case 'N':
+            /* continue recognise potential ing, ingly suffixes */
+            term++;
+            goto in_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+    
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+    
+        case '\0':
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+ie_label:
+    do {
+        switch (*term) {
+        case 'd':
+        case 'D':
+        case 's':
+        case 'S':
+            /* continue recognising potential ied or ies suffixes */
+            term++;
+            goto iesd_label;
+
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+    
+        case '\0':
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+iesd_label:
+    do {
+        switch (*term) {
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+    
+        case '\0':
+            /* replace -ies or -ied suffixes with -y suffix */
+            *suffix++ = 'y';
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+in_label:
+    do {
+        switch (*term) {
+        case 'g':
+        case 'G':
+            /* continue recognising potential ing, ingly suffixes */
+            term++;
+            goto ing_label;
+
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+    
+        case '\0':
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+ing_label:
+    do {
+        switch (*term) {
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ingly suffix */
+            term++;
+            goto ingl_label;
+        case '\0':
+            /* remove -ing suffix */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+ingl_label:
+    do {
+        switch (*term) {
+        case 'y':
+        case 'Y':
+            /* recognise potential ingly suffix */
+            term++;
+            goto ingly_label;
+
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+        case '\0':
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+ingly_label:
+    do {
+        switch (*term) {
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+        case '\0':
+            /* remove -ingly suffix */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+e_label:
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            break;
+
+        case 'd':
+        case 'D':
+        case 's':
+        case 'S':
+            /* continue recognising potential ed or es suffixes */
+            term++;
+            goto eds_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+    
+        case '\0':
+            /* stem e suffix away */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+eds_label:
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            goto s_label;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+
+        case '\0':
+            /* stem -ed or -es suffix away */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+
+s_label:
+    do {
+        switch (*term) {
+        case 'e':
+        case 'E':
+            /* recognise potential e suffix */
+            suffix = term++;
+            goto e_label;
+
+        case 's':
+        case 'S':
+            /* recognise potential s suffix */
+            suffix = term++;
+            break;
+
+        case 'i':
+        case 'I':
+            /* recognise potential ing, ingly, ies, ied suffixes */
+            suffix = term++;
+            goto i_label;
+
+        case 'l':
+        case 'L':
+            /* recognise potential ly suffix */
+            suffix = term++;
+            goto l_label;
+
+        case '\0':
+            /* stem -s suffix away */
+            *suffix = '\0';
+            return;
+    
+        default: 
+            /* no longer recognising a suffix */
+            term++;
+            goto suffixless_label;
+        }
+    } while (1);
+}
+
+#ifdef STEM_TEST
+#include <errno.h>
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+    struct stem_cache *stem = stem_cache_new(stem_porters, NULL, 200);
+    char buf[BUFSIZ + 1];
+    unsigned int i;
+
+    buf[BUFSIZ] = '\0';
+
+    if (!stem) {
+        return EXIT_FAILURE;
+    }
+
+    if (argc == 1) {
+        while (fgets(buf, BUFSIZ, stdin)) {
+            char *start;
+
+            str_rtrim(buf);
+            start = (char *) str_ltrim(buf);
+            stem_cache_stem(stem, start);
+            printf("%s\n", start);
+        }
+    } else {
+        for (i = 1; i < argc; i++) {
+            FILE *input = fopen(argv[i], "rb+");
+
+            if (!input) {
+                fprintf(stderr, "failed to open file %s: %s\n", argv[i], 
+                  strerror(errno));
+                stem_cache_delete(stem);
+                return EXIT_FAILURE;
+            }
+
+            while (fgets(buf, BUFSIZ, input)) {
+                char *start;
+
+                str_rtrim(buf);
+                start = (char *) str_ltrim(buf);
+                stem_cache_stem(stem, start);
+                printf("%s\n", start);
+            }
+    
+            fclose(input);
+        }
+    }
+
+    stem_cache_delete(stem);
+
+    return EXIT_SUCCESS;
+}
+
+#endif
+
diff --git a/src/stop.c b/src/stop.c
new file mode 100644 (file)
index 0000000..08e396b
--- /dev/null
@@ -0,0 +1,254 @@
+/* stop.c is a simple stoplist using the chash hashtable.
+ *
+ * written nml 2004-11-19
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "stop.h"
+
+#include "chash.h"
+#include "def.h"
+#include "poolalloc.h"
+#include "str.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct stop {
+    struct chash *table;        /* hashtable of stopped terms */
+    struct poolalloc *alloc;    /* allocator for term memory */
+
+    /* stemming algorithm */
+    void (*stem)(void *opaque, char *term);
+    void *opaque;
+};
+
+struct stop *stop_new(void (*stem)(void *opaque, char *term), void *opaque) {
+    struct stop *list;
+
+    if ((list = malloc(sizeof(*list))) 
+      && (list->alloc = poolalloc_new(!!DEAR_DEBUG, 1024, NULL))
+      && (list->table = chash_ptr_new(1, 0.5, 
+          (unsigned int (*)(const void *)) str_hash,
+          (int (*)(const void *, const void *)) str_cmp))) {
+
+        list->stem = stem;
+        list->opaque = opaque;
+    } else {
+        if (list) {
+            free(list);
+            list = NULL;
+        }
+    }
+
+    return list;
+}
+
+struct stop *stop_new_file(void (*stem)(void *opaque, char *term), 
+  void *opaque, const char *filename) {
+    struct stop *list;
+
+    if ((list = stop_new(stem, opaque)) 
+      && stop_add_file(list, filename) == STOP_OK) {
+        /* succeeded, do nothing */
+    } else {
+        if (list) {
+            stop_delete(list);
+            list = NULL;
+        }
+    }
+
+    return list;
+}
+
+void stop_delete(struct stop *list) {
+    chash_delete(list->table);
+    poolalloc_delete(list->alloc);
+    list->alloc = NULL;
+    free(list);
+    return;
+}
+
+#define BUFSIZE 4096
+
+enum stop_ret stop_add_file(struct stop *list, const char *filename) {
+    char buf[BUFSIZE + 1];
+    FILE *fp = fopen(filename, "rb");
+    enum stop_ret sret;
+    char *start;
+
+    if (fp) {
+        buf[BUFSIZE] = '\0';
+        while (fgets(buf, BUFSIZE - 1, fp)) {
+            if ((buf[str_len(buf) - 1] != '\n')
+              && (buf[str_len(buf) - 1] != '\r')) {
+                /* line too long */
+                fclose(fp);
+                return STOP_EINVAL;
+            }
+
+            str_rtrim(buf);
+            start = (char *) str_ltrim(buf);
+
+            if (*start && (*start != '#')) {
+                if (((sret = stop_add_term(list, start)) != STOP_OK)
+                  && (sret != STOP_EEXIST)) {
+                    /* something went wrong (note that we allow
+                     * duplicate entries in files) */
+                    fclose(fp);
+                    return sret;
+                }
+            }
+        }
+
+        fclose(fp);
+        return STOP_OK;
+    } else {
+        switch (errno) {
+        case EACCES: return STOP_EACCESS;
+        default: return STOP_EINVAL;
+        }
+    }
+}
+
+enum stop_ret stop_add_term(struct stop *list, const char *term) {
+    unsigned int len;
+    char *copy;
+
+    if (!list->stem && (stop_stop(list, term) == STOP_STOPPED)) {
+        return STOP_EEXIST;
+    }
+
+    len = str_len(term);
+    if ((copy = poolalloc_memalign(list->alloc, len + 1, 1))) {
+        memcpy(copy, term, len + 1);
+        assert(copy[len] == '\0');
+        str_tolower(copy);
+        if (list->stem) {
+            list->stem(list->opaque, copy);
+        }
+
+        if (stop_stop(list, copy) == STOP_STOPPED) {
+            return STOP_EEXIST;
+        }
+
+        if (chash_ptr_ptr_insert(list->table, copy, copy) == CHASH_OK) {
+            return STOP_OK;
+        } else {
+            /* unfortunately, at this point there's nothing we can do
+             * to reclaim the allocated memory for copy, we have to
+             * wait until we delete the stoplist */
+            return STOP_ENOMEM;
+        }
+    } else {
+        return STOP_ENOMEM;
+    }
+}
+
+enum stop_ret stop_stop(struct stop *list, const char *term) {
+    void **data;
+
+    if (chash_ptr_ptr_find(list->table, term, &data) == CHASH_OK) {
+        assert(!str_cmp(*data, term));
+        return STOP_STOPPED;
+    } else {
+        return STOP_OK;
+    }
+}
+
+enum stop_ret stop_print(struct stop *list, FILE *output) {
+    struct chash_iter *iter = chash_iter_new(list->table);
+    const void *key;
+    void **data;
+
+    if (!iter) {
+        return STOP_ENOMEM;
+    }
+
+    while (chash_iter_ptr_ptr_next(iter, &key, &data) == CHASH_OK) {
+        fprintf(output, "%s\n", (const char *) key);
+    }
+
+    chash_iter_delete(iter);
+    return STOP_OK;
+}
+
+enum stop_ret stop_write_code(struct stop *list, FILE *output) {
+    struct chash_iter *iter = chash_iter_new(list->table);
+    const void *key;
+    void **data;
+
+    if (!iter) {
+        return STOP_ENOMEM;
+    }
+
+    fprintf(output, "/* code generated by stop_write_code() to produce a\n");
+    fprintf(output, " * stoplist with default contents */\n\n");
+    fprintf(output, "#include \"firstinclude.h\"\n\n");
+    fprintf(output, "#include \"stop.h\"\n\n");
+    fprintf(output, "struct stop *stop_new_default(void (*stem)(void *opaque,"
+      " char *term),\n");
+    fprintf(output, "  void *opaque) {\n");
+    fprintf(output, "    struct stop *list = stop_new(stem, opaque);\n");
+    fprintf(output, "    enum stop_ret ret;\n");
+    fprintf(output, "    if (!list) {\n");
+    fprintf(output, "        return NULL;\n");
+    fprintf(output, "    }\n\n");
+
+    while (chash_iter_ptr_ptr_next(iter, &key, &data) == CHASH_OK) {
+        fprintf(output, "    if ((ret = stop_add_term(list, \"%s\")) "
+          "!= STOP_OK\n      && ret != STOP_EEXIST) {\n", (const char *) key);
+        fprintf(output, "        stop_delete(list);\n");
+        fprintf(output, "        return NULL;\n");
+        fprintf(output, "    }\n\n");
+    }
+
+    fprintf(output, "    return list;\n}\n\n");
+    chash_iter_delete(iter);
+    return STOP_OK;
+}
+
+#ifdef STOP_MAIN
+
+int main(int argc, char **argv) {
+    struct stop *list;
+    FILE *outfp;
+
+    if (argc > 3) {
+        fprintf(stderr, "usage: %s [file] [outfile]\n", *argv);
+        return EXIT_FAILURE;
+    }
+
+    if (argc > 2) {
+        outfp = fopen(argv[2], "wb");
+
+        if (!outfp) {
+            perror(*argv);
+            return EXIT_FAILURE;
+        }
+    } else {
+        outfp = stdout;
+    }
+
+    if (argc <= 1) {
+        fprintf(stderr, "usage: %s [file] [outfile]\n", *argv);
+        return EXIT_FAILURE;
+    }
+
+    if ((list = stop_new_file(NULL, NULL, argv[1]))) {
+        stop_write_code(list, outfp);
+        fclose(outfp);
+        stop_delete(list);
+        return EXIT_SUCCESS;
+    } else {
+        fclose(outfp);
+        fprintf(stderr, "failed to create stoplist object from stream\n");
+        return EXIT_FAILURE;
+    }
+}
+
+#endif
+
diff --git a/src/stop_default.c b/src/stop_default.c
new file mode 100644 (file)
index 0000000..91a399b
--- /dev/null
@@ -0,0 +1,2832 @@
+/* code generated by stop_write_code() to produce a
+ * stoplist with default contents */
+
+#include "firstinclude.h"
+
+#include "stop.h"
+
+struct stop *stop_new_default(void (*stem)(void *opaque, char *term),
+  void *opaque) {
+    struct stop *list = stop_new(stem, opaque);
+    enum stop_ret ret;
+    if (!list) {
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "across")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "serious")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "forty")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "million")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "vs")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "any")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "consequently")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "after")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "far")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "forth")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whenever")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sent")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "eighteen")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "anywhere")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "herein")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whereas")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "then")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "can")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "and")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "up")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "us")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "seventh")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "billion")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "them")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "herself")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "appear")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "they")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "themselves")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "seventy")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "inward")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "anyhow")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "to")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "seem")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "other")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "perhaps")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "understood")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "considering")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "most")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "eleven")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "specify")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whereupon")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "would")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "subject")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whereby")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "some")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "seventeen")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "probably")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "nevertheless")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "does")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "so")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "under")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "really")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "already")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "indicates")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "except")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "among")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "notion")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "more")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "without")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "anything")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "contain")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "with")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "specifying")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "f")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "e")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "d")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "c")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "b")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "a")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "indeed")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "n")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "hereafter")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "been")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "m")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "throughout")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "l")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "k")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "j")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "i")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "h")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "g")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "v")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "u")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "t")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "s")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "r")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "q")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "hardly")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "amongst")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "p")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "o")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "understand")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "z")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "least")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "y")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "indicated")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "few")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "x")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "someone")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "w")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "than")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "if")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ie")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "almost")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "means")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "may")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "rather")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "misses")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "that")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ought")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "somehow")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "notional")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "only")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "it")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "is")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "insofar")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "in")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "which")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "half")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "something")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "quite")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "apart")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "he")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "interests")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "relates")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "include")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "howbeit")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "exclusive")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "just")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "missed")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "upon")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "way")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whether")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "was")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "like")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sometime")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "related")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whither")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "go")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "toward")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "all")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "eighth")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "corresponding")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thereby")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "went")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "should")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "normally")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whatever")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "eighty")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "allowable")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whom")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "exclusively")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "containing")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "did")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thence")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "nowhere")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whence")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "even")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "another")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "yourselves")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "entire")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ever")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "might")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "neither")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whoever")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "although")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "included")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "anybody")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "namely")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "right")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "its")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ninth")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "between")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "our")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "three")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "self")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "out")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whereafter")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "relate")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "particularly")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "your")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "includes")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "before")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thousand")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "therefore")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "said")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "name")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "possible")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "done")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "where")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "never")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "left")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "immediate")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "please")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "hence")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "were")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "still")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ourselves")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "accordingly")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "many")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "own")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "specified")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "next")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "meanwhile")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "interesting")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "currently")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "since")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "onto")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "see")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ten")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "beside")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "besides")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thirty")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "twelve")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "stylish")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "particular")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "well")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "over")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "for")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "or")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "on")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "given")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "respectively")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "secondly")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "mostly")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "hundred")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "somewhere")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "outside")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "their")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "oh")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "of")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "could")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "otherwise")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "contains")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "four")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "however")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "via")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "note")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "she")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "down")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "his")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thus")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "notions")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "eg")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "therein")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "six")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "used")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "considered")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "wherever")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "from")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "et")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ex")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "viz")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "uses")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "fourteen")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "subjects")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "hereby")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sensible")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "downwards")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "nor")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "not")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "now")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "there")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "here")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "do")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "have")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "appears")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "when")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "much")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "inner")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "hers")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "further")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "twenty")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "fifty")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "styling")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "eleventh")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "the")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "styler")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "afterwards")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "into")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "co")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "stylistic")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "including")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "allowed")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "each")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "hereupon")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "consider")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "styled")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "furthermore")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "very")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "during")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "tenth")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "old")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "placed")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "seems")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "beforehand")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "third")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "former")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "missing")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "around")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "while")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "against")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "zero")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "both")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "within")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "provides")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ninety")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "twelth")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "enough")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "near")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "are")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sometimes")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "etc")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "wanted")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "these")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "latterly")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "fifth")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "every")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "below")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "behind")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "overall")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "instead")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thereafter")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "inc")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "got")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "becomes")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "various")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thoroughly")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "also")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "one")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "value")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thereupon")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "considers")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "fourth")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "nothing")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "allow")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "want")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sixteen")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whole")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "taken")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "you")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "those")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "beyond")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "useful")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "too")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "dozen")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "away")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "what")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ltd")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "theirs")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "such")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "unto")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "how")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "we")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "inasmuch")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "hitherto")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thorough")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "roles")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "use")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "same")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "but")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "became")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "plus")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "though")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "always")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "new")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "using")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "entirely")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "no")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "mean")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "had")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "several")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "wherein")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "doing")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "alone")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "me")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "along")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "has")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "my")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "noone")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "fifteen")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "latter")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "seven")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "albeit")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "cannot")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "unless")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "principle")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "allowing")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "allows")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "often")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "seeming")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "lest")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "less")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "nobody")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "through")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "myself")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "above")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "interest")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "get")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "mine")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "somewhat")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "about")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "found")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "must")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "others")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "meaning")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "else")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "be")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "big")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "eight")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "towards")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "will")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "somebody")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "thirteen")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "off")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "nineteen")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "style")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "interested")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "by")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sup")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "gone")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "having")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "this")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "her")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "because")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "an")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "ours")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "once")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "am")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "notes")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "become")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "necessary")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "at")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "as")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "per")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "nought")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "again")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "yourself")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "usually")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "either")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "why")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "considerable")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "together")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sixty")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "shall")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "last")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "none")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sub")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "questionable")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "himself")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "five")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "itself")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "who")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "indicate")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "sixth")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "relatively")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "first")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "anyone")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "nine")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "two")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "moreover")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "example")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "yet")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "little")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "role")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "seemed")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "whose")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "appropriate")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    if ((ret = stop_add_term(list, "until")) != STOP_OK
+      && ret != STOP_EEXIST) {
+        stop_delete(list);
+        return NULL;
+    }
+
+    return list;
+}
+
diff --git a/src/storagep.c b/src/storagep.c
new file mode 100644 (file)
index 0000000..f0df2dc
--- /dev/null
@@ -0,0 +1,105 @@
+/* storagep.c implements functions declared by storagep.h
+ *
+ * written nml 2003-02-17
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "storagep.h"
+
+#include "_mem.h"
+
+#include "bit.h"
+#include "def.h"
+#include "getmaxfsize.h"
+#include "mem.h"
+#include "zvalgrind.h"
+
+#include <limits.h>
+#include <math.h>
+
+unsigned int storagep_size() {
+    return 2 * sizeof(uint16_t) /* uint_fast16_t members */
+      + 3 * sizeof(uint32_t)    /* uint_fast32_t members */
+      + 3 * sizeof(uint8_t);    /* uint8_t members */
+}
+
+#define WRITE_MEMBER(ptr, member, sizetype)                                   \
+    VALGRIND_CHECK_READABLE(&member, sizeof(sizetype));                       \
+    tmp_##sizetype = member;                                                  \
+    mem_hton(ptr, &tmp_##sizetype, sizeof(sizetype));                         \
+    ptr += sizeof(sizetype)
+
+int storagep_write(const struct storagep *sp, void *vaddr) {
+    char *addr = vaddr;
+    uint32_t tmp_uint32_t;
+    uint16_t tmp_uint16_t;
+    uint8_t tmp_uint8_t;
+
+    WRITE_MEMBER(addr, sp->pagesize, uint32_t);
+    WRITE_MEMBER(addr, sp->max_termlen, uint16_t);
+    WRITE_MEMBER(addr, sp->max_filesize, uint32_t);
+    WRITE_MEMBER(addr, sp->vocab_lsize, uint16_t);
+    WRITE_MEMBER(addr, sp->file_lsize, uint32_t);
+
+    WRITE_MEMBER(addr, sp->btleaf_strategy, uint8_t);
+    WRITE_MEMBER(addr, sp->btnode_strategy, uint8_t);
+    WRITE_MEMBER(addr, sp->bigendian, uint8_t);
+
+    assert((unsigned int) (addr - (const char *) vaddr) == storagep_size());
+
+    return 1;
+}
+
+#define READ_MEMBER(ptr, member, sizetype)                                    \
+    MEM_NTOH(&tmp_##sizetype, ptr, sizeof(sizetype));                         \
+    member = tmp_##sizetype;                                                  \
+    ptr += sizeof(sizetype)
+
+int storagep_read(struct storagep *sp, const void *vaddr) {
+    const char *addr = vaddr;
+    uint32_t tmp_uint32_t;
+    uint16_t tmp_uint16_t;
+    uint8_t tmp_uint8_t;
+
+    READ_MEMBER(addr, sp->pagesize, uint32_t);
+    READ_MEMBER(addr, sp->max_termlen, uint16_t);
+    READ_MEMBER(addr, sp->max_filesize, uint32_t);
+    READ_MEMBER(addr, sp->vocab_lsize, uint16_t);
+    READ_MEMBER(addr, sp->file_lsize, uint32_t);
+
+    READ_MEMBER(addr, sp->btleaf_strategy, uint8_t);
+    READ_MEMBER(addr, sp->btnode_strategy, uint8_t);
+    READ_MEMBER(addr, sp->bigendian, uint8_t);
+
+    assert((unsigned int) (addr - (const char *) vaddr) == storagep_size());
+
+    return 1;
+}
+
+int storagep_defaults(struct storagep *storage, int fd) {
+    storage->pagesize = 8192;
+    storage->max_termlen = TERMLEN_DEFAULT;
+
+    /* get default maximum filesize limit */
+    storage->max_filesize = 4294967295U;        /* 4GB */
+    if (!getmaxfsize(fd, storage->max_filesize, &storage->max_filesize)) {
+        return -1;
+    }
+
+    storage->vocab_lsize = 0;
+    storage->file_lsize = storage->max_filesize;
+    storage->btleaf_strategy = 1;               /* 1 is sorted, general */
+    storage->btnode_strategy = 1;               /* 1 is sorted, general */
+
+    /* bigendian defaults to whatever this machine is */
+#ifdef WORDS_BIGENDIAN
+    storage->bigendian = 1;
+#else
+    storage->bigendian = 0;
+#endif
+
+    return 0;
+}
+
diff --git a/src/str.c b/src/str.c
new file mode 100644 (file)
index 0000000..9a4bcc0
--- /dev/null
+++ b/src/str.c
@@ -0,0 +1,763 @@
+/* str.c implements different (quicker) implementations of the
+ * standard library string functions (and some additional extras such
+ * as strlcat and strlcpy from the OpenBSD project)
+ *
+ * written nml 2003-03-26
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "ascii.h"
+#include "str.h"
+
+#include <assert.h>
+#include <limits.h>
+#include <stdlib.h>                       /* need malloc and free for strdup */
+#include <string.h>
+
+size_t str_len(const char *s) {
+    register const char *pos = s;
+
+    while (*pos) {
+        pos++;
+    }
+
+    return pos - s;
+}
+
+size_t str_nlen(const char *s, size_t maxlen) {
+    register const char *pos = s,
+                        *end = s + maxlen;
+
+    while (*pos && (pos < end)) {
+        pos++;
+    }
+
+    return pos - s;
+}
+
+int str_cmp(const char *s1, const char *s2) {
+    while (*s1 && (*s1 == *s2)) {
+        s1++;
+        s2++;
+    }
+
+    return (unsigned char) *s1 - (unsigned char) *s2;
+}
+
+int str_ncmp(const char *s1, const char *s2, size_t size) {
+    while (size && *s1 && (*s1 == *s2)) {
+        s1++;
+        s2++;
+        size--;
+    }
+
+    if (size) {
+        return (unsigned char) *s1 - (unsigned char) *s2;
+    } else {
+        return 0;
+    }
+}
+
+int str_nncmp(const char *s1, size_t size1, const char *s2, size_t size2) {
+    int def;
+    unsigned int len;
+
+    if (size1 < size2) {
+        def = -1;
+        len = size1;
+    } else if (size1 > size2) {
+        def = 1;
+        len = size2;
+    } else {
+        len = size1;
+        def = 0;
+    }
+
+    while (len && *s1 && (*s1 == *s2)) {
+        s1++;
+        s2++;
+        len--;
+    }
+
+    if (len) {
+        return (unsigned char) *s1 - (unsigned char) *s2;
+    } else {
+        return def;
+    }
+}
+
+char *str_cpy(char *dst, const char *src) {
+    register char *dstpos = dst;
+
+    while ((*dstpos = *src)) {
+        dstpos++;
+        src++;
+    }
+
+    return dst;
+}
+
+char *str_cat(char *dst, const char *src) {
+    register char *dstpos = dst;
+
+    while (*dstpos) {
+        dstpos++;
+    }
+
+    while ((*dstpos = *src)) {
+        dstpos++;
+        src++;
+    }
+
+    return dst;
+}
+
+char *str_ncpy(char *dst, const char *src, 
+  size_t size) {
+    register char *dstpos = dst;
+
+    while (size && (*dstpos = *src)) {
+        dstpos++;
+        src++;
+        size--;
+    }
+
+    /* '\0' fill remaining space */
+    while (size) {
+        *dstpos = '\0';
+        size--;
+        dstpos++;
+    }
+
+    return dst;
+}
+
+char *str_ncat(char *dst, const char *src, 
+  size_t size) {
+    register char *dstpos = dst;
+
+    if (size) {
+        while (*dstpos) {
+            dstpos++;
+        }
+
+        while (size && (*dstpos = *src)) {
+            dstpos++;
+            src++;
+            size--;
+        }
+
+        *dstpos = '\0';
+    }
+
+    return dst;
+}
+
+size_t str_lcpy(char *dst, const char *src, size_t size) {
+    register const char *pos = src;
+
+    if (size) {
+        /* ensure that size is not zero */
+        while (--size && (*dst = *pos)) {
+            dst++;
+            pos++;
+        }
+
+        /* add NUL */
+        *dst = '\0';
+
+        /* traverse rest of src to get accurate count */
+        while (*pos) {
+            pos++;
+        }
+    } else {
+        /* size was 0, but we need to traverse src to get accurate count */
+        while (*pos) {
+            pos++;
+        }
+    }
+
+    return pos - src;   /* return count doesn't include '\0' */
+}
+
+size_t str_lcat(char *dst, const char *src, size_t size) {
+    register const char *srcpos = src;
+    register char *dstpos = dst;
+    register unsigned int dstlen = 0;
+
+    if (size) {
+        /* traverse dst until we reach the end */
+        size--;
+        while (size && *dstpos) {
+            dstpos++;
+            size--;
+        }
+        
+        dstlen = dstpos - dst;
+
+        if (size) {
+            /* copy src to dst */
+            while (size && (*dstpos = *srcpos)) {
+                dstpos++;
+                srcpos++;
+                size--;
+            }
+        } 
+
+        /* terminate the string */
+        *dstpos = '\0';
+    }
+
+    /* traverse src to get an accurate return count */
+    while (*srcpos) {
+        srcpos++;
+    }
+
+    return dstlen + (srcpos - src);
+}
+
+char *str_dup(const char *s) {
+    register const char *str = s;
+    register char *dupstr;
+    char *dup;
+
+    /* get length of string */
+    while (*str) {
+        str++;
+    }
+
+    if ((dup = malloc(((str - s) + 1) * sizeof(char)))) {
+        dupstr = dup;
+        while ((*dupstr = *s)) {
+            dupstr++;
+            s++;
+        }
+
+        return dup;
+    } else {
+        return NULL;
+    }
+}
+
+char *str_ndup(const char *str, size_t size) {
+    register char *copy,
+                  *pos;
+    unsigned int i,
+                 j;
+
+    for (i = 0; (i < size) && str[i]; i++) ;
+
+    if ((pos = copy = malloc(i + 1))) {
+        for (j = 0; j < i; j++) {
+            *pos = *str;
+            pos++;
+            str++;
+        }
+        *pos = '\0';
+    }
+
+    return copy;
+}
+
+#define CASE_SPACE                                                            \
+         ' ': case '\t': case '\n': case '\f': case '\v': case '\r'
+
+const char *str_ltrim(const char *s) {
+    do {
+        switch (*s) {
+        case CASE_SPACE:
+            s++;
+            break;
+    
+        default:
+            return s;
+        }
+    } while (1);   /* loop forever */
+}
+
+unsigned int str_rtrim(char *s) {
+    unsigned int lpos = 0;       /* start of last run we found a space at */
+    char *sc = s;
+
+/* state machine that switches between in a whitespace sequence (inseq) and not
+ * in a whitespace sequence (outseq).  If the string terminates in a whitespace
+ * sequence, then it is reterminated and the number of characters removed is
+ * returned.  Otherwise it is untouched. */
+
+outseq_label:
+    switch (*sc++) {
+    case CASE_SPACE:
+        lpos = sc - s;
+        goto inseq_label;
+
+    case '\0':
+        /* didn't find a non-whitespace character */
+        return 0;
+
+    default:
+        break;
+    }
+    goto outseq_label;   /* loop */
+
+inseq_label:
+    switch (*sc++) {
+    case CASE_SPACE:
+        /* do nothing, it just continues sequence */
+        break;
+
+    case '\0':
+        /* found the end of string in a whitespace sequence, terminate
+         * string where we started */
+        s[lpos - 1] = '\0';
+        return (sc - s) - lpos;
+
+    default:
+        goto outseq_label;
+        break;
+    }
+    goto inseq_label;   /* loop */
+}
+
+unsigned int str_tolower(char *s) {
+    unsigned int converted = 0;
+
+    do {
+        switch (*s) {
+        case ASCII_CASE_UPPER:
+            *s = ASCII_TOLOWER(*s);
+            converted++;
+            break;
+
+        case '\0':
+            return converted;
+        }
+        s++;
+    } while (1);
+}
+
+unsigned int str_ntolower(char *s, size_t size) {
+    unsigned int converted = 0;
+
+    while (size--) {
+        switch (*s) {
+        case ASCII_CASE_UPPER:
+            *s = ASCII_TOLOWER(*s);
+            converted++;
+            break;
+
+        case '\0':
+            return converted;
+        }
+        s++;
+    }
+
+    return converted;
+}
+
+unsigned int str_toupper(char *s) {
+    unsigned int converted = 0;
+
+    do {
+        switch (*s) {
+        case ASCII_CASE_LOWER:
+            *s = ASCII_TOUPPER(*s);
+            converted++;
+            break;
+
+        case '\0':
+            return converted;
+        }
+        s++;
+    } while (1);
+}
+
+unsigned int str_ntoupper(char *s, size_t size) {
+    unsigned int converted = 0;
+
+    while (size--) {
+        switch (*s) {
+        case ASCII_CASE_LOWER:
+            *s = ASCII_TOUPPER(*s);
+            converted++;
+            break;
+
+        case '\0':
+            return converted;
+        }
+        s++;
+    }
+
+    return converted;
+}
+
+/* lookup array of lowercase converted characters (note that we'll offset
+ * lookups into this array by 128 to get rid of signed/unsigned problems) */
+static char lookup[] = {
+    /* first comes the extended character set in case chars are signed */
+    (char) 128, (char) 129, (char) 130, (char) 131, (char) 132, (char) 133, 
+    (char) 134, (char) 135, (char) 136, (char) 137, (char) 138, (char) 139, 
+    (char) 140, (char) 141, (char) 142, (char) 143, (char) 144, (char) 145, 
+    (char) 146, (char) 147, (char) 148, (char) 149, (char) 150, (char) 151, 
+    (char) 152, (char) 153, (char) 154, (char) 155, (char) 156, (char) 157, 
+    (char) 158, (char) 159, (char) 160, (char) 161, (char) 162, (char) 163, 
+    (char) 164, (char) 165, (char) 166, (char) 167, (char) 168, (char) 169, 
+    (char) 170, (char) 171, (char) 172, (char) 173, (char) 174, (char) 175, 
+    (char) 176, (char) 177, (char) 178, (char) 179, (char) 180, (char) 181, 
+    (char) 182, (char) 183, (char) 184, (char) 185, (char) 186, (char) 187, 
+    (char) 188, (char) 189, (char) 190, (char) 191, (char) 192, (char) 193, 
+    (char) 194, (char) 195, (char) 196, (char) 197, (char) 198, (char) 199, 
+    (char) 200, (char) 201, (char) 202, (char) 203, (char) 204, (char) 205, 
+    (char) 206, (char) 207, (char) 208, (char) 209, (char) 210, (char) 211, 
+    (char) 212, (char) 213, (char) 214, (char) 215, (char) 216, (char) 217, 
+    (char) 218, (char) 219, (char) 220, (char) 221, (char) 222, (char) 223, 
+    (char) 224, (char) 225, (char) 226, (char) 227, (char) 228, (char) 229, 
+    (char) 230, (char) 231, (char) 232, (char) 233, (char) 234, (char) 235, 
+    (char) 236, (char) 237, (char) 238, (char) 239, (char) 240, (char) 241, 
+    (char) 242, (char) 243, (char) 244, (char) 245, (char) 246, (char) 247, 
+    (char) 248, (char) 249, (char) 250, (char) 251, (char) 252, (char) 253, 
+    (char) 254, (char) 255,
+
+    /* then the regular 7-bit character set */
+    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 
+    21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, '!', '"', '#', '$', '%', 
+    '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', 
+    '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'a', 'b', 'c', 
+    'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 
+    's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\', ']', '^', '_', '`', 'a', 
+    'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 
+    'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 127, 
+   
+    /* then the extended character set again in case chars are unsigned */
+    (char) 128, (char) 129, (char) 130, (char) 131, (char) 132, (char) 133, 
+    (char) 134, (char) 135, (char) 136, (char) 137, (char) 138, (char) 139, 
+    (char) 140, (char) 141, (char) 142, (char) 143, (char) 144, (char) 145, 
+    (char) 146, (char) 147, (char) 148, (char) 149, (char) 150, (char) 151, 
+    (char) 152, (char) 153, (char) 154, (char) 155, (char) 156, (char) 157, 
+    (char) 158, (char) 159, (char) 160, (char) 161, (char) 162, (char) 163, 
+    (char) 164, (char) 165, (char) 166, (char) 167, (char) 168, (char) 169, 
+    (char) 170, (char) 171, (char) 172, (char) 173, (char) 174, (char) 175, 
+    (char) 176, (char) 177, (char) 178, (char) 179, (char) 180, (char) 181, 
+    (char) 182, (char) 183, (char) 184, (char) 185, (char) 186, (char) 187, 
+    (char) 188, (char) 189, (char) 190, (char) 191, (char) 192, (char) 193, 
+    (char) 194, (char) 195, (char) 196, (char) 197, (char) 198, (char) 199, 
+    (char) 200, (char) 201, (char) 202, (char) 203, (char) 204, (char) 205, 
+    (char) 206, (char) 207, (char) 208, (char) 209, (char) 210, (char) 211, 
+    (char) 212, (char) 213, (char) 214, (char) 215, (char) 216, (char) 217, 
+    (char) 218, (char) 219, (char) 220, (char) 221, (char) 222, (char) 223, 
+    (char) 224, (char) 225, (char) 226, (char) 227, (char) 228, (char) 229, 
+    (char) 230, (char) 231, (char) 232, (char) 233, (char) 234, (char) 235, 
+    (char) 236, (char) 237, (char) 238, (char) 239, (char) 240, (char) 241, 
+    (char) 242, (char) 243, (char) 244, (char) 245, (char) 246, (char) 247, 
+    (char) 248, (char) 249, (char) 250, (char) 251, (char) 252, (char) 253, 
+    (char) 254, (char) 255
+};
+
+int str_casecmp(const char *s1, const char *s2) {
+    const char *us1 = (const char*) s1,
+                        *us2 = (const char*) s2;
+
+    while (*us1 && (lookup[*us1 + 128] == lookup[*us2 + 128])) {
+        us1++;
+        us2++;
+    }
+
+    return (unsigned char) lookup[*us1 + 128] 
+      - (unsigned char) lookup[*us2 + 128];
+}
+
+int str_ncasecmp(const char *s1, const char *s2, 
+  size_t size) {
+    const char *us1 = (const char*) s1,
+                        *us2 = (const char*) s2;
+
+    while (size && *us1 && (lookup[*us1 + 128] == lookup[*us2 + 128])) {
+        us1++;
+        us2++;
+        size--;
+    }
+
+    if (size) {
+        return (unsigned char) lookup[*us1 + 128] 
+          - (unsigned char) lookup[*us2 + 128];
+    } else {
+        return 0;
+    }
+}
+
+char *str_chr(const char *s, int c) {
+    do {
+        if (*s == c) {
+            return (char*) s;
+        } else if (!*s) {
+            return NULL;
+        } else {
+            s++;
+        }
+    } while (1);
+}
+
+char *str_rchr(const char *s, int c) {
+    char *last = NULL;
+
+    do {
+        if (*s == c) {
+            last = (char*) s;
+        } 
+
+        /* can't else here otherwise we can't detect c as \0 */
+        if (!*s) {
+            return last;
+        } else {
+            s++;
+        }
+    } while (1);
+}
+
+char **str_split(char *str, const char *delim, 
+  unsigned int *parts) {
+    char **arr = malloc(sizeof(char*) + sizeof(char*));
+    void *ptr;
+    char *pos;
+    unsigned int i,
+                 len = str_len(delim);
+
+    /* advance string past leading delimeters */
+    while (*str) {
+        for (i = 0; i < len; i++) {
+            if (*str == delim[i]) {
+                break;
+            }
+        }
+
+        if (i == len) {
+            break;
+        } else {
+            str++;
+        }
+    } 
+
+    if (arr) {
+        *arr = pos = str;
+        *parts = 1;
+    } else {
+        return NULL;
+    }
+
+/* outside of a delimiter string */
+out_delim_label:
+    while (*pos) {
+        for (i = 0; i < len; i++) {
+            if (*pos == delim[i]) {
+                /* found a delimiter, need to split */
+                if ((ptr = realloc(arr, sizeof(char*) * (*parts + 2)))) {
+                    (*parts)++;
+                    arr = ptr;
+                    *pos = '\0';
+                    pos++;
+
+                    /* we anticipate that the next character will be the first 
+                     * character in the split string (and if not we push it 
+                     * again) */
+                    arr[*parts - 1] = pos;
+
+                    goto in_delim_label;
+                } else {
+                    if (arr) {
+                        free(arr);
+                    }
+                    return NULL;
+                }
+            }
+        }
+        pos++;
+    }
+
+    arr[*parts] = NULL;      /* NULL terminate */
+    return arr;
+
+/* in a delimiter string */
+in_delim_label:
+    while (*pos) {
+        for (i = 0; i < len; i++) {
+            if (*pos == delim[i]) {
+                *pos = '\0';
+                break;
+            }
+        }
+
+        pos++;
+
+        if (i == len) {
+            /* it wasn't a delimiter, switch states */
+            goto out_delim_label;
+        }
+
+        /* we anticipate that the next character will be the first character 
+         * in the split string (and if not we push it again) */
+        arr[*parts - 1] = pos;
+    }
+
+    /* there ended up not being another split string, so decrement parts */
+    (*parts)--;
+
+    arr[*parts] = NULL;      /* NULL terminate */
+    return arr;
+}
+
+int str_signed_char() {
+    return STR_SIGNED_CHAR;
+}
+
+unsigned int str_from_char(char c) {
+    return STR_FROM_CHAR(c);
+}
+
+char str_to_char(unsigned int c) {
+    return STR_TO_CHAR(c);
+}
+
+unsigned int str_strip(char *str) {
+    char *readpos = str,
+         *writepos = str;
+
+    /* haven't received any acceptable characters yet */
+    while (1) {
+        switch (*readpos) {
+        case '\0':
+            /* end of string */
+            *writepos++ = *readpos++;
+            return readpos - writepos;
+
+        case ASCII_CASE_UPPER:
+            *writepos++ = ASCII_TOLOWER(*readpos++);
+            goto inword_label;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* preserve */
+            *writepos++ = *readpos++;
+            goto inword_label;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+        case CASE_SPACE:
+        case ASCII_CASE_PUNCTUATION:
+            /* strip */
+            readpos++;
+            break;
+
+        /* shouldn't happen, default should be the null set */
+        default:
+            assert(0);
+        }
+    }
+
+/* just parsed a preserved char, so we can accept a hyphen if it comes */
+inword_label:
+    while (1) {
+        switch (*readpos) {
+        case '\0':
+            /* end of string */
+            *writepos++ = *readpos++;
+            return readpos - writepos;
+
+        case ASCII_CASE_UPPER:
+            *writepos++ = ASCII_TOLOWER(*readpos++);
+            break;
+
+        case ASCII_CASE_LOWER:
+        case ASCII_CASE_DIGIT:
+            /* preserve */
+            *writepos++ = *readpos++;
+            break;
+
+        case ASCII_CASE_EXTENDED:
+        case ASCII_CASE_CONTROL:
+        case CASE_SPACE:
+        case '-':
+        default:  /* default is the rest of the punctuation here */
+            /* strip */
+            readpos++;
+            break;
+        }
+    }
+}
+
+char *str_dirname(char *dst, unsigned int dstsize, const char *src) {
+    char *end = str_rchr(src, OS_SEPARATOR);
+
+    if (!end) {
+        str_lcpy(dst, ".", dstsize);
+
+    /* figure out if string will fit in dst, stepping over the seperator
+     * character (++end) beforehand */
+    } else if ((unsigned int) (++end - src) >= dstsize) {
+        memcpy(dst, src, dstsize - 1);
+        dst[dstsize - 1] = '\0';
+    } else {
+        memcpy(dst, src, end - src);
+        dst[end - src] = '\0';
+    }
+
+    return dst;
+}
+
+const char *str_basename(const char *src) {
+    char *end = str_rchr(src, OS_SEPARATOR);
+
+    if (!end) {
+        return src;
+    } else {
+        if (!end[1]) {
+            /* points to trailing slash, need to back up to either start 
+             * of string or previous slash.  Unlike reference basename, 
+             * we don't strip trailing slashes off. */
+
+            /* first, back up until we have something thats not a directory
+             * seperator */
+            while (end >= src && *end == OS_SEPARATOR) {
+                end--;
+            }
+
+            if (end >= src) {
+                /* now, skip back until the next seperator */
+                while (end >= src && *end != OS_SEPARATOR) {
+                    end--;
+                }
+            }
+        }
+        return &end[1];
+    }
+}
+
+#define LARGEPRIME 100000007
+
+unsigned int str_hash(const char *str) {
+    /* Author J. Zobel, April 2001. */
+    char c;
+    unsigned int h = LARGEPRIME;
+    const char* word = str;
+
+    for (; (c = *word) != '\0'; word++) {
+        h ^= ((h << 5) + c + (h >> 2));
+    }
+
+    return h;
+}
+
+unsigned int str_nhash(const char *str, unsigned int len) {
+    /* Author J. Zobel, April 2001. */
+    char c;
+    unsigned int h = LARGEPRIME,
+                 i;
+    const char* word = str;
+
+    for (i = 0; (i < len) && ((c = *word) != '\0'); word++, i++) {
+        h ^= ((h << 5) + c + (h >> 2));
+    }
+
+    return h;
+}
+
diff --git a/src/summarise.c b/src/summarise.c
new file mode 100644 (file)
index 0000000..8d5bc2c
--- /dev/null
@@ -0,0 +1,937 @@
+/* summarise.c declares methods for creating a query-biased textual summary 
+ * of a document
+ *
+ * Calculation of scores is based on the paper
+ * "Advantages of Query Biased Summaries in Information Retreival"
+ * by A. Tombros and M. Sanderson.
+ *
+ * Each sentence in a docuement is given a score based on the number of
+ * query terms in the sentence and the number of terms in the query:
+ *
+ * score = (square of the number of query terms in the sentence) 
+ *   / (number of terms in the query)
+ *
+ * written nml 2006-03-30
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "summarise.h"
+
+#include "ascii.h"
+#include "chash.h"
+#include "def.h"
+#include "fdset.h"
+#include "heap.h"
+#include "_index.h"
+#include "index_querybuild.h"
+#include "docmap.h"
+#include "mlparse_wrap.h"
+#include "psettings.h"
+#include "str.h"
+#include "stream.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct summarise {
+    struct mlparse parser;
+    struct index *idx;        
+    struct fdset *fd;
+    struct psettings *pset;
+    struct docmap *map;
+    unsigned int max_termlen;
+    void (*stem)                   /* stemming function for terms */
+      (void *opaque, char *term);
+    void *stemmer;                 /* stemming object */
+    char *buf;
+    unsigned int bufsize;
+
+    struct stream *last_stream;
+    unsigned int last_fileno;
+    off_t last_offset;
+    off_t last_poffset;
+};
+
+struct persum {
+    unsigned int term;             /* current term number */
+    unsigned int summary_len;      /* length of summary to be generated */
+    char *termbuf;                 /* buffer capable of holding one term */
+    char *title;                   /* buffer for title */
+    unsigned int title_len;        /* length of title */
+    unsigned int title_size;       /* length of title buffer */
+    struct psettings_type *ptype;  /* tags for given document type */
+    struct chash *terms;           /* hashtable lookup for query terms */
+    int index;                     /* current state */
+    unsigned int stack;            /* state stack */
+    int fd;                        /* source fd */
+    unsigned int bytes_left;       /* bytes left in the document */
+};
+
+struct summarise *summarise_new(struct index *idx) {
+    struct summarise *sum = malloc(sizeof(*sum));
+
+    if (sum 
+      && (sum->buf = malloc(BUFSIZ))
+      && (mlparse_new(&sum->parser, idx->storage.max_termlen, LOOKAHEAD))) {
+
+        sum->stem = index_stemmer(idx);
+        sum->stemmer = idx->stem;
+        sum->idx = idx;
+        sum->fd = idx->fd;
+        sum->pset = idx->settings;
+        sum->map = idx->map;
+        sum->max_termlen = idx->storage.max_termlen;
+        sum->last_stream = NULL;
+        sum->last_fileno = -1;
+        sum->last_offset = -1;
+        sum->bufsize = BUFSIZ;
+    } else if (sum) {
+        if (sum->buf) {
+            free(sum->buf);
+        }
+        free(sum);
+        sum = NULL;
+    }
+
+    return sum;
+}
+
+void summarise_delete(struct summarise *sum) {
+    if (sum->last_stream) {
+        stream_delete(sum->last_stream);
+    }
+    free(sum->buf);
+    mlparse_delete(&sum->parser);
+    free(sum);
+}
+
+struct sentence {
+    char *buf;                    /* buffer */
+    unsigned int buflen;          /* buffer length */
+    unsigned int bufsize;         /* buffer capacity */
+    unsigned int start_term;      /* ordinal number of initial term */
+    unsigned int terms;           /* number of terms in sentence */
+    unsigned int qterms;          /* number of query terms in sentence */
+    float score;                  /* sentence score */
+    struct sentence *next;        /* next sentence */
+    struct sentence *prev;        /* previous sentence */
+};
+
+/* internal function to handle reallocation of sentence buffers */
+static int ensure_space(struct sentence **sent, unsigned int space) {
+    while ((*sent)->buflen + space >= (*sent)->bufsize) {
+        void *ptr = realloc(*sent, sizeof(**sent) + (*sent)->bufsize * 2);
+
+        if (ptr) {
+            *sent = ptr;
+            (*sent)->buf = (void *) (*sent + 1);
+
+            if (DEAR_DEBUG) {
+                memset((*sent)->buf + (*sent)->bufsize, 0, (*sent)->bufsize);
+            }
+
+            (*sent)->bufsize *= 2;
+        } else {
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+/* internal function to finish up extraction of a sentence */
+static struct sentence *extract_finish(struct sentence *sent, struct persum *ps,
+  enum index_summary_type type, int highlight) {
+    if (highlight && type == INDEX_SUMMARISE_TAG) {
+        /* need to close the tag */
+        if (sent->buflen + str_len("</b>") >= sent->bufsize 
+          && !ensure_space(&sent, sent->buflen + str_len("</b>"))) {
+            unsigned int space = 0;
+            /* ran out of memory (damn!) at an inconvenient time,
+             * erase terms from the buffer until we can fit in an
+             * ending tag */
+
+            while (!isspace(sent->buf[sent->buflen - 1]) 
+              && (sent->buf[sent->buflen - 1] != '>')
+              && sent->buflen
+              && (space < str_len("</b>"))) {
+                sent->buflen--;
+            }
+
+            /* end highlighting */
+            str_cpy(sent->buf + sent->buflen, "</b>");
+            sent->buflen += str_len("</b>");
+        }
+    }
+
+    /* trim overly-long sentence term-by-term */
+    while (sent->buflen > ps->summary_len) {
+        sent->buflen--;
+        while (sent->buf[sent->buflen - 1] != ' ') {
+            sent->buflen--;
+        }
+    }
+
+    /* remove superfluous whitespace from the end of the sentence */
+    while (sent->buf[sent->buflen - 1] == ' ') {
+        sent->buflen--;
+    }
+
+    sent->buf[sent->buflen] = '\0';
+    return sent;
+}
+
+unsigned int html_cpy(struct sentence **sent, const char *term, 
+  unsigned int len) {
+    unsigned int extra = 0,
+                 orig_len = len;
+    const char *name = NULL;
+
+/* maximum length of an escape sequence that we insert (max &quot; or &#123;) */
+#define MAX_ESCAPE 6
+
+    while (len) {
+        while (len && ((*sent)->buflen + MAX_ESCAPE < (*sent)->bufsize)) {
+            switch (*term) {
+            case ASCII_CASE_CONTROL:
+            case ASCII_CASE_EXTENDED:
+            case '\'': /* note that &apos; is not standard */
+            case '\0':
+                /* numeric escape character */
+                (*sent)->buf[(*sent)->buflen++] = '&';
+                (*sent)->buf[(*sent)->buflen++] = '#';
+                extra++;
+                if (*term > 99) {
+                    (*sent)->buf[(*sent)->buflen++] = ((*term) / 100) + '0';
+                    extra++;
+                }
+                (*sent)->buf[(*sent)->buflen++] = (((*term) / 10) % 10) + '0';
+                extra++;
+                (*sent)->buf[(*sent)->buflen++] = ((*term) % 10) + '0';
+                extra++;
+                (*sent)->buf[(*sent)->buflen++] = ';';
+                extra++;
+                assert((*sent)->buflen < (*sent)->bufsize);
+                break;
+
+            case '<':
+            case '>':
+            case '"':
+            case '&':
+                /* named escape character */
+                switch (*term) {
+                case '<': name = "lt"; break;
+                case '>': name = "gt"; break;
+                case '"': name = "quot"; break;
+                case '&': name = "amp"; break;
+                }
+                (*sent)->buf[(*sent)->buflen++] = '&';
+                while (*name) {
+                    (*sent)->buf[(*sent)->buflen++] = *name++;
+                    extra++;
+                }
+                (*sent)->buf[(*sent)->buflen++] = ';';
+                extra++;
+                break;
+
+            default:
+                (*sent)->buf[(*sent)->buflen++] = *term;
+                break;
+            }
+            term++;
+            len--;
+        }
+
+        if (len && !ensure_space(sent, (*sent)->bufsize + len)) {
+            return orig_len - len + extra;
+        }
+    }
+
+    assert(!len);
+    return orig_len + extra;
+}
+
+/* internal function to extract the next sentence */
+static struct sentence *extract(struct summarise *sum, struct persum *ps,
+  enum index_summary_type type, const struct query *q, 
+  struct sentence *sent, unsigned int *occs) {
+    unsigned int i,
+                 len;
+    int highlight = 0,          /* whether we're currently highlighting */
+        title = 0;              /* whether we're currently in a title */
+    void **found;
+    struct conjunct *conj;      /* current query term, in query struct */
+    enum mlparse_ret ret; 
+    enum psettings_attr attr;
+
+    /* note that because we potentially realloc sent, we *must* return it if we
+     * modify it or else risk leaking memory */
+
+    /* note that we try to replicate the parsing here
+     * (actually we should refactor it somewhere else so that we can reuse 
+     * it) */
+    /* zero out occurrance table */
+    for (i = 0; i < q->terms; i++) {
+        occs[i] = 0;
+    }
+    sent->start_term = ps->term;
+    sent->buflen = 0;
+    sent->terms = 0;
+    sent->qterms = 0;
+
+    do {
+        ret 
+          = mlparse_parse(&sum->parser, ps->termbuf, &len, 0);
+        switch (ret) {
+        case MLPARSE_COMMENT:
+        case MLPARSE_COMMENT | MLPARSE_END:
+            if (ret & MLPARSE_END) {
+                len = str_len("/sgmlcomment");
+                assert(len < sum->max_termlen);
+                memcpy(ps->termbuf, "/sgmlcomment", len);
+            } else {
+                len = str_len("sgmlcomment");
+                assert(len < sum->max_termlen);
+                memcpy(ps->termbuf, "sgmlcomment", len);
+            }
+            /* fallthrough to tag parsing */
+        case MLPARSE_TAG:
+            /* lookup tag, see if text can flow through this tag (otherwise
+             * sentence ends) */
+            ps->termbuf[len] = '\0';
+            str_strip(ps->termbuf + (ps->termbuf[0] == '/'));
+            attr = psettings_type_find(sum->pset, ps->ptype, ps->termbuf);
+            title = 0;
+
+            /* change state based on tag index attribute */
+            if (attr & PSETTINGS_ATTR_INDEX 
+              || attr & PSETTINGS_ATTR_CHECKBIN) {
+                /* note that we assume that the binary check succeeded */
+                ps->stack <<= 1;
+                ps->stack |= !ps->index;
+                ps->index = 1;
+            } else if (attr & PSETTINGS_ATTR_POP) {
+                ps->index = !(ps->stack & 1);
+                ps->stack >>= 1;
+            } else if (attr & PSETTINGS_ATTR_OFF_END) {
+                /* need to search forward until we get the end tag */
+
+                /* store end tag at the end of the current summary */
+                if (sent->buflen + len + 1 < sent->bufsize 
+                  || ensure_space(&sent, sent->buflen + len + 1)) {
+
+                    str_cpy(sent->buf + sent->buflen, ps->termbuf);
+
+                    do {
+                        ret = mlparse_parse(&sum->parser, ps->termbuf, 
+                            &len, 0);
+                        switch (ret) {
+                        case MLPARSE_ERR:
+                        case MLPARSE_EOF:
+                            if (sent->buflen) {
+                                return extract_finish(sent, ps, type, 
+                                    highlight);
+                            } else {
+                                /* can return NULL because we can't have 
+                                 * realloc'd the buffer */
+                                return NULL;
+                            }
+                            break;
+
+                        case MLPARSE_TAG:
+                            ps->termbuf[len] = '\0';
+                            str_strip(ps->termbuf + (ps->termbuf[0] == '/'));
+                            if ((sent->buf[sent->buflen] == '/' 
+                                && !str_cmp(sent->buf + sent->buflen + 1, 
+                                    ps->termbuf))
+                              || (sent->buf[sent->buflen] != '/'
+                                && ps->termbuf[0] == '/'
+                                && !str_cmp(sent->buf + sent->buflen,
+                                    ps->termbuf + 1))) {
+                                /* found the end tag */
+                                ps->index = 1;
+                            }
+                            break;
+
+                        case MLPARSE_INPUT:
+                            if (!ps->bytes_left) {
+                                mlparse_eof(&sum->parser);
+                            } else if (index_stream_read(sum->last_stream, 
+                                ps->fd, sum->buf, sum->bufsize) == STREAM_OK) {
+
+                                sum->parser.next_in 
+                                  = sum->last_stream->curr_out;
+                                if (ps->bytes_left 
+                                  >= sum->last_stream->avail_out) {
+                                    sum->parser.avail_in 
+                                      = sum->last_stream->avail_out;
+                                    ps->bytes_left 
+                                      -= sum->last_stream->avail_out;
+                                    sum->last_stream->avail_out = 0;
+                                } else {
+                                    sum->parser.avail_in = ps->bytes_left;
+                                    sum->last_stream->avail_out 
+                                      -= ps->bytes_left;
+                                    sum->last_stream->curr_out 
+                                      += ps->bytes_left;
+                                    ps->bytes_left = 0;
+                                }
+                            } else {
+                                return extract_finish(sent, ps, type, 
+                                    highlight);
+                            }
+                            break;
+
+                        default: /* ignore */ break;
+                        }
+                    } while (!ps->index);
+                }
+
+                /* note that we turn indexing back on (slightly dodgy, since 
+                 * we don't know that's the action specified by that tag - 
+                 * XXX) but it keeps things simple */
+            } else if (attr & PSETTINGS_ATTR_TITLE) {
+                title = 1;
+            } else {
+                /* indexing off */
+                ps->stack <<= 1;
+                ps->stack |= !ps->index;
+                ps->index = 0;
+            }
+
+            if (sent->buflen && !(attr & PSETTINGS_ATTR_FLOW)) {
+                /* sentence ends here, due to markup */
+                ps->term++;  /* separate this sentence from next, since 
+                              * a significant tag lies between them */
+                return extract_finish(sent, ps, type, highlight);
+            }
+            break;
+
+        case MLPARSE_WORD:
+        case MLPARSE_WORD | MLPARSE_CONT:
+        case MLPARSE_WORD | MLPARSE_END:
+            if (title) {
+                /* copy into title buffer, don't generate a sentence from it */
+                if (ps->title_len + len + 2 < ps->title_size) {
+                    memcpy(ps->title + ps->title_len, ps->termbuf, len);
+                    ps->title_len += len;
+                    ps->title[ps->title_len++] = ' ';
+                } else if (ps->title_len + 1 < ps->title_size) {
+                    unsigned int tlen = ps->title_size - ps->title_len - 1;
+                    memcpy(ps->title + ps->title_len, ps->termbuf, tlen);
+                    ps->title_len += tlen;
+                    assert(ps->title_len + 1 <= ps->title_size);
+                    if (ps->title_len + 1 < ps->title_size) {
+                        ps->title[ps->title_len++] = ' ';
+                    }
+                    assert(ps->title_len + 1 == ps->title_size);
+                }
+                break;
+            } else if (!ps->index) {
+                break;
+            }
+
+            sent->terms++;
+            ps->term++;
+
+            /* ensure we have enough memory in buffer for the term */
+            if (sent->buflen + len + 1 >= sent->bufsize 
+              && !ensure_space(&sent, sent->buflen + len + 1)) {
+                /* ran out of memory, just skip this term */
+                assert(sent->buflen);
+                return extract_finish(sent, ps, type, highlight);
+            }
+
+            /* copy term in, before we mangle it */
+            if (type == INDEX_SUMMARISE_TAG) {
+                unsigned int tmp = sent->buflen;
+
+                /* need to escape HTML entities in the term */
+                len = html_cpy(&sent, ps->termbuf, len);
+                sent->buflen = tmp;
+            } else {
+                memcpy(sent->buf + sent->buflen, ps->termbuf, len);
+            }
+
+            /* strip and stem the term */
+            ps->termbuf[len] = '\0';
+            str_strip(ps->termbuf);
+            sum->stem(sum->stemmer, ps->termbuf);
+
+            if (chash_str_ptr_find(ps->terms, ps->termbuf, &found) 
+              == CHASH_OK) {
+                unsigned int taglen;
+
+                /* it's a query term, retroactively highlight it in the 
+                 * sentence buffer */
+                switch (type) {
+                case INDEX_SUMMARISE_PLAIN: /* do nothing */ break;
+                case INDEX_SUMMARISE_CAPITALISE:
+                    for (i = 0; i < len; i++) {
+                        sent->buf[sent->buflen + i] 
+                          = toupper(sent->buf[sent->buflen + i]);
+                    }
+                    break;
+
+                case INDEX_SUMMARISE_TAG:
+                    if (!highlight) {
+                        taglen = str_len("<b>");
+                        if (sent->buflen + taglen >= sent->bufsize 
+                          && !ensure_space(&sent, sent->buflen + taglen)) {
+                            /* ran out of memory, just skip this term */
+                            assert(sent->buflen);
+                            return extract_finish(sent, ps, type, highlight);
+                        }
+
+                        memmove(sent->buf + sent->buflen + taglen, 
+                          sent->buf + sent->buflen, len);
+                        memcpy(sent->buf + sent->buflen, "<b>", taglen);
+                        sent->buflen += taglen;
+                    }
+                    break;
+
+                default: assert("can't get here" && 0);
+                }
+                highlight = 1;
+
+                /* increment counters */
+                conj = *found;
+                if (conj >= q->term && conj < q->term + q->terms) {
+                    occs[conj - q->term]++;
+                }
+                sent->qterms++;
+            } else {
+                /* it's not a query term */
+                if (highlight && type == INDEX_SUMMARISE_TAG) {
+                    unsigned int taglen = str_len("</b>");
+                    if (sent->buflen + taglen >= sent->bufsize 
+                      && !ensure_space(&sent, sent->buflen + taglen)) {
+                        /* ran out of memory, just skip this term */
+                        assert(sent->buflen);
+                        return extract_finish(sent, ps, type, highlight);
+                    }
+
+                    /* end highlighting */
+                    memmove(sent->buf + sent->buflen + taglen, 
+                      sent->buf + sent->buflen, len);
+                    memcpy(sent->buf + sent->buflen, "</b>", taglen);
+                    sent->buflen += taglen;
+                }
+                highlight = 0;
+            }
+            sent->buflen += len;
+
+            if (ret & MLPARSE_END) {
+                return extract_finish(sent, ps, type, highlight);
+            } else if (!(ret & MLPARSE_CONT)) {
+                sent->buf[sent->buflen++] = ' ';
+            }
+            break;
+
+        case MLPARSE_INPUT:
+            if (!ps->bytes_left) {
+                mlparse_eof(&sum->parser);
+            } else if (index_stream_read(sum->last_stream, ps->fd, sum->buf, 
+                sum->bufsize) == STREAM_OK) {
+
+                sum->parser.next_in = sum->last_stream->curr_out;
+                if (ps->bytes_left > sum->last_stream->avail_out) {
+                    sum->parser.avail_in = sum->last_stream->avail_out;
+                    ps->bytes_left -= sum->last_stream->avail_out;
+                } else {
+                    sum->parser.avail_in = ps->bytes_left;
+                    sum->last_stream->avail_out -= ps->bytes_left;
+                    sum->last_stream->curr_out += ps->bytes_left;
+                    ps->bytes_left = 0;
+                }
+            } else {
+                return extract_finish(sent, ps, type, highlight);
+            }
+            break;
+
+        case MLPARSE_ERR:
+        case MLPARSE_EOF: 
+            if (sent->buflen) {
+                return extract_finish(sent, ps, type, highlight);
+            } else {
+                /* can return NULL because we can't have realloc'd the buffer */
+                return NULL;
+            }
+            break;
+
+        default:
+            /* ignore */
+            break;
+        }
+    } while ((ret != (MLPARSE_WORD | MLPARSE_END)) 
+      && (sent->buflen < ps->summary_len));
+
+    return extract_finish(sent, ps, type, highlight);
+}
+
+static void score(struct sentence *sent, const struct query *q) {
+    sent->score = (sent->qterms * sent->qterms) / (float) q->terms;
+}
+
+/* internal function (for qsort) to order sentences by position in the 
+ * document */
+static int sum_pos_cmp(const void *vone, const void *vtwo) {
+    const struct sentence *one = *((const struct sentence **) vone), 
+                          *two = *((const struct sentence **) vtwo);
+
+    return one->start_term - two->start_term;
+}
+
+/* internal function (for heap) to order sentences by score */
+static int sum_score_cmp(const void *vone, const void *vtwo) {
+    const struct sentence *one = *((const struct sentence **) vone), 
+                          *two = *((const struct sentence **) vtwo);
+
+    if (one->score < two->score) {
+        return -1;
+    } else if (one->score > two->score) {
+        return 1;
+    } else {
+        return two->start_term - one->start_term;
+    }
+}
+
+/* internal function (for heap) to order sentences by score */
+static int rev_sum_score_cmp(const void *vone, const void *vtwo) {
+    const struct sentence *one = *((const struct sentence **) vone), 
+                          *two = *((const struct sentence **) vtwo);
+
+    if (one->score < two->score) {
+        return 1;
+    } else if (one->score > two->score) {
+        return -1;
+    } else {
+        return two->start_term - one->start_term;
+    }
+}
+
+static void persum_delete(struct summarise *sum, struct persum *ps) {
+    free(ps->termbuf);
+    sum->last_poffset = lseek(ps->fd, 0, SEEK_CUR);
+    fdset_unpin(sum->fd, sum->idx->repos_type, sum->last_fileno, ps->fd);
+    chash_delete(ps->terms);
+}
+
+enum summarise_ret summarise(struct summarise *sum, unsigned long int docno,
+  const struct query *query, enum index_summary_type type, 
+  struct summary *result) {
+    struct persum ps;                     /* per-sum elements */
+    struct sentence **heap = NULL,        /* heap of candidate sentences */
+                    *unused = NULL,       /* unused sentence buffers */
+                    *prev = NULL,         /* previous sentence */
+                    *min;                 /* minimum element on heap */
+    unsigned int i,
+                 heap_len = 0,            /* number of items in heap */
+                 heap_size = 0,           /* capacity of heap */
+                 heap_bytes = 0,          /* length of heap in total buffered 
+                                           * bytes */
+                 selected,                /* number of sentences selected */
+                 *occs,                   /* array for counting query term 
+                                           * occurrances */
+                 fileno,                  /* repository of given document */
+                 bytes;                   /* size of given document */
+    off_t offset,                         /* repository offset of given doc */
+          curroffset,
+          physoffset;
+    int finished = 0;                     /* continued iteration indicator */
+    enum docmap_ret dmret;
+    enum docmap_flag dmflags;
+    enum mime_types mtype;
+    struct stream_filter *filter;
+
+    if (!(occs = malloc(sizeof(*occs) * query->terms))) {
+        return SUMMARISE_ENOMEM;
+    }
+
+    /* find document, and reinitialise parser with fd for it */
+    if (((dmret = docmap_get_location(sum->map, docno, &fileno, &offset, 
+        &bytes, &mtype, &dmflags)) == DOCMAP_OK)) {
+
+        mlparse_reinit(&sum->parser);
+        if (dmflags & DOCMAP_COMPRESSED) {
+            /* read from a compressed file */
+            if (sum->last_fileno == fileno && sum->last_offset < offset) {
+                /* can use previous stream */
+                physoffset = sum->last_poffset;
+                curroffset = sum->last_offset;
+                sum->last_offset = offset + bytes;
+            } else {
+                /* have to initialise a new stream */
+                curroffset = physoffset = 0;
+
+                if (sum->last_stream) {
+                    stream_delete(sum->last_stream);
+                }
+
+                if ((sum->last_stream = stream_new())
+                  && (filter 
+                    = (struct stream_filter *) gunzipfilter_new(BUFSIZ))) {
+
+                    stream_filter_push(sum->last_stream, filter);
+                    sum->last_fileno = fileno;
+                    sum->last_offset = offset + bytes;
+                } else {
+                    if (sum->last_stream) {
+                        stream_delete(sum->last_stream);
+                        sum->last_stream = NULL;
+                    }
+                    return SUMMARISE_ENOMEM;
+                }
+            }
+        } else {
+            /* read from a regular file */
+            if ((sum->last_stream = stream_new())) {
+                sum->last_fileno = fileno;
+                sum->last_offset = offset + bytes;
+                curroffset = physoffset = offset;
+            } else {
+                return SUMMARISE_ENOMEM;
+            }
+        }
+    } else {
+        return SUMMARISE_EIO;
+    }
+
+    /* initialise ps */
+    if ((ps.termbuf = malloc(sum->max_termlen + 1)) 
+      && (ps.terms = chash_str_new(3, 0.5, str_nhash))
+      && (ps.fd = fdset_pin(sum->fd, sum->idx->repos_type, fileno, physoffset, 
+            SEEK_SET))
+      && (psettings_type_tags(sum->pset, mtype, &ps.ptype) == PSETTINGS_OK)) {
+
+        if (DEAR_DEBUG) {
+            memset(ps.termbuf, 0, sum->max_termlen + 1);
+        }
+
+        ps.bytes_left = bytes;
+        ps.index = 1;
+        ps.stack = 0;
+        ps.term = 0;
+        ps.title = result->title;
+        ps.summary_len = result->summary_len;
+        ps.title_len = 0;
+        ps.title_size = result->title_len;
+    } else {
+        free(occs);
+        if (ps.termbuf) {
+            free(ps.termbuf);
+            if (ps.terms) {
+                if (ps.fd >= 0) {
+                    fdset_unpin(sum->fd, sum->idx->repos_type, fileno, ps.fd);
+                }
+                chash_delete(ps.terms);
+                return SUMMARISE_ERR;
+            }
+        }
+        return SUMMARISE_ENOMEM;
+    }
+
+    /* read until we hit the start of the document */
+    assert(curroffset <= offset);
+    while (curroffset + (off_t) sum->last_stream->avail_out < offset) {
+        curroffset += sum->last_stream->avail_out;
+        if (index_stream_read(sum->last_stream, ps.fd, sum->buf, sum->bufsize) 
+          != STREAM_OK) {
+            persum_delete(sum, &ps);
+            return SUMMARISE_EIO;
+        }
+    }
+    sum->last_stream->curr_out += offset - curroffset;
+    sum->last_stream->avail_out -= offset - curroffset;
+
+    /* stream now points to start of doc */
+    sum->parser.next_in = sum->last_stream->curr_out;
+    sum->parser.avail_in = sum->last_stream->avail_out;
+    if (ps.bytes_left > sum->last_stream->avail_out) {
+        ps.bytes_left -= sum->last_stream->avail_out;
+    } else {
+        sum->last_stream->curr_out += ps.bytes_left;
+        sum->last_stream->avail_out -= ps.bytes_left;
+        ps.bytes_left = 0;
+    }
+
+    /* load all query terms into hash */
+    for (i = 0; i < query->terms; i++) {
+        struct term *term = &query->term[i].term;
+
+        do {
+            /* FIXME: what about prefix phrases? */
+            if (chash_str_ptr_insert(ps.terms, term->term, term) == CHASH_OK) {
+                term = term->next;
+            } else {
+                free(occs);
+                persum_delete(sum, &ps);
+            }
+        } while (term);
+    }
+
+    while (!finished) {
+        /* get a free sentence buffer */
+        struct sentence *space = unused,
+                        *next;
+
+        if (space) {
+            unused = unused->next;
+        } else if ((space 
+            = malloc(sizeof(*space) + sum->max_termlen * 2))) {
+            /* point buffer to the end of the struct within the malloc'd 
+             * block */
+            space->buf = (void *) (space + 1);
+            space->bufsize = sum->max_termlen * 2;
+
+            if (DEAR_DEBUG) {
+                memset(space->buf, 0, space->bufsize);
+            }
+        } else {
+            /* can't get memory for more sentences, finish up with what 
+             * we have */
+            finished = 1;
+            break;
+        }
+        space->prev = prev;
+        space->next = NULL;
+
+        /* extract sentence */
+        if ((next = extract(sum, &ps, type, query, space, occs))) {
+            /* got a sentence, score it and figure out whether to heap it */
+            score(next, query);
+
+            if (!heap_len 
+              || ((min = *((struct sentence **) 
+                  heap_peek(heap, heap_len, sizeof(*heap))))
+                && (min->score < next->score))
+              || (heap_bytes < result->summary_len)) {
+
+                /* insert next into heap */
+                prev = next;
+
+                /* try to make space in the array for it */
+                if (heap_len + 1 >= heap_size) {
+                    void *ptr = realloc(heap, 
+                        sizeof(*heap) * (heap_size * 2 + 1));
+
+                    if (ptr) {
+                        heap = ptr;
+                        heap_size *= 2;
+                        heap_size++;
+                    }
+                }
+
+                if (heap_len < heap_size) {
+                    heap_insert(heap, &heap_len, sizeof(*heap), sum_score_cmp,
+                      &next);
+                    heap_bytes += next->buflen;
+
+                    min = *((struct sentence **) 
+                      heap_peek(heap, heap_len, sizeof(*heap)));
+                    while (heap_bytes - min->buflen > result->summary_len) {
+                        /* minimum element can't make it into the summary,
+                         * remove it */
+                        heap_pop(heap, &heap_len, sizeof(*heap), sum_score_cmp);
+                        heap_bytes -= min->buflen;
+                        min->next = unused;
+                        min->prev = NULL;
+                        unused = min;
+                        min = *((struct sentence **) 
+                          heap_peek(heap, heap_len, sizeof(*heap)));
+                    }
+                } else {
+                    heap_bytes += next->buflen;
+                    heap_replace(heap, heap_len, sizeof(*heap), sum_score_cmp, 
+                      &next);
+                    heap_bytes -= next->buflen;
+                    next->next = unused;
+                    next->prev = NULL;
+                    unused = next;
+                }
+            } else {
+                next->next = unused;
+                next->prev = NULL;
+                unused = next;
+                prev = NULL;
+            }
+        } else {
+            finished = 1;
+            space->next = unused;
+            space->prev = NULL;
+            unused = space;
+        }
+    }
+
+    /* free the unused entries */
+    while (unused) {
+        struct sentence *next = unused;
+        unused = unused->next;
+        free(next);
+    }
+
+    /* now figure out how many sentences to stuff into the buffer */
+    if (!heap_len) {
+        /* it's an empty document, don't know why we're summarising 
+         * it, but... */
+        result->summary[0] = '\0';
+    } else {
+        assert(heap_len);
+        /* sort by score.  Note use of rev_sum_score_cmp to order with highest
+         * scoring first */
+        qsort(heap, heap_len, sizeof(*heap), rev_sum_score_cmp);
+        heap_bytes = heap[0]->buflen;
+        selected = 1;
+        for (; selected < heap_len 
+          && heap_bytes + heap[selected]->buflen + 5 < result->summary_len; 
+          selected++) {
+            heap_bytes += heap[selected]->buflen + 5;
+        }
+        assert(selected);
+
+        /* copy them all into the buffer, and we're done */
+        qsort(heap, selected, sizeof(*heap), sum_pos_cmp);
+        for (heap_bytes = i = 0; i < selected; i++) {
+            if (i) {
+                if (heap[i - 1]->start_term + heap[i - 1]->terms 
+                  != heap[i]->start_term) { 
+                    if (result->summary[heap_bytes - 1] != '.'
+                      || !isupper(heap[i]->buf[0])) {
+                        result->summary[heap_bytes++] = ' ';
+                        result->summary[heap_bytes++] = '.';
+                    }
+                    result->summary[heap_bytes++] = '.';
+                    result->summary[heap_bytes++] = '.';
+                    result->summary[heap_bytes++] = ' ';
+                } else {
+                    result->summary[heap_bytes++] = ' ';
+                    result->summary[heap_bytes++] = ' ';
+                }
+            }
+            memcpy(result->summary + heap_bytes, heap[i]->buf, heap[i]->buflen);
+            heap_bytes += heap[i]->buflen;
+            assert(heap_bytes < result->summary_len);
+        }
+        assert(heap_bytes < result->summary_len);
+        result->summary[heap_bytes] = '\0';
+    }
+
+    for (i = 0; i < heap_len; i++) {
+        free(heap[i]);
+    }
+
+    if (heap) {
+        free(heap);
+    }
+
+    free(occs);
+    persum_delete(sum, &ps);
+    return SUMMARISE_OK;
+}
+
diff --git a/src/test.c b/src/test.c
new file mode 100644 (file)
index 0000000..74beca4
--- /dev/null
@@ -0,0 +1,138 @@
+/* test.c implements the main function for unit tests, so that it runs
+ * correctly under the automake testing functions
+ *
+ * written nml 2003-10-14
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "test.h"
+#include "getlongopt.h"
+#include "zglob.h"
+
+#include <assert.h> 
+#include <errno.h> 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+
+/* internal function to open a file specified in the arguments */
+static FILE *argfile(int argc, char **argv, FILE *output) {
+    FILE *fp;
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    enum getlongopt_ret ret;     /* return value from option parser */
+
+    struct getlongopt_opt opts[] = {
+        {"input", '\0', GETLONGOPT_ARG_REQUIRED, 'i'}
+    };
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(output, "failed to initialise options parser\n");
+        exit(EXIT_FAILURE);
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case 'i':
+            /* specified input */
+            if ((fp = fopen(arg, "rb"))) {
+                getlongopt_delete(parser);
+                return fp;
+            } else {
+                fprintf(output, 
+                  "unable to open file '%s': %s\n", arg, strerror(errno));
+                exit(EXIT_FAILURE);
+            }
+
+        default: assert(0);
+        }
+    }
+
+    getlongopt_delete(parser);
+    return NULL;
+}
+
+int main(int argc, char **argv) {
+    FILE *fp;
+    unsigned int i,
+                 len,
+                 files = 0,
+                 ret = 1;
+    char *srcdir;
+    char buf[FILENAME_MAX + 1];
+    glob_t globbuf;
+
+    /* check for srcdir environmental variable which indicates that
+     * we're running in an automake test case, and that we should
+     * locate test files ourselves */
+    if ((srcdir = getenv("srcdir"))) {
+        /* glob files in directory to find ones we want to run over */
+        snprintf(buf, FILENAME_MAX, "%s/%s.*", srcdir, *argv);
+        globbuf.gl_offs = 1;
+        if (glob(buf, 0, NULL, &globbuf) != 0) {
+            perror("glob failed");
+            return EXIT_FAILURE;
+        }
+        len = strlen(srcdir) + 1 + strlen(*argv) + 1;
+
+        /* traverse the glob */
+        for (i = 0; i < globbuf.gl_pathc; i++) {
+            /* don't execute on .c and .o files */
+            if (strcmp(globbuf.gl_pathv[i] + len, "c") 
+              && strcmp(globbuf.gl_pathv[i] + len, "o")) {
+                if ((fp = fopen(globbuf.gl_pathv[i], "rb"))) {
+                    files++;
+                    if (!(ret = test_file(fp, argc, argv))) {
+                        fprintf(stderr, "failed in globbed file %s\n", 
+                          globbuf.gl_pathv[i]);
+                        /* don't bother cleaning up */
+                        return EXIT_FAILURE;
+                    }
+                    fclose(fp);
+                } else {
+                    fprintf(stderr, "couldn't open globbed file %s: %s\n", 
+                      globbuf.gl_pathv[i], strerror(errno));
+                    /* don't bother cleaning up */
+                    return EXIT_FAILURE;
+                }
+            }
+        }
+
+        globfree(&globbuf);
+
+        if (!files && !(ret = test_file(NULL, argc, argv))) {
+            fprintf(stderr, "testing with no file failed\n");
+            return EXIT_FAILURE;
+        }
+
+    /* use specified file if there is one */
+    } else if ((fp = argfile(argc, argv, stderr))) {
+        if (!(ret = test_file(fp, argc, argv))) {
+            fclose(fp);
+            fprintf(stderr, "specified file failed test\n");
+            return EXIT_FAILURE;
+        }
+        fclose(fp);
+
+    /* fallback to stdin */
+    } else {
+        if (!(ret = test_file(stdin, argc, argv))) {
+            fprintf(stderr, "stdin failed test\n");
+            return EXIT_FAILURE;
+        }
+    }
+
+    if (ret == EXIT_DOESNT_COUNT) {
+        return EXIT_DOESNT_COUNT;
+    } else {
+        return EXIT_SUCCESS;
+    }
+}
+
diff --git a/src/test/binsearch_1.c b/src/test/binsearch_1.c
new file mode 100644 (file)
index 0000000..aa239a8
--- /dev/null
@@ -0,0 +1,197 @@
+/* binsearch_1.c is a unit test for the binsearch module.  It operates
+ * by sorting randomly (well, generated with rand) generated integers.
+ *
+ * input format is:
+ *
+ * # comment
+ * num_items [rand_seed]
+ *
+ * where both num_items is the number of integers to sort, rand_seed
+ * is the random seed to initialise generation, and both occur on the
+ * same line.  Line length is limited to 4k.
+ *
+ * written nml 2003-10-17
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "test.h"
+#include "binsearch.h"
+#include "getlongopt.h"
+#include "str.h"
+#include "lcrand.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+struct params {
+    int verbose;
+};
+
+static int parse_params(int argc, char **argv, struct params *params) {
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    enum getlongopt_ret ret;     /* return value from option parser */
+
+    struct getlongopt_opt opts[] = {
+        {"input", '\0', GETLONGOPT_ARG_REQUIRED, 'i'},
+        {"verbose", 'v', GETLONGOPT_ARG_NONE, 'v'}
+    };
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(stderr, "failed to initialise options parser\n");
+        return 0;
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case 'i':
+            /* ignore */
+            break;
+
+        case 'v':
+            /* verbose */
+            params->verbose = 1;
+            break;
+
+        default: assert(0);
+        }
+    }
+
+    getlongopt_delete(parser);
+    return 1;
+}
+
+#define BUFSIZE 4096
+
+static int int_cmp(const void* one, const void* two) {
+    const int* ione = one,
+             * itwo = two;
+
+    if (*ione < *itwo) {
+        return -1;
+    } else if (*ione > *itwo) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+static int test_arr(int *arr, unsigned long int entries) {
+    unsigned int i;
+
+    if (!entries) {
+        return 1;
+    }
+
+    for (i = 1; i < entries; i++) {
+        if (arr[i] < arr[i - 1]) {
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+static int test_bsearch(unsigned long int entries, unsigned long int seed, 
+  int verbose) {
+    int *arr,
+        *ptr,
+        i,
+        r;
+    struct lcrand *rand = lcrand_new(seed);
+
+    if (!rand) {
+        fprintf(stderr, "failed to init random number generator\n");
+        return EXIT_FAILURE;
+    }
+
+    if (!(arr = malloc(sizeof(int) * entries))) {
+        fprintf(stderr, "failed to allocate %lu bytes of memory\n", 
+          sizeof(int) * entries);
+        lcrand_delete(rand);
+        return EXIT_FAILURE;
+    }
+
+    /* insert numbers into the array */
+    for (i = 0; i < entries; i++) {
+        r = lcrand(rand);
+        ptr = (int*) binsearch(&r, arr, i, sizeof(int), int_cmp);
+        memmove(ptr + 1, ptr, sizeof(int) * (i - (ptr - arr)));
+        *ptr = r;
+    }
+
+    /* check the sorting of the array */
+    lcrand_delete(rand);
+    if (!test_arr(arr, entries)) {
+        free(arr);
+        return 0;
+    } else {
+        free(arr);
+        return 1;
+    }
+}
+
+int test_file(FILE *fp, int argc, char **argv) {
+    char buf[BUFSIZE + 1];
+    char *pos;
+    struct params params = {0};
+    unsigned long int entries,
+                      seed;
+
+    if (!parse_params(argc, argv, &params)) {
+        fprintf(stderr, "failed to parse params\n");
+        return 0;
+    }
+
+    while (fgets(buf, BUFSIZE, fp)) {
+        str_rtrim((char*) buf);
+        pos = (char*) str_ltrim((char*) buf);
+
+        if ((*pos != '#') && str_len(pos)) {
+            errno = 0;
+            entries = strtol(pos, &pos, 10);
+            if (!errno && (isspace(*pos) || (*pos == '\0'))) {
+                pos = (char*) str_ltrim(pos);
+                if (str_len(pos)) {
+                    seed = strtol(pos, &pos, 10);
+                    if (!errno && (isspace(*pos) || (*pos == '\0'))) {
+                        if (!test_bsearch(entries, seed, params.verbose)) {
+                            fprintf(stderr, "binsearch sort using entries %lu "
+                              "seed %lu failed\n", entries, seed);
+                            return 0;
+                        } else if (params.verbose) {
+                            printf("sort using %lu %lu succeeded\n", entries, 
+                              seed);
+                        }
+                    }
+                } else {
+                    seed = time(NULL);
+                    if (!test_bsearch(entries, seed, params.verbose)) {
+                        fprintf(stderr, "binsearch sort using entries %lu "
+                          "seed %lu failed\n", entries, seed);
+                        return 0;
+                    } else if (params.verbose) {
+                        printf("sort using %lu %lu succeeded\n", entries, seed);
+                    }
+                }
+            } else {
+                fprintf(stderr, "can't understand line '%s'\n", buf);
+                return 0;
+            }
+        }
+    }
+
+    return 1;
+}
+
diff --git a/src/test/binsearch_1.cases b/src/test/binsearch_1.cases
new file mode 100644 (file)
index 0000000..b4bc26d
--- /dev/null
@@ -0,0 +1,40 @@
+# this file contains unit tests for the binsearch module.  See binsearch_1.c for
+# more details.
+#
+# apart from comments, it accepts lines of the form: 
+# 
+#   nel seed
+#
+# where nel and seed are both unsigned integers, indicating the number
+# of elements and a random seed to apply when sorting.  These tests
+# proceed by using the heap to perform a heapsort and then testing
+# whether its correctly sorted.
+#
+# written nml 2003-02-25
+
+10000 0
+10000 1
+10000 2
+10000 3
+10000 4
+10000 5
+10000 6
+10000 7
+10000 8
+10000 9
+
+10000 29234
+10000 43977
+10000 12785
+10000 52609
+10000 12097
+10000 09789
+
+# check out some time generated numbers
+20000
+20000
+20000
+20000
+20000
+20000
+
diff --git a/src/test/bit_1.c b/src/test/bit_1.c
new file mode 100644 (file)
index 0000000..c88604d
--- /dev/null
@@ -0,0 +1,223 @@
+/* test_bit.c test the facilities implemented in bit.c, which implement fast
+ * logical and mathematical operations based on the base 2 operations available
+ * on pretty much all CPU's
+ *
+ * to run a set of automated tests, simply run the executable.  
+ *
+ * ./test_bit
+ *
+ * Otherwise the executable can be used for debugging by getting it to print 
+ * out a table of the values of each of the functions available using 
+ * ascending arguments
+ *
+ * ./test_bit [set|toggle|get|log2|mul2|div2|mod2|pow2|
+ *   umask|lmask|tobyte|frombyte] var n
+ *
+ * where the first argument prints out a table containing the result of the
+ * named function.  The bit manipulation functions (set, toggle, get)
+ * can't accept values of n greater than 32.  
+ * n specifies the size of the table printed out.
+ *
+ * written nml 2004-01-21
+ *
+ */
+
+#include "bit.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define TEST(success)                                                         \
+    if (!(success)) {                                                         \
+        fprintf(stderr, "test on line %u failed in %s\n", __LINE__,           \
+          __FILE__);                                                          \
+        err = 1;                                                              \
+    } else
+
+int test_file(FILE *fp, int argc, char **argv) {
+    int err = 0;
+
+    if (argc < 2) {
+        /* run automated test suite */
+        if (fp) {
+            fprintf(stderr, "file provided to stand-alone test bit_1\n");
+            return 0;
+        }
+
+        /* set                          set0 */
+        TEST(bit_set(1, 0, 1) == 0x01); TEST(bit_set(0xff, 0, 0) == 0xfe);
+        TEST(bit_set(1, 1, 1) == 0x03); TEST(bit_set(0xff, 1, 0) == 0xfd);
+        TEST(bit_set(1, 2, 1) == 0x05); TEST(bit_set(0xff, 2, 0) == 0xfb);
+        TEST(bit_set(1, 3, 1) == 0x09); TEST(bit_set(0xff, 3, 0) == 0xf7);
+        TEST(bit_set(1, 4, 1) == 0x11); TEST(bit_set(0xff, 4, 0) == 0xef);
+        TEST(bit_set(1, 5, 1) == 0x21); TEST(bit_set(0xff, 5, 0) == 0xdf);
+
+        /* toggle */
+        TEST(bit_toggle(1, 0) == 0x00); TEST(bit_toggle(1, 1) == 0x03);
+        TEST(bit_toggle(1, 2) == 0x05); TEST(bit_toggle(1, 3) == 0x09);
+        TEST(bit_toggle(1, 4) == 0x11); TEST(bit_toggle(1, 5) == 0x21);
+        TEST(bit_toggle(0xa5, 0) == 0xa4); TEST(bit_toggle(0xa5, 1) == 0xa7);
+        TEST(bit_toggle(0xa5, 2) == 0xa1); TEST(bit_toggle(0xa5, 3) == 0xad);
+        TEST(bit_toggle(0xa5, 4) == 0xb5); TEST(bit_toggle(0xa5, 5) == 0x85);
+
+        /* get */
+        TEST(bit_get(0xa5, 0) == 0x01); TEST(bit_get(0xa5, 1) == 0);
+        TEST(bit_get(0xa5, 2) == 0x04); TEST(bit_get(0xa5, 3) == 0);
+        TEST(bit_get(0xa5, 4) == 0); TEST(bit_get(0xa5, 5) == 0x20);
+
+        /* log2 */
+        TEST(bit_log2(0) == 0); TEST(bit_log2(1) == 0);
+        TEST(bit_log2(2) == 1); TEST(bit_log2(3) == 1);
+        TEST(bit_log2(4) == 2); TEST(bit_log2(5) == 2);
+        TEST(bit_log2(6) == 2); TEST(bit_log2(7) == 2);
+        TEST(bit_log2(8) == 3); TEST(bit_log2(15) == 3);
+        TEST(bit_log2(16) == 4); TEST(bit_log2(17) == 4);
+        TEST(bit_log2(31) == 4); TEST(bit_log2(32) == 5);
+        TEST(bit_log2(33) == 5); TEST(bit_log2(1023) == 9);
+        TEST(bit_log2(1024) == 10); TEST(bit_log2(1025) == 10);
+
+        /* pow2 */
+        TEST(bit_pow2(0) == 1); TEST(bit_pow2(1) == 2);
+        TEST(bit_pow2(2) == 4); TEST(bit_pow2(3) == 8);
+        TEST(bit_pow2(4) == 16); TEST(bit_pow2(5) == 32);
+        TEST(bit_pow2(10) == 1024); TEST(bit_pow2(20) == 1048576);
+
+        /* mul2 */
+        TEST(bit_mul2(1, 0) == 1); TEST(bit_mul2(1, 1) == 2);
+        TEST(bit_mul2(1, 2) == 4); TEST(bit_mul2(1, 3) == 8);
+        TEST(bit_mul2(1, 4) == 16); TEST(bit_mul2(1, 5) == 32);
+        TEST(bit_mul2(14, 4) == 224);
+
+        /* div2 */
+        TEST(bit_div2(0xff, 0) == 0xff); TEST(bit_div2(0xff, 1) == 0x7f);
+        TEST(bit_div2(0xff, 2) == 0x3f); TEST(bit_div2(0xff, 3) == 0x1f);
+        TEST(bit_div2(0xff, 4) == 0x0f); TEST(bit_div2(0xff, 5) == 0x07);
+        TEST(bit_div2(5349784, 4) == 334361);
+
+        /* mod2 */
+        TEST(bit_mod2(168070, 0) == 0); TEST(bit_mod2(168070, 1) == 0);
+        TEST(bit_mod2(168070, 2) == 2); TEST(bit_mod2(168070, 3) == 6);
+        TEST(bit_mod2(168070, 4) == 6); TEST(bit_mod2(168070, 5) == 6);
+
+        /* umask */
+        TEST(bit_umask(0) == 0); TEST(bit_umask(1) == 0x80000000);
+
+        /* lmask */
+        TEST(bit_lmask(0) == 0); TEST(bit_lmask(1) == 0x01);
+        TEST(bit_lmask(2) == 0x03); TEST(bit_lmask(3) == 0x07);
+        TEST(bit_lmask(4) == 0x0f); TEST(bit_lmask(5) == 0x1f);
+
+        /* tobyte */
+        TEST(bit_to_byte(0 * 8) == 0); TEST(bit_to_byte(1 * 8) == 1);
+        TEST(bit_to_byte(2 * 8) == 2); TEST(bit_to_byte(3 * 8) == 3);
+        TEST(bit_to_byte(4 * 8) == 4); TEST(bit_to_byte(5 * 8) == 5);
+        /* frombyte */
+        TEST(bit_from_byte(0) == 0 * 8); TEST(bit_from_byte(1) == 1 * 8);
+        TEST(bit_from_byte(2) == 2 * 8); TEST(bit_from_byte(3) == 3 * 8);
+        TEST(bit_from_byte(4) == 4 * 8); TEST(bit_from_byte(5) == 5 * 8);
+
+        TEST(bit_to_byte(bit_from_byte(43)) == 43);
+        TEST(bit_to_byte(bit_from_byte(355)) == 355);
+        TEST(bit_to_byte(bit_from_byte(6346)) == 6346);
+
+        if (!err) {
+            return 1;
+        } else {
+            return 0;
+        }
+    } else if ((argc == 4)) {
+        unsigned int i,
+                     n = atoi(argv[3]),
+                     var = atoi(argv[2]);
+
+        if (!strcmp(argv[1], "set")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_set(var, i, 1), bit_set(var, i, 1));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "set0")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_set(var, i, 0), bit_set(var, i, 0));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "toggle")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_toggle(var, i), bit_toggle(var, i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "get")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_get(var, i), bit_get(var, i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "log2")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_log2(i), bit_log2(i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "mul2")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_mul2(var, i), bit_mul2(var, i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "div2")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_div2(var, i), bit_div2(var, i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "mod2")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_mod2(var, i), bit_mod2(var, i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "pow2")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_pow2(i), bit_pow2(i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "umask")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_umask(i), bit_umask(i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "lmask")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_lmask(i), bit_lmask(i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "tobyte")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_to_byte(i), bit_to_byte(i));
+            }
+            return 1;
+        } else if (!strcmp(argv[1], "frombyte")) {
+            for (i = 0; i < n; i++) {
+                printf("%u (0x%xh): %u (0x%xh)\n", i, i, 
+                  bit_from_byte(i), bit_from_byte(i));
+            }
+            return 1;
+        } else {
+            /* unrecognised */
+            fprintf(stderr, "unrecognised operation\n");
+        }
+    }
+
+    printf("%s [set|toggle|get|log2|mul2|div2|mod2|pow2|umask|lmask|"
+      "tobyte|frombyte] n (var)\n", *argv);
+
+    return EXIT_FAILURE;
+}
+
diff --git a/src/test/bucket_1.c b/src/test/bucket_1.c
new file mode 100644 (file)
index 0000000..af89b73
--- /dev/null
@@ -0,0 +1,455 @@
+/* bucket_1.c is a unit test for the bucket module.  Its pretty
+ * general, intended to test all of the individual bucket stuff. 
+ * Input format is:
+ *
+ * # comments
+ * command params
+ *
+ * commands are:
+ *
+ *   new name buckettype size: 
+ *     create a new bucket of size size 
+ *     buckettype is the bucketing strategy 
+ *
+ *   add term veclen succeed: 
+ *     add a new term (term) to the bucket with vector length veclen
+ *     and contents vector.  succeed is an integer indicating whether
+ *     the operation should succeed or not.  Note that the vector cannot 
+ *     start with whitespace.
+ *
+ *   ls numterms [term veclen vector]*:
+ *     list the contents (not in order) of the bucket.  There should be
+ *     numterms entries.  Each entry is a whitespace delimited term
+ *     listing, vector length and then vector.
+ *
+ *   set term veclen vector:
+ *     set the vector for a term.  The allocated length should be
+ *     veclen at the time else the operation will fail.
+ *
+ *   realloc term newlen succeed:
+ *     change the space allocated to a term to newlen.  succeed
+ *     indicates whether the operation should succeed.
+ *
+ *   rm term succeed
+ *     remove a term from the bucket.  succeed indicates whether the
+ *     operation should succeed (try removing nonexistant terms)
+ *
+ *   print
+ *     print out current state of the bucket and other debug info
+ *
+ * there is a length limit 65535 on terms and vectors.  Commands
+ * should be put on a line by themselves, like this:
+ *
+ * # this is a comment, followed by a couple of commands
+ * new
+ *   case01 1 100 50
+ * add 
+ *   term1 10 xxxxxxxxxx 1
+ *
+ * written nml 2003-10-13
+ *
+ */
+
+/* suggestions for improvement: 
+   - ordered ls (tests for order as well)
+   - set on add (tests return pointer from alloc)
+ */
+
+#include "firstinclude.h"
+
+#include "test.h"
+
+#include "bucket.h"
+#include "str.h"
+#include "chash.h"
+#include "getlongopt.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+
+struct params {
+    int verbose;
+};
+
+static int parse_params(int argc, char **argv, struct params *params) {
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    enum getlongopt_ret ret;     /* return value from option parser */
+
+    struct getlongopt_opt opts[] = {
+        {"input", '\0', GETLONGOPT_ARG_REQUIRED, 'i'},
+        {"verbose", 'v', GETLONGOPT_ARG_NONE, 'v'}
+    };
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(stderr, "failed to initialise options parser\n");
+        return 0;
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case 'i':
+            /* ignore */
+            break;
+
+        case 'v':
+            /* verbose */
+            params->verbose = 1;
+            break;
+
+        default: assert(0);
+        }
+    }
+
+    getlongopt_delete(parser);
+    return 1;
+}
+
+int test_file(FILE *fp, int argc, char **argv) {
+    char buf[65535 + 1];
+    char *pos;
+    unsigned int strategy = 0;  /* what bucketing strategy we're 
+                                          using */
+    void *ptr = NULL;
+    unsigned int bucketsize = 0;
+    struct params params = {0};
+    struct chash *hash = NULL;
+    char name[256];
+
+    if (!parse_params(argc, argv, &params)) {
+        fprintf(stderr, "failed to parse params\n");
+        return 0;
+    }
+
+    while (fgets((char *) buf, 65535, fp)) {
+        str_rtrim(buf);
+        pos = (char *) str_ltrim(buf);
+
+        if (!str_casecmp(pos, "new")) {
+
+            /* creating a new bucket */
+            unsigned int size = -1;
+
+            if (ptr) {
+                chash_delete(hash);
+                free(ptr);
+            }
+
+            /* read parameters */
+            if ((fscanf(fp, "%255s %u %u", name, &strategy, &size) == 3)
+              && (size <= 65535) 
+              && (bucketsize = size)
+              && (ptr = malloc(size))
+              && (hash = chash_ptr_new(1, 2.0, 
+                /* some fn pointer casting dodginess */
+                (unsigned int (*)(const void *)) str_len, 
+                (int (*)(const void *, const void *)) str_cmp))
+              && (bucket_new(ptr, bucketsize, strategy))) {
+                /* succeeded, do nothing */
+                if (params.verbose) {
+                    printf("%s: new bucket with size %u strategy %u\n", name, 
+                      size, strategy);
+                }
+            } else {
+                fprintf(stderr, "%s: failed to create bucket\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "add")) {
+            /* adding a term to the bucket */
+            void *ret;
+            unsigned int veclen,
+                         succeed,
+                         len;
+            int toobig;
+
+            if (!ptr) { return 0; }
+
+            /* read parameters */
+            if ((fscanf(fp, "%65535s %u %u", buf, &veclen, &succeed) == 3) 
+              && (veclen <= 65535)) {
+
+                len = str_len(buf);
+                if ((((ret = bucket_alloc(ptr, bucketsize, strategy, buf, len, 
+                        veclen, &toobig, NULL))
+                      && succeed)
+                    || (!ret && !succeed))) {
+                    /* do nothing */
+                    if (params.verbose) {
+                        printf("%s: added term '%s'\n", name, buf);
+                    }
+                } else if (succeed) {
+                    fprintf(stderr, "%s: failed to add '%s' to bucket\n", 
+                      name, buf);
+                    return 0;
+                } else if (!succeed) {
+                    fprintf(stderr, "%s: add '%s' succeeded but shouldn't "
+                      "have\n", name, buf);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to add\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "ls")) {
+            /* matching stuff in the bucket */
+            unsigned int numterms,
+                         i,
+                         len,
+                         veclen,
+                         veclen2,
+                         state;
+            void *addr;
+            struct chash *tmphash;
+            const char *term;
+            void **tmpptr,
+                  *tmp;
+
+            if (!ptr) { return 0; }
+
+            if (!(tmphash = chash_ptr_new(1, 2.0, 
+              /* some fn pointer casting dodginess */
+              (unsigned int (*)(const void *)) str_len, 
+              (int (*)(const void *, const void *)) str_cmp))) {
+                fprintf(stderr, "%s: failed to init hashtable\n", name);
+                return 0;
+            }
+
+            /* first, fill hashtable with all terms from bucket */
+            state = 0;
+            while ((term 
+              = bucket_next_term(ptr, bucketsize, strategy,
+                  &state, &len, &addr, &veclen))) {
+
+                if (!((term = str_ndup(term, len)) 
+                  && (chash_ptr_ptr_insert(tmphash, term, (void*) term) 
+                      == CHASH_OK))) {
+
+                    fprintf(stderr, "%s: failed to init hashtable\n", name);
+                    return 0;
+                }
+            }
+
+            /* now, take terms from file, comparing them with hashtable 
+             * entries */
+            if (fscanf(fp, "%u", &numterms)) {
+                for (i = 0; i < numterms; i++) {
+                    if (fscanf(fp, "%65535s %u ", buf, &veclen)) {
+                        if (params.verbose) {
+                            printf("%s: ls checking %s\n", name, buf);
+                        }
+                        
+                        if ((addr = bucket_find(ptr, bucketsize, strategy,
+                            buf, str_len(buf), &veclen2, NULL))
+                          /* remove it from hashtable */
+                          && chash_ptr_ptr_find(tmphash, buf, &tmpptr) 
+                            == CHASH_OK
+                          && chash_ptr_ptr_remove(tmphash, *tmpptr, &tmp) 
+                            == CHASH_OK
+                          && (free(tmp), 1)
+                          && (veclen <= 65535)
+                          && (veclen2 == veclen)
+                          && fread(buf, veclen, 1, fp)
+                          && ((buf[veclen] = '\0'), 1)
+                          && (!params.verbose 
+                            || printf("%s: ls check read '%s'\n", name, buf))
+                          && !memcmp(buf, addr, veclen)) {
+                            /* do nothing */
+                        } else {
+                            unsigned int j;
+
+                            fprintf(stderr, "%s: ls failed cmp '%s' with '", 
+                              name, buf);
+                            for (j = 0; j < veclen; j++) {
+                                putc(((char *) addr)[j], stderr);
+                            }
+                            fprintf(stderr, "'\n");
+                            return 0;
+                        }
+                    } else {
+                        fprintf(stderr, "%s: ls failed\n", name);
+                        return 0;
+                    }
+                }
+
+                if (chash_size(tmphash)) {
+                    fprintf(stderr, "%s: ls failed\n", name);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: ls failed\n", name);
+                return 0;
+            }
+
+            chash_delete(tmphash);
+
+            if (params.verbose) {
+                printf("%s: matched all (%u) entries\n", name, numterms);
+            }
+        } else if (!str_casecmp(pos, "set")) {
+            /* setting the vector for a term in the bucket */
+            unsigned int veclen,
+                        reallen;
+            void *addr;
+
+            if (!ptr) { return 0; }
+
+            /* read parameters */
+            if ((fscanf(fp, "%65535s %u ", buf, &veclen) == 2) 
+              && (veclen <= 65535)) {
+
+                addr = bucket_find(ptr, bucketsize, strategy, buf, 
+                  str_len(buf), &reallen, NULL);
+
+                if (addr && (reallen == veclen) 
+                  && fread(addr, 1, veclen, fp)) {
+                    /* do nothing */
+                    if (params.verbose) {
+                        unsigned int j;
+
+                        printf("%s: set term '%s' to '", name, buf);
+                        for (j = 0; j < reallen; j++) {
+                            putc(((char *) addr)[j], stdout);
+                        }
+                        printf("'\n");
+                    }
+                } else {
+                    fprintf(stderr, "%s: failed to set!\n", name);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to set\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "realloc")) {
+            /* reallocating a term in the bucket */
+            unsigned int veclen,
+                         succeed;
+            int toobig;
+
+            if (!ptr) { return 0; }
+
+            /* read parameters */
+            if ((fscanf(fp, "%65535s %u %u", buf, &veclen, &succeed) == 3) 
+              && (veclen <= 65535)) {
+
+                if (!bucket_realloc(ptr, bucketsize, strategy, buf, 
+                  str_len(buf), veclen, &toobig)) {
+                    fprintf(stderr, "%s: failed to realloc!\n", name);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to realloc\n", name);
+                return 0;
+            }
+
+            if (params.verbose) {
+                printf("%s: realloc'd term '%s'\n", name, buf);
+            }
+        } else if (!str_casecmp(pos, "rm")) {
+            /* removing something from the bucket */
+            unsigned int succeed;
+
+            if (!ptr) { return 0; }
+
+            if (fscanf(fp, "%65535s %u", buf, &succeed) == 2) {
+                if (succeed) {
+
+                    if (!(bucket_remove(ptr, bucketsize, strategy, buf, 
+                      str_len(buf)))) {
+                        fprintf(stderr, "%s: failed to rm '%s'\n", name, 
+                          buf);
+                        return 0;
+                    } else if (params.verbose) {
+                        printf("%s: rm term '%s'\n", name, buf);
+                    }
+                } else if (succeed) {
+                    fprintf(stderr, "%s: failed to rm\n", name);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to rm\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "print")) {
+            /* printing out the bucket contents */
+            unsigned int state = 0,
+                         len,
+                         veclen;
+            const char *term;
+            char format[100];
+            void *addr;
+
+            if (!ptr) { 
+                printf("can't print, no bucket\n");
+            } else {
+                do {
+                    term 
+                      = bucket_next_term(ptr, bucketsize, strategy, &state, 
+                        &len, &addr, &veclen);
+                } while (term 
+                  && memcpy(buf, term, len)
+                  && ((buf[len] = '\0') || 1)
+                  && snprintf(format, 100, "%%.%us (%%u): '%%.%us' (%%u) "
+                    "(off %%u)\n", len, veclen) 
+                  && printf(format, term, len, (char*) addr, veclen, 
+                    ((char *) addr) - (char *) ptr));
+
+                if (!state) {
+                    printf("(empty)\n");
+                }
+
+                printf("%u entries, %u data, %u string, %u overhead, %u free\n", 
+                  bucket_entries(ptr, bucketsize, strategy), 
+                  bucket_utilised(ptr, bucketsize, strategy), 
+                  bucket_string(ptr, bucketsize, strategy), 
+                  bucket_overhead(ptr, bucketsize, strategy),
+                  bucket_unused(ptr, bucketsize, strategy));
+            }
+        } else if (!str_casecmp(pos, "match")) {
+            unsigned int veclen,
+                         veclen2;
+            void *addr;
+
+            if (fscanf(fp, "%65535s %u ", buf, &veclen)) {
+                if ((addr = bucket_find(ptr, bucketsize, strategy,
+                    buf, str_len(buf), &veclen2, NULL))
+                  && (veclen <= 65535)
+                  && (veclen2 >= veclen)
+                  && (!params.verbose 
+                    || printf("%s: match on '%s' ", name, buf))
+                  && fread(buf, veclen, 1, fp)
+                  && !memcmp(buf, addr, veclen)) {
+                    if (params.verbose) {
+                        printf("content succeeded\n");
+                    }
+                } else {
+                    fprintf(stderr, "%s: match failed (%s vs %s)\n", name, buf,
+                      (char *) addr);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: match failed\n", name);
+                return 0;
+            }
+        } else if ((*pos != '#') && str_len(pos)) {
+            fprintf(stderr, "%s: unknown command '%s'\n", name, pos);
+            return 0;
+        }
+    }
+
+    if (ptr) {
+        chash_delete(hash);
+        free(ptr);
+    }
+
+    return 1;
+}
+
diff --git a/src/test/bucket_1.cases b/src/test/bucket_1.cases
new file mode 100644 (file)
index 0000000..6f35592
--- /dev/null
@@ -0,0 +1,575 @@
+# this file contains unit tests for the bucket module.  see bucket_1.c
+# for more details.
+#
+# commands:
+#
+#   # comment
+#
+#   new
+#   buckettype size fullsize
+#
+#   add
+#   term veclen succeed
+#
+#   ls
+#   numterms [term veclen vector]*
+#
+#   set
+#   term veclen vector
+#
+#   realloc 
+#   term newlen succeed
+#
+#   rm 
+#   term succeed
+#
+#   print
+#
+# written nml 2003-10-20
+      
+# bucket strategy 1
+
+# add to bucket until full
+new
+    case_1_1 1 100 
+add
+    the 7 1
+add
+    and 7 1
+add
+    blah 6 1
+add
+    foo 7 1
+add
+    bar 7 1
+add
+    bang 6 1
+add
+    hash 6 1
+# bucket is now full, if we try and add to it we should fail
+add
+    b 0 0
+# set all vectors
+set
+    the 7 1111111
+set
+    and 7 2222222
+set 
+    blah 6 333333
+set
+    foo 7 4444444
+set
+    bar 7 5555555
+set
+    bang 6 666666
+set
+    hash 6 777777
+ls 
+    7
+    the 7 1111111
+    and 7 2222222
+    blah 6 333333
+    foo 7 4444444
+    bar 7 5555555
+    bang 6 666666
+    hash 6 777777
+
+
+# fill bucket to fullsize (test fullsize vs size)
+new
+    case_1_2 1 100 
+add
+    the 7 1
+add
+    and 7 1
+add
+    blah 6 1
+add
+    foo 7 1
+add
+    bar 7 1
+add
+    bang 6 1
+add
+    hash 6 1
+# bucket is now full, if we try and add to it we should fail
+add
+    b 0 0
+# set all vectors
+set
+    the 7 1111111
+set
+    and 7 2222222
+set 
+    blah 6 333333
+set
+    foo 7 4444444
+set
+    bar 7 5555555
+set
+    bang 6 666666
+set
+    hash 6 777777
+ls 
+    7
+    the 7 1111111
+    and 7 2222222
+    blah 6 333333
+    foo 7 4444444
+    bar 7 5555555
+    bang 6 666666
+    hash 6 777777
+
+
+# fill bucket and then remove them in the same order
+new
+    case_1_3 1 100 
+add
+    the 7 1
+add
+    and 7 1
+add
+    blah 6 1
+add
+    foo 7 1
+add
+    bar 7 1
+add
+    bang 6 1
+add
+    hash 6 1
+# set all vectors
+set
+    the 7 1111111
+set
+    and 7 2222222
+set 
+    blah 6 333333
+set
+    foo 7 4444444
+set
+    bar 7 5555555
+set
+    bang 6 666666
+set
+    hash 6 777777
+ls 
+    7
+    the 7 1111111
+    and 7 2222222
+    blah 6 333333
+    foo 7 4444444
+    bar 7 5555555
+    bang 6 666666
+    hash 6 777777
+rm 
+    the 1
+rm
+    and 1
+rm
+    blah 1
+rm
+    foo 1
+rm
+    bar 1
+rm
+    bang 1
+rm
+    hash 1
+ls 
+       0
+
+
+# fill bucket and then remove them in reverse order
+new
+    case_1_4 1 100 
+add
+    the 7 1
+add
+    and 7 1
+add
+    blah 6 1
+add
+    foo 7 1
+add
+    bar 7 1
+add
+    bang 6 1
+add
+    hash 6 1
+# set all vectors
+set
+    the 7 1111111
+set
+    and 7 2222222
+set 
+    blah 6 333333
+set
+    foo 7 4444444
+set
+    bar 7 5555555
+set
+    bang 6 666666
+set
+    hash 6 777777
+ls 
+    7
+    the 7 1111111
+    and 7 2222222
+    blah 6 333333
+    foo 7 4444444
+    bar 7 5555555
+    bang 6 666666
+    hash 6 777777
+rm
+    hash 1
+rm
+    bang 1
+rm
+    bar 1
+rm
+    foo 1
+rm
+    blah 1
+rm
+    and 1
+rm 
+    the 1
+ls 
+       0
+
+
+# fill bucket and then remove them in random order
+new
+    case_1_5 1 100 
+add
+    the 7 1
+add
+    and 7 1
+add
+    blah 6 1
+add
+    foo 7 1
+add
+    bar 7 1
+add
+    bang 6 1
+add
+    hash 6 1
+# set all vectors
+set
+    the 7 1111111
+set
+    and 7 2222222
+set 
+    blah 6 333333
+set
+    foo 7 4444444
+set
+    bar 7 5555555
+set
+    bang 6 666666
+set
+    hash 6 777777
+ls 
+    7
+    the 7 1111111
+    and 7 2222222
+    blah 6 333333
+    foo 7 4444444
+    bar 7 5555555
+    bang 6 666666
+    hash 6 777777
+rm
+    blah 1
+rm
+    foo 1
+rm 
+    the 1
+rm
+    and 1
+rm
+    hash 1
+rm
+    bang 1
+rm
+    bar 1
+ls 
+       0
+
+
+# add to bucket until full
+new
+    case_1_6 1 100 
+add
+    the 7 1
+add
+    and 3 1
+add
+    blah 6 1
+add
+    foo 16 1
+add
+    bar 7 1
+add
+    bang 2 1
+add
+    hash 5 1
+# set all terms 
+set
+    the 7 1111111
+set
+    and 3 222
+set
+    blah 6 333333
+set
+    foo 16 4444444444444444
+set
+    bar 7 5555555
+set
+    bang 2 66
+set
+    hash 5 77777
+ls
+    7
+    the 7 1111111
+    and 3 222
+    blah 6 333333
+    foo 16 4444444444444444
+    bar 7 5555555
+    bang 2 66
+    hash 5 77777
+
+
+# use terms with common prefix
+new
+       case_1_7 1 100
+add
+       their 4 1
+add
+       the 3 1
+add
+       there 2 1
+add
+       thesis 1 1
+add
+       theology 3 1
+add 
+       ther 2 1
+add
+       through 3 1
+add
+       th 1 1
+set
+       their 4 1111
+set
+       the 3 222
+set
+       there 2 33
+set
+       thesis 1 4
+set
+       theology 3 555
+set 
+       ther 2 66
+set
+       through 3 777
+set
+       th 1 8
+ls
+       8
+       their 4 1111
+       the 3 222
+       there 2 33
+       thesis 1 4
+       theology 3 555
+       ther 2 66
+       through 3 777
+       th 1 8
+
+# add to bucket until full
+new
+    case_1_8 1 100 
+add
+    the 7 1
+add
+    and 7 1
+add
+    blah 6 1
+add
+    foo 7 1
+# growing realloc 
+realloc
+    the 10 1
+# growing realloc 
+realloc
+    and 15 1
+#growing realloc 
+realloc
+    and 37 1
+realloc
+       foo 8 1
+set 
+       foo 8 22222222
+#growing realloc 
+realloc
+    and 45 1
+# realloc to same size
+realloc
+       foo 8 1
+# shrinking realloc 
+realloc
+    blah 3 1
+# shrinking realloc 
+realloc
+       and 36 1
+#shrinking first realloc
+realloc
+       and 10 1
+set
+    the 10 1111111111
+set
+       and 10 4444444444
+set 
+    blah 3 333
+ls
+       4
+       and 10 4444444444
+    blah 3 333
+       foo 8 22222222
+    the 10 1111111111
+
+# test data preservation during reallocation
+new
+    case_1_9 1 100 
+add
+    the 7 1
+set
+       the 7 1111111
+add
+    and 7 1
+set
+    and 7 2222222
+add
+    blah 6 1
+set
+    blah 6 333333
+add
+    foo 7 1
+set
+    foo 7 4444444
+# growing realloc 
+realloc
+    the 10 1
+match
+       the 7 1111111
+match
+       and 7 2222222
+match
+       foo 7 4444444
+match
+       blah 6 333333
+set
+       the 10 1111111111
+# growing realloc 
+realloc
+    and 15 1
+match
+       the 10 1111111111
+match
+       and 7 2222222
+match
+       foo 7 4444444
+match
+       blah 6 333333
+set
+       and 15 222222222222222
+# growing realloc 
+realloc
+    and 37 1
+match
+       the 10 1111111111
+match
+       and 15 222222222222222
+match
+       foo 7 4444444
+match
+       blah 6 333333
+set
+       and 37 2222222222222222222222222222222222222
+realloc
+       foo 8 1
+match
+       the 10 1111111111
+match
+       and 37 2222222222222222222222222222222222222
+match
+       foo 7 4444444
+match
+       blah 6 333333
+set 
+       foo 8 44444444
+# growing realloc 
+realloc
+    and 45 1
+match
+       the 10 1111111111
+match
+       and 37 2222222222222222222222222222222222222
+match
+       foo 8 44444444
+match
+       blah 6 333333
+set
+       and 45 222222222222222222222222222222222222222222222
+# realloc to same size
+realloc
+       foo 8 1
+match
+       the 10 1111111111
+match
+       and 45 222222222222222222222222222222222222222222222
+match
+       foo 8 44444444
+match
+       blah 6 333333
+# shrinking realloc 
+realloc
+    blah 3 1
+match
+       the 10 1111111111
+match
+       and 45 222222222222222222222222222222222222222222222
+match
+       foo 8 44444444
+match
+       blah 3 333
+# shrinking realloc 
+realloc
+       and 36 1
+match
+       the 10 1111111111
+match
+       and 36 222222222222222222222222222222222222
+match
+       foo 8 44444444
+match
+       blah 3 333
+# shrinking first realloc
+realloc
+       and 10 1
+match
+       the 10 1111111111
+match
+       and 10 2222222222
+match
+       foo 8 44444444
+match
+       blah 3 333
+ls
+       4
+       and 10 2222222222
+       blah 3 333
+       foo 8 44444444
+       the 10 1111111111
+
diff --git a/src/test/bufstuffer_1.cases b/src/test/bufstuffer_1.cases
new file mode 100644 (file)
index 0000000..1182b14
--- /dev/null
@@ -0,0 +1,30 @@
+# @VERBOSE
+@SEED 40
+
+# NOTE: zlib has by default an 8K internal buffer; you have to put in enough
+# input to "flood" this in order to get to the FULL state.
+ZERO_THRESHOLD
+# threshold object-size
+BIG_STUFF 10 15
+# threshold num-inputs
+ZERO_LEN_INPUTS 1 60000
+ONE_LEN_INPUTS 5 100
+# threshold num-inputs max-length
+ONCE_FULL_ALWAYS_FULL 20 100 1500
+ONCE_FINISHED_NOT_WRITEABLE 1000 100 150
+
+@INPUT /usr/share/dict/words
+
+ZERO_THRESHOLD
+# threshold object-size
+BIG_STUFF 10 15
+# threshold num-inputs
+ZERO_LEN_INPUTS 1 60000
+ONE_LEN_INPUTS 5 100
+# threshold num-inputs max-length
+ONCE_FULL_ALWAYS_FULL 20 100 1500
+ONCE_FINISHED_NOT_WRITEABLE 1000 100 150
+ONCE_FINISHED_NOT_WRITEABLE 4000 2000 20
+ONCE_FINISHED_NOT_WRITEABLE 8000 8000 12
+ONCE_FINISHED_NOT_WRITEABLE 8000 200 400
+NULL_BUF_TEST
diff --git a/src/test/docmap_1.c b/src/test/docmap_1.c
new file mode 100644 (file)
index 0000000..701ff90
--- /dev/null
@@ -0,0 +1,507 @@
+/*
+ *  Test the docmap module.
+ *
+ *
+ *  Each line of the input file represents a "script" for
+ *  a test run.  Each line is made up of a series of
+ *  space-delimited tokens.  The first token is the "identifier"
+ *  of the run.  The remaining tokens are keyword "commands", some
+ *  of which are followed by "=<arg>".  The commands are:
+ *
+ *     ADD=<num>
+ *          Add <num> number of documents
+ *
+ *     CHECK
+ *          Check docmap against all added docs
+ *
+ *     RAND_CHECK
+ *          Check a random value of a random document
+ *
+ *     DUMP_LOAD
+ *          Dump and load the docmap
+ *
+ *  The following configuration commands may occur on a line by itself:
+ *
+ *     @VERBOSE
+ *          Switch to verbose mode
+ *     @NOVERBOSE
+ *          Switch out of verbose mode
+ *     @SEED <seed>
+ *          Seed the random-number generator with <seed>
+ *     @INPUT <filename>
+ *          Use <filename> for input, not random data
+ *     @MAXFILE <bytes>
+ *          Limit files to a maxmimum size of <bytes>
+ */
+
+#include "firstinclude.h"
+#include "test.h"
+#include "testutils.h"
+#include "docmap.h"
+#include "lcrand.h"
+#include "error.h"
+#include "str.h"
+#include "fdset.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <math.h>
+
+static int verbose = 0;
+
+#define NEWDOCMAP_TEST_FD_TYPE 0xEADE
+
+#define DEFAULT_SEED 87
+
+#define DEFAULT_FILELEN_MAX (200u * 1024u * 1024u)
+
+#define DEFAULT_SOURCEFILE_MAX 20u
+#define DEFAULT_OFFSET_MAX (3u * 1024u * 1024u * 1024u)
+#define DEFAULT_BYTES_MAX (2u * 1024u * 1024u)
+#define DEFAULT_WEIGHT_MAX (55.0)
+#define DEFAULT_AUX_LEN_MAX (2 * 1024u)
+#define DEFAULT_MTYPE_MAX (300)
+
+static unsigned filelen_max = DEFAULT_FILELEN_MAX;
+
+static unsigned int bytes_max = DEFAULT_BYTES_MAX;
+/* words < bytes, distinct_words < words. */
+static double weight_max = DEFAULT_WEIGHT_MAX;
+static unsigned int aux_len_max = DEFAULT_AUX_LEN_MAX;
+static unsigned int mtype_max = DEFAULT_MTYPE_MAX;
+
+static double get_dbl_rand(double limit) {
+    assert(tu_rand != NULL);
+    return ((double) limit * lcrand(tu_rand)/(LCRAND_MAX + 1.0));
+}
+
+struct docinfo {
+    unsigned int sourcefile;
+    unsigned long int offset;
+    unsigned int bytes;
+    enum docmap_flag flags;
+    unsigned int words;
+    unsigned int distinct_words;
+    enum mime_types mtype;
+    double weight;
+    char * aux;
+    unsigned aux_len;
+};
+
+static void init_rand_docinfo(struct docinfo * docinfo, struct docinfo *prev) {
+    unsigned int i;
+
+    /* note that we generate some numbers in relation to others to satisfy
+     * properties that real documents would have */
+
+    docinfo->bytes = tu_rand_limit(bytes_max);
+    docinfo->words = tu_rand_limit((docinfo->bytes + 1) / 2);
+    docinfo->distinct_words = tu_rand_limit(docinfo->words);
+    docinfo->weight = get_dbl_rand(weight_max);
+    docinfo->mtype = tu_rand_limit(mtype_max);
+
+    if (!prev) {
+        /* first document */
+        docinfo->sourcefile = 0;
+        docinfo->offset = 0;
+        if (tu_rand_limit(2)) {
+            docinfo->flags = DOCMAP_COMPRESSED;
+        } else {
+            docinfo->flags = DOCMAP_NO_FLAGS;
+        }
+    } else if (tu_rand_limit(10) > 8) {
+        /* start new document */
+        docinfo->sourcefile = prev->sourcefile + 1;
+        docinfo->offset = 0;
+        if (tu_rand_limit(2)) {
+            docinfo->flags = DOCMAP_COMPRESSED;
+        } else {
+            docinfo->flags = DOCMAP_NO_FLAGS;
+        }
+    } else {
+        /* continue previous document */
+        docinfo->sourcefile = prev->sourcefile;
+        docinfo->offset = prev->offset + prev->bytes;
+        docinfo->flags = prev->flags;
+    }
+
+    docinfo->aux_len = tu_rand_limit(aux_len_max);
+    docinfo->aux = tu_get_rand_data(docinfo->aux_len);
+
+    /* convert random aux entry into something more readable */
+    for (i = 0; i < docinfo->aux_len; i++) {
+        docinfo->aux[i] = 32 + ((unsigned char) docinfo->aux[i]) % 95;
+    }
+    docinfo->aux[i] = '\0';
+}
+
+int do_run(char ** cmds, int num_cmds);
+
+int process_config(char * config);
+
+#define CHECK_FUNC(field) \
+static int check_ ## field(struct docmap * docmap, \
+  struct docinfo * docinfos, unsigned d)
+
+CHECK_FUNC(aux);
+CHECK_FUNC(location);
+CHECK_FUNC(bytes);
+CHECK_FUNC(words);
+CHECK_FUNC(distinct_words);
+CHECK_FUNC(weight);
+
+int test_file(FILE * fp, int argc, char ** argv) {
+    char buf[4096];
+    int line_num = 0;
+    char * ptr;
+    int all_passed = 1;
+
+    tu_init_rand_or_die(DEFAULT_SEED);
+    while (fgets((char *) buf, 4095, fp)) {
+        line_num++;
+        ptr = (char *) str_ltrim(buf);
+        str_rtrim(ptr);
+        if (*ptr == '@') {
+            if (!process_config(ptr + 1))
+                fprintf(stderr, "Error with config on line %d, '%s'\n",
+                  line_num, ptr);
+        } else if (*ptr != '#' && *ptr != '\0') {
+            unsigned int parts = 0;
+            char ** cmds = str_split(ptr, " ", &parts);
+            int ret;
+
+            ret = do_run(cmds, parts);
+            if (ret == -1) {
+                all_passed = 0;
+                fprintf(stderr, "Error doing run on line %d\n", line_num);
+            } else if (ret == 0) {
+                all_passed = 0;
+            }
+            free(cmds);
+        }
+    }
+    return all_passed;
+}
+
+int process_config(char * config) {
+    if (strncmp(config, "VERBOSE", 7) == 0) {
+        verbose = 1;
+        fprintf(stderr, "... VERBOSE mode on\n");
+    } else if (strncmp(config, "NOVERBOSE", 9) == 0) {
+        verbose = 0;
+    } else if (strncmp(config, "SEED", 4) == 0) {
+        unsigned seed = atoi(config + 4);
+        if (seed < 1)
+            return 0;
+        tu_init_rand_or_die(seed);
+    } else if (strncmp(config, "INPUT", 5) == 0) {
+        char * fname = (char *) str_ltrim(config + 5);
+        if (*fname == '\0')
+            return 0;
+        str_rtrim(fname);
+        tu_sample_data_file_init(fname);
+    } else if (strncmp(config, "MAXFILE", 7) == 0) {
+        unsigned maxfile = atoi(config + 7);
+        if (maxfile < 1)
+            return 0;
+        filelen_max = maxfile;
+    } else {
+        return 0;
+    }
+    return 1;
+}
+
+int do_run(char ** cmds, int num_cmds) {
+    int c;
+    char * id;
+    struct fdset * fdset = NULL;
+    struct docmap * docmap = NULL;
+    enum docmap_ret dm_ret;
+    static struct docinfo * docinfos= NULL;
+    static unsigned docinfos_size = 0;
+    unsigned num_docinfos = 0;
+    int ret = 1;
+
+    id = cmds[0];
+    if (verbose) {
+        fprintf(stderr, "... Starting run '%s'\n", id);
+    }
+    fdset = fdset_new(0777, 1);
+    if (fdset == NULL) {
+        fprintf(stderr, "Error creating fdset\n");
+        goto ERROR;
+    }
+    fdset_set_type_name(fdset, NEWDOCMAP_TEST_FD_TYPE, "docmaptest", 
+      strlen("docmaptest"), 1 /* writeable */);
+
+    docmap = docmap_new(fdset, NEWDOCMAP_TEST_FD_TYPE, 4096, 0, 
+      filelen_max, 0xfffff, &dm_ret);
+    if (dm_ret != DOCMAP_OK) {
+        ERROR1("Failed to create docmap: code %d\n", dm_ret);
+        goto ERROR;
+    }
+
+    for (c = 1; c < num_cmds; c++) {
+        char * cmd = cmds[c];
+
+        if (verbose)
+            fprintf(stderr, "... command '%s'\n", cmd);
+
+        /*
+         *  ADD=<num>
+         */
+        if (strncmp(cmd, "ADD=", 4) == 0) {
+            int num_adds = atoi(cmd + 4);
+            unsigned d;
+            if (num_adds < 1) {
+                fprintf(stderr, "Invalid ADD command\n");
+                goto ERROR;
+            }
+            while (num_docinfos + num_adds > docinfos_size) {
+                if (docinfos_size == 0) {
+                    docinfos_size = 4096;
+                } else {
+                    docinfos_size *= 2;
+                }
+                if ( (docinfos = realloc(docinfos, sizeof(*docinfos)
+                          * docinfos_size)) == NULL) {
+                    perror("ERROR reallocating docinfos");
+                    exit(EXIT_FAILURE);
+                }
+            }
+            for (d = 0; d < num_adds; d++) {
+                struct docinfo * docinfo = &docinfos[num_docinfos];
+                enum docmap_ret dm_ret;
+                unsigned long int docno;
+                init_rand_docinfo(docinfo, 
+                  num_docinfos ? &docinfos[num_docinfos - 1] : NULL);
+
+                dm_ret = docmap_add(docmap, docinfo->sourcefile,
+                  docinfo->offset, docinfo->bytes, 
+                  docinfo->flags, docinfo->words,
+                  docinfo->distinct_words, docinfo->weight,
+                  docinfo->aux, docinfo->aux_len, docinfo->mtype, &docno);
+                if (dm_ret != DOCMAP_OK) {
+                    ERROR1("docmap error: '%s'", docmap_strerror(dm_ret));
+                    goto FAILURE;
+                }
+                if (docno != num_docinfos) {
+                    ERROR2("docno returned as '%lu', should be '%u'\n",
+                      docno, num_docinfos);
+                }
+                num_docinfos++;
+            }
+        }
+
+        /*
+         *  CHECK
+         */
+        else if (strncmp(cmd, "CHECK", 5) == 0) {
+            unsigned d;
+
+            for (d = 0; d < num_docinfos; d++) {
+#define DO_CHECK(field) \
+                if (!check_ ## field(docmap,docinfos, d)) \
+                    goto FAILURE
+                DO_CHECK(aux);
+                DO_CHECK(location);
+                DO_CHECK(bytes);
+                DO_CHECK(words);
+                DO_CHECK(distinct_words);
+                DO_CHECK(weight);
+#undef DO_CHECK
+            }
+        }
+
+        /*
+         * RAND_CHECK.
+         */
+        else if (strncmp(cmd, "RAND_CHECK", 10) == 0) {
+            unsigned d;
+            enum { AUX = 0, LOCATION = 1, BYTES = 2,
+                WORDS = 3, DISTINCT_WORDS = 4, WEIGHT = 5,
+                END_ENUM = 6 } type;
+
+            d = tu_rand_limit(num_docinfos);
+            type = tu_rand_limit(END_ENUM);
+#define DO_CHECK(field) \
+            if (!check_ ## field(docmap,docinfos, d)) \
+                goto FAILURE
+            switch (type) {
+            case AUX:
+                DO_CHECK(aux);
+                break;
+            case LOCATION:
+                DO_CHECK(location);
+                break;
+            case BYTES:
+                DO_CHECK(bytes);
+                break;
+            case WORDS:
+                DO_CHECK(words);
+                break;
+            case DISTINCT_WORDS:
+                DO_CHECK(distinct_words);
+                break;
+            case WEIGHT:
+                DO_CHECK(weight);
+                break;
+            default:
+                assert(0);
+            }
+#undef DO_CHECK
+        }
+
+        /*
+         * DUMP_LOAD.
+         */
+        else if (strncmp(cmd, "DUMP_LOAD", 9) == 0) {
+            enum docmap_ret dm_ret;
+
+            dm_ret = docmap_save(docmap);
+            if (dm_ret != DOCMAP_OK) {
+                ERROR1("return code of '%d'", dm_ret);
+                goto FAILURE;
+            }
+            docmap_delete(docmap);
+            docmap = docmap_load(fdset, NEWDOCMAP_TEST_FD_TYPE, 4096, 0, 
+                filelen_max, 0xfffffff, &dm_ret);
+            if (dm_ret != DOCMAP_OK) {
+                ERROR1("docmap error: '%s'\n", docmap_strerror(dm_ret));
+                abort();
+                goto FAILURE;
+            }
+        }
+
+        else {
+            fprintf(stderr, "Unknown command '%s'\n", cmd);
+            goto ERROR;
+        }
+    }
+
+    goto END;
+
+FAILURE:
+    ret = 0;
+    goto END;
+
+ERROR:
+    ret = -1;
+
+END:
+    if (fdset != NULL) {
+        int i;
+        for (i = 0; i < 256; i++) 
+            fdset_unlink(fdset, NEWDOCMAP_TEST_FD_TYPE, i);
+        fdset_delete(fdset);
+    }
+    if (docmap != NULL) {
+        docmap_delete(docmap);
+    }
+    return ret;
+}
+
+#define CHECK_RET(ret) \
+            if (ret != DOCMAP_OK) { \
+                ERROR1("return code of '%d'", ret); \
+                return 0; \
+            } \
+            ret = DOCMAP_OK
+#define CHECK_VAL(valname, fmt_code, dno) \
+            if (docinfo->valname != valname) { \
+                ERROR4("%s is '" fmt_code "', should be '" fmt_code \
+                    "' for docno %u", # valname, valname, docinfo->valname, \
+                    dno); \
+                return 0; \
+            }
+
+CHECK_FUNC(aux) {
+    unsigned aux_len;
+    static char * aux_buf = NULL;
+    static unsigned aux_buf_len = 0;
+    enum docmap_ret dm_ret;
+    struct docinfo * docinfo = &docinfos[d];
+
+    dm_ret = docmap_get_trecno(docmap, d, aux_buf, aux_buf_len,
+      &aux_len);
+    if (dm_ret == DOCMAP_OK && aux_len > aux_buf_len) {
+        aux_buf = realloc(aux_buf, aux_len + 1);
+        if (aux_buf == NULL) {
+            perror("ERROR reallocating aux_buf");
+            exit(EXIT_FAILURE);
+        }
+        aux_buf_len = aux_len;
+        dm_ret = docmap_get_trecno(docmap, d, aux_buf, aux_buf_len,
+          &aux_len);
+    }
+
+    CHECK_RET(dm_ret);
+    CHECK_VAL(aux_len, "%u", d);
+    if (memcmp(docinfo->aux, aux_buf, aux_len) != 0) {
+        ERROR("returned and entered aux differ");
+        return 0;
+    }
+    return 1;
+}
+
+CHECK_FUNC(location) {
+    enum docmap_ret dm_ret;
+    unsigned int sourcefile;
+    off_t offset;
+    unsigned int bytes;
+    enum docmap_flag flags;
+    struct docinfo * docinfo = &docinfos[d];
+    enum mime_types mtype;
+
+    dm_ret = docmap_get_location(docmap, d, &sourcefile, &offset, &bytes,
+      &mtype, &flags);
+    CHECK_RET(dm_ret);
+    CHECK_VAL(sourcefile, "%u", d);
+    CHECK_VAL(offset, "%lu", d);
+    CHECK_VAL(bytes, "%u", d);
+    CHECK_VAL(flags, "%u", d);
+    CHECK_VAL(mtype, "%d", d);
+    return 1;
+}
+
+#define CHECK_SINGLE_VAL_FUNC_DEFN(field, type, fmt) \
+CHECK_FUNC(field) { \
+    enum docmap_ret dm_ret; \
+    type field; \
+    struct docinfo * docinfo = &docinfos[d]; \
+\
+    dm_ret = docmap_get_ ## field(docmap, d, &field); \
+    CHECK_RET(dm_ret); \
+    CHECK_VAL(field, fmt, d); \
+    return 1; \
+}
+
+#define CHECK_UNSIGNED_FUNC_DEFN(field) \
+CHECK_SINGLE_VAL_FUNC_DEFN(field, unsigned int, "%u")
+    
+CHECK_UNSIGNED_FUNC_DEFN(bytes)
+CHECK_UNSIGNED_FUNC_DEFN(words)
+CHECK_UNSIGNED_FUNC_DEFN(distinct_words)
+
+CHECK_FUNC(weight) {
+    enum docmap_ret dm_ret; 
+    double weight; 
+    struct docinfo * docinfo = &docinfos[d]; 
+
+    dm_ret = docmap_get_weight(docmap, d, &weight); 
+    CHECK_RET(dm_ret); 
+    /* floats are converted to mantissa, exponent integer pairs for
+       storage, then back to floats on load.  Allow a slight loss of
+       precision. */
+    if (weight > docinfo->weight * 1.04 || weight < docinfo->weight * 0.96) {
+        ERROR3("weight is '%lf', should be '%lf', diff %lf", docinfo->weight, 
+          weight, docinfo->weight / weight);
+        return 0;
+    }
+    return 1; 
+}
diff --git a/src/test/docmap_1.cases b/src/test/docmap_1.cases
new file mode 100644 (file)
index 0000000..4e3e023
--- /dev/null
@@ -0,0 +1,7 @@
+#@VERBOSE
+@SEED 19
+A ADD=400 CHECK
+B ADD=400 CHECK DUMP_LOAD CHECK ADD=100 DUMP_LOAD RAND_CHECK
+B ADD=400 CHECK DUMP_LOAD RAND_CHECK ADD=100 DUMP_LOAD CHECK
+C ADD=400 CHECK DUMP_LOAD RAND_CHECK ADD=100 DUMP_LOAD CHECK DUMP_LOAD ADD=10 RAND_CHECK
+#D DUMP_LOAD
diff --git a/src/test/freemap_1.c b/src/test/freemap_1.c
new file mode 100644 (file)
index 0000000..2ceddb9
--- /dev/null
@@ -0,0 +1,543 @@
+/* freemap_1.c implements a unit test for the freemap module.  It aims
+ * to test the entire interface.  Input format is:
+ *
+ * # comments
+ * command params
+ *
+ * commands are:
+ *
+ *   new name append files [size]
+ *     create a new freemap that can append at most append bytes to any
+ *     non-exact allocation, and grows to at most files number of
+ *     files, each of which is of size given in the size array
+ *
+ *   print
+ *     print the freemap to stdout
+ *
+ *   malloc exact size ret
+ *     allocate some memory of size at least size from the freemap, getting the 
+ *     exact amount of space if exact is 1.  ret indicates whether the
+ *     operation will succeed or fail.
+ *
+ *   locmalloc exact fileno offset size ret
+ *     allocate some memory from a specific location.  like malloc,
+ *     except that the allocation MUST occur from specified fileno and
+ *     offset if it is to succeed.
+ *
+ *   free fileno offset size ret
+ *     free memory allocated at fileno, offset, of size size.  ret
+ *     indicates whether this action should succeed.
+ *
+ *   autofree num
+ *     free memory allocated by call num
+ *
+ *   finish
+ *     free all memory, check that map is sensible, delete it
+ *
+ *   realloc exact fileno offset size additional ret
+ *     resize an existing allocation at fileno, offset of current size
+ *     size, with additional specifying how much extra to get (XXX:
+ *     should be able to shrink allocations with this too)
+ *
+ * Commands should be put on a line by themselves, like this:
+ *
+ * # this is a comment, followed by a couple of commands
+ * new
+ *   case01 1 1 100
+ * malloc 
+ *   0 10 1
+ *
+ * written nml 2004-08-24
+ *
+ */
+
+#include "test.h"
+
+#include "freemap.h"
+#include "str.h"
+#include "getlongopt.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+
+struct params {
+    int verbose;
+};
+
+static int parse_params(int argc, char **argv, struct params *params) {
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    enum getlongopt_ret ret;     /* return value from option parser */
+
+    struct getlongopt_opt opts[] = {
+        {"input", '\0', GETLONGOPT_ARG_REQUIRED, 'i'},
+        {"verbose", 'v', GETLONGOPT_ARG_NONE, 'v'}
+    };
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(stderr, "failed to initialise options parser\n");
+        return 0;
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case 'i':
+            /* ignore */
+            break;
+
+        case 'v':
+            /* verbose */
+            params->verbose = 1;
+            break;
+
+        default: assert(0);
+        }
+    }
+
+    getlongopt_delete(parser);
+    return 1;
+}
+
+struct uint_arr {
+    unsigned int size;
+    unsigned int *arr;
+};
+
+int newfile(void *opaque, unsigned int file, unsigned int *maxsize) {
+    struct uint_arr *files = opaque;
+    
+    if (file < files->size) {
+        *maxsize = files->arr[file];
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+struct allocation {
+    unsigned int fileno;
+    unsigned long int offset;
+    unsigned int size;
+};
+
+int allocation_grow(struct allocation **alloc, unsigned int *size) {
+    void *ptr = realloc(*alloc, (*size * 2 + 1) * sizeof(**alloc));
+
+    if (ptr) {
+        *alloc = ptr;
+        *size = *size * 2 + 1;
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int test_file(FILE *fp, int argc, char **argv) {
+    char *pos;
+    unsigned long int tmp;
+    struct params params = {0};
+    struct freemap *map = NULL;
+    unsigned int append;
+    struct uint_arr files = {0, NULL};
+    char name[256];
+    int ret,
+        exact;
+    char buf[1024 + 1];
+    unsigned int fileno,
+                 tmpfileno;
+    unsigned long int offset,
+                      tmpoffset;
+    unsigned int size;
+    unsigned int additional,
+                 i;
+    struct allocation *alloc = NULL;
+    unsigned int allocs = 0;
+    unsigned int alloc_cap = 0;
+
+
+    if (!parse_params(argc, argv, &params)) {
+        fprintf(stderr, "failed to parse params\n");
+        return 0;
+    }
+
+    while (fgets((char *) buf, 1024, fp)) {
+        str_rtrim(buf);
+        pos = (char *) str_ltrim(buf);
+
+        if (!str_casecmp(pos, "new")) {
+            if (map) {
+                freemap_delete(map);
+            }
+            if (files.arr) {
+                free(files.arr);
+            }
+            allocs = 0;
+            if (params.verbose) {
+                printf("\n");
+            }
+
+            /* read parameters */
+            if ((fscanf(fp, "%255s %u %u", name, &append, &files.size) == 3)
+              && (files.arr = malloc(sizeof(*files.arr) * files.size))
+              && (map = freemap_new(FREEMAP_STRATEGY_FIRST, append, &files, 
+                  newfile))) {
+
+                for (i = 0; i < files.size; i++) {
+                    if (!(fscanf(fp, "%u", &files.arr[i]))) {
+                        free(files.arr);
+                        files.arr = NULL;
+                        freemap_delete(map);
+                        map = NULL;
+                        break;
+                    }
+                }
+
+                if (i == files.size) {
+                    /* succeeded, do nothing */
+                    if (params.verbose) {
+                        printf("%s: new freemap with append size %u, "
+                          "file sizes: ", name, append);
+                        for (i = 0; i < files.size; i++) {
+                            printf("%u ", files.arr[i]);
+                        }
+                        printf("\n");
+                    }
+                } else {
+                    /* failed */
+                    fprintf(stderr, "%s: failed to read all file sizes\n", name);
+                }
+            } else {
+                fprintf(stderr, "%s: failed to create freemap\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "malloc")) {
+            if (!map) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%d %u %d", &exact, &size, &ret) == 3) {
+                tmp = size;
+                if (freemap_malloc(map, &fileno, &offset, &size, 
+                    !!exact * FREEMAP_OPT_EXACT)) {
+
+                    while (allocs >= alloc_cap) {
+                        if (!(allocation_grow(&alloc, &alloc_cap))) {
+                            fprintf(stderr, "%s: failed to grow allocations\n", 
+                              name);
+                            return 0;
+                        }
+                    }
+
+                    /* stuff it into allocations table */
+                    alloc[allocs].fileno = fileno;
+                    alloc[allocs].offset = offset;
+                    alloc[allocs].size = size;
+                    allocs++;
+
+                    if (ret) {
+                        if (params.verbose) {
+                            printf("%s: allocated %u %lu %u\n", name, fileno, 
+                              offset, size);
+                        }
+                    } else {
+                        fprintf(stderr, "%s: malloc size %lu should have failed "
+                          "but didn't (returned %u %lu %u)\n", name, tmp, 
+                            fileno, offset, size);
+                        return 0;
+                    }
+                } else {
+                    if (ret) {
+                        fprintf(stderr, "%s: malloc size %u should have "
+                          "succeeded but didn't\n", name, size);
+                        return 0;
+                    } else {
+                        if (params.verbose) {
+                            printf("%s: succeeded in failing to allocate %u "
+                              "bytes\n", name, size);
+                        }
+                    }
+                }
+            } else {
+                fprintf(stderr, "%s: failed to read params for malloc\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "locmalloc")) {
+            if (!map) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%d %u %lu %u %d", &exact, &fileno, &offset, &size, 
+                &ret) == 5) {
+
+                tmp = size;
+                tmpfileno = fileno;
+                tmpoffset = offset;
+                if (freemap_malloc(map, &fileno, &offset, &size, 
+                    !!exact * FREEMAP_OPT_EXACT | FREEMAP_OPT_LOCATION, 
+                    fileno, offset)) {
+
+                    assert(fileno == tmpfileno && offset == tmpoffset);
+
+                    while (allocs >= alloc_cap) {
+                        if (!(allocation_grow(&alloc, &alloc_cap))) {
+                            fprintf(stderr, "%s: failed to grow allocations\n", 
+                              name);
+                            return 0;
+                        }
+                    }
+
+                    /* stuff it into allocations table */
+                    alloc[allocs].fileno = fileno;
+                    alloc[allocs].offset = offset;
+                    alloc[allocs].size = size;
+                    allocs++;
+
+                    if (ret) {
+                        if (params.verbose) {
+                            printf("%s: allocated %u %lu %u with loc %u %lu\n",
+                              name, fileno, offset, size, tmpfileno, tmpoffset);
+                        }
+                    } else {
+                        fprintf(stderr, "%s: locmalloc size %lu should have "
+                          "failed but didn't (returned %u %lu %u)\n", name, tmp, 
+                            fileno, offset, size);
+                        return 0;
+                    }
+                } else {
+                    if (ret) {
+                        fprintf(stderr, "%s: locmalloc size %u should have "
+                          "succeeded but didn't\n", name, size);
+                        return 0;
+                    } else {
+                        if (params.verbose) {
+                            printf("%s: succeeded in failing to allocate %u "
+                              "bytes with loc %u %lu\n", name, size, fileno, 
+                              offset);
+                        }
+                    }
+                }
+            } else {
+                fprintf(stderr, "%s: failed to read params for locmalloc\n", 
+                  name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "realloc")) {
+            if (!map) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%d %u %lu %u %u %d", &exact, &fileno, &offset, 
+                &size, &additional, &ret) == 6) {
+
+                if ((tmp = freemap_realloc(map, fileno, offset, size, 
+                    additional, !!exact * FREEMAP_OPT_EXACT))) {
+
+                    assert(tmp >= additional);
+
+                    for (i = 0; i < allocs; i++) {
+                        if (alloc[i].fileno == fileno 
+                          && alloc[i].offset == offset) {
+                            assert(alloc[i].size == size);
+                            alloc[i].size = size + tmp;
+                            break;
+                        }
+                    }
+
+                    if (i == allocs) {
+                        fprintf(stderr, 
+                          "%s: failed to update %u %lu in allocations table\n", 
+                          name, fileno, offset);
+                        return 0;
+                    }
+
+                    if (ret) {
+                        if (params.verbose) {
+                            printf("%s: reallocated %u %lu %u to size %lu\n",
+                              name, fileno, offset, size, size + tmp);
+                        }
+                    } else {
+                        fprintf(stderr, "%s: realloc %u %lu %u + %u should have "
+                          "failed but didn't (returned %lu)\n", name, fileno, 
+                          offset, size, additional, tmp);
+                        return 0;
+                    }
+                } else {
+                    if (ret) {
+                        fprintf(stderr, "%s: realloc %u %lu %u + %lu should "
+                          "have succeeded but didn't\n", name, fileno, offset, 
+                          size, tmp);
+                        return 0;
+                    } else {
+                        if (params.verbose) {
+                            printf("%s: succeeded in failing to reallocate "
+                              "%u %lu %u + %u\n", name, fileno, 
+                              offset, size, additional);
+                        }
+                    }
+                }
+            } else {
+                fprintf(stderr, "%s: failed to read params for realloc\n", 
+                  name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "autofree")) {
+            if (!map) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%lu", &tmp) == 1) {
+
+                if (tmp >= allocs) {
+                    fprintf(stderr, "%s: no such allocation %lu\n", name, tmp);
+                }
+
+                if (freemap_free(map, alloc[tmp].fileno, alloc[tmp].offset, 
+                  alloc[tmp].size)) {
+                    if (params.verbose) {
+                        printf("%s: autofreed %u %lu %u\n",
+                          name, alloc[tmp].fileno, alloc[tmp].offset, 
+                          alloc[tmp].size);
+                    }
+                } else {
+                    fprintf(stderr, "%s: autofree %u %lu %u should "
+                      "have succeeded but didn't\n", name, alloc[tmp].fileno, 
+                      alloc[tmp].offset, alloc[tmp].size);
+                    return 0;
+                }
+
+                allocs--;
+                memmove(&alloc[tmp], &alloc[tmp + 1], 
+                  sizeof(*alloc) * (allocs - tmp));
+            } else {
+                fprintf(stderr, "%s: failed to read params for autofree\n", 
+                  name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "free")) {
+            if (!map) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%u %lu %u %d", &fileno, &offset, &size, &ret) 
+                == 4) {
+
+                if (freemap_free(map, fileno, offset, size)) {
+                    if (ret) {
+                        if (params.verbose) {
+                            printf("%s: freed %u %lu %u\n",
+                              name, fileno, offset, size);
+                        }
+                    } else {
+                        fprintf(stderr, "%s: free %u %lu %u "
+                          "failed but didn't\n", name, fileno, offset, size);
+                        return 0;
+                    }
+                } else {
+                    if (ret) {
+                        fprintf(stderr, "%s: free %u %lu %u should "
+                          "have succeeded but didn't\n", name, fileno, offset, 
+                          size);
+                        return 0;
+                    } else {
+                        if (params.verbose) {
+                            printf("%s: succeeded in failing to free "
+                              "%u %lu %u\n", name, fileno, offset, size);
+                        }
+                    }
+                }
+            } else {
+                fprintf(stderr, "%s: failed to read params for free\n", 
+                  name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "finish")) {
+            if (!map) { return 0; }
+
+            /* return all autoallocations */
+            for (i = 0; i < allocs; i++) {
+                if (freemap_free(map, alloc[i].fileno, alloc[i].offset, 
+                  alloc[i].size)) {
+                } else {
+                    fprintf(stderr, "%s: finish autofree %u %lu %u should "
+                      "have succeeded but didn't\n", name, alloc[i].fileno, 
+                      alloc[i].offset, alloc[i].size);
+                    return 0;
+                }
+            }
+
+            /* we should now be able to locmalloc the original locations we 
+             * had */
+            for (i = 0; i < files.size; i++) {
+                if (!freemap_malloc(map, &fileno, &offset, &files.arr[i], 
+                    FREEMAP_OPT_EXACT | FREEMAP_OPT_LOCATION, i, 0)) {
+
+                    fprintf(stderr, "%s: finish locmalloc %u %u %u should "
+                      "have succeeded but didn't\n", name, i, 0, files.arr[i]);
+                    return 0;
+                }
+            }
+
+            /* and the map should be completely utilised with no entries */
+            if (freemap_utilisation(map) != 1.0 || freemap_entries(map)) {
+                fprintf(stderr, "%s: finish map utilisation and entries are "
+                  "screwed up (%f and %u)\n", name, freemap_utilisation(map), 
+                  freemap_entries(map));
+                freemap_print(map, stdout);
+                return 0;
+            }
+            if (files.arr) {
+                free(files.arr);
+                files.arr = NULL;
+            }
+            if (map) {
+                freemap_delete(map);
+                map = NULL;
+            }
+            if (alloc) {
+                free(alloc);
+                allocs = 0;
+                alloc_cap = 0;
+                alloc = NULL;
+            }
+        } else if (!str_casecmp(pos, "printauto")) {
+            for (i = 0; i < allocs; i++) {
+                printf("%u. %u %lu size %u\n", i, alloc[i].fileno, 
+                  alloc[i].offset, alloc[i].size);
+            }
+
+            printf("\n%u allocations stored\n\n", allocs);
+        } else if (!str_casecmp(pos, "print")) {
+            if (!map) { return 0; }
+
+            printf("\n");
+            freemap_print(map, stdout);
+            printf("\n%u entries, %f utilised out of %f, %f wasted\n\n", 
+              freemap_entries(map), freemap_utilisation(map), 
+              freemap_space(map), freemap_wasted(map));
+        } else if ((*pos != '#') && str_len(pos)) {
+            fprintf(stderr, "%s: unknown command '%s'\n", name, pos);
+            return 0;
+        }
+    }
+    
+    if (files.arr) {
+        free(files.arr);
+    }
+    if (map) {
+        freemap_delete(map);
+    }
+    if (alloc) {
+        allocs = 0;
+        alloc_cap = 0;
+        free(alloc);
+        alloc = NULL;
+    }
+
+    return 1;
+}
+
diff --git a/src/test/freemap_1.cases b/src/test/freemap_1.cases
new file mode 100644 (file)
index 0000000..5f18719
--- /dev/null
@@ -0,0 +1,712 @@
+# freemap_1.cases is a test suite for the freemap module.  See freemap_1.c
+# for more details
+#
+# written nml 2004-08-23
+
+# simple cases
+
+new
+       case_1_1 0 1 100
+malloc 
+       0 10 1
+malloc
+       0 9 1
+malloc
+       0 8 1
+malloc
+       0 7 1
+malloc
+       0 6 1
+malloc 
+       0 5 1
+malloc
+       0 4 1
+malloc
+       0 3 1
+malloc
+       0 2 1
+malloc
+       0 1 1
+malloc 
+       0 10 1
+malloc
+       0 9 1
+malloc
+       0 8 1
+malloc
+       0 7 1
+malloc
+       0 6 1
+malloc 
+       0 5 1
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+autofree
+       0
+finish
+
+new
+       case_1_2 0 1 100
+malloc 
+       0 10 1
+malloc
+       0 9 1
+malloc
+       0 8 1
+malloc
+       0 7 1
+malloc
+       0 6 1
+malloc 
+       0 5 1
+malloc
+       0 4 1
+malloc
+       0 3 1
+malloc
+       0 2 1
+malloc
+       0 1 1
+malloc 
+       0 10 1
+malloc
+       0 9 1
+malloc
+       0 8 1
+malloc
+       0 7 1
+malloc
+       0 6 1
+malloc 
+       0 5 1
+autofree
+       15
+autofree
+       14
+autofree
+       13
+autofree
+       12
+autofree
+       11
+autofree
+       10
+autofree
+       9
+autofree
+       8
+autofree
+       7
+autofree
+       6
+autofree
+       5
+autofree
+       4
+autofree
+       3
+autofree
+       2
+autofree
+       1
+autofree
+       0
+finish
+
+new
+       case_1_3 0 1 100
+malloc 
+       0 10 1
+malloc
+       0 9 1
+malloc
+       0 8 1
+malloc
+       0 7 1
+malloc
+       0 6 1
+malloc 
+       0 5 1
+autofree
+       5
+autofree
+       1
+autofree
+       3
+autofree
+       0
+autofree
+       1
+autofree
+       0
+finish
+
+# test edge cases
+
+# this test case should probably succeed, but making it to so would
+# slow everything down, and it really isn't that important anyway.  The
+# new case_2_1 is close enough
+
+# test used/unused contiguous allocations
+#new
+       #case_2_1 0 1 10
+#malloc
+       #0 5 1
+#autofree
+       #0
+#malloc 
+       #0 10 1
+#autofree
+       #0
+
+# test used/unused contiguous allocations
+new
+       case_2_1 0 1 10
+malloc
+       0 5 1
+autofree
+       0
+locmalloc 
+       0 0 0 10 1
+autofree
+       0
+finish
+
+# test append anti-fragmentation
+new
+       case_2_2 2 1 10
+malloc
+       0 5 1
+autofree
+       0
+malloc
+       0 3 1
+malloc
+       0 7 0
+malloc
+       0 5 1
+autofree
+       0
+autofree
+       0
+finish
+
+# test multiple files
+new
+       case_2_3 0 2 10 10
+malloc
+       0 5 1
+malloc
+       0 10 1
+autofree
+       0
+autofree
+       0
+finish
+
+# request a too-large allocation
+new
+       case_2_4 0 2 5 10
+malloc
+       0 11 0
+malloc
+       0 10 1
+finish
+
+# request an allocation thats too large for the first file
+new
+       case_2_5 0 2 5 10
+malloc
+       0 10 0
+malloc
+       0 10 1
+finish
+
+# test (whitebox) all allocation and free routes through freemap.c
+
+# first freemap_malloc_location
+
+new
+    case_white_1_1 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate it all, requiring merger between used and unused
+locmalloc
+    0 0 0 10 1
+finish
+
+new
+    case_white_1_2 1 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate it all using append, requiring merger between used and unused
+locmalloc
+    0 0 0 9 1
+# fail to allocate stuff that should have been appended
+locmalloc
+    0 0 9 1 0
+finish
+
+new
+    case_white_1_3 1 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate it all, append off by 1, requiring merger between used and unused
+locmalloc
+    0 0 0 8 1
+# allocate rest
+locmalloc
+    0 0 8 2 1
+finish
+
+new
+    case_white_1_4 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate some, requiring merger between used and unused, leaving some used
+locmalloc
+    0 0 1 9 1
+finish
+
+new
+    case_white_1_5 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate some, requiring merger between used and unused, leaving some unused
+locmalloc
+    0 0 0 9 1
+finish
+
+new
+    case_white_1_6 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate some, requiring merger between used and unused, leaving some of both
+locmalloc
+    0 0 1 8 1
+finish
+
+new
+    case_white_1_7 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from unused
+locmalloc
+    0 0 5 5 1
+finish
+
+new
+    case_white_1_8 1 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from unused, using append
+locmalloc
+    0 0 5 4 1
+# fail to allocate the next position
+locmalloc
+    0 0 9 1 0
+finish
+
+new
+    case_white_1_9 1 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from unused, append off by 1
+locmalloc
+    0 0 5 3 1
+# allocate the next position
+locmalloc
+    0 0 8 2 1
+finish
+
+new
+    case_white_1_10 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from unused, don't consume
+locmalloc
+    0 0 5 3 1
+finish
+
+new
+    case_white_1_11 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from unused, don't consume, split into two 
+locmalloc
+    0 0 6 3 1
+finish
+
+new
+    case_white_1_12 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from unused, don't consume, leave only front part
+locmalloc
+    0 0 6 4 1
+finish
+
+new
+    case_white_1_13 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from used
+locmalloc
+    0 0 0 5 1
+finish
+
+new
+    case_white_1_14 1 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from used, using append
+locmalloc
+    0 0 0 4 1
+# fail to allocate next block
+locmalloc
+    0 0 4 1 0
+finish
+
+new
+    case_white_1_15 1 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from used, append off by 1
+locmalloc
+    0 0 0 3 1
+# allocate next block
+locmalloc
+    0 0 3 2 1
+finish
+
+new
+    case_white_1_16 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from used, don't consume
+locmalloc
+    0 0 0 4 1
+finish
+new
+    case_white_1_17 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from used, don't consume, split into two
+locmalloc
+    0 0 1 3 1
+finish
+
+new
+    case_white_1_18 0 1 10
+# put half onto unused list
+locmalloc
+    0 0 0 5 1
+autofree
+    0
+# allocate from used, don't consume, leave only front part
+locmalloc
+    0 0 1 4 1
+finish
+
+new
+    case_white_1_19 0 3 10 10 10
+# allocate from last file
+locmalloc
+    0 2 0 10 1
+finish
+
+new
+    case_white_1_20 0 1 10
+# 0 length allocation
+locmalloc
+    0 0 0 0 1
+finish
+
+new
+    case_white_1_21 0 1 10
+# 0 length allocation
+locmalloc
+    0 0 1 0 1
+finish
+
+# now test malloc
+
+new
+    case_white_2_1 0 1 10
+# allocate from unused
+malloc
+    0 10 1
+finish
+
+new
+    case_white_2_2 1 1 10
+# allocate from unused, using append
+malloc
+    0 9 1
+# fail to allocate next block
+locmalloc
+    0 0 9 1 0
+finish
+new
+    case_white_2_3 1 1 10
+# allocate from unused, append off by 1
+malloc
+    0 8 1
+# allocate next block
+locmalloc
+    0 0 8 2 1
+finish
+
+new
+    case_white_2_4 0 1 10
+# allocate from unused, don't consume
+malloc
+    0 9 1
+finish
+new
+    case_white_2_5 0 1 10
+# put allocation onto used list
+malloc
+    0 10 1
+autofree 
+    0
+# allocate from used
+malloc
+    0 10 1
+finish
+  
+new
+    case_white_2_6 1 1 10
+# put allocation onto used list
+malloc
+    0 10 1
+autofree 
+    0
+# allocate from used, using append
+malloc
+    0 9 1
+# fail to allocate next block 
+locmalloc
+    0 0 9 1 0
+finish
+new
+    case_white_2_7 1 1 10
+# put allocation onto used list
+malloc
+    0 10 1
+autofree 
+    0
+# allocate from used, append off by 1
+malloc
+    0 8 1
+# allocate next location
+locmalloc
+    0 0 8 2 1
+finish
+
+# 0 length allocation
+new
+    case_white_2_8 0 1 10
+malloc
+    0 0 1
+finish
+
+# now test free
+
+new
+    case_white_3_1 0 1 10
+locmalloc 
+    0 0 0 10 1
+autofree
+    0
+# force free to coalesce with block after
+locmalloc
+    0 0 0 9 1
+autofree
+    0
+malloc
+    0 10 1
+finish
+
+new
+    case_white_3_2 0 1 10
+locmalloc 
+    0 0 0 10 1
+autofree
+    0
+# force free to coalesce with block before
+locmalloc
+    0 0 1 9 1
+autofree
+    0
+malloc
+    0 10 1
+finish
+
+new
+    case_white_3_2 0 1 10
+locmalloc 
+    0 0 0 10 1
+autofree
+    0
+# force free to coalesce with blocks both before and after
+locmalloc
+    0 0 1 8 1
+autofree
+    0
+malloc
+    0 10 1
+finish
+
+# now test realloc
+
+new
+    case_white_4_1 0 1 10
+# put entire allocation on free list, so we don't realloc from unused
+locmalloc 
+    0 0 0 10 1
+autofree
+    0
+locmalloc
+    0 0 0 5 1
+realloc
+    0 0 0 5 5 1
+finish
+
+new
+    case_white_4_2 1 1 10
+# put entire allocation on free list, so we don't realloc from unused
+locmalloc
+    0 0 0 10 1
+autofree
+    0
+locmalloc
+    0 0 0 5 1
+# realloc with append
+realloc
+    0 0 0 5 4 1
+finish
+    
+new
+    case_white_4_3 1 1 10
+# put entire allocation on free list, so we don't realloc from unused
+locmalloc
+    0 0 0 10 1
+autofree
+    0
+locmalloc
+    0 0 0 5 1
+# realloc with append off by 1
+realloc
+    0 0 0 5 3 1
+finish
+
+new
+    case_white_4_4 0 1 10
+locmalloc
+    0 0 0 5 1
+realloc
+    0 0 0 5 5 1
+finish
+
+new
+    case_white_4_5 1 1 10
+locmalloc
+    0 0 0 5 1
+# realloc with append
+realloc
+    0 0 0 5 4 1
+finish
+    
+new
+    case_white_4_6 1 1 10
+locmalloc
+    0 0 0 5 1
+# realloc with append off by 1
+realloc
+    0 0 0 5 3 1
+finish
+
diff --git a/src/test/getlongopt_1.c b/src/test/getlongopt_1.c
new file mode 100644 (file)
index 0000000..4d9efeb
--- /dev/null
@@ -0,0 +1,269 @@
+/* getlongopt_1.c is a unit test for the getlongopt module.  It accepts a script
+ * describing what tests to perform in the format:
+ *
+ *   opt longname shortname arg id -- adds an option to the current list, where:
+ *     longname is the string to match (to match '--blah' use 'blah')
+ *     shortname is the character to match (to match '-v' use v)
+ *     arg is whether to require an argument, with 0 == no argument, 
+ *       1 == required argument, 2 == optional argument
+ *     id is the number to return when this option is matched
+ *
+ *   print -- prints the current options
+ *
+ *   clear -- clears the current options
+ *
+ *   parse options* -- prints out a parsed representation of options provided
+ *
+ *   check options* -- verifies that the parsed representation of the
+ *     options is the same as the options listed on the next few lines.
+ *     Next line must be number of options expected (by itself).
+ *     Subsequent lines are of the form 'ret [id arg]' ret is the
+ *     return value from getlongopt ('OK' or 'UNKNOWN' etc) and id is the id
+ *     number of the expected option, and arg is the expected argument string.
+ *     Comments are not currently supported within these lines
+ *
+ * written nml 2004-06-07
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "test.h"
+
+#include "getlongopt.h"
+#include "str.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define BUFSIZE 2048
+
+int test_file(FILE *input, int argc, char **argv) {
+    char buf[BUFSIZE];
+    char buf2[BUFSIZE];
+    char buf3[BUFSIZE];
+    unsigned int opts = 0;
+    unsigned int cap = 0,
+                 i;
+    enum getlongopt_ret ret;
+    struct getlongopt_opt *opt = NULL;
+    struct getlongopt *parser = NULL;
+    int verbose = 0;
+    unsigned int line = 0;
+
+    if ((argc == 2) && (!str_cmp(argv[1], "-v"))) {
+        verbose = 1;
+    }
+
+    while (fgets(buf, BUFSIZE, input)) {
+        line++;
+        str_rtrim(buf);
+        if (verbose) {
+            printf("> %s\n", buf);
+        }
+        if (!str_ncmp(buf, "option", str_len("option"))) {
+            /* add new option */
+            if (opts >= cap) {
+                void *ptr;
+                if ((ptr = realloc(opt, (2 * cap + 1) * sizeof(*opt)))) {
+                    opt = ptr;
+                    cap = 2 * cap + 1;
+                } else {
+                    perror(*argv);
+                    return 0;
+                }
+            }
+
+            if ((sscanf(buf + str_len("option"), "%s %c %d %d", buf2, 
+                &opt[opts].shortname, (int*) &opt[opts].argument, 
+                &opt[opts].id) == 4) 
+              && (opt[opts].longname = str_dup(buf2))) {
+                if (verbose) {
+                    printf("added %s %c %s id %d\n", opt[opts].longname, 
+                      opt[opts].shortname,
+                      opt[opts].argument == GETLONGOPT_ARG_NONE ? "no arg" 
+                        : opt[opts].argument == GETLONGOPT_ARG_REQUIRED 
+                          ? "arg req" 
+                            : opt[opts].argument == GETLONGOPT_ARG_OPTIONAL 
+                              ? "arg opt" : "arg unknown", opt[opts].id);
+                }
+                opts++;
+            } else {
+                buf[str_len(buf) - 1] = '\0';
+                fprintf(stderr, "failed to parse '%s'\n", buf);
+            }
+        } else if (!str_cmp(buf, "print")) {
+            for (i = 0; i < opts; i++) {
+                printf("%s %c %s (%d) id %d\n", opt[i].longname, 
+                  opt[i].shortname,
+                  opt[i].argument == GETLONGOPT_ARG_NONE ? "no arg" 
+                    : opt[i].argument == GETLONGOPT_ARG_REQUIRED ? "arg req" 
+                      : opt[i].argument == GETLONGOPT_ARG_OPTIONAL ? "arg opt" 
+                        : "arg unknown", opt[i].argument, opt[i].id);
+            }
+        } else if (!str_cmp(buf, "clear")) {
+            for (i = 0; i < opts; i++) {
+                free((char *) opt[i].longname);
+            }
+            opts = 0;
+            if (verbose) {
+                printf("cleared\n");
+            }
+        } else if (!str_ncmp(buf, "parse", str_len("parse"))) {
+            /* parse the line */
+            unsigned int splitargs;
+            char **splitarg;
+            int id;
+            const char *arg;
+
+            if ((splitarg 
+              = str_split(buf + str_len("parse"), " \t\n\f\r", &splitargs))
+              && (parser = getlongopt_new(splitargs, (const char **) splitarg, 
+                 opt, opts))) {
+
+                while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+                    printf("parsed id %d (", id);
+                    for (i = 0; i < opts; i++) {
+                        if (opt[i].id == id) {
+                            printf("%s", opt[i].longname);
+                        }
+                    }
+                    printf(") ");
+                    if (isprint(id)) {
+                        printf("(%c)", id);
+                    }
+
+                    if (arg) {
+                        printf("arg '%s'\n", arg);
+                    } else {
+                        printf("\n");
+                    }
+                }
+
+                for (i = getlongopt_optind(parser); i < splitargs; i++) {
+                    printf("parsed arg %s\n", splitarg[i]);
+                }
+
+                if (ret != GETLONGOPT_END) {
+                    fprintf(stderr, "didn't end, got %d instead\n", ret);
+                }
+
+                free(splitarg);
+                getlongopt_delete(parser);
+            } else {
+                perror(*argv);
+                return 0;
+            }
+        } else if (!str_ncmp(buf, "check", str_len("check"))) {
+            /* parse the line */
+            unsigned int splitargs;
+            char **splitarg;
+            int id,
+                scan_id;
+            const char *arg;
+
+            if ((splitarg 
+              = str_split(buf + str_len("check"), " \t\n\f\r", &splitargs))
+              && (parser = getlongopt_new(splitargs, (const char **) splitarg, 
+                  opt, opts))) {
+
+                ret = GETLONGOPT_OK;
+
+                while ((ret == GETLONGOPT_OK) 
+                  && ((ret = getlongopt(parser, &id, &arg)), 1)
+                  && (fgets(buf3, BUFSIZE, input))
+                  && (++line)
+                  && (sscanf(buf3, "%s", buf2) == 1)) {
+
+                    if (!str_ncmp(buf2, "OK", str_len("OK"))) {
+
+                        if ((ret == GETLONGOPT_OK)
+                          && (buf2[0] = '\0', 1)
+                          && (sscanf(buf3, "%s %d %s", buf, &scan_id, buf2)
+                            >= 2)) {
+                            if ((scan_id == id) 
+                              && ((!arg && !str_len(buf2)) 
+                                || (!str_cmp(arg, buf2)))) {
+
+                                /* matched */
+                                if (verbose) {
+                                    printf("checked OK %d '%s'\n", id, arg);
+                                }
+                            } else {
+                                if (scan_id != id) {
+                                    fprintf(stderr, "expecting id %d, got %d\n",
+                                      id, scan_id);
+                                }
+                                if (str_cmp(arg, buf2)) {
+                                    fprintf(stderr, 
+                                      "expecting arg '%s', got '%s'\n", buf2, 
+                                      arg);
+                                } 
+                            }
+                        } else {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        }
+                    } else if (!str_cmp(buf2, "END")) {
+                        if (ret != GETLONGOPT_END) {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        } else if (verbose) {
+                            printf("checked %s\n", buf2);
+                        }
+                    } else if (!str_cmp(buf2, "UNKNOWN")) {
+                        if (ret != GETLONGOPT_UNKNOWN) {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        } else if (verbose) {
+                            printf("checked %s\n", buf2);
+                        }
+                    } else if (!str_cmp(buf2, "MISSING_ARG")) {
+                        if (ret != GETLONGOPT_MISSING_ARG) {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        } else if (verbose) {
+                            printf("checked %s\n", buf2);
+                        }
+                    } else if (!str_cmp(buf2, "ERR")) {
+                        if (ret != GETLONGOPT_ERR) {
+                            fprintf(stderr, 
+                              "expected %s, got %d line %u\n", buf2, ret,
+                              line);
+                        } else if (verbose) {
+                            printf("checked %s\n", buf2);
+                        }
+                    } else {
+                        fprintf(stderr, "unknown error '%s'\n", buf2);
+                        return 0;
+                    }
+                }
+
+                free(splitarg);
+                getlongopt_delete(parser);
+            } else {
+                perror(*argv);
+                return 0;
+            }
+        } else if ((str_len(buf) > 0) && (*str_ltrim(buf) != '#')) {
+            printf("command '%s' not understood\n", buf);
+        }
+    }
+
+    if (opt) {
+        for (i = 0; (i < opts) && opt; i++) {
+            free((char *) opt[i].longname);
+        }
+        free(opt);
+    }
+
+    return 1;
+}
+
diff --git a/src/test/getlongopt_1.cases b/src/test/getlongopt_1.cases
new file mode 100644 (file)
index 0000000..94ed261
--- /dev/null
@@ -0,0 +1,155 @@
+# test cases for getlongopt
+#
+# commands are:
+#   option longname shortname arg id -- adds an option to the current list, where:
+#     longname is the string to match (to match '--blah' use 'blah')
+#     shortname is the character to match (to match '-v' use v)
+#     arg is whether to require an argument, with 0 == no argument, 
+#       1 == required argument, 2 == optional argument
+#     id is the number to return when this option is matched
+#
+#   print -- prints the current options
+#
+#   clear -- clears the current options
+#
+#   parse options* -- prints out a parsed representation of options provided
+#
+#   check options* -- verifies that the parsed representation of the
+#     options is the same as the options listed on the next few lines.
+#     Next line must be number of options expected (by itself).
+#     Subsequent lines are of the form 'ret [id arg]' ret is the
+#     return value from getlongopt ('OK' or 'UNKNOWN' etc) and id is the id
+#     number of the expected option, and arg is the expected argument string.
+#     Comments are not currently supported within these lines
+#
+#   # comment -- its a comment (must be on its own line)
+#
+# written nml 2004-06-07
+
+# some options to play with
+option blah b 0 101
+option foo f 1 102
+option bar r 2 103
+
+# some simple tests
+
+check
+END
+
+check -b
+OK 101
+END
+
+check --blah
+OK 101
+END
+
+check -r
+OK 103
+END
+
+check -f
+MISSING_ARG
+
+check --foo
+MISSING_ARG
+
+check -a
+UNKNOWN
+
+check --unknown
+UNKNOWN
+
+check -b arg
+OK 101
+END
+
+check -r arg
+OK 103 arg
+END
+
+check -br
+OK 101
+OK 103
+END
+
+check -bf arg
+OK 101
+OK 102 arg
+END
+
+check -bf
+OK 101
+MISSING_ARG
+
+# check all argument passing syntax quirks
+
+check -f arg
+OK 102 arg
+END
+
+check --foo arg
+OK 102 arg
+END
+
+check --foo=arg
+OK 102 arg
+END
+
+# check ambiguity resolution
+
+check --bar -b
+OK 103 
+OK 101
+END
+
+check --bar --blah
+OK 103 
+OK 101
+END
+
+check --bar arg
+OK 103 arg
+END
+
+# bigger test
+
+check --foo arg --bar=stuff -b -f arg --bar arg --bar --blah --blah
+OK 102 arg
+OK 103 stuff
+OK 101
+OK 102 arg
+OK 103 arg
+OK 103
+OK 101
+OK 101
+END
+
+# obscure stuff with - and --
+
+check -
+END
+
+check -b -
+OK 101
+END
+
+check - -b
+END
+
+check -f -
+OK 102 -
+END
+
+check --bar -
+OK 103 -
+END
+
+check -b -- -b
+OK 101
+END
+
+check --bar --
+OK 103
+END
+
diff --git a/src/test/heap_1.c b/src/test/heap_1.c
new file mode 100644 (file)
index 0000000..be2d523
--- /dev/null
@@ -0,0 +1,94 @@
+/* heap_1.c tests the heap code by using it to heapsort.  The input
+ * format is a simple line based format:
+ *
+ * # comment
+ * nel seed
+ *
+ * lines starting with hash are treated as comments and ignored.
+ * other lines should contain one or two unsigned integers.  nel gives
+ * the number of elements to sort and seed gives a random seed to use
+ * (XXX: should really write a simple random number generator to
+ * ensure the same sequence is generated in all locations)
+ *
+ * written nml 2003-02-25
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "test.h"
+
+#include "heap.h"
+#include "str.h"
+#include "lcrand.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static void fillarr(unsigned int *arr, unsigned int elements, 
+  unsigned int seed) {
+    unsigned int i;
+    struct lcrand *rand = lcrand_new(seed);
+
+    assert(rand);
+
+    for (i = 0; i < elements; i++) {
+        arr[i] = lcrand(rand) % (elements << 1);
+    }
+
+    return;
+}
+
+static int cmp_int(const void *vone, const void *vtwo) {
+    const unsigned int *one = vone,
+                       *two = vtwo;
+
+    if (*two < *one) {
+        return 1;
+    } else if (*one < *two) {
+        return -1;
+    } else {
+        return 0;
+    }
+}
+
+int test_file(FILE *fp, int argc, char **argv) {
+    char buf[1024];
+    char *ptr;
+    unsigned int nel,
+                 seed,
+                 *arr;
+
+    while (fgets((char *) buf, 1023, fp)) {
+        ptr = (char *) str_ltrim(buf);
+        str_rtrim(ptr);
+
+        if (*ptr == '#') {
+            /* its a comment, ignore it */
+        } else if (sscanf((char *) ptr, "%u %u", &nel, &seed) == 2) {
+            
+            if (!(arr = malloc(sizeof(*arr) * nel))) {
+                fprintf(stderr, "can't get memory\n");
+            }
+
+            fillarr(arr, nel, seed);
+
+            /* sort */
+            heap_sort(arr, nel, nel, sizeof(*arr), cmp_int);
+
+            if (!heap_issorted(arr, nel, sizeof(*arr), cmp_int, 0)) {
+                printf("arr is not sorted (nel %u seed %u)!\n", nel, seed);
+            } 
+
+            free(arr);
+
+        } else if (str_len(ptr)) {
+            fprintf(stderr, "couldn't understand '%s'\n", (char *) ptr);
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
diff --git a/src/test/heap_1.cases b/src/test/heap_1.cases
new file mode 100644 (file)
index 0000000..37728ab
--- /dev/null
@@ -0,0 +1,33 @@
+# this file contains unit tests for the heap module.  See heap_1.c for
+# more details.
+#
+# apart from comments, it accepts lines of the form: 
+# 
+#   nel seed
+#
+# where nel and seed are both unsigned integers, indicating the number
+# of elements and a random seed to apply when sorting.  These tests
+# proceed by using the heap to perform a heapsort and then testing
+# whether its correctly sorted.
+#
+# written nml 2003-02-25
+
+10000 0
+10000 1
+10000 2
+10000 3
+10000 4
+10000 5
+10000 6
+10000 7
+10000 8
+10000 9
+
+100000 29234
+100000 43977
+100000 12785
+100000 52609
+100000 12097
+100000 09789
+
+
diff --git a/src/test/iobtree_1.c b/src/test/iobtree_1.c
new file mode 100644 (file)
index 0000000..143ab93
--- /dev/null
@@ -0,0 +1,476 @@
+/* iobtree_1.c is a unit test for the iobtree module.  Its pretty
+ * general, intended to test the btree as a black-box datastructure
+ * Input format is:
+ *
+ * # comments
+ * command params
+ *
+ * commands are:
+ *
+ *   new name pagesize leaftype nodetype: 
+ *     create a new btree with page size pagesize, leaftype and nodetype specify
+ *     the leaf and node strategies respectively
+ *
+ *   add term veclen: 
+ *     add a new term (term) to the btree with vector length veclen
+ *     and contents vector.  succeed is an integer indicating whether
+ *     the operation should succeed or not.  Note that the vector cannot 
+ *     start with whitespace.
+ *
+ *   ls numterms [term veclen vector]*:
+ *     list the contents (in order) of the btree.  There should be
+ *     numterms entries.  Each entry is a whitespace delimited term
+ *     listing, vector length and then vector.
+ *
+ *   set term veclen vector:
+ *     set the vector for a term.  The allocated length should be
+ *     veclen at the time else the operation will fail.
+ *
+ *   realloc term newlen:
+ *     change the space allocated to a term to newlen.  succeed
+ *     indicates whether the operation should succeed.
+ *
+ *   rm term succeed
+ *     remove a term from the btree.  succeed indicates whether the
+ *     operation should succeed (try removing nonexistant terms)
+ *
+ *   append term
+ *     like add, except that term must be lexically the largest in the tree, and
+ *     should be more efficient
+ *
+ *   print
+ *     print out current state of the btree and other debug info
+ *
+ * there is a length limit 65535 on terms and vectors.  Commands
+ * should be put on a line by themselves, like this:
+ *
+ * # this is a comment, followed by a couple of commands
+ * new
+ *   case01 50 1 1
+ * add 
+ *   term1 10 xxxxxxxxxx 1
+ *
+ * written nml 2003-10-13
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "test.h"
+
+#include "iobtree.h"
+#include "fdset.h"
+#include "freemap.h"
+#include "getmaxfsize.h"
+#include "getlongopt.h"
+#include "str.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+
+/* this stuff is for open */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* XXX: dodgy local declaration of debugging function */
+int iobtree_print_index(struct iobtree *btree);
+
+struct params {
+    int verbose;
+};
+
+static int addfile(void *opaque, unsigned int file, unsigned int *maxsize) {
+    int fd;
+    struct fdset *fds = opaque;
+
+    if (((fd = fdset_create(fds, 0, file)) >= 0)
+      && getmaxfsize(fd, UINT_MAX, maxsize)
+      && (fdset_unpin(fds, 0, file, fd) == FDSET_OK)) {
+        return 1;
+    }
+
+    return 0;
+}
+
+static int parse_params(int argc, char **argv, struct params *params) {
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    enum getlongopt_ret ret;     /* return value from option parser */
+
+    struct getlongopt_opt opts[] = {
+        {"input", '\0', GETLONGOPT_ARG_REQUIRED, 'i'},
+        {"verbose", 'v', GETLONGOPT_ARG_NONE, 'v'}
+    };
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(stderr, "failed to initialise options parser\n");
+        return 0;
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case 'i':
+            /* ignore */
+            break;
+
+        case 'v':
+            /* verbose */
+            params->verbose = 1;
+            break;
+
+        default: assert(0);
+        }
+    }
+
+    getlongopt_delete(parser);
+    return 1;
+}
+
+int test_file(FILE *fp, int argc, char **argv) {
+    char buf[65535 + 1];
+    char *pos;
+    struct params params = {0};
+    char name[256];
+    int leaf_strategy,
+        node_strategy,
+        write;
+    struct iobtree *btree = NULL;
+    struct fdset *fd = NULL;
+    struct freemap *map = NULL;
+    unsigned int i,
+                 len;
+
+    name[0] = '\0';
+
+    if (!parse_params(argc, argv, &params)) {
+        fprintf(stderr, "failed to parse params\n");
+        return 0;
+    }
+
+    while (fgets((char*) buf, 65535, fp)) {
+        str_rtrim(buf);
+        pos = (char *) str_ltrim(buf);
+
+        if (!str_casecmp(pos, "new")) {
+            /* creating a new btree */
+            unsigned int size = -1;
+
+            if (btree) {
+                iobtree_delete(btree);
+            }
+            if (map) {
+                freemap_delete(map);
+            }
+            if (fd) {
+                i = 0;
+                while ((fdset_name(fd, 0, i, name, 256, &len, &write) 
+                  == FDSET_OK) && (name[len] = '\0', unlink(name) == 0)) {
+                    i++;
+                }
+                fdset_delete(fd);
+            }
+
+            /* read parameters */
+            if ((fscanf(fp, "%255s %u %d %d", name, &size, &leaf_strategy, 
+                &node_strategy) == 4)
+              && (fd = fdset_new(0644, 0))
+              && (fdset_set_type_name(fd, 0, "iobtree", str_len("iobtree"), 1) 
+                == FDSET_OK)
+              && (map = freemap_new(FREEMAP_STRATEGY_FIRST, 0, fd, addfile))
+              && (btree = iobtree_new(size, leaf_strategy, node_strategy, map, 
+                  fd, 0))) {
+
+                /* succeeded, do nothing */
+            } else {
+                fprintf(stderr, "%s: failed to create btree\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "add")) {
+            /* adding a term to the btree */
+            void *ret;
+            unsigned int veclen,
+                         len;
+            int toobig;
+            unsigned int tmplen;
+
+            if (!btree) { return 0; }
+
+            /* read parameters */
+            veclen = 0;
+            if (((tmplen = fscanf(fp, "%65535s %u", buf, &veclen)) == 2) 
+              && (veclen <= 65535)) {
+
+                len = str_len(buf);
+                if ((ret = iobtree_alloc(btree, buf, len, veclen, &toobig))) {
+                    /* do nothing */
+                    if (params.verbose) {
+                        printf("added term %s\n", buf);
+                    }
+                } else {
+                    fprintf(stderr, 
+                      "%s: failed to add '%s' (len %u data %u) to btree\n", 
+                      name, buf, (unsigned int) str_len(buf), veclen);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to add '%s' (%u, %u)\n", name, buf, 
+                  veclen, tmplen);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "append")) {
+            /* appending a term to the btree */
+            void *ret;
+            unsigned int veclen,
+                         len;
+            int toobig;
+            unsigned int tmplen;
+
+            if (!btree) { return 0; }
+
+            /* read parameters */
+            veclen = 0;
+            if (((tmplen = fscanf(fp, "%65535s %u", buf, &veclen)) == 2) 
+              && (veclen <= 65535)) {
+
+                len = str_len(buf);
+                if ((ret = iobtree_append(btree, buf, len, veclen, &toobig))) {
+                    /* do nothing */
+                    if (params.verbose) {
+                        printf("added term %s\n", buf);
+                    }
+                } else {
+                    fprintf(stderr, 
+                      "%s: failed to add '%s' (len %u data %u) to btree\n", 
+                      name, buf, (unsigned int) str_len(buf), veclen);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to add '%s' (%u, %u)\n", name, buf, 
+                  veclen, tmplen);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "ls")) {
+            /* matching stuff in the btree */
+            unsigned int numterms,
+                         i,
+                         len,
+                         veclen,
+                         veclen2,
+                         state[3];
+            void *addr;
+            const char *term;
+            int intret;
+
+            state[0] = state[1] = state[2] = 0;
+
+            if (!btree) { return 0; }
+
+            /* iterate along terms in btree, comparing with those given */
+            if ((intret = fscanf(fp, "%u", &numterms)) 
+              && (iobtree_size(btree) == numterms)) {
+                char *tmpstr;
+
+                /* now, take terms from file, comparing them with btree 
+                 * entries */
+                for (i = 0; i < numterms; i++) {
+                    if ((term = iobtree_next_term(btree, state, &len, &addr, 
+                        &veclen)) 
+                      && fscanf(fp, "%65535s %u ", buf, &veclen2)
+                      && (len == str_len(buf))
+                      && !str_ncmp(buf, term, len)
+                      && (tmpstr = str_dup(buf))) {
+                        /* compare vectors */
+                        if (fread(buf, veclen, 1, fp)
+                          && (veclen == veclen2)
+                          && !memcmp(buf, addr, veclen)) {
+
+                            /* locate it through _find and compare again */
+                            if ((addr = iobtree_find(btree, tmpstr, 
+                                str_len(tmpstr), 0, &veclen))
+                              && (veclen == veclen2)
+                              && !memcmp(buf, addr, veclen)) {
+                                /* do nothing */
+                            } else {
+                                unsigned int j;
+
+                                fprintf(stderr, "%s: ls failed finding term ", 
+                                  name);
+                                for (j = 0; j < len; j++) {
+                                    putc(term[j], stderr);
+                                }
+                                fprintf(stderr, "\n");
+                                return 0;
+                            }
+                        } else {
+                            unsigned int j;
+
+                            fprintf(stderr, 
+                              "%s: ls: different content for term ", name);
+                            for (j = 0; j < len; j++) {
+                                putc(term[j], stderr);
+                            }
+                            putc(':', stderr);
+                            putc(' ', stderr);
+                            for (j = 0; j < veclen; j++) {
+                                putc(((const char *) addr)[j], stderr);
+                            }
+                            fprintf(stderr, " vs %s\n", buf);
+                            return 0;
+                        }
+                        free(tmpstr);
+                    } else {
+                        unsigned int j;
+
+                        fprintf(stderr, "%s: ls failed on term ", name);
+                        for (j = 0; j < len; j++) {
+                            putc(term[j], stderr);
+                        }
+                        fprintf(stderr, " vs %s\n", buf);
+                        return 0;
+                    }
+                }
+
+                if (params.verbose) {
+                    printf("successfully matched %u terms\n", numterms);
+                }
+            } else if (intret) {
+                fprintf(stderr, "numterms different than in btree (%u vs %u)\n",
+                  numterms, iobtree_size(btree));
+                return 0;
+            } else {
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "set")) {
+            /* setting the vector for a term in the btree */
+            unsigned int veclen,
+                        reallen;
+            void *addr;
+
+            if (!btree) { return 0; }
+
+            /* read parameters */
+            if ((fscanf(fp, "%65535s %u ", buf, &veclen) == 2) 
+              && (veclen <= 65535)) {
+
+                addr = iobtree_find(btree, buf, str_len(buf), 1, &reallen);
+
+                if (addr && (reallen == veclen) 
+                  && fread(addr, 1, veclen, fp)) {
+                    /* do nothing */
+                } else {
+                    fprintf(stderr, "%s: failed to set '%s'!\n", name, buf);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to set '%s'\n", name, buf);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "realloc")) {
+            /* reallocating a term in the btree */
+            unsigned int veclen;
+            int toobig;
+
+            if (!btree) { return 0; }
+
+            /* read parameters */
+            if ((fscanf(fp, "%65535s %u", buf, &veclen) == 2) 
+              && (veclen <= 65535)) {
+
+                if (!iobtree_realloc(btree, buf, 
+                  str_len(buf), veclen, 
+                  &toobig)) {
+                    fprintf(stderr, "%s: failed to realloc!\n", name);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to realloc\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "rm")) {
+            /* removing something from the btree */
+            unsigned int succeed;
+            int intret;
+
+            if (!btree) { return 0; }
+
+            if (fscanf(fp, "%65535s %u", buf, &succeed) == 2) {
+                if ((!(intret 
+                      = iobtree_remove(btree, buf, str_len(buf))) 
+                    && succeed) 
+                  || (intret && !succeed)) {
+                    fprintf(stderr, "%s: failed to rm '%s'\n", name, buf);
+                    return 0;
+                }
+            } else {
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "print")) {
+            /* printing out the btree contents */
+            unsigned int state[3] = {0, 0, 0},
+                         len,
+                         veclen;
+            const char *term;
+            char format[100];
+            void *addr;
+
+            if (!btree) { 
+                printf("can't print, no btree\n");
+            } else {
+                do {
+                    unsigned int i;
+
+                    term 
+                      = iobtree_next_term(btree, state, &len, &addr, &veclen);
+
+                    for (i = 0; term && i < len; i++) {
+                        fputc(term[i], stdout);
+                    }
+                } while (term 
+                  && memcpy(buf, term, len)
+                  && ((buf[len] = '\0') || 1)
+                  && snprintf(format, 100, "(%%u): '%%.%us' (%%u)\n", veclen)
+                  && printf(format, len, (char *) addr, veclen));
+
+                if (!state) {
+                    printf("(empty)\n");
+                }
+
+                printf("\nindex:\n");
+                iobtree_print_index(btree);
+
+                printf("%u entries\n\n", iobtree_size(btree));
+            }
+        } else if ((*pos != '#') && str_len(pos)) {
+            fprintf(stderr, "%s: unknown command '%s'\n", name, pos);
+            return 0;
+        }
+    }
+
+    if (btree) {
+        iobtree_delete(btree);
+    }
+    if (map) {
+        freemap_delete(map);
+    }
+    if (fd) {
+        i = 0;
+        while ((fdset_name(fd, 0, i, name, 256, &len, &write) 
+          == FDSET_OK) && (name[len] = '\0', unlink(name) == 0)) {
+            i++;
+        }
+        fdset_delete(fd);
+    }
+
+    return 1;
+}
+
diff --git a/src/test/iobtree_1.cases b/src/test/iobtree_1.cases
new file mode 100644 (file)
index 0000000..0a11bbb
--- /dev/null
@@ -0,0 +1,5571 @@
+# (see iobtree_1.c for more detail), format is:
+#
+# # comments
+# command params
+# 
+# commands are:
+#
+#   new name pagesize leaftype nodetype: 
+#
+#   add term veclen: 
+#
+#   ls numterms [term veclen vector]*:
+#
+#   set term veclen vector:
+#
+#   realloc term newlen:
+#
+#   rm term succeed
+#
+#   print
+
+new
+       basic 50 1 1
+add
+       blah 5
+set
+       blah 5 11111
+add
+       foo 6
+set
+       foo 6 222222
+add
+       bar 8
+set
+       bar 8 33333333
+add
+       bang 3
+set
+       bang 3 444
+add
+       hash 7
+set 
+       hash 7 5555555
+add
+       the 9
+set
+       the 9 666666666
+add
+       and 7
+set
+       and 7 7777777
+add
+       stop 7
+set
+       stop 7 8888888
+add
+       list 8
+set
+       list 8 99999999
+ls
+       9
+       and 7 7777777
+       bang 3 444
+       bar 8 33333333
+       blah 5 11111
+       foo 6 222222
+       hash 7 5555555
+       list 8 99999999
+       stop 7 8888888
+       the 9 666666666
+
+new
+       basic_append 50 1 1
+append
+       and 7
+set
+       and 7 7777777
+append
+       bang 3
+set
+       bang 3 444
+append
+       bar 8
+set
+       bar 8 33333333
+append
+       blah 5
+set
+       blah 5 11111
+append
+       foo 6
+set
+       foo 6 222222
+append
+       hash 7
+set 
+       hash 7 5555555
+append
+       list 8
+set
+       list 8 99999999
+append
+       stop 7
+set
+       stop 7 8888888
+append
+       the 9
+set
+       the 9 666666666
+ls
+       9
+       and 7 7777777
+       bang 3 444
+       bar 8 33333333
+       blah 5 11111
+       foo 6 222222
+       hash 7 5555555
+       list 8 99999999
+       stop 7 8888888
+       the 9 666666666
+
+new
+       fromjohn1 4096 1 1
+add
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4 0000
+add
+       http://www.npr.gov:80/library/reports/intel07.html 4
+set
+       http://www.npr.gov:80/library/reports/intel07.html 4 0000
+add
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4
+set
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4 0000
+add
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4 0000
+add
+       http://www.objecttechnology.nl:80/ 4
+set
+       http://www.objecttechnology.nl:80/ 4 0000
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4 0000
+add
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4
+set
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4 0000
+add
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4
+set
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4 0000
+add
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4
+set
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4 0000
+add
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4
+set
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4 0000
+add
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4 0000
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4 0000
+add
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4 0000
+add
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4 0000
+add
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4 0000
+add
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4
+set
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4 0000
+add
+       http://www.nns.ru:80/persons/mashkov.html 4
+set
+       http://www.nns.ru:80/persons/mashkov.html 4 0000
+add
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4 0000
+add
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4 0000
+add
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4 0000
+add
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4 0000
+add
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4
+set
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4 0000
+add
+       http://www.nysite.com:80/westside/blocks/b72.htm 4
+set
+       http://www.nysite.com:80/westside/blocks/b72.htm 4 0000
+add
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4 0000
+add
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4 0000
+add
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4
+set
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4 0000
+add
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4 0000
+add
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4 0000
+add
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4 0000
+add
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4
+set
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4 0000
+add
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4 0000
+add
+       http://www.objectreality.com:80/osg/osgtrain.htm 4
+set
+       http://www.objectreality.com:80/osg/osgtrain.htm 4 0000
+add
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4
+set
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4 0000
+add
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4
+set
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4 0000
+add
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4 0000
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4 0000
+add
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4
+set
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4 0000
+add
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4 0000
+add
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4 0000
+add
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4
+set
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4 0000
+add
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4
+set
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4 0000
+add
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4 0000
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4 0000
+add
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4 0000
+add
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4 0000
+add
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4 0000
+add
+       http://www.npr.gov:80/library/reports/intelact.html 4
+set
+       http://www.npr.gov:80/library/reports/intelact.html 4 0000
+add
+       http://www.nns.ru:80/persons/medv.html 4
+set
+       http://www.nns.ru:80/persons/medv.html 4 0000
+add
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4 0000
+add
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4 0000
+add
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4 0000
+add
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4 0000
+add
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4 0000
+add
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4 0000
+add
+       http://www.nortel.com:80/wireless/omni_gif.html 4
+set
+       http://www.nortel.com:80/wireless/omni_gif.html 4 0000
+add
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4
+set
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4 0000
+add
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4 0000
+add
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4 0000
+add
+       http://www.nylp.com:80/ctyelb.htm 4
+set
+       http://www.nylp.com:80/ctyelb.htm 4 0000
+add
+       http://www.nysite.com:80/westside/blocks/b73.htm 4
+set
+       http://www.nysite.com:80/westside/blocks/b73.htm 4 0000
+add
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4
+set
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4 0000
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4 0000
+add
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4 0000
+add
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4 0000
+add
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4
+set
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4 0000
+add
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4
+set
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4 0000
+add
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4 0000
+add
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4 0000
+add
+       http://www.oberon.nl:80/xmas96/index.htm 4
+set
+       http://www.oberon.nl:80/xmas96/index.htm 4 0000
+add
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4
+set
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4 0000
+add
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4
+set
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4 0000
+add
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4 0000
+add
+       http://www.objectreality.com:80/osg/ol.htm 4
+set
+       http://www.objectreality.com:80/osg/ol.htm 4 0000
+add
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4 0000
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4 0000
+add
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4 0000
+add
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4 0000
+add
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4
+set
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4 0000
+add
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4 0000
+add
+       http://www.nns.ru:80/persons/medvser.html 4
+set
+       http://www.nns.ru:80/persons/medvser.html 4 0000
+add
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4 0000
+add
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4 0000
+add
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4 0000
+add
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4 0000
+add
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4
+set
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4 0000
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4 0000
+add
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4 0000
+add
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4 0000
+add
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4
+set
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4 0000
+add
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4
+set
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4 0000
+add
+       http://www.nylp.com:80/pparty2.htm 4
+set
+       http://www.nylp.com:80/pparty2.htm 4 0000
+add
+       http://severin.objectware.no:80/ 4
+set
+       http://severin.objectware.no:80/ 4 0000
+add
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4
+set
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4 0000
+add
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4 0000
+add
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4
+set
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4 0000
+add
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4 0000
+add
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4 0000
+add
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4
+set
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4 0000
+add
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4 0000
+add
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4 0000
+add
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4 0000
+add
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4
+set
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4 0000
+add
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4 0000
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4 0000
+add
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4 0000
+add
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4 0000
+add
+       http://www.objectreality.com:80/osg/otug.htm 4
+set
+       http://www.objectreality.com:80/osg/otug.htm 4 0000
+add
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4 0000
+add
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4 0000
+add
+       http://www.nns.ru:80/persons/merkush.html 4
+set
+       http://www.nns.ru:80/persons/merkush.html 4 0000
+add
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4 0000
+add
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4 0000
+add
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4 0000
+ls 
+       113
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4 0000
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4 0000
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4 0000
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4 0000
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4 0000
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4 0000
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4 0000
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4 0000
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4 0000
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4 0000
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4 0000
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4 0000
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4 0000
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4 0000
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4 0000
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4 0000
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4 0000
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4 0000
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4 0000
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4 0000
+       http://severin.objectware.no:80/ 4 0000
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4 0000
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4 0000
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4 0000
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4 0000
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4 0000
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4 0000
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4 0000
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4 0000
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4 0000
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4 0000
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4 0000
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4 0000
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4 0000
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4 0000
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4 0000
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4 0000
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4 0000
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4 0000
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4 0000
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4 0000
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4 0000
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4 0000
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4 0000
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4 0000
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4 0000
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4 0000
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4 0000
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4 0000
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4 0000
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4 0000
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4 0000
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4 0000
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4 0000
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4 0000
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4 0000
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4 0000
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4 0000
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4 0000
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4 0000
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4 0000
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4 0000
+       http://www.nns.ru:80/persons/mashkov.html 4 0000
+       http://www.nns.ru:80/persons/medv.html 4 0000
+       http://www.nns.ru:80/persons/medvser.html 4 0000
+       http://www.nns.ru:80/persons/merkush.html 4 0000
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4 0000
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4 0000
+       http://www.nortel.com:80/wireless/omni_gif.html 4 0000
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4 0000
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4 0000
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4 0000
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4 0000
+       http://www.npr.gov:80/library/reports/intel07.html 4 0000
+       http://www.npr.gov:80/library/reports/intelact.html 4 0000
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4 0000
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4 0000
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4 0000
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4 0000
+       http://www.nylp.com:80/ctyelb.htm 4 0000
+       http://www.nylp.com:80/pparty2.htm 4 0000
+       http://www.nysite.com:80/westside/blocks/b72.htm 4 0000
+       http://www.nysite.com:80/westside/blocks/b73.htm 4 0000
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4 0000
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4 0000
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4 0000
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4 0000
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4 0000
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4 0000
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4 0000
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4 0000
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4 0000
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4 0000
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4 0000
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4 0000
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4 0000
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4 0000
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4 0000
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4 0000
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4 0000
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4 0000
+       http://www.oberon.nl:80/xmas96/index.htm 4 0000
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4 0000
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4 0000
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4 0000
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4 0000
+       http://www.objectreality.com:80/osg/ol.htm 4 0000
+       http://www.objectreality.com:80/osg/osgtrain.htm 4 0000
+       http://www.objectreality.com:80/osg/otug.htm 4 0000
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4 0000
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4 0000
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4 0000
+       http://www.objecttechnology.nl:80/ 4 0000
+
+new
+       fromjohn2 4096 1 1
+add
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4 0001
+add
+       http://www.npr.gov:80/library/reports/intel07.html 4
+set
+       http://www.npr.gov:80/library/reports/intel07.html 4 0002
+add
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4
+set
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4 0003
+add
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4 0004
+add
+       http://www.objecttechnology.nl:80/ 4
+set
+       http://www.objecttechnology.nl:80/ 4 0005
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4 0006
+add
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4
+set
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4 0007
+add
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4
+set
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4 0008
+add
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4
+set
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4 0009
+add
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4
+set
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4 0010
+add
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4 0011
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4 0012
+add
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4 0013
+add
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4 0014
+add
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4 0015
+add
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4
+set
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4 0016
+add
+       http://www.nns.ru:80/persons/mashkov.html 4
+set
+       http://www.nns.ru:80/persons/mashkov.html 4 0017
+add
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4 0018
+add
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4 0019
+add
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4 0020
+add
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4 0021
+add
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4
+set
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4 0022
+add
+       http://www.nysite.com:80/westside/blocks/b72.htm 4
+set
+       http://www.nysite.com:80/westside/blocks/b72.htm 4 0023
+add
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4 0024
+add
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4 0025
+add
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4
+set
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4 0026
+add
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4 0027
+add
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4 0028
+add
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4 0029
+add
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4
+set
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4 0030
+add
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4 0031
+add
+       http://www.objectreality.com:80/osg/osgtrain.htm 4
+set
+       http://www.objectreality.com:80/osg/osgtrain.htm 4 0032
+add
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4
+set
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4 0033
+add
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4
+set
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4 0034
+add
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4 0035
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4 0036
+add
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4
+set
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4 0037
+add
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4 0038
+add
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4 0039
+add
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4
+set
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4 0040
+add
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4
+set
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4 0041
+add
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4 0042
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4 0043
+add
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4 0044
+add
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4 0045
+add
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4 0046
+add
+       http://www.npr.gov:80/library/reports/intelact.html 4
+set
+       http://www.npr.gov:80/library/reports/intelact.html 4 0047
+add
+       http://www.nns.ru:80/persons/medv.html 4
+set
+       http://www.nns.ru:80/persons/medv.html 4 0048
+add
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4 0049
+add
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4 0050
+add
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4 0051
+add
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4 0052
+add
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4 0053
+add
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4 0054
+add
+       http://www.nortel.com:80/wireless/omni_gif.html 4
+set
+       http://www.nortel.com:80/wireless/omni_gif.html 4 0055
+add
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4
+set
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4 0056
+add
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4 0057
+add
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4 0058
+add
+       http://www.nylp.com:80/ctyelb.htm 4
+set
+       http://www.nylp.com:80/ctyelb.htm 4 0059
+add
+       http://www.nysite.com:80/westside/blocks/b73.htm 4
+set
+       http://www.nysite.com:80/westside/blocks/b73.htm 4 0060
+add
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4
+set
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4 0061
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4 0062
+add
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4 0063
+add
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4 0064
+add
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4
+set
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4 0065
+add
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4
+set
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4 0066
+add
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4 0067
+add
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4 0068
+add
+       http://www.oberon.nl:80/xmas96/index.htm 4
+set
+       http://www.oberon.nl:80/xmas96/index.htm 4 0069
+add
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4
+set
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4 0070
+add
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4
+set
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4 0071
+add
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4 0072
+add
+       http://www.objectreality.com:80/osg/ol.htm 4
+set
+       http://www.objectreality.com:80/osg/ol.htm 4 0073
+add
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4 0074
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4 0075
+add
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4 0076
+add
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4 0077
+add
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4
+set
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4 0078
+add
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4 0079
+add
+       http://www.nns.ru:80/persons/medvser.html 4
+set
+       http://www.nns.ru:80/persons/medvser.html 4 0080
+add
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4 0081
+add
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4 0082
+add
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4 0083
+add
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4 0084
+add
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4
+set
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4 0085
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4 0086
+add
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4 0087
+add
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4 0088
+add
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4
+set
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4 0089
+add
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4
+set
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4 0090
+add
+       http://www.nylp.com:80/pparty2.htm 4
+set
+       http://www.nylp.com:80/pparty2.htm 4 0091
+add
+       http://severin.objectware.no:80/ 4
+set
+       http://severin.objectware.no:80/ 4 0092
+add
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4
+set
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4 0093
+add
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4 0094
+add
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4
+set
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4 0095
+add
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4 0096
+add
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4 0097
+add
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4
+set
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4 0098
+add
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4 0099
+add
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4 0100
+add
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4 0101
+add
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4
+set
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4 0102
+add
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4 0103
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4 0104
+add
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4 0105
+add
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4 0106
+add
+       http://www.objectreality.com:80/osg/otug.htm 4
+set
+       http://www.objectreality.com:80/osg/otug.htm 4 0107
+add
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4 0108
+add
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4 0109
+add
+       http://www.nns.ru:80/persons/merkush.html 4
+set
+       http://www.nns.ru:80/persons/merkush.html 4 0110
+add
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4 0111
+add
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4 0112
+add
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4 0113
+add
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0615.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0615.htm 4 0114
+add
+       http://www.nortel.com:80/cool/supply_mgt/UK_Paign.html 4
+set
+       http://www.nortel.com:80/cool/supply_mgt/UK_Paign.html 4 0115
+add
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=campanas.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=campanas.html/SID=769425689 4 0116
+add
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/stnfrd.htm/map 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/stnfrd.htm/map 4 0117
+add
+       http://www.newstimes.com:80/archive/dec1296/tvg.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tvg.htm 4 0118
+add
+       http://www.nznewsuk.co.uk:80/12jun96/front.html 4
+set
+       http://www.nznewsuk.co.uk:80/12jun96/front.html 4 0119
+add
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,6820_5,00.html 4
+set
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,6820_5,00.html 4 0120
+add
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/ad.htm 4
+set
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/ad.htm 4 0121
+add
+       http://www.nha.v2net.com:80/nhaNews/edit-subscribe.pl/music/11.html 4
+set
+       http://www.nha.v2net.com:80/nhaNews/edit-subscribe.pl/music/11.html 4 0122
+add
+       http://niteowl.net:80/homes1c.asp?propertyno=6932879 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=6932879 4 0123
+add
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.util.zip.Inflater.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.util.zip.Inflater.html 4 0124
+add
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/ardickey.html.cgi 4
+set
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/ardickey.html.cgi 4 0125
+add
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/agesglossary.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/agesglossary.html 4 0126
+add
+       http://severin.objectware.no:80/home/ow/english.htm 4
+set
+       http://severin.objectware.no:80/home/ow/english.htm 4 0127
+add
+       http://www.nflhome.com:80/vikings/club/media/yearkick.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yearkick.html 4 0128
+add
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1553.jpg 4
+set
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1553.jpg 4 0129
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:2 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:2 4 0130
+add
+       http://equinox.vtc.vsc.edu:80/info.html 4
+set
+       http://equinox.vtc.vsc.edu:80/info.html 4 0131
+add
+       http://c21-champions.com:80/office=50106/mort.html 4
+set
+       http://c21-champions.com:80/office=50106/mort.html 4 0132
+add
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/FNorling.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/FNorling.html 4 0133
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/sesseval.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/sesseval.html 4 0134
+add
+       http://epinet.org:80/ep0708-c.html 4
+set
+       http://epinet.org:80/ep0708-c.html 4 0135
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNUP_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNUP_local_variable 4 0136
+add
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan14.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan14.html 4 0137
+add
+       http://eprd.kpm.my:80/erangka.html 4
+set
+       http://eprd.kpm.my:80/erangka.html 4 0138
+add
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/ganz_neue_Bookmarks.html 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/ganz_neue_Bookmarks.html 4 0139
+add
+       http://shell.aros.net:80/reports/octanner/120796.html 4
+set
+       http://shell.aros.net:80/reports/octanner/120796.html 4 0140
+add
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/mlb/feat/archive/052896/mlb65943.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/mlb/feat/archive/052896/mlb65943.html 4 0141
+add
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Interval.i3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Interval.i3.html 4 0142
+add
+       http://ella.netpoint.net:80/empg/news/cpia.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/cpia.htm 4 0143
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00757.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00757.html 4 0144
+add
+       http://connectedpc.com:80/design/pricelst/21db2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21db2.htm 4 0145
+add
+       http://einstein.physics.drexel.edu:80/pages/students/wisniewski_old/ 4
+set
+       http://einstein.physics.drexel.edu:80/pages/students/wisniewski_old/ 4 0146
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/eric.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/eric.html 4 0147
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t275.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t275.html 4 0148
+add
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi2.html 4
+set
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi2.html 4 0149
+add
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+INFORMATION+alej-log.jan96 4
+set
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+INFORMATION+alej-log.jan96 4 0150
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9506/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9506/pap00.htm 4 0151
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0894.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0894.html 4 0152
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-kinkcorp.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-kinkcorp.html&v_prev=/sort-company.html&tracking_id=LE 4 0153
+add
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/GKohlhepp.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/GKohlhepp.html 4 0154
+add
+       http://emphase-10.yweb.com:80/070300de.html 4
+set
+       http://emphase-10.yweb.com:80/070300de.html 4 0155
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-208.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-208.html 4 0156
+add
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan15.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan15.html 4 0157
+add
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/noch_mehr_unsortierte_bookmarks.html 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/noch_mehr_unsortierte_bookmarks.html 4 0158
+add
+       http://c21-champions.com:80/office=50106/loanpack.html 4
+set
+       http://c21-champions.com:80/office=50106/loanpack.html 4 0159
+add
+       http://shell.aros.net:80/reports/octanner/121095.html 4
+set
+       http://shell.aros.net:80/reports/octanner/121095.html 4 0160
+add
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052896/phi37127.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052896/phi37127.html 4 0161
+add
+       http://ella.netpoint.net:80/empg/news/tek.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/tek.htm 4 0162
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00758.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00758.html 4 0163
+add
+       http://connectedpc.com:80/design/pricelst/21db6.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21db6.htm 4 0164
+add
+       http://einstein.physics.drexel.edu:80/pages/students/xing/ 4
+set
+       http://einstein.physics.drexel.edu:80/pages/students/xing/ 4 0165
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:4 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:4 4 0166
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/don.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/don.html 4 0167
+add
+       http://epinet.org:80/ep0701-c.html 4
+set
+       http://epinet.org:80/ep0701-c.html 4 0168
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/atndlist.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/atndlist.html 4 0169
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNDN_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNDN_local_variable 4 0170
+add
+       http://eprd.kpm.my:80/emape.html 4
+set
+       http://eprd.kpm.my:80/emape.html 4 0171
+add
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Trapezoid.i3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Trapezoid.i3.html 4 0172
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0895.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0895.html 4 0173
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t280.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t280.html 4 0174
+add
+       http://epcc.ed.ac.uk:80/ssp/Applications.html 4
+set
+       http://epcc.ed.ac.uk:80/ssp/Applications.html 4 0175
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/onepgfacts/onepgfacts.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/onepgfacts/onepgfacts.html 4 0176
+add
+       http://emphase-10.yweb.com:80/070303de.html 4
+set
+       http://emphase-10.yweb.com:80/070303de.html 4 0177
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-209.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-209.html 4 0178
+add
+       http://ella.netpoint.net:80/empg/news/wsa.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/wsa.htm 4 0179
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb24341.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb24341.html 4 0180
+add
+       http://einstein.physics.drexel.edu:80/pages/students/zlatev/ 4
+set
+       http://einstein.physics.drexel.edu:80/pages/students/zlatev/ 4 0181
+add
+       http://shell.aros.net:80/reports/octanner/121496.html 4
+set
+       http://shell.aros.net:80/reports/octanner/121496.html 4 0182
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-week:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-week:1 4 0183
+add
+       http://epinet.org:80/ep0624-c.html 4
+set
+       http://epinet.org:80/ep0624-c.html 4 0184
+add
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan4.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan4.html 4 0185
+add
+       http://c21-champions.com:80/office=50106/usmap.map 4
+set
+       http://c21-champions.com:80/office=50106/usmap.map 4 0186
+add
+       http://connectedpc.com:80/design/pricelst/21dba.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dba.htm 4 0187
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-lockheed.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-lockheed.html&v_prev=/sort-company.html&tracking_id=LE 4 0188
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNTP_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNTP_local_variable 4 0189
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/andy.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/andy.html 4 0190
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/introcnf.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/introcnf.html 4 0191
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0900.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0900.html 4 0192
+add
+       http://enterprise.mathematik.uni-essen.de:80/enterprise 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/enterprise 4 0193
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00759.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00759.html 4 0194
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t283.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t283.html 4 0195
+add
+       http://equity.wharton.upenn.edu:80/ 4
+set
+       http://equity.wharton.upenn.edu:80/ 4 0196
+add
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/cub/feat/archive/052896/cub24714.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/cub/feat/archive/052896/cub24714.html 4 0197
+add
+       http://emphase-10.yweb.com:80/070305de.html 4
+set
+       http://emphase-10.yweb.com:80/070305de.html 4 0198
+add
+       http://shell.aros.net:80/reports/octanner/121795.html 4
+set
+       http://shell.aros.net:80/reports/octanner/121795.html 4 0199
+add
+       http://ella.netpoint.net:80/empg/news/eta.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/eta.htm 4 0200
+add
+       http://connectedpc.com:80/design/pricelst/21dbe.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dbe.htm 4 0201
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-210.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-210.html 4 0202
+add
+       http://c21-champions.com:80/office=50106/bytim2.html 4
+set
+       http://c21-champions.com:80/office=50106/bytim2.html 4 0203
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-history:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-history:1 4 0204
+add
+       http://epinet.org:80/ep0617-c.html 4
+set
+       http://epinet.org:80/ep0617-c.html 4 0205
+add
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan5.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan5.html 4 0206
+add
+       http://eprd.kpm.my:80/admin.html 4
+set
+       http://eprd.kpm.my:80/admin.html 4 0207
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkmi-lamp/lkmi-lamp.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkmi-lamp/lkmi-lamp.html 4 0208
+add
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/saveinline.html 4
+set
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/saveinline.html 4 0209
+add
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/netobjrt/../uid/src/Common/TimeStamp.i3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/netobjrt/../uid/src/Common/TimeStamp.i3.html 4 0210
+add
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi3.html 4
+set
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi3.html 4 0211
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0897.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0897.html 4 0212
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00760.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00760.html 4 0213
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/josh.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/josh.html 4 0214
+add
+       http://shell.aros.net:80/reports/octanner/122296.html 4
+set
+       http://shell.aros.net:80/reports/octanner/122296.html 4 0215
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb26281.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb26281.html 4 0216
+add
+       http://ella.netpoint.net:80/empg/news/marine.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/marine.htm 4 0217
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/Helpful_Bookmarks.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/Helpful_Bookmarks.html 4 0218
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNBM_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNBM_local_variable 4 0219
+add
+       http://enterprise.mathematik.uni-essen.de:80/cgi-bin/man-cgi?tar 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/cgi-bin/man-cgi?tar 4 0220
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-macys.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-macys.html&v_prev=/sort-company.html&tracking_id=LE 4 0221
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t284.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t284.html 4 0222
+add
+       http://einstein.physics.drexel.edu:80/INPC-98/signatures.html 4
+set
+       http://einstein.physics.drexel.edu:80/INPC-98/signatures.html 4 0223
+add
+       http://emphase-10.yweb.com:80/070302de.html 4
+set
+       http://emphase-10.yweb.com:80/070302de.html 4 0224
+add
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/f95/ 4
+set
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/f95/ 4 0225
+add
+       http://connectedpc.com:80/design/pricelst/21dc2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dc2.htm 4 0226
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9407/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9407/pap00.htm 4 0227
+add
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan6.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan6.html 4 0228
+add
+       http://c21-champions.com:80/o=50134/x=21,2 4
+set
+       http://c21-champions.com:80/o=50134/x=21,2 4 0229
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/announ6-94.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/announ6-94.html 4 0230
+add
+       http://shell.aros.net:80/reports/octanner/122495.html 4
+set
+       http://shell.aros.net:80/reports/octanner/122495.html 4 0231
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sea/feat/archive/052896/sea35379.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sea/feat/archive/052896/sea35379.html 4 0232
+add
+       http://ella.netpoint.net:80/empg/news/king.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/king.htm 4 0233
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0898.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0898.html 4 0234
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00761.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00761.html 4 0235
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:2 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:2 4 0236
+add
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uuencode 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uuencode 4 0237
+add
+       http://epinet.org:80/ep0610-c.html 4
+set
+       http://epinet.org:80/ep0610-c.html 4 0238
+add
+       http://eprd.kpm.my:80/bmenkpm.html 4
+set
+       http://eprd.kpm.my:80/bmenkpm.html 4 0239
+add
+       http://eps.geo.titech.ac.jp:80/takahashilab/ronbun.html 4
+set
+       http://eps.geo.titech.ac.jp:80/takahashilab/ronbun.html 4 0240
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/marge_smith.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/marge_smith.html 4 0241
+add
+       http://cypress.ukc.ac.uk:2001/home/jf4/rtf/rtftohtml-2.7.5/docs/ 4
+set
+       http://cypress.ukc.ac.uk:2001/home/jf4/rtf/rtftohtml-2.7.5/docs/ 4 0242
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/rama.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/rama.html 4 0243
+add
+       http://enterprise.mathematik.uni-essen.de:80/mdw/LDP/nag/node92.html 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/mdw/LDP/nag/node92.html 4 0244
+add
+       http://c21-champions.com:80/o=50134/state=2/county=2/city=2/browse.cmd 4
+set
+       http://c21-champions.com:80/o=50134/state=2/county=2/city=2/browse.cmd 4 0245
+add
+       http://shell.aros.net:80/reports/octanner/122996.html 4
+set
+       http://shell.aros.net:80/reports/octanner/122996.html 4 0246
+add
+       http://epinet.org:80/ep0603-c.html 4
+set
+       http://epinet.org:80/ep0603-c.html 4 0247
+add
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan7.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan7.html 4 0248
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/lwi-lkon-abbr.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/lwi-lkon-abbr.html 4 0249
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/col/feat/archive/052896/col53341.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/col/feat/archive/052896/col53341.html 4 0250
+add
+       http://eps.geo.titech.ac.jp:80/takahashilab/staff/staff.html 4
+set
+       http://eps.geo.titech.ac.jp:80/takahashilab/staff/staff.html 4 0251
+add
+       http://ella.netpoint.net:80/empg/news/aquaquest.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/aquaquest.htm 4 0252
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0905.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0905.html 4 0253
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00762.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00762.html 4 0254
+add
+       http://connectedpc.com:80/design/pricelst/21dc6.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dc6.htm 4 0255
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:4 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:4 4 0256
+add
+       http://emphase-10.yweb.com:80/070306de.html 4
+set
+       http://emphase-10.yweb.com:80/070306de.html 4 0257
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t287.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t287.html 4 0258
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9507/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9507/pap00.htm 4 0259
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/surds196.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/surds196.html 4 0260
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_FSWAP_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_FSWAP_local_variable 4 0261
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mit.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mit.html&v_prev=/sort-company.html&tracking_id=LE 4 0262
+add
+       http://eprd.kpm.my:80/bmtim.html 4
+set
+       http://eprd.kpm.my:80/bmtim.html 4 0263
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/bill.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/bill.html 4 0264
+add
+       http://c21-champions.com:80/o=50134/x=19,2,1 4
+set
+       http://c21-champions.com:80/o=50134/x=19,2,1 4 0265
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/wasteupd.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/wasteupd.html 4 0266
+add
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan8.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan8.html 4 0267
+add
+       http://shell.aros.net:80/reports/octanner/123195.html 4
+set
+       http://shell.aros.net:80/reports/octanner/123195.html 4 0268
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0899.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0899.html 4 0269
+add
+       http://connectedpc.com:80/design/pricelst/21dca.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dca.htm 4 0270
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/512/512-112.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/512/512-112.html 4 0271
+add
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/det/feat/archive/052896/det3191.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/det/feat/archive/052896/det3191.html 4 0272
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00763.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00763.html 4 0273
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-week:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-week:1 4 0274
+add
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uudecode 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uudecode 4 0275
+add
+       http://epinet.org:80/ep0528-c.html 4
+set
+       http://epinet.org:80/ep0528-c.html 4 0276
+add
+       http://eprd.kpm.my:80/bsgkpm.html 4
+set
+       http://eprd.kpm.my:80/bsgkpm.html 4 0277
+add
+       http://ella.netpoint.net:80/empg/news/sos.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/sos.htm 4 0278
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/jack.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/jack.html 4 0279
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t289.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t289.html 4 0280
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9508/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9508/pap00.htm 4 0281
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_XFT_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_XFT_local_variable 4 0282
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jdspres/index.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jdspres/index.html 4 0283
+add
+       http://emphase-10.yweb.com:80/070304de.html 4
+set
+       http://emphase-10.yweb.com:80/070304de.html 4 0284
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-motorola.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-motorola.html&v_prev=/sort-company.html&tracking_id=LE 4 0285
+add
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Kabel/ 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Kabel/ 4 0286
+add
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/webnews.html 4
+set
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/webnews.html 4 0287
+add
+       http://c21-champions.com:80/o=50134/x=19,2,18 4
+set
+       http://c21-champions.com:80/o=50134/x=19,2,18 4 0288
+add
+       http://epcc.ed.ac.uk:80/Middle-Earth/ 4
+set
+       http://epcc.ed.ac.uk:80/Middle-Earth/ 4 0289
+add
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan9.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan9.html 4 0290
+add
+       http://eprd.kpm.my:80/bmdgkpm.html 4
+set
+       http://eprd.kpm.my:80/bmdgkpm.html 4 0291
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/factsheet/lampsfact.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/factsheet/lampsfact.html 4 0292
+add
+       http://shell.aros.net:80/reports/onvine/010297.html 4
+set
+       http://shell.aros.net:80/reports/onvine/010297.html 4 0293
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cws/feat/archive/052896/cws33871.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cws/feat/archive/052896/cws33871.html 4 0294
+add
+       http://ella.netpoint.net:80/empg/news/demaasia.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/demaasia.htm 4 0295
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0902.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0902.html 4 0296
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00764.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00764.html 4 0297
+add
+       http://connectedpc.com:80/design/pricelst/21dce.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dce.htm 4 0298
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-history:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-history:1 4 0299
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/colin.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/colin.html 4 0300
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-111.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-111.html 4 0301
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/ljdpres/index.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/ljdpres/index.html 4 0302
+add
+       http://epinet.org:80/ep0520-c.html 4
+set
+       http://epinet.org:80/ep0520-c.html 4 0303
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t291.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t291.html 4 0304
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-multiad.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-multiad.html&v_prev=/sort-company.html&tracking_id=LE 4 0305
+add
+       http://emneta.emnet.co.uk:80/EcoDev/Agencies/GNTEC/ 4
+set
+       http://emneta.emnet.co.uk:80/EcoDev/Agencies/GNTEC/ 4 0306
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_YFT_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_YFT_local_variable 4 0307
+add
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/para/domain/../prog_strat/prog_strat.html 4
+set
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/para/domain/../prog_strat/prog_strat.html 4 0308
+add
+       http://emphase-10.yweb.com:80/070301de.html 4
+set
+       http://emphase-10.yweb.com:80/070301de.html 4 0309
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9409/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9409/pap00.htm 4 0310
+add
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=gzip 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=gzip 4 0311
+add
+       http://c21-champions.com:80/o=50134/x=19,2,23 4
+set
+       http://c21-champions.com:80/o=50134/x=19,2,23 4 0312
+add
+       http://shell.aros.net:80/reports/onvine/010597.html 4
+set
+       http://shell.aros.net:80/reports/onvine/010597.html 4 0313
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mon/feat/archive/052896/mon34035.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mon/feat/archive/052896/mon34035.html 4 0314
+add
+       http://ella.netpoint.net:80/empg/news/coral.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/coral.htm 4 0315
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0901.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0901.html 4 0316
+add
+       http://connectedpc.com:80/design/pricelst/21dd2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dd2.htm 4 0317
+add
+       http://epinet.org:80/ep0513-c.html 4
+set
+       http://epinet.org:80/ep0513-c.html 4 0318
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00765.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00765.html 4 0319
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:2 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:2 4 0320
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-118.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-118.html 4 0321
+add
+       http://eprd.kpm.my:80/dkpm.html 4
+set
+       http://eprd.kpm.my:80/dkpm.html 4 0322
+add
+       http://eps.geo.titech.ac.jp:80/nakazawalab/hemori/hemori.html 4
+set
+       http://eps.geo.titech.ac.jp:80/nakazawalab/hemori/hemori.html 4 0323
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/steve.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/steve.html 4 0324
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/tools196.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/tools196.html 4 0325
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.97.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.97.html 4 0326
+add
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedBarVBT.m3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedBarVBT.m3.html 4 0327
+add
+       http://epinet.org:80/ep0506-c.html 4
+set
+       http://epinet.org:80/ep0506-c.html 4 0328
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_EFT_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_EFT_local_variable 4 0329
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/EPA-905-S94-001/EPA-905-S94-001.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/EPA-905-S94-001/EPA-905-S94-001.html 4 0330
+add
+       http://shell.aros.net:80/reports/onvine/011297.html 4
+set
+       http://shell.aros.net:80/reports/onvine/011297.html 4 0331
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/kcr/feat/archive/052896/kcr27998.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/kcr/feat/archive/052896/kcr27998.html 4 0332
+add
+       http://ella.netpoint.net:80/empg/news/maya.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/maya.htm 4 0333
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0903.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0903.html 4 0334
+add
+       http://connectedpc.com:80/design/pricelst/21dd6.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dd6.htm 4 0335
+add
+       http://devetsil.vse.cz:80/cgi-bin/wwl/pindex.cgi?servik=ALFA.VSE.CZ&port=372&volba=index&skupina=LISTPROC 4
+set
+       http://devetsil.vse.cz:80/cgi-bin/wwl/pindex.cgi?servik=ALFA.VSE.CZ&port=372&volba=index&skupina=LISTPROC 4 0336
+add
+       http://emphase-10.yweb.com:80/070307de.html 4
+set
+       http://emphase-10.yweb.com:80/070307de.html 4 0337
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9509/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9509/pap00.htm 4 0338
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mystic.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mystic.html&v_prev=/sort-company.html&tracking_id=LE 4 0339
+add
+       http://eprd.kpm.my:80/divikpm.html 4
+set
+       http://eprd.kpm.my:80/divikpm.html 4 0340
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00766.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00766.html 4 0341
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:4 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:4 4 0342
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/jennifer.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/jennifer.html 4 0343
+add
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/techwatch-nulibs/num-lib.book_1.html 4
+set
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/techwatch-nulibs/num-lib.book_1.html 4 0344
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-116.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-116.html 4 0345
+add
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=netscape 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=netscape 4 0346
+add
+       http://c21-champions.com:80/o=50134/browse.cmd 4
+set
+       http://c21-champions.com:80/o=50134/browse.cmd 4 0347
+add
+       http://epinet.org:80/ep0430-c.html 4
+set
+       http://epinet.org:80/ep0430-c.html 4 0348
+add
+       http://shell.aros.net:80/reports/onvine/051296.html 4
+set
+       http://shell.aros.net:80/reports/onvine/051296.html 4 0349
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cle/feat/archive/052896/cle19203.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cle/feat/archive/052896/cle19203.html 4 0350
+add
+       http://ella.netpoint.net:80/empg/news/carib.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/carib.htm 4 0351
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0904.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0904.html 4 0352
+add
+       http://connectedpc.com:80/design/pricelst/21dda.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dda.htm 4 0353
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jhale.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jhale.html 4 0354
+add
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/winsound.html 4
+set
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/winsound.html 4 0355
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.97.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.97.html 4 0356
+add
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedFeedbackVBT.m3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedFeedbackVBT.m3.html 4 0357
+add
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.all 4
+set
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.all 4 0358
+add
+       http://emphase-10.yweb.com:80/070800de.html 4
+set
+       http://emphase-10.yweb.com:80/070800de.html 4 0359
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_CDUMY_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_CDUMY_local_variable 4 0360
+add
+       http://eprd.kpm.my:80/moe1.html 4
+set
+       http://eprd.kpm.my:80/moe1.html 4 0361
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00767.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00767.html 4 0362
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-week:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-week:1 4 0363
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/jimmy.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/jimmy.html 4 0364
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-117.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-117.html 4 0365
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-north.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-north.html&v_prev=/sort-company.html&tracking_id=LE 4 0366
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/ARCS-92-Workplan/ARCS-Workplan.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/ARCS-92-Workplan/ARCS-Workplan.html 4 0367
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9410/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9410/pap00.htm 4 0368
+add
+       http://c21-champions.com:80/w=1/o=50134/fpage.cmd 4
+set
+       http://c21-champions.com:80/w=1/o=50134/fpage.cmd 4 0369
+add
+       http://connectedpc.com:80/design/pricelst/21dde.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dde.htm 4 0370
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0907.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0907.html 4 0371
+add
+       http://ella.netpoint.net:80/empg/news/aladin.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/aladin.htm 4 0372
+add
+       http://shell.aros.net:80/reports/onvine/051996.html 4
+set
+       http://shell.aros.net:80/reports/onvine/051996.html 4 0373
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb71878.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb71878.html 4 0374
+add
+       http://einstein.leyada.jlm.k12.il:80/novell/about/ 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/about/ 4 0375
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.html 4 0376
+add
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedVBT.m3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedVBT.m3.html 4 0377
+add
+       http://emphase-10.yweb.com:80/070700de.html 4
+set
+       http://emphase-10.yweb.com:80/070700de.html 4 0378
+add
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.tab 4
+set
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.tab 4 0379
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-history:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-history:1 4 0380
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00768.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00768.html 4 0381
+add
+       http://c21-champions.com:80/office=50134/lots=1/fpage.cmd 4
+set
+       http://c21-champions.com:80/office=50134/lots=1/fpage.cmd 4 0382
+add
+       http://eps.geo.titech.ac.jp:80/nakazawalab/thamane/thamane.html 4
+set
+       http://eps.geo.titech.ac.jp:80/nakazawalab/thamane/thamane.html 4 0383
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/536/536-112.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/536/536-112.html 4 0384
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0910.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0910.html 4 0385
+add
+       http://shell.aros.net:80/reports/onvine/052696.html 4
+set
+       http://shell.aros.net:80/reports/onvine/052696.html 4 0386
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/overview.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/overview.html 4 0387
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_IBUFF_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_IBUFF_local_variable 4 0388
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/bob.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/bob.html 4 0389
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest1.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest1.html&v_prev=/sort-company.html&tracking_id=LE 4 0390
+add
+       http://ella.netpoint.net:80/empg/news/holland.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/holland.htm 4 0391
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg38415.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg38415.html 4 0392
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9510/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9510/pap00.htm 4 0393
+add
+       http://connectedpc.com:80/design/pricelst/21de2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21de2.htm 4 0394
+add
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/ZTerm.html 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/ZTerm.html 4 0395
+add
+       http://epinet.org:80/ep0422-c.html 4
+set
+       http://epinet.org:80/ep0422-c.html 4 0396
+add
+       http://einstein.leyada.jlm.k12.il:80/novell/etgar/ 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/etgar/ 4 0397
+add
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.html 4 0398
+add
+       http://emphase-10.yweb.com:80/070100de.html 4
+set
+       http://emphase-10.yweb.com:80/070100de.html 4 0399
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00769.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00769.html 4 0400
+add
+       http://era.org:80/ 4
+set
+       http://era.org:80/ 4 0401
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0911.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0911.html 4 0402
+add
+       http://c21-champions.com:80/office=50134/indexguide.html 4
+set
+       http://c21-champions.com:80/office=50134/indexguide.html 4 0403
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/zain.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/zain.html 4 0404
+add
+       http://connectedpc.com:80/design/pricelst/21de6.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21de6.htm 4 0405
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:2 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:2 4 0406
+add
+       http://shell.aros.net:80/reports/onvine/060296.html 4
+set
+       http://shell.aros.net:80/reports/onvine/060296.html 4 0407
+add
+       http://ella.netpoint.net:80/empg/news/dticonf.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/dticonf.htm 4 0408
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-100.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-100.html 4 0409
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/oak/feat/archive/052896/oak23146.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/oak/feat/archive/052896/oak23146.html 4 0410
+add
+       http://eps.geo.titech.ac.jp:80/nakazawalab/tyoshida/tyoshida.html 4
+set
+       http://eps.geo.titech.ac.jp:80/nakazawalab/tyoshida/tyoshida.html 4 0411
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC1_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC1_local_variable 4 0412
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9411/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9411/pap00.htm 4 0413
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/sesseval.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/sesseval.html 4 0414
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest2.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest2.html&v_prev=/sort-company.html&tracking_id=LE 4 0415
+add
+       http://epinet.org:80/ep0416-c.html 4
+set
+       http://epinet.org:80/ep0416-c.html 4 0416
+add
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/mpi-slides/mpi-slides_1.html 4
+set
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/mpi-slides/mpi-slides_1.html 4 0417
+add
+       http://era.org:80/pages/gic.html 4
+set
+       http://era.org:80/pages/gic.html 4 0418
+add
+       http://edmunds.com:80/edweb/burkleon/burke8.html 4
+set
+       http://edmunds.com:80/edweb/burkleon/burke8.html 4 0419
+add
+       http://c21-champions.com:80/w=1/o=50134/real-index.html 4
+set
+       http://c21-champions.com:80/w=1/o=50134/real-index.html 4 0420
+add
+       http://einstein.leyada.jlm.k12.il:80/novell/img/ 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/img/ 4 0421
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0912.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0912.html 4 0422
+add
+       http://connectedpc.com:80/design/pricelst/21dea.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dea.htm 4 0423
+add
+       http://emphase-10.yweb.com:80/070150de.html 4
+set
+       http://emphase-10.yweb.com:80/070150de.html 4 0424
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/ross.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/ross.html 4 0425
+add
+       http://eprd.kpm.my:80/undang.html 4
+set
+       http://eprd.kpm.my:80/undang.html 4 0426
+add
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/SLIP/ 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/SLIP/ 4 0427
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/GlennW.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/GlennW.html 4 0428
+add
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/diffeq/ 4
+set
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/diffeq/ 4 0429
+add
+       http://shell.aros.net:80/reports/onvine/060996.html 4
+set
+       http://shell.aros.net:80/reports/onvine/060996.html 4 0430
+add
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg43595.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg43595.html 4 0431
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:4 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:4 4 0432
+add
+       http://ella.netpoint.net:80/empg/news/archives.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/archives.htm 4 0433
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/640/640-100.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/640/640-100.html 4 0434
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00770.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00770.html 4 0435
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/atndlist.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/atndlist.html 4 0436
+add
+       http://eps.geo.titech.ac.jp:80/nakazawalab/sinaba/sinaba.html 4
+set
+       http://eps.geo.titech.ac.jp:80/nakazawalab/sinaba/sinaba.html 4 0437
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest3.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest3.html&v_prev=/sort-company.html&tracking_id=LE 4 0438
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TCHAJJ_JTCHC1_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TCHAJJ_JTCHC1_local_variable 4 0439
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9511/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9511/pap00.htm 4 0440
+add
+       http://epinet.org:80/ep0408-c.html 4
+set
+       http://epinet.org:80/ep0408-c.html 4 0441
+add
+       http://era.org:80/pages/locator.html 4
+set
+       http://era.org:80/pages/locator.html 4 0442
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/Rockwell.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/Rockwell.html 4 0443
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0913.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0913.html 4 0444
+add
+       http://connectedpc.com:80/design/pricelst/21dee.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dee.htm 4 0445
+add
+       http://edmunds.com:80/edweb/cars/Geo/183.97.html 4
+set
+       http://edmunds.com:80/edweb/cars/Geo/183.97.html 4 0446
+add
+       http://einstein.leyada.jlm.k12.il:80/novell/index.htm 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/index.htm 4 0447
+add
+       http://c21-champions.com:80/w=1/o=50134/browse.cmd 4
+set
+       http://c21-champions.com:80/w=1/o=50134/browse.cmd 4 0448
+add
+       http://shell.aros.net:80/reports/onvine/061696.html 4
+set
+       http://shell.aros.net:80/reports/onvine/061696.html 4 0449
+add
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052796/phi6831.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052796/phi6831.html 4 0450
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/geoff.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/geoff.html 4 0451
+add
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/amigaservers.html 4
+set
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/amigaservers.html 4 0452
+add
+       http://eprd.kpm.my:80/unuku.html 4
+set
+       http://eprd.kpm.my:80/unuku.html 4 0453
+add
+       http://ella.netpoint.net:80/empg/bahama-divers/bd0.htm 4
+set
+       http://ella.netpoint.net:80/empg/bahama-divers/bd0.htm 4 0454
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00771.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00771.html 4 0455
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-week:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-week:1 4 0456
+add
+       http://emphase-10.yweb.com:80/070105de.html 4
+set
+       http://emphase-10.yweb.com:80/070105de.html 4 0457
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-200.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-200.html 4 0458
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/introcnf.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/introcnf.html 4 0459
+add
+       http://epinet.org:80/ep0401-c.html 4
+set
+       http://epinet.org:80/ep0401-c.html 4 0460
+add
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC2_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC2_local_variable 4 0461
+add
+       http://era.org:80/pages/cic.html 4
+set
+       http://era.org:80/pages/cic.html 4 0462
+add
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Nameserver/ 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Nameserver/ 4 0463
+add
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/massbalance/EPA-905-8-89-001/MBSPToC.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/massbalance/EPA-905-8-89-001/MBSPToC.html 4 0464
+add
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0916.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0916.html 4 0465
+add
+       http://connectedpc.com:80/design/pricelst/21df2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21df2.htm 4 0466
+add
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-novations.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-novations.html&v_prev=/sort-company.html&tracking_id=LE 4 0467
+add
+       http://eos.wdcb.rssi.ru:80/transl/izve/9412/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9412/pap00.htm 4 0468
+add
+       http://shell.aros.net:80/reports/onvine/062396.html 4
+set
+       http://shell.aros.net:80/reports/onvine/062396.html 4 0469
+add
+       http://lyne.chemeng.ed.ac.uk:80/people/andyb.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/andyb.html 4 0470
+add
+       http://edmunds.com:80/edweb/cars/Geo/184.97.html 4
+set
+       http://edmunds.com:80/edweb/cars/Geo/184.97.html 4 0471
+add
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/nym/feat/archive/052796/nym3971.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/nym/feat/archive/052796/nym3971.html 4 0472
+add
+       http://c21-champions.com:80/w=1/o=50134/wlcmctr.html 4
+set
+       http://c21-champions.com:80/w=1/o=50134/wlcmctr.html 4 0473
+add
+       http://emanuelnyc.org:80/history/pilgrimage/pilgrimage6.html 4
+set
+       http://emanuelnyc.org:80/history/pilgrimage/pilgrimage6.html 4 0474
+add
+       http://einstein.leyada.jlm.k12.il:80/novell/index2.htm 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/index2.htm 4 0475
+add
+       http://ella.netpoint.net:80/empg/bahama-divers/bd1.htm 4
+set
+       http://ella.netpoint.net:80/empg/bahama-divers/bd1.htm 4 0476
+add
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00772.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00772.html 4 0477
+add
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-history:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-history:1 4 0478
+add
+       http://emphase-10.yweb.com:80/070104de.html 4
+set
+       http://emphase-10.yweb.com:80/070104de.html 4 0479
+add
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/GA-slides/Genetic-slides.book_1.html 4
+set
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/GA-slides/Genetic-slides.book_1.html 4 0480
+add
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-201.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-201.html 4 0481
+add
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/Helpful_Bookmarks.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/Helpful_Bookmarks.html 4 0482
+add
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=cat 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=cat 4 0483
+add
+       http://epinet.org:80/epdatall.html 4
+set
+       http://epinet.org:80/epdatall.html 4 0484
+add
+       http://era.org:80/pages/calendar.html 4
+set
+       http://era.org:80/pages/calendar.html 4 0485
+add
+       http://edmunds.com:80/edweb/cars/Geo/186.97.html 4
+set
+       http://edmunds.com:80/edweb/cars/Geo/186.97.html 4 0486
+add
+       http://c21-champions.com:80/w=1/o=50134/buycentr.html 4
+set
+       http://c21-champions.com:80/w=1/o=50134/buycentr.html 4 0487
+ls
+       487
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC1_local_variable 4 0412
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC2_local_variable 4 0461
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TCHAJJ_JTCHC1_local_variable 4 0439
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_CDUMY_local_variable 4 0360
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_EFT_local_variable 4 0329
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_FSWAP_local_variable 4 0261
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_IBUFF_local_variable 4 0388
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_XFT_local_variable 4 0282
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_YFT_local_variable 4 0307
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNBM_local_variable 4 0219
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNDN_local_variable 4 0170
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNTP_local_variable 4 0189
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNUP_local_variable 4 0136
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan14.html 4 0137
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan15.html 4 0157
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan4.html 4 0185
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan5.html 4 0206
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan6.html 4 0228
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan7.html 4 0248
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan8.html 4 0267
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan9.html 4 0290
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4 0040
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4 0010
+       http://c21-champions.com:80/o=50134/browse.cmd 4 0347
+       http://c21-champions.com:80/o=50134/state=2/county=2/city=2/browse.cmd 4 0245
+       http://c21-champions.com:80/o=50134/x=19,2,1 4 0265
+       http://c21-champions.com:80/o=50134/x=19,2,18 4 0288
+       http://c21-champions.com:80/o=50134/x=19,2,23 4 0312
+       http://c21-champions.com:80/o=50134/x=21,2 4 0229
+       http://c21-champions.com:80/office=50106/bytim2.html 4 0203
+       http://c21-champions.com:80/office=50106/loanpack.html 4 0159
+       http://c21-champions.com:80/office=50106/mort.html 4 0132
+       http://c21-champions.com:80/office=50106/usmap.map 4 0186
+       http://c21-champions.com:80/office=50134/indexguide.html 4 0403
+       http://c21-champions.com:80/office=50134/lots=1/fpage.cmd 4 0382
+       http://c21-champions.com:80/w=1/o=50134/browse.cmd 4 0448
+       http://c21-champions.com:80/w=1/o=50134/buycentr.html 4 0487
+       http://c21-champions.com:80/w=1/o=50134/fpage.cmd 4 0369
+       http://c21-champions.com:80/w=1/o=50134/real-index.html 4 0420
+       http://c21-champions.com:80/w=1/o=50134/wlcmctr.html 4 0473
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Interval.i3.html 4 0142
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Trapezoid.i3.html 4 0172
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedBarVBT.m3.html 4 0327
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedFeedbackVBT.m3.html 4 0357
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedVBT.m3.html 4 0377
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/netobjrt/../uid/src/Common/TimeStamp.i3.html 4 0210
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0894.html 4 0152
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0895.html 4 0173
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0897.html 4 0212
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0898.html 4 0234
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0899.html 4 0269
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0900.html 4 0192
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0901.html 4 0316
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0902.html 4 0296
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0903.html 4 0334
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0904.html 4 0352
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0905.html 4 0253
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0907.html 4 0371
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0910.html 4 0385
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0911.html 4 0402
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0912.html 4 0422
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0913.html 4 0444
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0916.html 4 0465
+       http://connectedpc.com:80/design/pricelst/21db2.htm 4 0145
+       http://connectedpc.com:80/design/pricelst/21db6.htm 4 0164
+       http://connectedpc.com:80/design/pricelst/21dba.htm 4 0187
+       http://connectedpc.com:80/design/pricelst/21dbe.htm 4 0201
+       http://connectedpc.com:80/design/pricelst/21dc2.htm 4 0226
+       http://connectedpc.com:80/design/pricelst/21dc6.htm 4 0255
+       http://connectedpc.com:80/design/pricelst/21dca.htm 4 0270
+       http://connectedpc.com:80/design/pricelst/21dce.htm 4 0298
+       http://connectedpc.com:80/design/pricelst/21dd2.htm 4 0317
+       http://connectedpc.com:80/design/pricelst/21dd6.htm 4 0335
+       http://connectedpc.com:80/design/pricelst/21dda.htm 4 0353
+       http://connectedpc.com:80/design/pricelst/21dde.htm 4 0370
+       http://connectedpc.com:80/design/pricelst/21de2.htm 4 0394
+       http://connectedpc.com:80/design/pricelst/21de6.htm 4 0405
+       http://connectedpc.com:80/design/pricelst/21dea.htm 4 0423
+       http://connectedpc.com:80/design/pricelst/21dee.htm 4 0445
+       http://connectedpc.com:80/design/pricelst/21df2.htm 4 0466
+       http://cypress.ukc.ac.uk:2001/home/jf4/rtf/rtftohtml-2.7.5/docs/ 4 0242
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00757.html 4 0144
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00758.html 4 0163
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00759.html 4 0194
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00760.html 4 0213
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00761.html 4 0235
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00762.html 4 0254
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00763.html 4 0273
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00764.html 4 0297
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00765.html 4 0319
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00766.html 4 0341
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00767.html 4 0362
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00768.html 4 0381
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00769.html 4 0400
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00770.html 4 0435
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00771.html 4 0455
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00772.html 4 0477
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/atndlist.html 4 0169
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/sesseval.html 4 0134
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/Helpful_Bookmarks.html 4 0218
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/atndlist.html 4 0436
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/introcnf.html 4 0191
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jdspres/index.html 4 0283
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jhale.html 4 0354
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/surds196.html 4 0260
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/tools196.html 4 0325
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/ljdpres/index.html 4 0302
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/marge_smith.html 4 0241
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/overview.html 4 0387
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/sesseval.html 4 0414
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/Helpful_Bookmarks.html 4 0482
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/introcnf.html 4 0459
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+INFORMATION+alej-log.jan96 4 0150
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.all 4 0358
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.tab 4 0379
+       http://devetsil.vse.cz:80/cgi-bin/wwl/pindex.cgi?servik=ALFA.VSE.CZ&port=372&volba=index&skupina=LISTPROC 4 0336
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=cat 4 0483
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=gzip 4 0311
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=netscape 4 0346
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uudecode 4 0275
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uuencode 4 0237
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/amigaservers.html 4 0452
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/saveinline.html 4 0209
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/webnews.html 4 0287
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/winsound.html 4 0355
+       http://edmunds.com:80/edweb/burkleon/burke8.html 4 0419
+       http://edmunds.com:80/edweb/cars/Geo/183.97.html 4 0446
+       http://edmunds.com:80/edweb/cars/Geo/184.97.html 4 0471
+       http://edmunds.com:80/edweb/cars/Geo/186.97.html 4 0486
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t275.html 4 0148
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t280.html 4 0174
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t283.html 4 0195
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t284.html 4 0222
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t287.html 4 0258
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t289.html 4 0280
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t291.html 4 0304
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.97.html 4 0326
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.html 4 0376
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.97.html 4 0356
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.html 4 0398
+       http://einstein.leyada.jlm.k12.il:80/novell/about/ 4 0375
+       http://einstein.leyada.jlm.k12.il:80/novell/etgar/ 4 0397
+       http://einstein.leyada.jlm.k12.il:80/novell/img/ 4 0421
+       http://einstein.leyada.jlm.k12.il:80/novell/index.htm 4 0447
+       http://einstein.leyada.jlm.k12.il:80/novell/index2.htm 4 0475
+       http://einstein.physics.drexel.edu:80/INPC-98/signatures.html 4 0223
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/diffeq/ 4 0429
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/para/domain/../prog_strat/prog_strat.html 4 0308
+       http://einstein.physics.drexel.edu:80/pages/students/wisniewski_old/ 4 0146
+       http://einstein.physics.drexel.edu:80/pages/students/xing/ 4 0165
+       http://einstein.physics.drexel.edu:80/pages/students/zlatev/ 4 0181
+       http://ella.netpoint.net:80/empg/bahama-divers/bd0.htm 4 0454
+       http://ella.netpoint.net:80/empg/bahama-divers/bd1.htm 4 0476
+       http://ella.netpoint.net:80/empg/news/aladin.htm 4 0372
+       http://ella.netpoint.net:80/empg/news/aquaquest.htm 4 0252
+       http://ella.netpoint.net:80/empg/news/archives.htm 4 0433
+       http://ella.netpoint.net:80/empg/news/carib.htm 4 0351
+       http://ella.netpoint.net:80/empg/news/coral.htm 4 0315
+       http://ella.netpoint.net:80/empg/news/cpia.htm 4 0143
+       http://ella.netpoint.net:80/empg/news/demaasia.htm 4 0295
+       http://ella.netpoint.net:80/empg/news/dticonf.htm 4 0408
+       http://ella.netpoint.net:80/empg/news/eta.htm 4 0200
+       http://ella.netpoint.net:80/empg/news/holland.htm 4 0391
+       http://ella.netpoint.net:80/empg/news/king.htm 4 0233
+       http://ella.netpoint.net:80/empg/news/marine.htm 4 0217
+       http://ella.netpoint.net:80/empg/news/maya.htm 4 0333
+       http://ella.netpoint.net:80/empg/news/sos.htm 4 0278
+       http://ella.netpoint.net:80/empg/news/tek.htm 4 0162
+       http://ella.netpoint.net:80/empg/news/wsa.htm 4 0179
+       http://emanuelnyc.org:80/history/pilgrimage/pilgrimage6.html 4 0474
+       http://emneta.emnet.co.uk:80/EcoDev/Agencies/GNTEC/ 4 0306
+       http://emphase-10.yweb.com:80/070100de.html 4 0399
+       http://emphase-10.yweb.com:80/070104de.html 4 0479
+       http://emphase-10.yweb.com:80/070105de.html 4 0457
+       http://emphase-10.yweb.com:80/070150de.html 4 0424
+       http://emphase-10.yweb.com:80/070300de.html 4 0155
+       http://emphase-10.yweb.com:80/070301de.html 4 0309
+       http://emphase-10.yweb.com:80/070302de.html 4 0224
+       http://emphase-10.yweb.com:80/070303de.html 4 0177
+       http://emphase-10.yweb.com:80/070304de.html 4 0284
+       http://emphase-10.yweb.com:80/070305de.html 4 0198
+       http://emphase-10.yweb.com:80/070306de.html 4 0257
+       http://emphase-10.yweb.com:80/070307de.html 4 0337
+       http://emphase-10.yweb.com:80/070700de.html 4 0378
+       http://emphase-10.yweb.com:80/070800de.html 4 0359
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-kinkcorp.html&v_prev=/sort-company.html&tracking_id=LE 4 0153
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-lockheed.html&v_prev=/sort-company.html&tracking_id=LE 4 0188
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-macys.html&v_prev=/sort-company.html&tracking_id=LE 4 0221
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mit.html&v_prev=/sort-company.html&tracking_id=LE 4 0262
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-motorola.html&v_prev=/sort-company.html&tracking_id=LE 4 0285
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-multiad.html&v_prev=/sort-company.html&tracking_id=LE 4 0305
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mystic.html&v_prev=/sort-company.html&tracking_id=LE 4 0339
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-north.html&v_prev=/sort-company.html&tracking_id=LE 4 0366
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-novations.html&v_prev=/sort-company.html&tracking_id=LE 4 0467
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest1.html&v_prev=/sort-company.html&tracking_id=LE 4 0390
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest2.html&v_prev=/sort-company.html&tracking_id=LE 4 0415
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest3.html&v_prev=/sort-company.html&tracking_id=LE 4 0438
+       http://enterprise.mathematik.uni-essen.de:80/cgi-bin/man-cgi?tar 4 0220
+       http://enterprise.mathematik.uni-essen.de:80/enterprise 4 0193
+       http://enterprise.mathematik.uni-essen.de:80/mdw/LDP/nag/node92.html 4 0244
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/ganz_neue_Bookmarks.html 4 0139
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/noch_mehr_unsortierte_bookmarks.html 4 0158
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Kabel/ 4 0286
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Nameserver/ 4 0463
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/SLIP/ 4 0427
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/ZTerm.html 4 0395
+       http://eos.wdcb.rssi.ru:80/transl/izve/9407/pap00.htm 4 0227
+       http://eos.wdcb.rssi.ru:80/transl/izve/9409/pap00.htm 4 0310
+       http://eos.wdcb.rssi.ru:80/transl/izve/9410/pap00.htm 4 0368
+       http://eos.wdcb.rssi.ru:80/transl/izve/9411/pap00.htm 4 0413
+       http://eos.wdcb.rssi.ru:80/transl/izve/9412/pap00.htm 4 0468
+       http://eos.wdcb.rssi.ru:80/transl/izve/9506/pap00.htm 4 0151
+       http://eos.wdcb.rssi.ru:80/transl/izve/9507/pap00.htm 4 0259
+       http://eos.wdcb.rssi.ru:80/transl/izve/9508/pap00.htm 4 0281
+       http://eos.wdcb.rssi.ru:80/transl/izve/9509/pap00.htm 4 0338
+       http://eos.wdcb.rssi.ru:80/transl/izve/9510/pap00.htm 4 0393
+       http://eos.wdcb.rssi.ru:80/transl/izve/9511/pap00.htm 4 0440
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/ARCS-92-Workplan/ARCS-Workplan.html 4 0367
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/EPA-905-S94-001/EPA-905-S94-001.html 4 0330
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/factsheet/lampsfact.html 4 0292
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkmi-lamp/lkmi-lamp.html 4 0208
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/announ6-94.html 4 0230
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/lwi-lkon-abbr.html 4 0249
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/wasteupd.html 4 0266
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/onepgfacts/onepgfacts.html 4 0176
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/massbalance/EPA-905-8-89-001/MBSPToC.html 4 0464
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/GlennW.html 4 0428
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/Rockwell.html 4 0443
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/FNorling.html 4 0133
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/GKohlhepp.html 4 0154
+       http://epcc.ed.ac.uk:80/Middle-Earth/ 4 0289
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/GA-slides/Genetic-slides.book_1.html 4 0480
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/f95/ 4 0225
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/mpi-slides/mpi-slides_1.html 4 0417
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/techwatch-nulibs/num-lib.book_1.html 4 0344
+       http://epcc.ed.ac.uk:80/ssp/Applications.html 4 0175
+       http://epinet.org:80/ep0401-c.html 4 0460
+       http://epinet.org:80/ep0408-c.html 4 0441
+       http://epinet.org:80/ep0416-c.html 4 0416
+       http://epinet.org:80/ep0422-c.html 4 0396
+       http://epinet.org:80/ep0430-c.html 4 0348
+       http://epinet.org:80/ep0506-c.html 4 0328
+       http://epinet.org:80/ep0513-c.html 4 0318
+       http://epinet.org:80/ep0520-c.html 4 0303
+       http://epinet.org:80/ep0528-c.html 4 0276
+       http://epinet.org:80/ep0603-c.html 4 0247
+       http://epinet.org:80/ep0610-c.html 4 0238
+       http://epinet.org:80/ep0617-c.html 4 0205
+       http://epinet.org:80/ep0624-c.html 4 0184
+       http://epinet.org:80/ep0701-c.html 4 0168
+       http://epinet.org:80/ep0708-c.html 4 0135
+       http://epinet.org:80/epdatall.html 4 0484
+       http://eprd.kpm.my:80/admin.html 4 0207
+       http://eprd.kpm.my:80/bmdgkpm.html 4 0291
+       http://eprd.kpm.my:80/bmenkpm.html 4 0239
+       http://eprd.kpm.my:80/bmtim.html 4 0263
+       http://eprd.kpm.my:80/bsgkpm.html 4 0277
+       http://eprd.kpm.my:80/divikpm.html 4 0340
+       http://eprd.kpm.my:80/dkpm.html 4 0322
+       http://eprd.kpm.my:80/emape.html 4 0171
+       http://eprd.kpm.my:80/erangka.html 4 0138
+       http://eprd.kpm.my:80/moe1.html 4 0361
+       http://eprd.kpm.my:80/undang.html 4 0426
+       http://eprd.kpm.my:80/unuku.html 4 0453
+       http://eps.geo.titech.ac.jp:80/nakazawalab/hemori/hemori.html 4 0323
+       http://eps.geo.titech.ac.jp:80/nakazawalab/sinaba/sinaba.html 4 0437
+       http://eps.geo.titech.ac.jp:80/nakazawalab/thamane/thamane.html 4 0383
+       http://eps.geo.titech.ac.jp:80/nakazawalab/tyoshida/tyoshida.html 4 0411
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi2.html 4 0149
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi3.html 4 0211
+       http://eps.geo.titech.ac.jp:80/takahashilab/ronbun.html 4 0240
+       http://eps.geo.titech.ac.jp:80/takahashilab/staff/staff.html 4 0251
+       http://equinox.vtc.vsc.edu:80/info.html 4 0131
+       http://equity.wharton.upenn.edu:80/ 4 0196
+       http://era.org:80/ 4 0401
+       http://era.org:80/pages/calendar.html 4 0485
+       http://era.org:80/pages/cic.html 4 0462
+       http://era.org:80/pages/gic.html 4 0418
+       http://era.org:80/pages/locator.html 4 0442
+       http://lyne.chemeng.ed.ac.uk:80/people/andy.html 4 0190
+       http://lyne.chemeng.ed.ac.uk:80/people/andyb.html 4 0470
+       http://lyne.chemeng.ed.ac.uk:80/people/bill.html 4 0264
+       http://lyne.chemeng.ed.ac.uk:80/people/bob.html 4 0389
+       http://lyne.chemeng.ed.ac.uk:80/people/colin.html 4 0300
+       http://lyne.chemeng.ed.ac.uk:80/people/don.html 4 0167
+       http://lyne.chemeng.ed.ac.uk:80/people/eric.html 4 0147
+       http://lyne.chemeng.ed.ac.uk:80/people/geoff.html 4 0451
+       http://lyne.chemeng.ed.ac.uk:80/people/jack.html 4 0279
+       http://lyne.chemeng.ed.ac.uk:80/people/jennifer.html 4 0343
+       http://lyne.chemeng.ed.ac.uk:80/people/jimmy.html 4 0364
+       http://lyne.chemeng.ed.ac.uk:80/people/josh.html 4 0214
+       http://lyne.chemeng.ed.ac.uk:80/people/rama.html 4 0243
+       http://lyne.chemeng.ed.ac.uk:80/people/ross.html 4 0425
+       http://lyne.chemeng.ed.ac.uk:80/people/steve.html 4 0324
+       http://lyne.chemeng.ed.ac.uk:80/people/zain.html 4 0404
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-history:1 4 0478
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:2 4 0406
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:4 4 0432
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-week:1 4 0456
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-history:1 4 0380
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:2 4 0320
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:4 4 0342
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-week:1 4 0363
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-history:1 4 0204
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:2 4 0130
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:4 4 0166
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-week:1 4 0183
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-history:1 4 0299
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:2 4 0236
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:4 4 0256
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-week:1 4 0274
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4 0054
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4 0025
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4 0082
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4 0111
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4 0108
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4 0076
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4 0013
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4 0044
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4 0008
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/ad.htm 4 0121
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4 0093
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4 0065
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4 0037
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4 0029
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4 0068
+       http://niteowl.net:80/homes1c.asp?propertyno=6932879 4 0123
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4 0099
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4 0103
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4 0072
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4 0031
+       http://severin.objectware.no:80/ 4 0092
+       http://severin.objectware.no:80/home/ow/english.htm 4 0127
+       http://shell.aros.net:80/reports/octanner/120796.html 4 0140
+       http://shell.aros.net:80/reports/octanner/121095.html 4 0160
+       http://shell.aros.net:80/reports/octanner/121496.html 4 0182
+       http://shell.aros.net:80/reports/octanner/121795.html 4 0199
+       http://shell.aros.net:80/reports/octanner/122296.html 4 0215
+       http://shell.aros.net:80/reports/octanner/122495.html 4 0231
+       http://shell.aros.net:80/reports/octanner/122996.html 4 0246
+       http://shell.aros.net:80/reports/octanner/123195.html 4 0268
+       http://shell.aros.net:80/reports/onvine/010297.html 4 0293
+       http://shell.aros.net:80/reports/onvine/010597.html 4 0313
+       http://shell.aros.net:80/reports/onvine/011297.html 4 0331
+       http://shell.aros.net:80/reports/onvine/051296.html 4 0349
+       http://shell.aros.net:80/reports/onvine/051996.html 4 0373
+       http://shell.aros.net:80/reports/onvine/052696.html 4 0386
+       http://shell.aros.net:80/reports/onvine/060296.html 4 0407
+       http://shell.aros.net:80/reports/onvine/060996.html 4 0430
+       http://shell.aros.net:80/reports/onvine/061696.html 4 0449
+       http://shell.aros.net:80/reports/onvine/062396.html 4 0469
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4 0079
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4 0042
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4 0011
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/stnfrd.htm/map 4 0117
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-208.html 4 0156
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-209.html 4 0178
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-210.html 4 0202
+       http://truck.its.unimelb.edu.au:80/HB/Med/512/512-112.html 4 0271
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-100.html 4 0409
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-111.html 4 0301
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-118.html 4 0321
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-200.html 4 0458
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-201.html 4 0481
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-116.html 4 0345
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-117.html 4 0365
+       http://truck.its.unimelb.edu.au:80/HB/Med/536/536-112.html 4 0384
+       http://truck.its.unimelb.edu.au:80/HB/Med/640/640-100.html 4 0434
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4 0052
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4 0024
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4 0094
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.util.zip.Inflater.html 4 0124
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4 0053
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4 0083
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4 0112
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4 0021
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4 0109
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4 0018
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4 0049
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4 0081
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4 0051
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4 0100
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4 0020
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4 0009
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4 0066
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4 0034
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4 0039
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4 0001
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4 0074
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=campanas.html/SID=769425689 4 0116
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4 0014
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4 0084
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4 0045
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4 0095
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,6820_5,00.html 4 0120
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4 0019
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4 0050
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4 0087
+       http://www.newstimes.com:80/archive/dec1296/tvg.htm 4 0118
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4 0033
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4 0028
+       http://www.nflhome.com:80/vikings/club/media/yearkick.html 4 0128
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4 0057
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4 0097
+       http://www.nha.v2net.com:80/nhaNews/edit-subscribe.pl/music/11.html 4 0122
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4 0003
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4 0061
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4 0007
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4 0063
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4 0088
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4 0113
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4 0070
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1553.jpg 4 0129
+       http://www.nns.ru:80/persons/mashkov.html 4 0017
+       http://www.nns.ru:80/persons/medv.html 4 0048
+       http://www.nns.ru:80/persons/medvser.html 4 0080
+       http://www.nns.ru:80/persons/merkush.html 4 0110
+       http://www.nortel.com:80/cool/supply_mgt/UK_Paign.html 4 0115
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4 0089
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4 0022
+       http://www.nortel.com:80/wireless/omni_gif.html 4 0055
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4 0027
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4 0058
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4 0096
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4 0085
+       http://www.npr.gov:80/library/reports/intel07.html 4 0002
+       http://www.npr.gov:80/library/reports/intelact.html 4 0047
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4 0016
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4 0078
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/ardickey.html.cgi 4 0125
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4 0041
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4 0098
+       http://www.nylp.com:80/ctyelb.htm 4 0059
+       http://www.nylp.com:80/pparty2.htm 4 0091
+       http://www.nysite.com:80/westside/blocks/b72.htm 4 0023
+       http://www.nysite.com:80/westside/blocks/b73.htm 4 0060
+       http://www.nznewsuk.co.uk:80/12jun96/front.html 4 0119
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4 0090
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4 0056
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4 0026
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4 0035
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4 0101
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4 0067
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4 0006
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4 0036
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4 0062
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4 0086
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0615.htm 4 0114
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4 0075
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4 0043
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4 0012
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/agesglossary.html 4 0126
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4 0104
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4 0004
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4 0038
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4 0064
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4 0105
+       http://www.oberon.nl:80/xmas96/index.htm 4 0069
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4 0015
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4 0046
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4 0077
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4 0106
+       http://www.objectreality.com:80/osg/ol.htm 4 0073
+       http://www.objectreality.com:80/osg/osgtrain.htm 4 0032
+       http://www.objectreality.com:80/osg/otug.htm 4 0107
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4 0030
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4 0071
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4 0102
+       http://www.objecttechnology.nl:80/ 4 0005
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/cub/feat/archive/052896/cub24714.html 4 0197
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/det/feat/archive/052896/det3191.html 4 0272
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/mlb/feat/archive/052896/mlb65943.html 4 0141
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/nym/feat/archive/052796/nym3971.html 4 0472
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052796/phi6831.html 4 0450
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052896/phi37127.html 4 0161
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cle/feat/archive/052896/cle19203.html 4 0350
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/col/feat/archive/052896/col53341.html 4 0250
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cws/feat/archive/052896/cws33871.html 4 0294
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/kcr/feat/archive/052896/kcr27998.html 4 0332
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb24341.html 4 0180
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb26281.html 4 0216
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb71878.html 4 0374
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mon/feat/archive/052896/mon34035.html 4 0314
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/oak/feat/archive/052896/oak23146.html 4 0410
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sea/feat/archive/052896/sea35379.html 4 0232
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg38415.html 4 0392
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg43595.html 4 0431
+
+new
+       append2 4096 1 1
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC1_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC1_local_variable 4 0412
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC2_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC2_local_variable 4 0461
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TCHAJJ_JTCHC1_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TCHAJJ_JTCHC1_local_variable 4 0439
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_CDUMY_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_CDUMY_local_variable 4 0360
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_EFT_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_EFT_local_variable 4 0329
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_FSWAP_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_FSWAP_local_variable 4 0261
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_IBUFF_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_IBUFF_local_variable 4 0388
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_XFT_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_XFT_local_variable 4 0282
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_YFT_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_YFT_local_variable 4 0307
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNBM_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNBM_local_variable 4 0219
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNDN_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNDN_local_variable 4 0170
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNTP_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNTP_local_variable 4 0189
+append
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNUP_local_variable 4
+set
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNUP_local_variable 4 0136
+append
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan14.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan14.html 4 0137
+append
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan15.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan15.html 4 0157
+append
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan4.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan4.html 4 0185
+append
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan5.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan5.html 4 0206
+append
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan6.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan6.html 4 0228
+append
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan7.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan7.html 4 0248
+append
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan8.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan8.html 4 0267
+append
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan9.html 4
+set
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan9.html 4 0290
+append
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4
+set
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4 0040
+append
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4
+set
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4 0010
+append
+       http://c21-champions.com:80/o=50134/browse.cmd 4
+set
+       http://c21-champions.com:80/o=50134/browse.cmd 4 0347
+append
+       http://c21-champions.com:80/o=50134/state=2/county=2/city=2/browse.cmd 4
+set
+       http://c21-champions.com:80/o=50134/state=2/county=2/city=2/browse.cmd 4 0245
+append
+       http://c21-champions.com:80/o=50134/x=19,2,1 4
+set
+       http://c21-champions.com:80/o=50134/x=19,2,1 4 0265
+append
+       http://c21-champions.com:80/o=50134/x=19,2,18 4
+set
+       http://c21-champions.com:80/o=50134/x=19,2,18 4 0288
+append
+       http://c21-champions.com:80/o=50134/x=19,2,23 4
+set
+       http://c21-champions.com:80/o=50134/x=19,2,23 4 0312
+append
+       http://c21-champions.com:80/o=50134/x=21,2 4
+set
+       http://c21-champions.com:80/o=50134/x=21,2 4 0229
+append
+       http://c21-champions.com:80/office=50106/bytim2.html 4
+set
+       http://c21-champions.com:80/office=50106/bytim2.html 4 0203
+append
+       http://c21-champions.com:80/office=50106/loanpack.html 4
+set
+       http://c21-champions.com:80/office=50106/loanpack.html 4 0159
+append
+       http://c21-champions.com:80/office=50106/mort.html 4
+set
+       http://c21-champions.com:80/office=50106/mort.html 4 0132
+append
+       http://c21-champions.com:80/office=50106/usmap.map 4
+set
+       http://c21-champions.com:80/office=50106/usmap.map 4 0186
+append
+       http://c21-champions.com:80/office=50134/indexguide.html 4
+set
+       http://c21-champions.com:80/office=50134/indexguide.html 4 0403
+append
+       http://c21-champions.com:80/office=50134/lots=1/fpage.cmd 4
+set
+       http://c21-champions.com:80/office=50134/lots=1/fpage.cmd 4 0382
+append
+       http://c21-champions.com:80/w=1/o=50134/browse.cmd 4
+set
+       http://c21-champions.com:80/w=1/o=50134/browse.cmd 4 0448
+append
+       http://c21-champions.com:80/w=1/o=50134/buycentr.html 4
+set
+       http://c21-champions.com:80/w=1/o=50134/buycentr.html 4 0487
+append
+       http://c21-champions.com:80/w=1/o=50134/fpage.cmd 4
+set
+       http://c21-champions.com:80/w=1/o=50134/fpage.cmd 4 0369
+append
+       http://c21-champions.com:80/w=1/o=50134/real-index.html 4
+set
+       http://c21-champions.com:80/w=1/o=50134/real-index.html 4 0420
+append
+       http://c21-champions.com:80/w=1/o=50134/wlcmctr.html 4
+set
+       http://c21-champions.com:80/w=1/o=50134/wlcmctr.html 4 0473
+append
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Interval.i3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Interval.i3.html 4 0142
+append
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Trapezoid.i3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Trapezoid.i3.html 4 0172
+append
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedBarVBT.m3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedBarVBT.m3.html 4 0327
+append
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedFeedbackVBT.m3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedFeedbackVBT.m3.html 4 0357
+append
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedVBT.m3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedVBT.m3.html 4 0377
+append
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/netobjrt/../uid/src/Common/TimeStamp.i3.html 4
+set
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/netobjrt/../uid/src/Common/TimeStamp.i3.html 4 0210
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0894.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0894.html 4 0152
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0895.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0895.html 4 0173
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0897.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0897.html 4 0212
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0898.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0898.html 4 0234
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0899.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0899.html 4 0269
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0900.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0900.html 4 0192
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0901.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0901.html 4 0316
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0902.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0902.html 4 0296
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0903.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0903.html 4 0334
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0904.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0904.html 4 0352
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0905.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0905.html 4 0253
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0907.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0907.html 4 0371
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0910.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0910.html 4 0385
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0911.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0911.html 4 0402
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0912.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0912.html 4 0422
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0913.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0913.html 4 0444
+append
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0916.html 4
+set
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0916.html 4 0465
+append
+       http://connectedpc.com:80/design/pricelst/21db2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21db2.htm 4 0145
+append
+       http://connectedpc.com:80/design/pricelst/21db6.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21db6.htm 4 0164
+append
+       http://connectedpc.com:80/design/pricelst/21dba.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dba.htm 4 0187
+append
+       http://connectedpc.com:80/design/pricelst/21dbe.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dbe.htm 4 0201
+append
+       http://connectedpc.com:80/design/pricelst/21dc2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dc2.htm 4 0226
+append
+       http://connectedpc.com:80/design/pricelst/21dc6.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dc6.htm 4 0255
+append
+       http://connectedpc.com:80/design/pricelst/21dca.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dca.htm 4 0270
+append
+       http://connectedpc.com:80/design/pricelst/21dce.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dce.htm 4 0298
+append
+       http://connectedpc.com:80/design/pricelst/21dd2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dd2.htm 4 0317
+append
+       http://connectedpc.com:80/design/pricelst/21dd6.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dd6.htm 4 0335
+append
+       http://connectedpc.com:80/design/pricelst/21dda.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dda.htm 4 0353
+append
+       http://connectedpc.com:80/design/pricelst/21dde.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dde.htm 4 0370
+append
+       http://connectedpc.com:80/design/pricelst/21de2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21de2.htm 4 0394
+append
+       http://connectedpc.com:80/design/pricelst/21de6.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21de6.htm 4 0405
+append
+       http://connectedpc.com:80/design/pricelst/21dea.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dea.htm 4 0423
+append
+       http://connectedpc.com:80/design/pricelst/21dee.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21dee.htm 4 0445
+append
+       http://connectedpc.com:80/design/pricelst/21df2.htm 4
+set
+       http://connectedpc.com:80/design/pricelst/21df2.htm 4 0466
+append
+       http://cypress.ukc.ac.uk:2001/home/jf4/rtf/rtftohtml-2.7.5/docs/ 4
+set
+       http://cypress.ukc.ac.uk:2001/home/jf4/rtf/rtftohtml-2.7.5/docs/ 4 0242
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00757.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00757.html 4 0144
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00758.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00758.html 4 0163
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00759.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00759.html 4 0194
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00760.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00760.html 4 0213
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00761.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00761.html 4 0235
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00762.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00762.html 4 0254
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00763.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00763.html 4 0273
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00764.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00764.html 4 0297
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00765.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00765.html 4 0319
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00766.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00766.html 4 0341
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00767.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00767.html 4 0362
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00768.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00768.html 4 0381
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00769.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00769.html 4 0400
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00770.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00770.html 4 0435
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00771.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00771.html 4 0455
+append
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00772.html 4
+set
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00772.html 4 0477
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/atndlist.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/atndlist.html 4 0169
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/sesseval.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/sesseval.html 4 0134
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/Helpful_Bookmarks.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/Helpful_Bookmarks.html 4 0218
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/atndlist.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/atndlist.html 4 0436
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/introcnf.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/introcnf.html 4 0191
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jdspres/index.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jdspres/index.html 4 0283
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jhale.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jhale.html 4 0354
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/surds196.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/surds196.html 4 0260
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/tools196.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/tools196.html 4 0325
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/ljdpres/index.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/ljdpres/index.html 4 0302
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/marge_smith.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/marge_smith.html 4 0241
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/overview.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/overview.html 4 0387
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/sesseval.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/sesseval.html 4 0414
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/Helpful_Bookmarks.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/Helpful_Bookmarks.html 4 0482
+append
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/introcnf.html 4
+set
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/introcnf.html 4 0459
+append
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+INFORMATION+alej-log.jan96 4
+set
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+INFORMATION+alej-log.jan96 4 0150
+append
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.all 4
+set
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.all 4 0358
+append
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.tab 4
+set
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.tab 4 0379
+append
+       http://devetsil.vse.cz:80/cgi-bin/wwl/pindex.cgi?servik=ALFA.VSE.CZ&port=372&volba=index&skupina=LISTPROC 4
+set
+       http://devetsil.vse.cz:80/cgi-bin/wwl/pindex.cgi?servik=ALFA.VSE.CZ&port=372&volba=index&skupina=LISTPROC 4 0336
+append
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=cat 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=cat 4 0483
+append
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=gzip 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=gzip 4 0311
+append
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=netscape 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=netscape 4 0346
+append
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uudecode 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uudecode 4 0275
+append
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uuencode 4
+set
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uuencode 4 0237
+append
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/amigaservers.html 4
+set
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/amigaservers.html 4 0452
+append
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/saveinline.html 4
+set
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/saveinline.html 4 0209
+append
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/webnews.html 4
+set
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/webnews.html 4 0287
+append
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/winsound.html 4
+set
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/winsound.html 4 0355
+append
+       http://edmunds.com:80/edweb/burkleon/burke8.html 4
+set
+       http://edmunds.com:80/edweb/burkleon/burke8.html 4 0419
+append
+       http://edmunds.com:80/edweb/cars/Geo/183.97.html 4
+set
+       http://edmunds.com:80/edweb/cars/Geo/183.97.html 4 0446
+append
+       http://edmunds.com:80/edweb/cars/Geo/184.97.html 4
+set
+       http://edmunds.com:80/edweb/cars/Geo/184.97.html 4 0471
+append
+       http://edmunds.com:80/edweb/cars/Geo/186.97.html 4
+set
+       http://edmunds.com:80/edweb/cars/Geo/186.97.html 4 0486
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t275.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t275.html 4 0148
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t280.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t280.html 4 0174
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t283.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t283.html 4 0195
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t284.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t284.html 4 0222
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t287.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t287.html 4 0258
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t289.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t289.html 4 0280
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t291.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t291.html 4 0304
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.97.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.97.html 4 0326
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.html 4 0376
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.97.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.97.html 4 0356
+append
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.html 4
+set
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.html 4 0398
+append
+       http://einstein.leyada.jlm.k12.il:80/novell/about/ 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/about/ 4 0375
+append
+       http://einstein.leyada.jlm.k12.il:80/novell/etgar/ 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/etgar/ 4 0397
+append
+       http://einstein.leyada.jlm.k12.il:80/novell/img/ 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/img/ 4 0421
+append
+       http://einstein.leyada.jlm.k12.il:80/novell/index.htm 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/index.htm 4 0447
+append
+       http://einstein.leyada.jlm.k12.il:80/novell/index2.htm 4
+set
+       http://einstein.leyada.jlm.k12.il:80/novell/index2.htm 4 0475
+append
+       http://einstein.physics.drexel.edu:80/INPC-98/signatures.html 4
+set
+       http://einstein.physics.drexel.edu:80/INPC-98/signatures.html 4 0223
+append
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/diffeq/ 4
+set
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/diffeq/ 4 0429
+append
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/para/domain/../prog_strat/prog_strat.html 4
+set
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/para/domain/../prog_strat/prog_strat.html 4 0308
+append
+       http://einstein.physics.drexel.edu:80/pages/students/wisniewski_old/ 4
+set
+       http://einstein.physics.drexel.edu:80/pages/students/wisniewski_old/ 4 0146
+append
+       http://einstein.physics.drexel.edu:80/pages/students/xing/ 4
+set
+       http://einstein.physics.drexel.edu:80/pages/students/xing/ 4 0165
+append
+       http://einstein.physics.drexel.edu:80/pages/students/zlatev/ 4
+set
+       http://einstein.physics.drexel.edu:80/pages/students/zlatev/ 4 0181
+append
+       http://ella.netpoint.net:80/empg/bahama-divers/bd0.htm 4
+set
+       http://ella.netpoint.net:80/empg/bahama-divers/bd0.htm 4 0454
+append
+       http://ella.netpoint.net:80/empg/bahama-divers/bd1.htm 4
+set
+       http://ella.netpoint.net:80/empg/bahama-divers/bd1.htm 4 0476
+append
+       http://ella.netpoint.net:80/empg/news/aladin.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/aladin.htm 4 0372
+append
+       http://ella.netpoint.net:80/empg/news/aquaquest.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/aquaquest.htm 4 0252
+append
+       http://ella.netpoint.net:80/empg/news/archives.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/archives.htm 4 0433
+append
+       http://ella.netpoint.net:80/empg/news/carib.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/carib.htm 4 0351
+append
+       http://ella.netpoint.net:80/empg/news/coral.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/coral.htm 4 0315
+append
+       http://ella.netpoint.net:80/empg/news/cpia.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/cpia.htm 4 0143
+append
+       http://ella.netpoint.net:80/empg/news/demaasia.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/demaasia.htm 4 0295
+append
+       http://ella.netpoint.net:80/empg/news/dticonf.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/dticonf.htm 4 0408
+append
+       http://ella.netpoint.net:80/empg/news/eta.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/eta.htm 4 0200
+append
+       http://ella.netpoint.net:80/empg/news/holland.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/holland.htm 4 0391
+append
+       http://ella.netpoint.net:80/empg/news/king.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/king.htm 4 0233
+append
+       http://ella.netpoint.net:80/empg/news/marine.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/marine.htm 4 0217
+append
+       http://ella.netpoint.net:80/empg/news/maya.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/maya.htm 4 0333
+append
+       http://ella.netpoint.net:80/empg/news/sos.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/sos.htm 4 0278
+append
+       http://ella.netpoint.net:80/empg/news/tek.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/tek.htm 4 0162
+append
+       http://ella.netpoint.net:80/empg/news/wsa.htm 4
+set
+       http://ella.netpoint.net:80/empg/news/wsa.htm 4 0179
+append
+       http://emanuelnyc.org:80/history/pilgrimage/pilgrimage6.html 4
+set
+       http://emanuelnyc.org:80/history/pilgrimage/pilgrimage6.html 4 0474
+append
+       http://emneta.emnet.co.uk:80/EcoDev/Agencies/GNTEC/ 4
+set
+       http://emneta.emnet.co.uk:80/EcoDev/Agencies/GNTEC/ 4 0306
+append
+       http://emphase-10.yweb.com:80/070100de.html 4
+set
+       http://emphase-10.yweb.com:80/070100de.html 4 0399
+append
+       http://emphase-10.yweb.com:80/070104de.html 4
+set
+       http://emphase-10.yweb.com:80/070104de.html 4 0479
+append
+       http://emphase-10.yweb.com:80/070105de.html 4
+set
+       http://emphase-10.yweb.com:80/070105de.html 4 0457
+append
+       http://emphase-10.yweb.com:80/070150de.html 4
+set
+       http://emphase-10.yweb.com:80/070150de.html 4 0424
+append
+       http://emphase-10.yweb.com:80/070300de.html 4
+set
+       http://emphase-10.yweb.com:80/070300de.html 4 0155
+append
+       http://emphase-10.yweb.com:80/070301de.html 4
+set
+       http://emphase-10.yweb.com:80/070301de.html 4 0309
+append
+       http://emphase-10.yweb.com:80/070302de.html 4
+set
+       http://emphase-10.yweb.com:80/070302de.html 4 0224
+append
+       http://emphase-10.yweb.com:80/070303de.html 4
+set
+       http://emphase-10.yweb.com:80/070303de.html 4 0177
+append
+       http://emphase-10.yweb.com:80/070304de.html 4
+set
+       http://emphase-10.yweb.com:80/070304de.html 4 0284
+append
+       http://emphase-10.yweb.com:80/070305de.html 4
+set
+       http://emphase-10.yweb.com:80/070305de.html 4 0198
+append
+       http://emphase-10.yweb.com:80/070306de.html 4
+set
+       http://emphase-10.yweb.com:80/070306de.html 4 0257
+append
+       http://emphase-10.yweb.com:80/070307de.html 4
+set
+       http://emphase-10.yweb.com:80/070307de.html 4 0337
+append
+       http://emphase-10.yweb.com:80/070700de.html 4
+set
+       http://emphase-10.yweb.com:80/070700de.html 4 0378
+append
+       http://emphase-10.yweb.com:80/070800de.html 4
+set
+       http://emphase-10.yweb.com:80/070800de.html 4 0359
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-kinkcorp.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-kinkcorp.html&v_prev=/sort-company.html&tracking_id=LE 4 0153
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-lockheed.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-lockheed.html&v_prev=/sort-company.html&tracking_id=LE 4 0188
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-macys.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-macys.html&v_prev=/sort-company.html&tracking_id=LE 4 0221
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mit.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mit.html&v_prev=/sort-company.html&tracking_id=LE 4 0262
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-motorola.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-motorola.html&v_prev=/sort-company.html&tracking_id=LE 4 0285
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-multiad.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-multiad.html&v_prev=/sort-company.html&tracking_id=LE 4 0305
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mystic.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mystic.html&v_prev=/sort-company.html&tracking_id=LE 4 0339
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-north.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-north.html&v_prev=/sort-company.html&tracking_id=LE 4 0366
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-novations.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-novations.html&v_prev=/sort-company.html&tracking_id=LE 4 0467
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest1.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest1.html&v_prev=/sort-company.html&tracking_id=LE 4 0390
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest2.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest2.html&v_prev=/sort-company.html&tracking_id=LE 4 0415
+append
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest3.html&v_prev=/sort-company.html&tracking_id=LE 4
+set
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest3.html&v_prev=/sort-company.html&tracking_id=LE 4 0438
+append
+       http://enterprise.mathematik.uni-essen.de:80/cgi-bin/man-cgi?tar 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/cgi-bin/man-cgi?tar 4 0220
+append
+       http://enterprise.mathematik.uni-essen.de:80/enterprise 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/enterprise 4 0193
+append
+       http://enterprise.mathematik.uni-essen.de:80/mdw/LDP/nag/node92.html 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/mdw/LDP/nag/node92.html 4 0244
+append
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/ganz_neue_Bookmarks.html 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/ganz_neue_Bookmarks.html 4 0139
+append
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/noch_mehr_unsortierte_bookmarks.html 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/noch_mehr_unsortierte_bookmarks.html 4 0158
+append
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Kabel/ 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Kabel/ 4 0286
+append
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Nameserver/ 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Nameserver/ 4 0463
+append
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/SLIP/ 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/SLIP/ 4 0427
+append
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/ZTerm.html 4
+set
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/ZTerm.html 4 0395
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9407/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9407/pap00.htm 4 0227
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9409/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9409/pap00.htm 4 0310
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9410/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9410/pap00.htm 4 0368
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9411/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9411/pap00.htm 4 0413
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9412/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9412/pap00.htm 4 0468
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9506/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9506/pap00.htm 4 0151
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9507/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9507/pap00.htm 4 0259
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9508/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9508/pap00.htm 4 0281
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9509/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9509/pap00.htm 4 0338
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9510/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9510/pap00.htm 4 0393
+append
+       http://eos.wdcb.rssi.ru:80/transl/izve/9511/pap00.htm 4
+set
+       http://eos.wdcb.rssi.ru:80/transl/izve/9511/pap00.htm 4 0440
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/ARCS-92-Workplan/ARCS-Workplan.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/ARCS-92-Workplan/ARCS-Workplan.html 4 0367
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/EPA-905-S94-001/EPA-905-S94-001.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/EPA-905-S94-001/EPA-905-S94-001.html 4 0330
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/factsheet/lampsfact.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/factsheet/lampsfact.html 4 0292
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkmi-lamp/lkmi-lamp.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkmi-lamp/lkmi-lamp.html 4 0208
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/announ6-94.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/announ6-94.html 4 0230
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/lwi-lkon-abbr.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/lwi-lkon-abbr.html 4 0249
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/wasteupd.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/wasteupd.html 4 0266
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/onepgfacts/onepgfacts.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/onepgfacts/onepgfacts.html 4 0176
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/massbalance/EPA-905-8-89-001/MBSPToC.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/massbalance/EPA-905-8-89-001/MBSPToC.html 4 0464
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/GlennW.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/GlennW.html 4 0428
+append
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/Rockwell.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/Rockwell.html 4 0443
+append
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/FNorling.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/FNorling.html 4 0133
+append
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/GKohlhepp.html 4
+set
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/GKohlhepp.html 4 0154
+append
+       http://epcc.ed.ac.uk:80/Middle-Earth/ 4
+set
+       http://epcc.ed.ac.uk:80/Middle-Earth/ 4 0289
+append
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/GA-slides/Genetic-slides.book_1.html 4
+set
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/GA-slides/Genetic-slides.book_1.html 4 0480
+append
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/f95/ 4
+set
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/f95/ 4 0225
+append
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/mpi-slides/mpi-slides_1.html 4
+set
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/mpi-slides/mpi-slides_1.html 4 0417
+append
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/techwatch-nulibs/num-lib.book_1.html 4
+set
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/techwatch-nulibs/num-lib.book_1.html 4 0344
+append
+       http://epcc.ed.ac.uk:80/ssp/Applications.html 4
+set
+       http://epcc.ed.ac.uk:80/ssp/Applications.html 4 0175
+append
+       http://epinet.org:80/ep0401-c.html 4
+set
+       http://epinet.org:80/ep0401-c.html 4 0460
+append
+       http://epinet.org:80/ep0408-c.html 4
+set
+       http://epinet.org:80/ep0408-c.html 4 0441
+append
+       http://epinet.org:80/ep0416-c.html 4
+set
+       http://epinet.org:80/ep0416-c.html 4 0416
+append
+       http://epinet.org:80/ep0422-c.html 4
+set
+       http://epinet.org:80/ep0422-c.html 4 0396
+append
+       http://epinet.org:80/ep0430-c.html 4
+set
+       http://epinet.org:80/ep0430-c.html 4 0348
+append
+       http://epinet.org:80/ep0506-c.html 4
+set
+       http://epinet.org:80/ep0506-c.html 4 0328
+append
+       http://epinet.org:80/ep0513-c.html 4
+set
+       http://epinet.org:80/ep0513-c.html 4 0318
+append
+       http://epinet.org:80/ep0520-c.html 4
+set
+       http://epinet.org:80/ep0520-c.html 4 0303
+append
+       http://epinet.org:80/ep0528-c.html 4
+set
+       http://epinet.org:80/ep0528-c.html 4 0276
+append
+       http://epinet.org:80/ep0603-c.html 4
+set
+       http://epinet.org:80/ep0603-c.html 4 0247
+append
+       http://epinet.org:80/ep0610-c.html 4
+set
+       http://epinet.org:80/ep0610-c.html 4 0238
+append
+       http://epinet.org:80/ep0617-c.html 4
+set
+       http://epinet.org:80/ep0617-c.html 4 0205
+append
+       http://epinet.org:80/ep0624-c.html 4
+set
+       http://epinet.org:80/ep0624-c.html 4 0184
+append
+       http://epinet.org:80/ep0701-c.html 4
+set
+       http://epinet.org:80/ep0701-c.html 4 0168
+append
+       http://epinet.org:80/ep0708-c.html 4
+set
+       http://epinet.org:80/ep0708-c.html 4 0135
+append
+       http://epinet.org:80/epdatall.html 4
+set
+       http://epinet.org:80/epdatall.html 4 0484
+append
+       http://eprd.kpm.my:80/admin.html 4
+set
+       http://eprd.kpm.my:80/admin.html 4 0207
+append
+       http://eprd.kpm.my:80/bmdgkpm.html 4
+set
+       http://eprd.kpm.my:80/bmdgkpm.html 4 0291
+append
+       http://eprd.kpm.my:80/bmenkpm.html 4
+set
+       http://eprd.kpm.my:80/bmenkpm.html 4 0239
+append
+       http://eprd.kpm.my:80/bmtim.html 4
+set
+       http://eprd.kpm.my:80/bmtim.html 4 0263
+append
+       http://eprd.kpm.my:80/bsgkpm.html 4
+set
+       http://eprd.kpm.my:80/bsgkpm.html 4 0277
+append
+       http://eprd.kpm.my:80/divikpm.html 4
+set
+       http://eprd.kpm.my:80/divikpm.html 4 0340
+append
+       http://eprd.kpm.my:80/dkpm.html 4
+set
+       http://eprd.kpm.my:80/dkpm.html 4 0322
+append
+       http://eprd.kpm.my:80/emape.html 4
+set
+       http://eprd.kpm.my:80/emape.html 4 0171
+append
+       http://eprd.kpm.my:80/erangka.html 4
+set
+       http://eprd.kpm.my:80/erangka.html 4 0138
+append
+       http://eprd.kpm.my:80/moe1.html 4
+set
+       http://eprd.kpm.my:80/moe1.html 4 0361
+append
+       http://eprd.kpm.my:80/undang.html 4
+set
+       http://eprd.kpm.my:80/undang.html 4 0426
+append
+       http://eprd.kpm.my:80/unuku.html 4
+set
+       http://eprd.kpm.my:80/unuku.html 4 0453
+append
+       http://eps.geo.titech.ac.jp:80/nakazawalab/hemori/hemori.html 4
+set
+       http://eps.geo.titech.ac.jp:80/nakazawalab/hemori/hemori.html 4 0323
+append
+       http://eps.geo.titech.ac.jp:80/nakazawalab/sinaba/sinaba.html 4
+set
+       http://eps.geo.titech.ac.jp:80/nakazawalab/sinaba/sinaba.html 4 0437
+append
+       http://eps.geo.titech.ac.jp:80/nakazawalab/thamane/thamane.html 4
+set
+       http://eps.geo.titech.ac.jp:80/nakazawalab/thamane/thamane.html 4 0383
+append
+       http://eps.geo.titech.ac.jp:80/nakazawalab/tyoshida/tyoshida.html 4
+set
+       http://eps.geo.titech.ac.jp:80/nakazawalab/tyoshida/tyoshida.html 4 0411
+append
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi2.html 4
+set
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi2.html 4 0149
+append
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi3.html 4
+set
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi3.html 4 0211
+append
+       http://eps.geo.titech.ac.jp:80/takahashilab/ronbun.html 4
+set
+       http://eps.geo.titech.ac.jp:80/takahashilab/ronbun.html 4 0240
+append
+       http://eps.geo.titech.ac.jp:80/takahashilab/staff/staff.html 4
+set
+       http://eps.geo.titech.ac.jp:80/takahashilab/staff/staff.html 4 0251
+append
+       http://equinox.vtc.vsc.edu:80/info.html 4
+set
+       http://equinox.vtc.vsc.edu:80/info.html 4 0131
+append
+       http://equity.wharton.upenn.edu:80/ 4
+set
+       http://equity.wharton.upenn.edu:80/ 4 0196
+append
+       http://era.org:80/ 4
+set
+       http://era.org:80/ 4 0401
+append
+       http://era.org:80/pages/calendar.html 4
+set
+       http://era.org:80/pages/calendar.html 4 0485
+append
+       http://era.org:80/pages/cic.html 4
+set
+       http://era.org:80/pages/cic.html 4 0462
+append
+       http://era.org:80/pages/gic.html 4
+set
+       http://era.org:80/pages/gic.html 4 0418
+append
+       http://era.org:80/pages/locator.html 4
+set
+       http://era.org:80/pages/locator.html 4 0442
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/andy.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/andy.html 4 0190
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/andyb.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/andyb.html 4 0470
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/bill.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/bill.html 4 0264
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/bob.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/bob.html 4 0389
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/colin.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/colin.html 4 0300
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/don.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/don.html 4 0167
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/eric.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/eric.html 4 0147
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/geoff.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/geoff.html 4 0451
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/jack.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/jack.html 4 0279
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/jennifer.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/jennifer.html 4 0343
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/jimmy.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/jimmy.html 4 0364
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/josh.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/josh.html 4 0214
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/rama.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/rama.html 4 0243
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/ross.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/ross.html 4 0425
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/steve.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/steve.html 4 0324
+append
+       http://lyne.chemeng.ed.ac.uk:80/people/zain.html 4
+set
+       http://lyne.chemeng.ed.ac.uk:80/people/zain.html 4 0404
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-history:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-history:1 4 0478
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:2 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:2 4 0406
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:4 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:4 4 0432
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-week:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-week:1 4 0456
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-history:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-history:1 4 0380
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:2 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:2 4 0320
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:4 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:4 4 0342
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-week:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-week:1 4 0363
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-history:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-history:1 4 0204
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:2 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:2 4 0130
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:4 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:4 4 0166
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-week:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-week:1 4 0183
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-history:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-history:1 4 0299
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:2 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:2 4 0236
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:4 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:4 4 0256
+append
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-week:1 4
+set
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-week:1 4 0274
+append
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4 0054
+append
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4 0025
+append
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4 0082
+append
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4
+set
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4 0111
+append
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4 0108
+append
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4 0076
+append
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4 0013
+append
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4
+set
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4 0044
+append
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4
+set
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4 0008
+append
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/ad.htm 4
+set
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/ad.htm 4 0121
+append
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4
+set
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4 0093
+append
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4
+set
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4 0065
+append
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4
+set
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4 0037
+append
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4 0029
+append
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4 0068
+append
+       http://niteowl.net:80/homes1c.asp?propertyno=6932879 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=6932879 4 0123
+append
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4
+set
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4 0099
+append
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4 0103
+append
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4 0072
+append
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4
+set
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4 0031
+append
+       http://severin.objectware.no:80/ 4
+set
+       http://severin.objectware.no:80/ 4 0092
+append
+       http://severin.objectware.no:80/home/ow/english.htm 4
+set
+       http://severin.objectware.no:80/home/ow/english.htm 4 0127
+append
+       http://shell.aros.net:80/reports/octanner/120796.html 4
+set
+       http://shell.aros.net:80/reports/octanner/120796.html 4 0140
+append
+       http://shell.aros.net:80/reports/octanner/121095.html 4
+set
+       http://shell.aros.net:80/reports/octanner/121095.html 4 0160
+append
+       http://shell.aros.net:80/reports/octanner/121496.html 4
+set
+       http://shell.aros.net:80/reports/octanner/121496.html 4 0182
+append
+       http://shell.aros.net:80/reports/octanner/121795.html 4
+set
+       http://shell.aros.net:80/reports/octanner/121795.html 4 0199
+append
+       http://shell.aros.net:80/reports/octanner/122296.html 4
+set
+       http://shell.aros.net:80/reports/octanner/122296.html 4 0215
+append
+       http://shell.aros.net:80/reports/octanner/122495.html 4
+set
+       http://shell.aros.net:80/reports/octanner/122495.html 4 0231
+append
+       http://shell.aros.net:80/reports/octanner/122996.html 4
+set
+       http://shell.aros.net:80/reports/octanner/122996.html 4 0246
+append
+       http://shell.aros.net:80/reports/octanner/123195.html 4
+set
+       http://shell.aros.net:80/reports/octanner/123195.html 4 0268
+append
+       http://shell.aros.net:80/reports/onvine/010297.html 4
+set
+       http://shell.aros.net:80/reports/onvine/010297.html 4 0293
+append
+       http://shell.aros.net:80/reports/onvine/010597.html 4
+set
+       http://shell.aros.net:80/reports/onvine/010597.html 4 0313
+append
+       http://shell.aros.net:80/reports/onvine/011297.html 4
+set
+       http://shell.aros.net:80/reports/onvine/011297.html 4 0331
+append
+       http://shell.aros.net:80/reports/onvine/051296.html 4
+set
+       http://shell.aros.net:80/reports/onvine/051296.html 4 0349
+append
+       http://shell.aros.net:80/reports/onvine/051996.html 4
+set
+       http://shell.aros.net:80/reports/onvine/051996.html 4 0373
+append
+       http://shell.aros.net:80/reports/onvine/052696.html 4
+set
+       http://shell.aros.net:80/reports/onvine/052696.html 4 0386
+append
+       http://shell.aros.net:80/reports/onvine/060296.html 4
+set
+       http://shell.aros.net:80/reports/onvine/060296.html 4 0407
+append
+       http://shell.aros.net:80/reports/onvine/060996.html 4
+set
+       http://shell.aros.net:80/reports/onvine/060996.html 4 0430
+append
+       http://shell.aros.net:80/reports/onvine/061696.html 4
+set
+       http://shell.aros.net:80/reports/onvine/061696.html 4 0449
+append
+       http://shell.aros.net:80/reports/onvine/062396.html 4
+set
+       http://shell.aros.net:80/reports/onvine/062396.html 4 0469
+append
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4 0079
+append
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4 0042
+append
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4 0011
+append
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/stnfrd.htm/map 4
+set
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/stnfrd.htm/map 4 0117
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-208.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-208.html 4 0156
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-209.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-209.html 4 0178
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-210.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-210.html 4 0202
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/512/512-112.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/512/512-112.html 4 0271
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-100.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-100.html 4 0409
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-111.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-111.html 4 0301
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-118.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-118.html 4 0321
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-200.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-200.html 4 0458
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-201.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-201.html 4 0481
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-116.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-116.html 4 0345
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-117.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-117.html 4 0365
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/536/536-112.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/536/536-112.html 4 0384
+append
+       http://truck.its.unimelb.edu.au:80/HB/Med/640/640-100.html 4
+set
+       http://truck.its.unimelb.edu.au:80/HB/Med/640/640-100.html 4 0434
+append
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4 0052
+append
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4 0024
+append
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4 0094
+append
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.util.zip.Inflater.html 4
+set
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.util.zip.Inflater.html 4 0124
+append
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4 0053
+append
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4 0083
+append
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4 0112
+append
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4
+set
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4 0021
+append
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4 0109
+append
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4 0018
+append
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4 0049
+append
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4
+set
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4 0081
+append
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4 0051
+append
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4 0100
+append
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4
+set
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4 0020
+append
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4
+set
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4 0009
+append
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4
+set
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4 0066
+append
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4
+set
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4 0034
+append
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4 0039
+append
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4 0001
+append
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4
+set
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4 0074
+append
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=campanas.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=campanas.html/SID=769425689 4 0116
+append
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4 0014
+append
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4 0084
+append
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4
+set
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4 0045
+append
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4
+set
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4 0095
+append
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,6820_5,00.html 4
+set
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,6820_5,00.html 4 0120
+append
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4 0019
+append
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4 0050
+append
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4 0087
+append
+       http://www.newstimes.com:80/archive/dec1296/tvg.htm 4
+set
+       http://www.newstimes.com:80/archive/dec1296/tvg.htm 4 0118
+append
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4
+set
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4 0033
+append
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4 0028
+append
+       http://www.nflhome.com:80/vikings/club/media/yearkick.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yearkick.html 4 0128
+append
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4 0057
+append
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4
+set
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4 0097
+append
+       http://www.nha.v2net.com:80/nhaNews/edit-subscribe.pl/music/11.html 4
+set
+       http://www.nha.v2net.com:80/nhaNews/edit-subscribe.pl/music/11.html 4 0122
+append
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4
+set
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4 0003
+append
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4
+set
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4 0061
+append
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4
+set
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4 0007
+append
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4 0063
+append
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4 0088
+append
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4
+set
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4 0113
+append
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4
+set
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4 0070
+append
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1553.jpg 4
+set
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1553.jpg 4 0129
+append
+       http://www.nns.ru:80/persons/mashkov.html 4
+set
+       http://www.nns.ru:80/persons/mashkov.html 4 0017
+append
+       http://www.nns.ru:80/persons/medv.html 4
+set
+       http://www.nns.ru:80/persons/medv.html 4 0048
+append
+       http://www.nns.ru:80/persons/medvser.html 4
+set
+       http://www.nns.ru:80/persons/medvser.html 4 0080
+append
+       http://www.nns.ru:80/persons/merkush.html 4
+set
+       http://www.nns.ru:80/persons/merkush.html 4 0110
+append
+       http://www.nortel.com:80/cool/supply_mgt/UK_Paign.html 4
+set
+       http://www.nortel.com:80/cool/supply_mgt/UK_Paign.html 4 0115
+append
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4
+set
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4 0089
+append
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4
+set
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4 0022
+append
+       http://www.nortel.com:80/wireless/omni_gif.html 4
+set
+       http://www.nortel.com:80/wireless/omni_gif.html 4 0055
+append
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4 0027
+append
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4 0058
+append
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4
+set
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4 0096
+append
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4
+set
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4 0085
+append
+       http://www.npr.gov:80/library/reports/intel07.html 4
+set
+       http://www.npr.gov:80/library/reports/intel07.html 4 0002
+append
+       http://www.npr.gov:80/library/reports/intelact.html 4
+set
+       http://www.npr.gov:80/library/reports/intelact.html 4 0047
+append
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4
+set
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4 0016
+append
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4
+set
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4 0078
+append
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/ardickey.html.cgi 4
+set
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/ardickey.html.cgi 4 0125
+append
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4
+set
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4 0041
+append
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4
+set
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4 0098
+append
+       http://www.nylp.com:80/ctyelb.htm 4
+set
+       http://www.nylp.com:80/ctyelb.htm 4 0059
+append
+       http://www.nylp.com:80/pparty2.htm 4
+set
+       http://www.nylp.com:80/pparty2.htm 4 0091
+append
+       http://www.nysite.com:80/westside/blocks/b72.htm 4
+set
+       http://www.nysite.com:80/westside/blocks/b72.htm 4 0023
+append
+       http://www.nysite.com:80/westside/blocks/b73.htm 4
+set
+       http://www.nysite.com:80/westside/blocks/b73.htm 4 0060
+append
+       http://www.nznewsuk.co.uk:80/12jun96/front.html 4
+set
+       http://www.nznewsuk.co.uk:80/12jun96/front.html 4 0119
+append
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4
+set
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4 0090
+append
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4
+set
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4 0056
+append
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4
+set
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4 0026
+append
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4 0035
+append
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4 0101
+append
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4
+set
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4 0067
+append
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4 0006
+append
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4 0036
+append
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4 0062
+append
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4 0086
+append
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0615.htm 4
+set
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0615.htm 4 0114
+append
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4 0075
+append
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4 0043
+append
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4 0012
+append
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/agesglossary.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/agesglossary.html 4 0126
+append
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4
+set
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4 0104
+append
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4 0004
+append
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4 0038
+append
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4 0064
+append
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4
+set
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4 0105
+append
+       http://www.oberon.nl:80/xmas96/index.htm 4
+set
+       http://www.oberon.nl:80/xmas96/index.htm 4 0069
+append
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4 0015
+append
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4 0046
+append
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4 0077
+append
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4
+set
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4 0106
+append
+       http://www.objectreality.com:80/osg/ol.htm 4
+set
+       http://www.objectreality.com:80/osg/ol.htm 4 0073
+append
+       http://www.objectreality.com:80/osg/osgtrain.htm 4
+set
+       http://www.objectreality.com:80/osg/osgtrain.htm 4 0032
+append
+       http://www.objectreality.com:80/osg/otug.htm 4
+set
+       http://www.objectreality.com:80/osg/otug.htm 4 0107
+append
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4
+set
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4 0030
+append
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4
+set
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4 0071
+append
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4
+set
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4 0102
+append
+       http://www.objecttechnology.nl:80/ 4
+set
+       http://www.objecttechnology.nl:80/ 4 0005
+append
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/cub/feat/archive/052896/cub24714.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/cub/feat/archive/052896/cub24714.html 4 0197
+append
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/det/feat/archive/052896/det3191.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/det/feat/archive/052896/det3191.html 4 0272
+append
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/mlb/feat/archive/052896/mlb65943.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/mlb/feat/archive/052896/mlb65943.html 4 0141
+append
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/nym/feat/archive/052796/nym3971.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/nym/feat/archive/052796/nym3971.html 4 0472
+append
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052796/phi6831.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052796/phi6831.html 4 0450
+append
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052896/phi37127.html 4
+set
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052896/phi37127.html 4 0161
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cle/feat/archive/052896/cle19203.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cle/feat/archive/052896/cle19203.html 4 0350
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/col/feat/archive/052896/col53341.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/col/feat/archive/052896/col53341.html 4 0250
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cws/feat/archive/052896/cws33871.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cws/feat/archive/052896/cws33871.html 4 0294
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/kcr/feat/archive/052896/kcr27998.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/kcr/feat/archive/052896/kcr27998.html 4 0332
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb24341.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb24341.html 4 0180
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb26281.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb26281.html 4 0216
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb71878.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb71878.html 4 0374
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mon/feat/archive/052896/mon34035.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mon/feat/archive/052896/mon34035.html 4 0314
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/oak/feat/archive/052896/oak23146.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/oak/feat/archive/052896/oak23146.html 4 0410
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sea/feat/archive/052896/sea35379.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sea/feat/archive/052896/sea35379.html 4 0232
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg38415.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg38415.html 4 0392
+append
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg43595.html 4
+set
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg43595.html 4 0431
+ls
+       487
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC1_local_variable 4 0412
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TARCJJ_JTARC2_local_variable 4 0461
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TCHAJJ_JTCHC1_local_variable 4 0439
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_CDUMY_local_variable 4 0360
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_EFT_local_variable 4 0329
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_FSWAP_local_variable 4 0261
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_IBUFF_local_variable 4 0388
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_XFT_local_variable 4 0282
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TFCAND_YFT_local_variable 4 0307
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNBM_local_variable 4 0219
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNDN_local_variable 4 0170
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNTP_local_variable 4 0189
+       http://afal25.cern.ch:80/lrn/Julia.dict/?NAME=TLNKJJ_JTLNUP_local_variable 4 0136
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan14.html 4 0137
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan15.html 4 0157
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan4.html 4 0185
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan5.html 4 0206
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan6.html 4 0228
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan7.html 4 0248
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan8.html 4 0267
+       http://amsterdam.park.org:80/Japan/Kyushu/CyberC/INDEX/PEOPLE/SIFAN/sifan9.html 4 0290
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=3983:1:0 4 0040
+       http://art.moca.go.kr:80/uw/dispatcher/artwork_query_eng?oid=4141:6:0 4 0010
+       http://c21-champions.com:80/o=50134/browse.cmd 4 0347
+       http://c21-champions.com:80/o=50134/state=2/county=2/city=2/browse.cmd 4 0245
+       http://c21-champions.com:80/o=50134/x=19,2,1 4 0265
+       http://c21-champions.com:80/o=50134/x=19,2,18 4 0288
+       http://c21-champions.com:80/o=50134/x=19,2,23 4 0312
+       http://c21-champions.com:80/o=50134/x=21,2 4 0229
+       http://c21-champions.com:80/office=50106/bytim2.html 4 0203
+       http://c21-champions.com:80/office=50106/loanpack.html 4 0159
+       http://c21-champions.com:80/office=50106/mort.html 4 0132
+       http://c21-champions.com:80/office=50106/usmap.map 4 0186
+       http://c21-champions.com:80/office=50134/indexguide.html 4 0403
+       http://c21-champions.com:80/office=50134/lots=1/fpage.cmd 4 0382
+       http://c21-champions.com:80/w=1/o=50134/browse.cmd 4 0448
+       http://c21-champions.com:80/w=1/o=50134/buycentr.html 4 0487
+       http://c21-champions.com:80/w=1/o=50134/fpage.cmd 4 0369
+       http://c21-champions.com:80/w=1/o=50134/real-index.html 4 0420
+       http://c21-champions.com:80/w=1/o=50134/wlcmctr.html 4 0473
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Interval.i3.html 4 0142
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/../geometry/src/Trapezoid.i3.html 4 0172
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedBarVBT.m3.html 4 0327
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedFeedbackVBT.m3.html 4 0357
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/lego/src/ShadowedVBT.m3.html 4 0377
+       http://ciop.dsi.unive.it:80/documents/modula3/m3sources/html/netobjrt/../uid/src/Common/TimeStamp.i3.html 4 0210
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0894.html 4 0152
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0895.html 4 0173
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0897.html 4 0212
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0898.html 4 0234
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0899.html 4 0269
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0900.html 4 0192
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0901.html 4 0316
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0902.html 4 0296
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0903.html 4 0334
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0904.html 4 0352
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0905.html 4 0253
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0907.html 4 0371
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0910.html 4 0385
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0911.html 4 0402
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0912.html 4 0422
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0913.html 4 0444
+       http://cobra.eit.com:80/goodies/lists/www.lists/www-talk.1993q3/0916.html 4 0465
+       http://connectedpc.com:80/design/pricelst/21db2.htm 4 0145
+       http://connectedpc.com:80/design/pricelst/21db6.htm 4 0164
+       http://connectedpc.com:80/design/pricelst/21dba.htm 4 0187
+       http://connectedpc.com:80/design/pricelst/21dbe.htm 4 0201
+       http://connectedpc.com:80/design/pricelst/21dc2.htm 4 0226
+       http://connectedpc.com:80/design/pricelst/21dc6.htm 4 0255
+       http://connectedpc.com:80/design/pricelst/21dca.htm 4 0270
+       http://connectedpc.com:80/design/pricelst/21dce.htm 4 0298
+       http://connectedpc.com:80/design/pricelst/21dd2.htm 4 0317
+       http://connectedpc.com:80/design/pricelst/21dd6.htm 4 0335
+       http://connectedpc.com:80/design/pricelst/21dda.htm 4 0353
+       http://connectedpc.com:80/design/pricelst/21dde.htm 4 0370
+       http://connectedpc.com:80/design/pricelst/21de2.htm 4 0394
+       http://connectedpc.com:80/design/pricelst/21de6.htm 4 0405
+       http://connectedpc.com:80/design/pricelst/21dea.htm 4 0423
+       http://connectedpc.com:80/design/pricelst/21dee.htm 4 0445
+       http://connectedpc.com:80/design/pricelst/21df2.htm 4 0466
+       http://cypress.ukc.ac.uk:2001/home/jf4/rtf/rtftohtml-2.7.5/docs/ 4 0242
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00757.html 4 0144
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00758.html 4 0163
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00759.html 4 0194
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00760.html 4 0213
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00761.html 4 0235
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00762.html 4 0254
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00763.html 4 0273
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00764.html 4 0297
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00765.html 4 0319
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00766.html 4 0341
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00767.html 4 0362
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00768.html 4 0381
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00769.html 4 0400
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00770.html 4 0435
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00771.html 4 0455
+       http://delphi.beckman.uiuc.edu:80/softimage/mail-archive/3d/96-07/msg00772.html 4 0477
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/atndlist.html 4 0169
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/jdspres/sesseval.html 4 0134
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/Helpful_Bookmarks.html 4 0218
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/atndlist.html 4 0436
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/introcnf.html 4 0191
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jdspres/index.html 4 0283
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jhale.html 4 0354
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/surds196.html 4 0260
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/jmapres/tools196.html 4 0325
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/ljdpres/index.html 4 0302
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/marge_smith.html 4 0241
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/overview.html 4 0387
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/jdspres/ljdpres/sesseval.html 4 0414
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/Helpful_Bookmarks.html 4 0482
+       http://delphi.colorado.edu:80/~irm/about_irm/schedule/WWW_conf_jan_96/index.html/jdspres/ljdpres/jdspres/ljdpres/jmapres/introcnf.html 4 0459
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+INFORMATION+alej-log.jan96 4 0150
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.all 4 0358
+       http://devetsil.vse.cz:80/cgi-bin/wwl/action.cgi?servik=ALFA.VSE.CZ&port=372&volba=get+ISIS+NET+ascii.tab 4 0379
+       http://devetsil.vse.cz:80/cgi-bin/wwl/pindex.cgi?servik=ALFA.VSE.CZ&port=372&volba=index&skupina=LISTPROC 4 0336
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=cat 4 0483
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=gzip 4 0311
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=netscape 4 0346
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uudecode 4 0275
+       http://dollar.ts.umu.se:80/cgi-bin/scripts/man?name=uuencode 4 0237
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/amigaservers.html 4 0452
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/saveinline.html 4 0209
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/webnews.html 4 0287
+       http://ecco.bsee.swin.edu.au:80/inet/www-faq/winsound.html 4 0355
+       http://edmunds.com:80/edweb/burkleon/burke8.html 4 0419
+       http://edmunds.com:80/edweb/cars/Geo/183.97.html 4 0446
+       http://edmunds.com:80/edweb/cars/Geo/184.97.html 4 0471
+       http://edmunds.com:80/edweb/cars/Geo/186.97.html 4 0486
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t275.html 4 0148
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t280.html 4 0174
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t283.html 4 0195
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t284.html 4 0222
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t287.html 4 0258
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t289.html 4 0280
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t291.html 4 0304
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.97.html 4 0326
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t292.html 4 0376
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.97.html 4 0356
+       http://edmunds.com:80/edweb/trucks/Chevrolet.Trucks/t293.html 4 0398
+       http://einstein.leyada.jlm.k12.il:80/novell/about/ 4 0375
+       http://einstein.leyada.jlm.k12.il:80/novell/etgar/ 4 0397
+       http://einstein.leyada.jlm.k12.il:80/novell/img/ 4 0421
+       http://einstein.leyada.jlm.k12.il:80/novell/index.htm 4 0447
+       http://einstein.leyada.jlm.k12.il:80/novell/index2.htm 4 0475
+       http://einstein.physics.drexel.edu:80/INPC-98/signatures.html 4 0223
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/diffeq/ 4 0429
+       http://einstein.physics.drexel.edu:80/hpcl/sscp/subjects/para/domain/../prog_strat/prog_strat.html 4 0308
+       http://einstein.physics.drexel.edu:80/pages/students/wisniewski_old/ 4 0146
+       http://einstein.physics.drexel.edu:80/pages/students/xing/ 4 0165
+       http://einstein.physics.drexel.edu:80/pages/students/zlatev/ 4 0181
+       http://ella.netpoint.net:80/empg/bahama-divers/bd0.htm 4 0454
+       http://ella.netpoint.net:80/empg/bahama-divers/bd1.htm 4 0476
+       http://ella.netpoint.net:80/empg/news/aladin.htm 4 0372
+       http://ella.netpoint.net:80/empg/news/aquaquest.htm 4 0252
+       http://ella.netpoint.net:80/empg/news/archives.htm 4 0433
+       http://ella.netpoint.net:80/empg/news/carib.htm 4 0351
+       http://ella.netpoint.net:80/empg/news/coral.htm 4 0315
+       http://ella.netpoint.net:80/empg/news/cpia.htm 4 0143
+       http://ella.netpoint.net:80/empg/news/demaasia.htm 4 0295
+       http://ella.netpoint.net:80/empg/news/dticonf.htm 4 0408
+       http://ella.netpoint.net:80/empg/news/eta.htm 4 0200
+       http://ella.netpoint.net:80/empg/news/holland.htm 4 0391
+       http://ella.netpoint.net:80/empg/news/king.htm 4 0233
+       http://ella.netpoint.net:80/empg/news/marine.htm 4 0217
+       http://ella.netpoint.net:80/empg/news/maya.htm 4 0333
+       http://ella.netpoint.net:80/empg/news/sos.htm 4 0278
+       http://ella.netpoint.net:80/empg/news/tek.htm 4 0162
+       http://ella.netpoint.net:80/empg/news/wsa.htm 4 0179
+       http://emanuelnyc.org:80/history/pilgrimage/pilgrimage6.html 4 0474
+       http://emneta.emnet.co.uk:80/EcoDev/Agencies/GNTEC/ 4 0306
+       http://emphase-10.yweb.com:80/070100de.html 4 0399
+       http://emphase-10.yweb.com:80/070104de.html 4 0479
+       http://emphase-10.yweb.com:80/070105de.html 4 0457
+       http://emphase-10.yweb.com:80/070150de.html 4 0424
+       http://emphase-10.yweb.com:80/070300de.html 4 0155
+       http://emphase-10.yweb.com:80/070301de.html 4 0309
+       http://emphase-10.yweb.com:80/070302de.html 4 0224
+       http://emphase-10.yweb.com:80/070303de.html 4 0177
+       http://emphase-10.yweb.com:80/070304de.html 4 0284
+       http://emphase-10.yweb.com:80/070305de.html 4 0198
+       http://emphase-10.yweb.com:80/070306de.html 4 0257
+       http://emphase-10.yweb.com:80/070307de.html 4 0337
+       http://emphase-10.yweb.com:80/070700de.html 4 0378
+       http://emphase-10.yweb.com:80/070800de.html 4 0359
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-kinkcorp.html&v_prev=/sort-company.html&tracking_id=LE 4 0153
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-lockheed.html&v_prev=/sort-company.html&tracking_id=LE 4 0188
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-macys.html&v_prev=/sort-company.html&tracking_id=LE 4 0221
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mit.html&v_prev=/sort-company.html&tracking_id=LE 4 0262
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-motorola.html&v_prev=/sort-company.html&tracking_id=LE 4 0285
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-multiad.html&v_prev=/sort-company.html&tracking_id=LE 4 0305
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-mystic.html&v_prev=/sort-company.html&tracking_id=LE 4 0339
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-north.html&v_prev=/sort-company.html&tracking_id=LE 4 0366
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-novations.html&v_prev=/sort-company.html&tracking_id=LE 4 0467
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest1.html&v_prev=/sort-company.html&tracking_id=LE 4 0390
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest2.html&v_prev=/sort-company.html&tracking_id=LE 4 0415
+       http://enterprise.apple.fireflybuzz.com:80/cgi-bin/owa/show_page?v_next=/ss-nwest3.html&v_prev=/sort-company.html&tracking_id=LE 4 0438
+       http://enterprise.mathematik.uni-essen.de:80/cgi-bin/man-cgi?tar 4 0220
+       http://enterprise.mathematik.uni-essen.de:80/enterprise 4 0193
+       http://enterprise.mathematik.uni-essen.de:80/mdw/LDP/nag/node92.html 4 0244
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/ganz_neue_Bookmarks.html 4 0139
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Bookmarks/noch_mehr_unsortierte_bookmarks.html 4 0158
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Kabel/ 4 0286
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/Nameserver/ 4 0463
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/SLIP/ 4 0427
+       http://enterprise.mathematik.uni-essen.de:80/~stefan/Mac---Linux/ZTerm.html 4 0395
+       http://eos.wdcb.rssi.ru:80/transl/izve/9407/pap00.htm 4 0227
+       http://eos.wdcb.rssi.ru:80/transl/izve/9409/pap00.htm 4 0310
+       http://eos.wdcb.rssi.ru:80/transl/izve/9410/pap00.htm 4 0368
+       http://eos.wdcb.rssi.ru:80/transl/izve/9411/pap00.htm 4 0413
+       http://eos.wdcb.rssi.ru:80/transl/izve/9412/pap00.htm 4 0468
+       http://eos.wdcb.rssi.ru:80/transl/izve/9506/pap00.htm 4 0151
+       http://eos.wdcb.rssi.ru:80/transl/izve/9507/pap00.htm 4 0259
+       http://eos.wdcb.rssi.ru:80/transl/izve/9508/pap00.htm 4 0281
+       http://eos.wdcb.rssi.ru:80/transl/izve/9509/pap00.htm 4 0338
+       http://eos.wdcb.rssi.ru:80/transl/izve/9510/pap00.htm 4 0393
+       http://eos.wdcb.rssi.ru:80/transl/izve/9511/pap00.htm 4 0440
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/ARCS-92-Workplan/ARCS-Workplan.html 4 0367
+       http://epaserver.ciesin.org:80/glreis/glnpo/data/arcs/EPA-905-S94-001/EPA-905-S94-001.html 4 0330
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/factsheet/lampsfact.html 4 0292
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkmi-lamp/lkmi-lamp.html 4 0208
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/announ6-94.html 4 0230
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/lwi-lkon/lwi-lkon-abbr.html 4 0249
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/lkon-lamp/wasteupd.html 4 0266
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/lamps/onepgfacts/onepgfacts.html 4 0176
+       http://epaserver.ciesin.org:80/glreis/glnpo/prog/massbalance/EPA-905-8-89-001/MBSPToC.html 4 0464
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/GlennW.html 4 0428
+       http://epaserver.ciesin.org:80/glreis/glnpo/whois/Rockwell.html 4 0443
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/FNorling.html 4 0133
+       http://epaserver.ciesin.org:80/glreis/nonpo/whois/GKohlhepp.html 4 0154
+       http://epcc.ed.ac.uk:80/Middle-Earth/ 4 0289
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/GA-slides/Genetic-slides.book_1.html 4 0480
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/f95/ 4 0225
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/mpi-slides/mpi-slides_1.html 4 0417
+       http://epcc.ed.ac.uk:80/epcc-tec/documents/techwatch-nulibs/num-lib.book_1.html 4 0344
+       http://epcc.ed.ac.uk:80/ssp/Applications.html 4 0175
+       http://epinet.org:80/ep0401-c.html 4 0460
+       http://epinet.org:80/ep0408-c.html 4 0441
+       http://epinet.org:80/ep0416-c.html 4 0416
+       http://epinet.org:80/ep0422-c.html 4 0396
+       http://epinet.org:80/ep0430-c.html 4 0348
+       http://epinet.org:80/ep0506-c.html 4 0328
+       http://epinet.org:80/ep0513-c.html 4 0318
+       http://epinet.org:80/ep0520-c.html 4 0303
+       http://epinet.org:80/ep0528-c.html 4 0276
+       http://epinet.org:80/ep0603-c.html 4 0247
+       http://epinet.org:80/ep0610-c.html 4 0238
+       http://epinet.org:80/ep0617-c.html 4 0205
+       http://epinet.org:80/ep0624-c.html 4 0184
+       http://epinet.org:80/ep0701-c.html 4 0168
+       http://epinet.org:80/ep0708-c.html 4 0135
+       http://epinet.org:80/epdatall.html 4 0484
+       http://eprd.kpm.my:80/admin.html 4 0207
+       http://eprd.kpm.my:80/bmdgkpm.html 4 0291
+       http://eprd.kpm.my:80/bmenkpm.html 4 0239
+       http://eprd.kpm.my:80/bmtim.html 4 0263
+       http://eprd.kpm.my:80/bsgkpm.html 4 0277
+       http://eprd.kpm.my:80/divikpm.html 4 0340
+       http://eprd.kpm.my:80/dkpm.html 4 0322
+       http://eprd.kpm.my:80/emape.html 4 0171
+       http://eprd.kpm.my:80/erangka.html 4 0138
+       http://eprd.kpm.my:80/moe1.html 4 0361
+       http://eprd.kpm.my:80/undang.html 4 0426
+       http://eprd.kpm.my:80/unuku.html 4 0453
+       http://eps.geo.titech.ac.jp:80/nakazawalab/hemori/hemori.html 4 0323
+       http://eps.geo.titech.ac.jp:80/nakazawalab/sinaba/sinaba.html 4 0437
+       http://eps.geo.titech.ac.jp:80/nakazawalab/thamane/thamane.html 4 0383
+       http://eps.geo.titech.ac.jp:80/nakazawalab/tyoshida/tyoshida.html 4 0411
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi2.html 4 0149
+       http://eps.geo.titech.ac.jp:80/takahashilab/kakenhi3.html 4 0211
+       http://eps.geo.titech.ac.jp:80/takahashilab/ronbun.html 4 0240
+       http://eps.geo.titech.ac.jp:80/takahashilab/staff/staff.html 4 0251
+       http://equinox.vtc.vsc.edu:80/info.html 4 0131
+       http://equity.wharton.upenn.edu:80/ 4 0196
+       http://era.org:80/ 4 0401
+       http://era.org:80/pages/calendar.html 4 0485
+       http://era.org:80/pages/cic.html 4 0462
+       http://era.org:80/pages/gic.html 4 0418
+       http://era.org:80/pages/locator.html 4 0442
+       http://lyne.chemeng.ed.ac.uk:80/people/andy.html 4 0190
+       http://lyne.chemeng.ed.ac.uk:80/people/andyb.html 4 0470
+       http://lyne.chemeng.ed.ac.uk:80/people/bill.html 4 0264
+       http://lyne.chemeng.ed.ac.uk:80/people/bob.html 4 0389
+       http://lyne.chemeng.ed.ac.uk:80/people/colin.html 4 0300
+       http://lyne.chemeng.ed.ac.uk:80/people/don.html 4 0167
+       http://lyne.chemeng.ed.ac.uk:80/people/eric.html 4 0147
+       http://lyne.chemeng.ed.ac.uk:80/people/geoff.html 4 0451
+       http://lyne.chemeng.ed.ac.uk:80/people/jack.html 4 0279
+       http://lyne.chemeng.ed.ac.uk:80/people/jennifer.html 4 0343
+       http://lyne.chemeng.ed.ac.uk:80/people/jimmy.html 4 0364
+       http://lyne.chemeng.ed.ac.uk:80/people/josh.html 4 0214
+       http://lyne.chemeng.ed.ac.uk:80/people/rama.html 4 0243
+       http://lyne.chemeng.ed.ac.uk:80/people/ross.html 4 0425
+       http://lyne.chemeng.ed.ac.uk:80/people/steve.html 4 0324
+       http://lyne.chemeng.ed.ac.uk:80/people/zain.html 4 0404
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-history:1 4 0478
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:2 4 0406
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-new:4 4 0432
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-all-week:1 4 0456
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-history:1 4 0380
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:2 4 0320
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-new:4 4 0342
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-other-week:1 4 0363
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-history:1 4 0204
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:2 4 0130
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-new:4 4 0166
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-sem-week:1 4 0183
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-history:1 4 0299
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:2 4 0236
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-new:4 4 0256
+       http://macbeth.emc.dk:80/DAN-cgi-bin/events.pl?imada-vacan-week:1 4 0274
+       http://marsha-3.pno.net:80/Issues/9610/arts.html 4 0054
+       http://marsha-3.pno.net:80/Issues/9610/news.html 4 0025
+       http://marsha-3.pno.net:80/Issues/9611/columns.html 4 0082
+       http://marsha-3.pno.net:80/Issues/9611/cover.html 4 0111
+       http://mostmedia.com:80/scripts/webx.exe?15@^3303@14@ 4 0108
+       http://mostmedia.com:80/scripts/webx.exe?18@^3303@14@ 4 0076
+       http://mostmedia.com:80/scripts/webx.exe?38@^3303@ 4 0013
+       http://mostmedia.com:80/scripts/webx.exe?9@^3303@ 4 0044
+       http://netskill.com:80/E0020/0wlAUn6vIs.qU8nwlT9loW0bALrBHXzu/ad.htm 4 0008
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/ad.htm 4 0121
+       http://netskill.com:80/E0020/6nePkBkRH08qU8nwlT9loKhznBANh+Rt/itc 4 0093
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/ad.htm 4 0065
+       http://netskill.com:80/E0020/aD6q2z+7s664vWJNI83iNys7EB3GTNW0/itc 4 0037
+       http://niteowl.net:80/homes1c.asp?propertyno=12898810 4 0029
+       http://niteowl.net:80/homes1c.asp?propertyno=13043766 4 0068
+       http://niteowl.net:80/homes1c.asp?propertyno=6932879 4 0123
+       http://niteowl.net:80/homes1c.asp?propertyno=6933727 4 0099
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/chung_lai_hong.htm 4 0103
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/gibbons_patrick.htm 4 0072
+       http://ntuix.ntu.edu.sg:80/nbs/staff-directory/wong_leung_roberta.htm 4 0031
+       http://severin.objectware.no:80/ 4 0092
+       http://severin.objectware.no:80/home/ow/english.htm 4 0127
+       http://shell.aros.net:80/reports/octanner/120796.html 4 0140
+       http://shell.aros.net:80/reports/octanner/121095.html 4 0160
+       http://shell.aros.net:80/reports/octanner/121496.html 4 0182
+       http://shell.aros.net:80/reports/octanner/121795.html 4 0199
+       http://shell.aros.net:80/reports/octanner/122296.html 4 0215
+       http://shell.aros.net:80/reports/octanner/122495.html 4 0231
+       http://shell.aros.net:80/reports/octanner/122996.html 4 0246
+       http://shell.aros.net:80/reports/octanner/123195.html 4 0268
+       http://shell.aros.net:80/reports/onvine/010297.html 4 0293
+       http://shell.aros.net:80/reports/onvine/010597.html 4 0313
+       http://shell.aros.net:80/reports/onvine/011297.html 4 0331
+       http://shell.aros.net:80/reports/onvine/051296.html 4 0349
+       http://shell.aros.net:80/reports/onvine/051996.html 4 0373
+       http://shell.aros.net:80/reports/onvine/052696.html 4 0386
+       http://shell.aros.net:80/reports/onvine/060296.html 4 0407
+       http://shell.aros.net:80/reports/onvine/060996.html 4 0430
+       http://shell.aros.net:80/reports/onvine/061696.html 4 0449
+       http://shell.aros.net:80/reports/onvine/062396.html 4 0469
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/_vti_bin/shtml.exe/pressrls.htm/map1 4 0079
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/kingery.htm 4 0042
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/pressrls.htm/stock.htm 4 0011
+       http://sylvester.oacis.com:80/Oacis/_vti_bin/shtml.exe/stnfrd.htm/map 4 0117
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-208.html 4 0156
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-209.html 4 0178
+       http://truck.its.unimelb.edu.au:80/HB/Med/511/511-210.html 4 0202
+       http://truck.its.unimelb.edu.au:80/HB/Med/512/512-112.html 4 0271
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-100.html 4 0409
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-111.html 4 0301
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-118.html 4 0321
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-200.html 4 0458
+       http://truck.its.unimelb.edu.au:80/HB/Med/513/513-201.html 4 0481
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-116.html 4 0345
+       http://truck.its.unimelb.edu.au:80/HB/Med/516/516-117.html 4 0365
+       http://truck.its.unimelb.edu.au:80/HB/Med/536/536-112.html 4 0384
+       http://truck.its.unimelb.edu.au:80/HB/Med/640/640-100.html 4 0434
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.AverageScaleFilter.html 4 0052
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.awt.image.ReplicateScaleFilter.html 4 0024
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.net.InetAddress.html 4 0094
+       http://ui.nada.kth.se:8080/javadoc/JDK1.1/api/java.util.zip.Inflater.html 4 0124
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041411.html 4 0053
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041418.html 4 0083
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000004/14/0000041420.html 4 0112
+       http://warp.nal.usda.gov:80/ttic/tektran/data/000006/86/0000068663.html 4 0021
+       http://www.msue.msu.edu:80/msue/imp/modc1/04219508.html 4 0109
+       http://www.msue.msu.edu:80/msue/imp/modc1/50694004.html 4 0018
+       http://www.msue.msu.edu:80/msue/imp/modc1/61193008.html 4 0049
+       http://www.msue.msu.edu:80/msue/imp/modc1/87920010.html 4 0081
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina10.html 4 0051
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/pagina16.html 4 0100
+       http://www.nacion.co.cr:80/ln_ee/1996/julio/22/ticos.html 4 0020
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/239.html 4 0009
+       http://www.nau.edu:80/~cline/speccoll/images/catrecs/240.html 4 0066
+       http://www.netprop.com:80/cgi-bin/rbox/makepage/NY/LIST/NY1-4169.html 4 0034
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?0!elk!886E!/vdoc/pdpage?mi=214154378 4 0039
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!884E!/vdoc/pdpage?mi=204487 4 0001
+       http://www.netseminar.com:80/cgi-bin/order/acclogin?1!elk!886E!/vdoc/pdpage?mi=214154378 4 0074
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=campanas.html/SID=769425689 4 0116
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=jrgifts.html/SID=769425689 4 0014
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=kirks.html/SID=769425689 4 0084
+       http://www.new-mexico-malls.com:80/wizards-bin/shop.pl/page=klawson.html/SID=769425689 4 0045
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,1541_4,00.html 4 0095
+       http://www.news.com:80/SpecialFeatures/Continued/0,6,6820_5,00.html 4 0120
+       http://www.newstimes.com:80/archive/dec1296/tvd.htm 4 0019
+       http://www.newstimes.com:80/archive/dec1296/tve.htm 4 0050
+       http://www.newstimes.com:80/archive/dec1296/tvf.htm 4 0087
+       http://www.newstimes.com:80/archive/dec1296/tvg.htm 4 0118
+       http://www.nextextent.com:80/~wkc/Melisabd.html 4 0033
+       http://www.nflhome.com:80/vikings/club/media/yearint.html 4 0028
+       http://www.nflhome.com:80/vikings/club/media/yearkick.html 4 0128
+       http://www.nflhome.com:80/vikings/club/media/yearsack.html 4 0057
+       http://www.nflhome.com:80/vikings/club/media/yeartack.html 4 0097
+       http://www.nha.v2net.com:80/nhaNews/edit-subscribe.pl/music/11.html 4 0122
+       http://www.nig.nl:80/congress/abstract/114-1225.html 4 0003
+       http://www.nig.nl:80/congress/abstract/114-1226.html 4 0061
+       http://www.nihon.net:80/shibuya/inetshop/html/jim003.htm 4 0007
+       http://www.nihon.net:80/shibuya/kako/html/ytdo20.htm 4 0063
+       http://www.nihon.net:80/shibuya/kako/html/ytdo30.htm 4 0088
+       http://www.nihon.net:80/shibuya/kako/html/ytdo40.htm 4 0113
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1552.jpg 4 0070
+       http://www.nirex.co.uk:80/poehtml/nrx15/nrx15.htm/nrx14/nrx13/nrx13/images/pe1553.jpg 4 0129
+       http://www.nns.ru:80/persons/mashkov.html 4 0017
+       http://www.nns.ru:80/persons/medv.html 4 0048
+       http://www.nns.ru:80/persons/medvser.html 4 0080
+       http://www.nns.ru:80/persons/merkush.html 4 0110
+       http://www.nortel.com:80/cool/supply_mgt/UK_Paign.html 4 0115
+       http://www.nortel.com:80/home/press/1996c/9_10_96270OpAmps.html 4 0089
+       http://www.nortel.com:80/wireless/news/1996a/3_12_96051Mobistar33M.html 4 0022
+       http://www.nortel.com:80/wireless/omni_gif.html 4 0055
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.7 4 0027
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.8 4 0058
+       http://www.notes.nt.gov.au:80/hansard/hansard7.nsf/4a3f1d82a80923f148255fce002cd98b?OpenView&Start=1&Count=30&Expand=3.9 4 0096
+       http://www.npr.gov:80/library/reports/Exec_Sum_DOI.html 4 0085
+       http://www.npr.gov:80/library/reports/intel07.html 4 0002
+       http://www.npr.gov:80/library/reports/intelact.html 4 0047
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_MaxFragments.html 4 0016
+       http://www.nscl.msu.edu:80/s800/evtbld/evb_Perror.html 4 0078
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/ardickey.html.cgi 4 0125
+       http://www.ntu.org:80/NTU/vote_tally/house/member/detail/fldiaz-b.html.cgi 4 0041
+       http://www.ny.mm.org:80/spa?ABC@TEEN 4 0098
+       http://www.nylp.com:80/ctyelb.htm 4 0059
+       http://www.nylp.com:80/pparty2.htm 4 0091
+       http://www.nysite.com:80/westside/blocks/b72.htm 4 0023
+       http://www.nysite.com:80/westside/blocks/b73.htm 4 0060
+       http://www.nznewsuk.co.uk:80/12jun96/front.html 4 0119
+       http://www.nznewsuk.co.uk:80/12jun96/lead.html 4 0090
+       http://www.nznewsuk.co.uk:80/19jun96/around.html 4 0056
+       http://www.nznewsuk.co.uk:80/19jun96/sportresult.html 4 0026
+       http://www.nzz.ch:80/folio/curr/articles/gespraech.html 4 0035
+       http://www.nzz.ch:80/folio/curr/articles/heimfaits.html 4 0101
+       http://www.nzz.ch:80/folio/curr/articles/stillepost.html 4 0067
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0611.htm 4 0006
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0612.htm 4 0036
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0613.htm 4 0062
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0614.htm 4 0086
+       http://www.oaklandathletics.com:80/pressbox/boxscores/0615.htm 4 0114
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/contributions-egypt.html 4 0075
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/religion-egypt.html 4 0043
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/egypt/reports.html 4 0012
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/agesglossary.html 4 0126
+       http://www.oakview.fcps.k12.va.us:80/~harris/96-97/agespages/prehistoric/cave.html 4 0104
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig125.htm 4 0004
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig130.htm 4 0038
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig135.htm 4 0064
+       http://www.oalj.dol.gov:80/public/ofccp/refrnc/ocdig140.htm 4 0105
+       http://www.oberon.nl:80/xmas96/index.htm 4 0069
+       http://www.obgyn.upenn.edu:80/genpractice/Berlin.html 4 0015
+       http://www.obgyn.upenn.edu:80/genpractice/Edwards.html 4 0046
+       http://www.obgyn.upenn.edu:80/genpractice/fang.html 4 0077
+       http://www.obgyn.upenn.edu:80/genpractice/holland.html 4 0106
+       http://www.objectreality.com:80/osg/ol.htm 4 0073
+       http://www.objectreality.com:80/osg/osgtrain.htm 4 0032
+       http://www.objectreality.com:80/osg/otug.htm 4 0107
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/020_Background/index.html 4 0030
+       http://www.objectronics.com:80/links/010_AboutObjectronics/links/030_ContactInformation/index.html 4 0071
+       http://www.objectronics.com:80/links/020_HotNews/links/010_PR_ObjectronicsFounded/index.html 4 0102
+       http://www.objecttechnology.nl:80/ 4 0005
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/cub/feat/archive/052896/cub24714.html 4 0197
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/det/feat/archive/052896/det3191.html 4 0272
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/mlb/feat/archive/052896/mlb65943.html 4 0141
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/nym/feat/archive/052796/nym3971.html 4 0472
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052796/phi6831.html 4 0450
+       http://xenocide.nando.net:80/newsroom/ap/bbo/1996/mlb/phi/feat/archive/052896/phi37127.html 4 0161
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cle/feat/archive/052896/cle19203.html 4 0350
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/col/feat/archive/052896/col53341.html 4 0250
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/cws/feat/archive/052896/cws33871.html 4 0294
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/kcr/feat/archive/052896/kcr27998.html 4 0332
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb24341.html 4 0180
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb26281.html 4 0216
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mlb/feat/archive/052896/mlb71878.html 4 0374
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/mon/feat/archive/052896/mon34035.html 4 0314
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/oak/feat/archive/052896/oak23146.html 4 0410
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sea/feat/archive/052896/sea35379.html 4 0232
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg38415.html 4 0392
+       http://xenocide.nando.net:80/newsroom/sports/bbo/1996/mlb/sfg/feat/archive/052896/sfg43595.html 4 0431
+
diff --git a/src/test/mem_1.c b/src/test/mem_1.c
new file mode 100644 (file)
index 0000000..a54ce13
--- /dev/null
@@ -0,0 +1,81 @@
+/* mem_1 does some (static) tests to ensure that the mem functions and macros
+ * work properly
+ *
+ * written nml 2003-02-03
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "test.h"
+#include "mem.h"
+#include "_mem.h"
+
+#include <inttypes.h>
+
+int test_file(FILE *fp, int argc, char **argv) {
+    unsigned int i,
+                 num,
+                 num2;
+
+    union {
+        unsigned int unum;
+        unsigned char uchar[1];
+    } u;
+
+    /* ensure that we aren't testing from a file */
+    if ((fp && (fp != stdin)) || (argc > 1)) {
+        return 0;
+    }
+
+    /* assign number in network byte order */
+    for (i = 0; i < sizeof(int); i++) {
+        u.uchar[i] = i + 1;         /* assign 1 2 3 4 etc to num, big-endian */
+    }
+
+    /* convert it */
+    mem_ntoh(&num, &u.unum, sizeof(num));
+
+    /* read it in host byte order */
+    for (i = 0; i < sizeof(int); i++) {
+        if (((num >> (8 * i)) & 0xff) != sizeof(int) - i) {
+            return 0;
+        }
+    }
+
+    /* convert it */
+    u.unum = 0;
+    mem_hton(&u.unum, &num, sizeof(num2));
+    for (i = 0; i < sizeof(int); i++) {
+        if (u.uchar[i] != i + 1) {
+            return 0;
+        }
+    }
+
+    /* assign number in network byte order */
+    for (i = 0; i < sizeof(int); i++) {
+        u.uchar[i] = i + 1;         /* assign 1 2 3 4 etc to num, big-endian */
+    }
+
+    /* convert it */
+    MEM_NTOH(&num, &u.unum, sizeof(num));
+
+    /* read it in host byte order */
+    for (i = 0; i < sizeof(int); i++) {
+        if (((num >> (8 * i)) & 0xff) != sizeof(int) - i) {
+            return 0;
+        }
+    }
+
+    /* convert it */
+    u.unum = 0;
+    MEM_HTON(&u.unum, &num, sizeof(num2));
+    for (i = 0; i < sizeof(int); i++) {
+        if (u.uchar[i] != i + 1) {
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
diff --git a/src/test/mlparse_1.c b/src/test/mlparse_1.c
new file mode 100644 (file)
index 0000000..f741fa7
--- /dev/null
@@ -0,0 +1,192 @@
+/* mlparse_1.c tests for a specific bug in the parser, report by John
+ * Yiannis
+ *
+ * written nml 2004-08-19
+ *
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "str.h"
+#include "mlparse.h"
+
+int test_file(FILE *fp, int argc, char **argv) {
+    /* this data (in two chunks) comes from the TREC GOV collection.
+     * Note that theres a docno in buf2, so you can see where it comes
+     * from. (buf1 immediately preceeds buf2 in the collection) */
+    const char *buf1 = " <!-- tz1* ->\r\n\
+</table>\r\n\
+\r\n\
+<br><hr><br>\r\n\
+send me back to the <a href=\"torn.htm\">Indiana County List.</a><br>\r\n\
+</center>\r\n\
+\r\n\
+</body>\r\n\
+</html>\r\n\
+\n\
+</";
+
+    const char *buf2 = "DOC>\n\
+<DOC>\n\
+<DOCNO>G45-82-1809307</DOCNO>\n\
+<DOCHDR>\n\
+http://www.fakr.noaa.gov/npfmc/HAPC/hapcdisc.pdf\n\
+HTTP/1.1 200 OK\r\n\
+Server: Microsoft-IIS/5.0\r\n\
+Date: Mon, 04 Feb 2002 00:20:28 GMT\r\n\
+Content-Type: application/pdf\r\n\
+Accept-Ranges: bytes\r\n\
+Last-Modified: Fri, 16 Jun 2000 18:33:26 GMT\r\n\
+ETag: \"01fe45bc1d7bf1:8fe\"\r\n\
+Content-Length: 30812\r\n\
+</DOCHDR>\n\
+                                             Discussion Paper";
+
+    struct mlparse parser;
+
+    if (fp && (fp != stdin)) {
+        fprintf(stderr, "string library test run with file, "
+          "but contains embedded tests (fp %p stdin %p)\n", 
+          (void *) fp, (void *) stdin);
+        return EXIT_FAILURE;
+    }
+
+    if (mlparse_new(&parser, 49, 200)) {
+        char buf[52];
+        unsigned int len;
+        enum mlparse_ret ret;
+
+        parser.next_in = buf1;
+        parser.avail_in = str_len(buf1);
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_INPUT));
+        parser.next_in = buf2;
+        parser.avail_in = str_len(buf2);
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "tz1"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "/table"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "br"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "hr"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "br"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "send"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "me"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "back"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "to"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "the"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "a"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_PARAM));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "href"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_PARAMVAL));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "tornhtm"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "indiana"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "county"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_WORD));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "list"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "/a"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "br"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "/center"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "/body"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        assert((ret == MLPARSE_TAG));
+        buf[len] = '\0';
+        assert(!str_cmp(buf, "/html"));
+
+        ret = mlparse_parse(&parser, buf, &len, 1);
+        if (ret == MLPARSE_TAG && (buf[len] = '\0', 1) && !str_cmp(buf, "/doc")) {
+            /* got the correct thing */
+            return 1;
+        } else {
+            /* incorrect */
+            buf[len] = '\0';
+            fprintf(stderr, "incorrect parsing (got %d, %s)\n", ret, buf);
+            assert(0);
+            return 0;
+        }
+    } else {
+        fprintf(stderr, "failed to initalise parser\n");
+        return 0;
+    }
+
+    return 1;
+}
+
diff --git a/src/test/poolalloc_1.c b/src/test/poolalloc_1.c
new file mode 100644 (file)
index 0000000..3d9bc87
--- /dev/null
@@ -0,0 +1,29 @@
+/*  
+ *  unit test for the poolalloc library.
+ *
+ */
+
+#include "firstinclude.h"
+#include "test.h"
+#include "poolalloc.h"
+#include "error.h"
+
+#include <stdio.h>
+
+int test_file(FILE * fp, int argc, char ** argv) {
+    struct poolalloc * pa;
+    unsigned a;
+    unsigned bulk_alloc = 1024;
+    unsigned margin = 10;
+
+    pa = poolalloc_new(0, bulk_alloc, NULL);
+    for (a = 0; a < bulk_alloc + margin; a++)
+        poolalloc_malloc(pa, 1);
+    if (poolalloc_allocated(pa) != bulk_alloc + margin) {
+        ERROR2("reports %u allocations though %u made", 
+          poolalloc_allocated(pa), bulk_alloc + margin);
+    }
+    poolalloc_delete(pa);
+    return 1;
+}
+
diff --git a/src/test/rbtree_1.c b/src/test/rbtree_1.c
new file mode 100644 (file)
index 0000000..195e227
--- /dev/null
@@ -0,0 +1,702 @@
+/* rbtree_1.c is a unit test for the rbtree module.  Its pretty
+ * general, intended to test all of the individual rbtree functions.
+ * Input format is:
+ *
+ * # comments
+ * command params
+ *
+ * commands are:
+ *
+ * insert, find, remove, find_insert, print, ls, clear
+ *
+ *   new name: 
+ *     create a new rbtree containing luints, ordered naturally.
+ *     name is the name of the test 
+ *
+ *   insert num datanum ret:
+ *     inserts the given number (num) into the current rbtree, verifying that
+ *     the return value is ret
+ *
+ *   remove num ret:
+ *     removes the given number (num) from the current rbtree, verifying that
+ *     the return value is ret
+ *
+ *   find num datanum ret:
+ *     finds the given number (num) in the current rbtree, verifying that
+ *     the return value is ret, and thats its data member is datanum
+ *
+ *   findinsert num datanum ret:
+ *     finds the given number (num) in the rbtree.  If found, the data member
+ *     is verfied as datanum, if not then it is inserted.  Return value is
+ *     verified as ret.
+ *
+ *   findnear num foundnum datanum ret:
+ *     finds the smallest key such that its smaller than or equal to the given
+ *     num.  If found, the found key and data member are verified as foundnum,
+ *     datanum.  Return value is verified as ret.
+ *
+ *   print order:
+ *     print the contents of the rbtree.  order is 
+ *     ("rev_"? ("in" | "pre" | "post")) to indicate inorder, post-order,
+ *     pre-order, optionally reversed, down the tree.
+ *
+ *   ls order numitems [num datanum]*:
+ *     list the contents of the rbtree.  There should be
+ *     numitems entries.  Each entry is a number entry in the rbtree.  They must
+ *     be in sorted order to pass.  order same as print command.
+ *
+ *   newrand name seed items iterations:
+ *     perform random validation of rbtree by creating a new rbtree, seeding the
+ *     random number generator with seed (or "time" to seed from the clock),
+ *     inserting items number of items into the tree, and then alternately
+ *     selecting an item for deletion and inserting a random replacement.  This
+ *     occurs iterations times
+ *
+ * Commands should be put on a line by themselves, like this:
+ *
+ * # this is a comment, followed by a couple of commands
+ * new
+ *   case01 1
+ * insert 
+ *   2 2 ok
+ *
+ * written nml 2004-07-26
+ *
+ */
+
+#include "test.h"
+
+#include "rbtree.h"
+#include "str.h"
+#include "getlongopt.h"
+#include "lcrand.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+/* dodgy internal declaration for internal rbtree function */
+void rbtree_print(struct rbtree *rb, FILE *output);
+
+struct params {
+    int verbose;
+};
+
+int ulongcmp(const void *vone, const void *vtwo) {
+    const unsigned long int *one = vone,
+                            *two = vtwo;
+
+    if (*one < *two) {
+        return -1;
+    } else if (*one > *two) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+static int parse_params(int argc, char **argv, struct params *params) {
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    enum getlongopt_ret ret;     /* return value from option parser */
+
+    struct getlongopt_opt opts[] = {
+        {"input", '\0', GETLONGOPT_ARG_REQUIRED, 'i'},
+        {"verbose", 'v', GETLONGOPT_ARG_NONE, 'v'}
+    };
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(stderr, "failed to initialise options parser\n");
+        return 0;
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case 'i':
+            /* ignore */
+            break;
+
+        case 'v':
+            /* verbose */
+            params->verbose = 1;
+            break;
+
+        default: assert(0);
+        }
+    }
+
+    getlongopt_delete(parser);
+    return 1;
+}
+
+enum rbtree_ret strtoret(char *str) {
+    if (!str_casecmp(str, "ok")) {
+        return RBTREE_OK;
+    } else if (!str_casecmp(str, "enoent")) {
+        return RBTREE_ENOENT;
+    } else if (!str_casecmp(str, "enomem")) {
+        return RBTREE_ENOMEM;
+    } else if (!str_casecmp(str, "eexist")) {
+        return RBTREE_EEXIST;
+    } else if (!str_casecmp(str, "einval")) {
+        return RBTREE_EINVAL;
+    } else {
+        /* failed */
+        return INT_MAX;
+    }
+}
+
+const char *rettostr(enum rbtree_ret ret) {
+    switch (ret) {
+    case RBTREE_OK: return "ok";
+    case RBTREE_ENOMEM: return "enomem";
+    case RBTREE_ENOENT: return "enoent";
+    case INT_MAX: return "lookup error";
+    default: return "unknown";
+    }
+}
+
+int luintcmp(const void *key1, const void *key2) {
+    const unsigned long int *lu1 = key1,
+                            *lu2 = key2;
+
+    if (*lu1 < *lu2) {
+        return -1;
+    } else if (*lu1 > *lu2) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int test_file(FILE *fp, int argc, char **argv) {
+    char *pos;
+    unsigned long int key,
+                      data,
+                      tmpkey,
+                      tmpdata,
+                      *ptr;
+    struct params params = {0};
+    struct rbtree *rbtree = NULL;
+    char name[256];
+    char ret[256];
+    char buf[1024 + 1];
+    char orderbuf[11];
+    enum rbtree_ret tmpret;
+    struct lcrand *rand = NULL;
+
+    if (!parse_params(argc, argv, &params)) {
+        fprintf(stderr, "failed to parse params\n");
+        return 0;
+    }
+
+    while (fgets((char *) buf, 1024, fp)) {
+        str_rtrim(buf);
+        pos = (char *) str_ltrim(buf);
+
+        if (!str_casecmp(pos, "newrand")) {
+            unsigned int seed,
+                         items,
+                         iterations,
+                         i,
+                         curr;
+            unsigned long int *arr;
+            char seedbuf[20];
+
+            /* create a new btree, fill it with random stuff, alternately delete
+             * and insert random stuff, delete */
+
+            if (rbtree) {
+                if (params.verbose) {
+                    printf("\n");
+                }
+                rbtree_delete(rbtree);
+                rbtree = NULL;
+                lcrand_delete(rand);
+                rand = NULL;
+            }
+
+            /* read parameters */
+            if (fscanf(fp, "%255s %20s %u %u", name, seedbuf, &items, 
+                &iterations) == 4) {
+
+                if (!str_casecmp(seedbuf, "time")) {
+                    seed = time(NULL);
+                } else {
+                    seed = atoi(seedbuf);
+                }
+
+                if (!(rand = lcrand_new(seed))) {
+                    fprintf(stderr, "%s: failed to init random "
+                      "number generator\n", name);
+                    return 0;
+                }
+
+                if (!(rbtree = rbtree_luint_new())) {
+                    fprintf(stderr, 
+                      "%s (seed %u): failed to get new rbtree\n", 
+                      name, seed);
+                    return 0;
+                }
+
+                if (!(arr = malloc(sizeof(*arr) * (items + 1)))) {
+                    fprintf(stderr, 
+                      "%s (seed %u): failed to get memory for %u items\n", 
+                      name, seed, items);
+                    return 0;
+                }
+
+                if (params.verbose) {
+                    printf("%s: new rbtree rand, seed %u\n", name, seed);
+                }
+
+                memset(arr, 0, items * sizeof(*arr));
+                /* insert 'items' number of entries */
+                for (i = 0; i < items; i++) {
+                    enum rbtree_ret ret;
+                    unsigned long int *tmp;
+
+                    do {
+                        curr = (unsigned int) (((float) items * 10) 
+                            * lcrand(rand) / (LCRAND_MAX + 1.0));
+                    } while (rbtree_luint_luint_find(rbtree, curr, &tmp) 
+                      == RBTREE_OK);
+
+                    arr[i] = curr;
+                    ret = rbtree_luint_luint_insert(rbtree, curr, curr);
+
+                    if (params.verbose) {
+                        printf("%s: insert\n%s: \t %u %u ok\n", name, name, 
+                          curr, curr);
+                    }
+
+                    if (ret != RBTREE_OK) {
+                        fprintf(stderr, 
+                          "%s (seed %u): failed to insert (%d)\n", name, seed,
+                          ret);
+                        return 0;
+                    }
+                }
+
+                assert(rbtree_size(rbtree) == items);
+
+                for (i = 0; i < iterations; i++) {
+                    enum rbtree_ret ret;
+                    struct rbtree_iter *iter;
+                    unsigned long int *tmp;
+
+                    /* add */
+
+                    do {
+                        curr = (unsigned int) (((float) items * 10) 
+                            * lcrand(rand) / (LCRAND_MAX + 1.0));
+                    } while (rbtree_luint_luint_find(rbtree, curr, &tmp) 
+                      == RBTREE_OK);
+
+                    arr[items] = curr;
+                    ret = rbtree_luint_luint_insert(rbtree, curr, curr);
+
+                    if (params.verbose) {
+                        printf("%s: insert\n%s: \t %u %u ok\n", name, name, 
+                          curr, curr);
+                    }
+
+                    if (ret != RBTREE_OK) {
+                        fprintf(stderr, "%s (seed %u): failed to insert (%d)\n",
+                          name, seed, ret);
+                        return 0;
+                    }
+
+                    /* delete */
+
+                    curr = (unsigned int) (((float) items) 
+                        * lcrand(rand) / (LCRAND_MAX + 1.0));
+                    assert(curr >= 0 && curr < items);
+
+                    if (params.verbose) {
+                        printf("%s: remove\n%s: \t%lu %lu ok\n", name, name, 
+                          arr[curr], arr[curr]);
+                    }
+
+                    ret 
+                      = rbtree_luint_luint_remove(rbtree, arr[curr], &tmpdata);
+                    if ((ret != RBTREE_OK) || (tmpdata != arr[curr])) {
+                        fprintf(stderr, 
+                          "%s (seed %u): rand removal of %lu failed, (%d)\n", 
+                          name, seed, arr[curr], ret);
+                        return 0;
+                    }
+
+                    arr[curr] = arr[items];
+
+                    /* compare (every so often) */
+                    if ((i % 10 == 0) || (i + 1 == items)) {
+                        qsort(arr, items, sizeof(*arr), ulongcmp);
+                        if ((iter 
+                          = rbtree_iter_new(rbtree, RBTREE_ITER_INORDER, 0))) {
+                            unsigned long int *ptr;
+                            unsigned int count = 0;
+
+                            while ((tmpret 
+                              = rbtree_iter_luint_luint_next(iter, &key, &ptr))
+                                == RBTREE_OK) {
+                                assert(count < items);
+
+                                if ((key == *ptr) && arr[count++] == key) {
+                                    /* succeeded, do nothing */
+                                } else {
+                                    fprintf(stderr, 
+                                      "%s (seed %u): compare failed "
+                                        "(%lu, %lu vs %lu, %lu\n", 
+                                      name, seed, key, *ptr, arr[count - 1], 
+                                      arr[count - 1]);
+
+                                    for (i = 0; i < items; i++) {
+                                        printf("%u: %lu\n", i, arr[i]);
+                                    }
+                                    printf("\n");
+                                    rbtree_print(rbtree, stdout);
+                                    return 0;
+                                }
+                            }
+
+                            if (count != items) {
+                                fprintf(stderr, 
+                                  "%s (seed %u): compare failed, wrong number "
+                                  "of items (%u vs %u)\n", 
+                                  name, seed, count, items);
+                                return 0;
+                            }
+                            rbtree_iter_delete(iter);
+                        } else {
+                            fprintf(stderr, 
+                              "%s (seed %u): failed to get iterator over "
+                                "rbtree to compare\n", name, seed);
+                            return 0;
+
+                        }
+
+                        if (params.verbose) {
+                            printf("%s: successful comparison\n", name);
+                        }
+                    }
+                }
+
+                free(arr);
+                rbtree_delete(rbtree);
+                lcrand_delete(rand);
+                rbtree = NULL;
+                rand = NULL;
+            } else {
+                fprintf(stderr, "%s: failed to read newrand parameters\n", 
+                  name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "new")) {
+            /* creating a new rbtree */
+
+            if (rbtree) {
+                if (params.verbose) {
+                    printf("\n");
+                }
+                rbtree_delete(rbtree);
+            }
+
+            /* read parameters */
+            if ((fscanf(fp, "%255s", name) == 1)
+              && (rbtree = rbtree_luint_new(luintcmp))) {
+                /* succeeded, do nothing */
+                if (params.verbose) {
+                    printf("%s: new rbtree\n", name);
+                }
+            } else {
+                fprintf(stderr, "%s: failed to create rbtree\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "insert")) {
+            /* insert a number into the rbtree */
+
+            if (!rbtree) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%lu %lu %256s", &key, &data, ret) == 3) {
+                if ((strtoret(ret) 
+                  == rbtree_luint_luint_insert(rbtree, key, data))) {
+                    if (params.verbose) {
+                        printf("%s: inserted %lu %lu, ret %s\n", name, key, 
+                          data, ret);
+                    }
+                } else {
+                    fprintf(stderr, "%s: failed to insert %lu %lu into rbtree "
+                      "(ret %s)\n", name, key, data, ret);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to insert\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "remove")) {
+            /* remove an entry from the rbtree */
+            enum rbtree_ret tmpret;
+
+            if (!rbtree) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%lu %lu %256s", &key, &data, ret) == 3) {
+                if ((strtoret(ret) == (tmpret 
+                    = rbtree_luint_luint_remove(rbtree, key, &tmpdata)))
+                  && ((tmpret != RBTREE_OK) || (data == tmpdata))) {
+                    if (params.verbose) {
+                        printf("%s: removed %lu %lu, ret %s\n", name, key, 
+                          data, ret);
+                    }
+                } else if (tmpret == strtoret(ret)) {
+                    fprintf(stderr, "%s: value mismatch (%lu vs %lu) "
+                      "while removing key %lu\n", name, data, tmpdata, key);
+                    return 0;
+                } else {
+                    fprintf(stderr, "%s: return mismatch (%s vs %s) "
+                      "while removing key %lu\n", name, ret, rettostr(tmpret), 
+                      key);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to remove\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "find")) {
+            /* find an entry in the rbtree */
+            enum rbtree_ret tmpret;
+
+            if (!rbtree) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%lu %lu %256s", &key, &data, ret) == 3) {
+                ptr = &tmpdata;
+                tmpdata = 0;
+                if ((strtoret(ret) == (tmpret 
+                    = rbtree_luint_luint_find(rbtree, key, &ptr))) 
+                  && (*ptr == data)) {
+                    if (params.verbose) {
+                        printf("%s: found %lu %lu, ret %s\n", name, key, data,
+                          ret);
+                    }
+                } else if (tmpret == strtoret(ret)) {
+                    fprintf(stderr, "%s: value mismatch (%lu vs %lu) "
+                      "while finding %lu\n", name, *ptr, data, key);
+                    return 0;
+                } else {
+                    fprintf(stderr, "%s: return mismatch (%s vs %s) "
+                      "while finding %lu\n", name, ret, rettostr(tmpret), key);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to find\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "findnear")) {
+            /* find an entry in the rbtree */
+            enum rbtree_ret tmpret;
+            unsigned long int fkey = 0,
+                              tmp_fkey = 0;
+
+            if (!rbtree) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%lu %lu %lu %256s", &key, &tmp_fkey, &data, ret) 
+                == 4) {
+
+                ptr = &tmpdata;
+                tmpdata = 0;
+                if ((strtoret(ret) == (tmpret 
+                    = rbtree_luint_luint_find_near(rbtree, key, &fkey, &ptr))) 
+                  && (fkey == tmp_fkey)
+                  && (*ptr == data)) {
+                    if (params.verbose) {
+                        printf("%s: found %lu %lu near %lu, ret %s\n", name, 
+                          fkey, data, key, ret);
+                    }
+                } else if (tmpret == strtoret(ret)) {
+                    fprintf(stderr, "%s: value mismatch (%lu vs %lu) "
+                      "while finding near %lu\n", name, *ptr, data, key);
+                    return 0;
+                } else {
+                    fprintf(stderr, "%s: return mismatch (%s vs %s) "
+                      "while finding near %lu\n", name, ret, rettostr(tmpret), 
+                      key);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to find near\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "print")) {
+            struct rbtree_iter *iter;
+            enum rbtree_iter_order order;
+            int reverse = 0;
+            int internal = 0;
+
+            /* print all entries */
+            if (fscanf(fp, "%10s", orderbuf)) {
+                orderbuf[10] = '\0';
+                if (!str_casecmp(orderbuf, "internal")) {
+                    rbtree_print(rbtree, stdout);
+                    order = RBTREE_ITER_PREORDER;
+                    internal = 1;
+                } else if (!str_casecmp(orderbuf, "pre")) {
+                    order = RBTREE_ITER_PREORDER;
+                    reverse = 0;
+                } else if (!str_casecmp(orderbuf, "in")) {
+                    order = RBTREE_ITER_INORDER;
+                    reverse = 0;
+                } else if (!str_casecmp(orderbuf, "post")) {
+                    order = RBTREE_ITER_POSTORDER;
+                    reverse = 0;
+                } else if (!str_casecmp(orderbuf, "rev_pre")) {
+                    order = RBTREE_ITER_PREORDER;
+                    reverse = 1;
+                } else if (!str_casecmp(orderbuf, "rev_in")) {
+                    order = RBTREE_ITER_INORDER;
+                    reverse = 1;
+                } else if (!str_casecmp(orderbuf, "rev_post")) {
+                    order = RBTREE_ITER_POSTORDER;
+                    reverse = 1;
+                } else {
+                    fprintf(stderr, "%s: unknown order '%s'\n",
+                      name, orderbuf);
+                    return 0;
+                }
+
+                if (!internal 
+                  && (iter = rbtree_iter_new(rbtree, order, reverse))) {
+                    unsigned long int *ptr;
+                    unsigned int items = 0;
+
+                    while ((tmpret 
+                      = rbtree_iter_luint_luint_next(iter, &key, &ptr))
+                        == RBTREE_OK) {
+
+                        printf("%lu %lu\n", key, *ptr);
+                        items++;
+                    }
+
+                    if ((tmpret == RBTREE_ITER_END) 
+                      && (items == rbtree_size(rbtree))) {
+                        printf("\n%u entries (%s)\n\n", items, orderbuf);
+                    } else if (tmpret != RBTREE_ITER_END) {
+                        fprintf(stderr, 
+                          "%s: iteration over rbtree failed (%s)\n",
+                          name, rettostr(tmpret));
+                        return 0;
+                    } else {
+                        fprintf(stderr, 
+                          "%s: iteration over rbtree fell short (%u vs %u)\n", 
+                          name, items, rbtree_size(rbtree));
+                        return 0;
+                    }
+                    rbtree_iter_delete(iter);
+                } else if (!internal) {
+                    fprintf(stderr, "%s: iteration over rbtree failed\n", name);
+                    return 0;
+                } else {
+                    printf("\n%u entries (%s)\n\n", rbtree_size(rbtree), 
+                      orderbuf);
+                }
+            }
+        } else if (!str_casecmp(pos, "ls")) {
+            /* match all entries */
+            struct rbtree_iter *iter;
+            unsigned int entries;
+            enum rbtree_iter_order order;
+            int reverse;
+
+            if (!rbtree) { return 0; }
+
+            if (fscanf(fp, "%10s %u", orderbuf, &entries) != 2) {
+                fprintf(stderr, "%s: expected order, entry count\n", name);
+                return 0;
+            }
+
+            orderbuf[10] = '\0';
+            if (!str_casecmp(orderbuf, "pre")) {
+                order = RBTREE_ITER_PREORDER;
+                reverse = 0;
+            } else if (!str_casecmp(orderbuf, "in")) {
+                order = RBTREE_ITER_INORDER;
+                reverse = 0;
+            } else if (!str_casecmp(orderbuf, "post")) {
+                order = RBTREE_ITER_POSTORDER;
+                reverse = 0;
+            } else if (!str_casecmp(orderbuf, "rev_pre")) {
+                order = RBTREE_ITER_PREORDER;
+                reverse = 1;
+            } else if (!str_casecmp(orderbuf, "rev_in")) {
+                order = RBTREE_ITER_INORDER;
+                reverse = 1;
+            } else if (!str_casecmp(orderbuf, "rev_post")) {
+                order = RBTREE_ITER_POSTORDER;
+                reverse = 1;
+            } else {
+                fprintf(stderr, "%s: unknown order '%s'\n",
+                  name, orderbuf);
+                return 0;
+            }
+
+            if (entries != rbtree_size(rbtree)) {
+                fprintf(stderr, "%s: wrong number of entries (%u vs %u)\n", 
+                  name, entries, rbtree_size(rbtree));
+                return 0;
+            }
+
+            if ((iter = rbtree_iter_new(rbtree, order, reverse))) {
+                unsigned long int *ptr;
+                unsigned int items = 0;
+
+                while (((tmpret 
+                    = rbtree_iter_luint_luint_next(iter, &key, &ptr))
+                      == RBTREE_OK)
+                  && (fscanf(fp, "%lu %lu", &tmpkey, &tmpdata) == 2) 
+                  && (tmpkey == key) && (tmpdata == *ptr)) {
+
+                    if (params.verbose) {
+                        printf("%s: matched %lu %lu\n", name, key, *ptr);
+                    }
+                    items++;
+                }
+
+                if ((tmpret == RBTREE_ITER_END) 
+                  && (items == rbtree_size(rbtree))) {
+                    if (params.verbose) {
+                        printf("%s: matched %u entries\n", name, items);
+                    }
+                } else {
+                    fprintf(stderr, "%s: ls matching failed\n", name);
+                    return 0;
+                }
+                rbtree_iter_delete(iter);
+            } else {
+                fprintf(stderr, "%s: iteration over rbtree failed\n", name);
+                return 0;
+            }
+        } else if ((*pos != '#') && str_len(pos)) {
+            fprintf(stderr, "%s: unknown command '%s'\n", name, pos);
+            return 0;
+        }
+    }
+
+    assert(!rand);
+    if (rbtree) {
+        rbtree_delete(rbtree);
+    }
+
+    return 1;
+}
+
diff --git a/src/test/rbtree_1.cases b/src/test/rbtree_1.cases
new file mode 100644 (file)
index 0000000..a355193
--- /dev/null
@@ -0,0 +1,581 @@
+# rbtree_1.cases contains test cases for the red-black tree.  See
+# rbtree_1.c for more detail.  Test case syntax is:
+#
+#   # comments
+#   new name
+#   insert num datanum ret
+#   remove num ret
+#   find num datanum ret
+#   findinsert num datanum ret
+#   print order
+#   ls order numitems [num datanum]*
+#
+# written nml 2004-08-04
+       
+# simple test to ensure data values can differ from key values and to
+# test iteration orders over the tree
+new
+       case_1_1
+insert 
+       1 101 ok
+insert
+       2 102 ok
+insert
+       3 103 ok
+ls 
+       in 3
+       1 101
+       2 102
+       3 103
+ls 
+       pre 3
+       2 102
+       1 101
+       3 103
+ls
+       post 3
+       1 101
+       3 103
+       2 102
+ls 
+       rev_in 3
+       3 103
+       2 102
+       1 101
+ls 
+       rev_pre 3
+       2 102
+       3 103
+       1 101
+ls
+       rev_post 3
+       3 103
+       1 101
+       2 102
+
+# simple test case where things don't return ok
+new
+       case_1_2
+insert
+       1 1 ok
+insert 
+       2 2 ok
+insert
+       3 3 ok
+insert 
+       1 0 eexist
+insert 
+       2 0 eexist
+insert 
+       3 0 eexist
+remove
+       4 0 enoent
+remove 
+       100 0 enoent
+remove
+       2 2 ok
+remove
+       2 2 enoent
+remove
+       1 1 ok
+remove
+       1 1 enoent
+remove 
+       3 3 ok
+remove
+       3 3 enoent
+ls
+       in 0
+
+# simple example requiring rebalancing
+new 
+       case_2_1
+insert
+       1 1 ok
+insert
+       2 2 ok
+insert 
+       3 3 ok
+insert 
+       4 4 ok
+insert 
+       5 5 ok
+insert 
+       6 6 ok
+insert 
+       7 7 ok
+insert 
+       8 8 ok
+insert 
+       9 9 ok
+insert 
+       10 10 ok
+insert 
+       11 11 ok
+insert 
+       12 12 ok
+insert 
+       13 13 ok
+insert 
+       14 14 ok
+insert 
+       15 15 ok
+insert 
+       16 16 ok
+insert 
+       17 17 ok
+insert 
+       18 18 ok
+insert 
+       19 19 ok
+insert 
+       20 20 ok
+ls
+       in 20
+       1 1
+       2 2
+       3 3
+       4 4
+       5 5
+       6 6
+       7 7
+       8 8
+       9 9
+       10 10
+       11 11
+       12 12
+       13 13
+       14 14
+       15 15
+       16 16
+       17 17
+       18 18
+       19 19
+       20 20
+
+# mirror to case 2_1
+new 
+       case_2_2
+insert 
+       20 20 ok
+insert 
+       19 19 ok
+insert 
+       18 18 ok
+insert 
+       17 17 ok
+insert 
+       16 16 ok
+insert 
+       15 15 ok
+insert 
+       14 14 ok
+insert 
+       13 13 ok
+insert 
+       12 12 ok
+insert 
+       11 11 ok
+insert 
+       10 10 ok
+insert 
+       9 9 ok
+insert 
+       8 8 ok
+insert 
+       7 7 ok
+insert 
+       6 6 ok
+insert 
+       5 5 ok
+insert 
+       4 4 ok
+insert 
+       3 3 ok
+insert
+       2 2 ok
+insert
+       1 1 ok
+ls
+       in 20
+       1 1
+       2 2
+       3 3
+       4 4
+       5 5
+       6 6
+       7 7
+       8 8
+       9 9
+       10 10
+       11 11
+       12 12
+       13 13
+       14 14
+       15 15
+       16 16
+       17 17
+       18 18
+       19 19
+       20 20
+
+# case requiring slightly more complex rebalancing
+new 
+       case_2_3
+insert
+       10 10 ok
+insert
+       20 20 ok
+insert 
+       30 30 ok
+ls
+       in 3
+       10 10
+       20 20
+       30 30
+insert
+       11 11 ok
+insert
+       12 12 ok
+ls
+       in 5
+       10 10
+       11 11
+       12 12
+       20 20
+       30 30
+
+# mirror of 2_3
+new 
+       case_2_4
+insert
+       10 10 ok
+insert
+       20 20 ok
+insert 
+       30 30 ok
+ls
+       in 3
+       10 10
+       20 20
+       30 30
+insert
+       29 29 ok
+insert
+       28 28 ok
+ls
+       in 5
+       10 10
+       20 20
+       28 28
+       29 29
+       30 30
+
+# example from pg 282 'introduction to algorithms', cormen et al
+new
+       case_cormen_282
+insert
+       11 11 ok
+insert
+       2 2 ok
+insert
+       14 14 ok
+insert
+       1 1 ok
+insert
+       7 7 ok
+insert
+       15 15 ok
+insert
+       5 5 ok
+insert
+       8 8 ok
+insert
+       4 4 ok
+ls
+       in 9
+       1 1
+       2 2
+       4 4
+       5 5
+       7 7
+       8 8
+       11 11
+       14 14
+       15 15
+
+# simple deletion example requiring rebalancing
+new 
+       case_3_1
+insert
+       1 1 ok
+insert
+       2 2 ok
+insert 
+       3 3 ok
+insert 
+       4 4 ok
+insert 
+       5 5 ok
+insert 
+       6 6 ok
+insert 
+       7 7 ok
+insert 
+       8 8 ok
+insert 
+       9 9 ok
+insert 
+       10 10 ok
+insert 
+       11 11 ok
+insert 
+       12 12 ok
+insert 
+       13 13 ok
+insert 
+       14 14 ok
+insert 
+       15 15 ok
+insert 
+       16 16 ok
+insert 
+       17 17 ok
+insert 
+       18 18 ok
+insert 
+       19 19 ok
+insert 
+       20 20 ok
+remove
+       20 20 ok
+remove 
+       19 19 ok
+remove 
+       18 18 ok
+remove 
+       17 17 ok
+remove 
+       16 16 ok
+remove 
+       15 15 ok
+remove 
+       14 14 ok
+remove 
+       13 13 ok
+remove 
+       12 12 ok
+remove 
+       11 11 ok
+remove 
+       10 10 ok
+ls
+       in 9
+       1 1
+       2 2
+       3 3
+       4 4
+       5 5
+       6 6
+       7 7
+       8 8
+       9 9
+remove 
+       9 9 ok
+remove 
+       8 8 ok
+remove 
+       7 7 ok
+remove 
+       6 6 ok
+remove 
+       5 5 ok
+remove 
+       4 4 ok
+remove 
+       3 3 ok
+remove 
+       2 2 ok
+remove 
+       1 1 ok
+ls
+       in 0
+
+# another simple deletion example 
+new 
+       case_3_2
+insert
+       1 1 ok
+insert
+       2 2 ok
+insert 
+       3 3 ok
+insert 
+       4 4 ok
+insert 
+       5 5 ok
+insert 
+       6 6 ok
+insert 
+       7 7 ok
+insert 
+       8 8 ok
+insert 
+       9 9 ok
+insert 
+       10 10 ok
+insert 
+       11 11 ok
+insert 
+       12 12 ok
+insert 
+       13 13 ok
+insert 
+       14 14 ok
+insert 
+       15 15 ok
+insert 
+       16 16 ok
+insert 
+       17 17 ok
+insert 
+       18 18 ok
+insert 
+       19 19 ok
+insert 
+       20 20 ok
+remove
+       1 1 ok
+remove
+       2 2 ok
+remove 
+       3 3 ok
+remove 
+       4 4 ok
+remove 
+       5 5 ok
+remove 
+       6 6 ok
+remove 
+       7 7 ok
+remove 
+       8 8 ok
+remove 
+       9 9 ok
+remove 
+       10 10 ok
+remove 
+       11 11 ok
+remove 
+       12 12 ok
+remove 
+       13 13 ok
+remove 
+       14 14 ok
+remove 
+       15 15 ok
+remove 
+       16 16 ok
+remove 
+       17 17 ok
+remove 
+       18 18 ok
+remove 
+       19 19 ok
+remove 
+       20 20 ok
+ls 
+       in 0
+
+# a case testing out find_near
+new
+       case_3_3
+insert
+       5 5 ok
+insert
+       10 10 ok
+insert 
+       15 15 ok
+insert 
+       20 20 ok
+insert 
+       25 25 ok
+insert 
+       30 30 ok
+insert 
+       35 35 ok
+insert 
+       40 40 ok
+insert
+       45 45 ok
+insert 
+       50 50 ok
+# shouldn't find anything smaller than 5
+findnear
+       0 0 0 eexist
+findnear
+       4 0 0 eexist
+# should find 5 with 5 - 9
+findnear
+       5 5 5 ok
+findnear
+       6 5 5 ok
+findnear
+       7 5 5 ok
+findnear
+       9 5 5 ok
+findnear
+       10 10 10 ok
+# should find other sensibly
+findnear
+       11 10 10 ok
+findnear
+       15 15 15 ok
+findnear
+       16 15 15 ok
+findnear
+       20 20 20 ok
+findnear
+       21 20 20 ok
+findnear
+       25 25 25 ok
+findnear
+       26 25 25 ok
+findnear
+       30 30 30 ok
+findnear
+       31 30 30 ok
+findnear
+       35 35 35 ok
+findnear
+       36 35 35 ok
+findnear
+       40 40 40 ok
+findnear
+       41 40 40 ok
+findnear
+       45 45 45 ok
+findnear
+       46 45 45 ok
+findnear
+       50 50 50 ok
+# should find end entry with keys larger than anything in the table
+findnear
+       51 50 50 ok
+findnear
+       100 50 50 ok
+findnear
+       1000 50 50 ok
+
+# some random cases
+newrand
+       case_rand_failed_1 1091769637 10 2
+
+newrand
+       case_rand_1 time 500 1000
+
+newrand
+       case_rand_1 time 501 1000
+
+
+
diff --git a/src/test/stack_1.c b/src/test/stack_1.c
new file mode 100644 (file)
index 0000000..466359b
--- /dev/null
@@ -0,0 +1,299 @@
+/* stack_1.c is a unit test for the stack module.  Its pretty
+ * general, intended to test all of the individual stack functions.
+ * Input format is:
+ *
+ * # comments
+ * command params
+ *
+ * commands are:
+ *
+ *   new name sizehint: 
+ *     create a new stack using size hint sizehint 
+ *     name is the name of the test 
+ *     the stack is a luint stack (for ease of testing)
+ *
+ *   push num ret:
+ *     push the given number onto the stack, and verify that return
+ *     value is ret
+ *
+ *   pop num ret:
+ *     pop a value from the stack, verifying that the return value is
+ *     ret and the number returned (ignored if ret != OK) is the same
+ *     as num
+ *
+ *   peek num ret:
+ *     peek at the top value in the stack, verifying that the return value is 
+ *     ret and the number returned (ignored if ret != OK) is the same
+ *     as num
+ *
+ *   print:
+ *     print the contents of the stack
+ *
+ *   ls numitems [num]*:
+ *     list the contents of the stack.  There should be
+ *     numitems entries.  Each entry is a number entry in the stack.
+ *
+ * Commands should be put on a line by themselves, like this:
+ *
+ * # this is a comment, followed by a couple of commands
+ * new
+ *   case01 1
+ * push 
+ *   2 OK
+ *
+ * written nml 2004-07-26
+ *
+ */
+
+#include "test.h"
+
+#include "stack.h"
+#include "str.h"
+#include "getlongopt.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+struct params {
+    int verbose;
+};
+
+static int parse_params(int argc, char **argv, struct params *params) {
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    enum getlongopt_ret ret;     /* return value from option parser */
+
+    struct getlongopt_opt opts[] = {
+        {"input", '\0', GETLONGOPT_ARG_REQUIRED, 'i'},
+        {"verbose", 'v', GETLONGOPT_ARG_NONE, 'v'}
+    };
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(stderr, "failed to initialise options parser\n");
+        return 0;
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case 'i':
+            /* ignore */
+            break;
+
+        case 'v':
+            /* verbose */
+            params->verbose = 1;
+            break;
+
+        default: assert(0);
+        }
+    }
+
+    getlongopt_delete(parser);
+    return 1;
+}
+
+enum stack_ret strtoret(char *str) {
+    if (!str_casecmp(str, "ok")) {
+        return STACK_OK;
+    } else if (!str_casecmp(str, "enoent")) {
+        return STACK_ENOENT;
+    } else if (!str_casecmp(str, "enomem")) {
+        return STACK_ENOMEM;
+    } else {
+        /* failed */
+        return INT_MAX;
+    }
+}
+
+const char *rettostr(enum stack_ret ret) {
+    switch (ret) {
+    case STACK_OK: return "ok";
+    case STACK_ENOMEM: return "enomem";
+    case STACK_ENOENT: return "enoent";
+    case INT_MAX: return "lookup error";
+    default: return "unknown";
+    }
+}
+
+int test_file(FILE *fp, int argc, char **argv) {
+    char *pos;
+    unsigned long int tmp;
+    struct params params = {0};
+    struct stack *stack = NULL;
+    char name[256];
+    char ret[256];
+    char buf[1024 + 1];
+
+    if (!parse_params(argc, argv, &params)) {
+        fprintf(stderr, "failed to parse params\n");
+        return 0;
+    }
+
+    while (fgets((char *) buf, 1024, fp)) {
+        str_rtrim(buf);
+        pos = (char *) str_ltrim(buf);
+
+        if (!str_casecmp(pos, "new")) {
+            /* creating a new stack */
+
+            if (stack) {
+                stack_delete(stack);
+            }
+
+            /* read parameters */
+            if ((fscanf(fp, "%255s %lu", name, &tmp) == 2)
+              && (stack = stack_new((unsigned int) tmp))) {
+                /* succeeded, do nothing */
+                if (params.verbose) {
+                    printf("%s: new stack with sizehint %lu\n", name, tmp);
+                }
+            } else {
+                fprintf(stderr, "%s: failed to create stack\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "push")) {
+            /* push a term onto the stack */
+
+            if (!stack) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%lu %256s", &tmp, ret) == 2) {
+                if ((strtoret(ret) == stack_luint_push(stack, tmp))) {
+                    if (params.verbose) {
+                        printf("%s: pushed %lu, ret %s\n", name, tmp, ret);
+                    }
+                } else {
+                    fprintf(stderr, "%s: failed to push %lu onto stack "
+                      "(ret %s)\n", name, tmp, ret);
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to push\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "pop")) {
+            /* popping an entry from the stack */
+            unsigned long int num;
+            enum stack_ret tmpret;
+
+            if (!stack) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%lu %256s", &num, ret) == 2) {
+                if ((strtoret(ret) == (tmpret = stack_luint_pop(stack, &tmp))) 
+                  && (tmp == num)) {
+                    if (params.verbose) {
+                        printf("%s: popped %lu, ret %s\n", name, tmp, ret);
+                    }
+                } else if (tmpret == strtoret(ret)) {
+                    fprintf(stderr, "%s: value mismatch (%lu vs %lu) "
+                      "while popping value\n", name, tmp, num);
+                    return 0;
+                } else {
+                    fprintf(stderr, "%s: return mismatch (%s vs %s) "
+                      "while popping value\n", name, ret, rettostr(tmpret));
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to push\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "peek")) {
+            /* peeking at an entry from the stack */
+            unsigned long int num;
+            enum stack_ret tmpret;
+
+            if (!stack) { return 0; }
+
+            /* read parameters */
+            if (fscanf(fp, "%lu %256s", &num, ret) == 2) {
+                if ((strtoret(ret) == (tmpret = stack_luint_peek(stack, &tmp))) 
+                  && (tmp == num)) {
+                    if (params.verbose) {
+                        printf("%s: popped %lu, ret %s\n", name, tmp, ret);
+                    }
+                } else if (tmpret == strtoret(ret)) {
+                    fprintf(stderr, "%s: value mismatch (%lu vs %lu) "
+                      "while peeking at value\n", name, tmp, num);
+                    return 0;
+                } else {
+                    fprintf(stderr, "%s: return mismatch (%s vs %s) "
+                      "while peeking at value\n", name, ret, rettostr(tmpret));
+                    return 0;
+                }
+            } else {
+                fprintf(stderr, "%s: failed to peek\n", name);
+                return 0;
+            }
+        } else if (!str_casecmp(pos, "print")) {
+            /* print all entries */
+            unsigned int i;
+
+            if (!stack) { return 0; }
+
+            for (i = 0; i < stack_size(stack); i++) {
+                if (stack_luint_fetch(stack, i, &tmp) == STACK_OK) {
+                    printf("%lu\n", tmp);
+                } else {
+                    fprintf(stderr, "%s: failed to print\n", name);
+                    return 0;
+                }
+            }
+            printf("\n%u entries\n", stack_size(stack));
+        } else if (!str_casecmp(pos, "ls")) {
+            /* compare all entries */
+            unsigned int i;
+            unsigned int numitems;
+            unsigned long int tmpnum;
+
+            if (!stack) { return 0; }
+
+            if (fscanf(fp, "%u", &numitems)) {
+                for (i = 0; i < numitems; i++) {
+                    if (fscanf(fp, "%lu ", &tmp)) {
+                        if (params.verbose) {
+                            printf("%s: ls checking %lu\n", name, tmp);
+                        }
+
+                        if (stack_luint_fetch(stack, i, &tmpnum) == STACK_OK) {
+                            if (tmpnum != tmp) {
+                                fprintf(stderr, "%s: ls comparison failed at "
+                                  "position %u (%lu vs %lu)\n", name, i, tmp, 
+                                  tmpnum);
+                                return 0;
+                            }
+                        } else {
+                            fprintf(stderr, "%s: ls comparison failed at "
+                              "position %u (fetch failure %s)\n", name, i, 
+                              rettostr(stack_luint_fetch(stack, i, &tmpnum)));
+                            return 0;
+                        }
+                    } else {
+                        fprintf(stderr, "%s: ls failed\n", name);
+                        return 0;
+                    }
+                }
+            } else {
+                fprintf(stderr, "%s: ls failed\n", name);
+                return 0;
+            }
+        } else if ((*pos != '#') && str_len(pos)) {
+            fprintf(stderr, "%s: unknown command '%s'\n", name, pos);
+            return 0;
+        }
+    }
+
+    if (stack) {
+        stack_delete(stack);
+    }
+
+    return 1;
+}
+
diff --git a/src/test/stack_1.cases b/src/test/stack_1.cases
new file mode 100644 (file)
index 0000000..cd5a63b
--- /dev/null
@@ -0,0 +1,592 @@
+# stack_1.cases is a test suite for the stack module.  See stack_1.c
+# for more details
+#
+# written nml 2004-07-26
+
+new
+       case_1 0
+pop
+       0 enoent
+push
+       0 ok
+push
+       1 ok
+pop 
+       1 ok
+pop 
+       0 ok
+
+# empty again
+pop
+       0 enoent
+
+# two pushes, one pop
+push 
+       0 ok
+push 
+       1 ok
+pop 
+       1 ok
+push
+       2 ok
+push 
+       3 ok
+pop 
+       3 ok
+push
+       4 ok
+push 
+       5 ok
+pop 
+       5 ok
+push
+       6 ok
+push 
+       7 ok
+pop 
+       7 ok
+push
+       8 ok
+push 
+       9 ok
+pop 
+       9 ok
+ls
+       5
+               0
+               2
+               4
+               6
+               8
+
+# two pops, one push
+pop
+       8 ok
+pop 
+       6 ok
+push
+       10 ok
+pop
+       10 ok
+pop 
+       4 ok
+push 
+       11 ok
+pop 
+       11 ok
+pop 
+       2 ok
+push 
+       12 ok
+pop 
+       12 ok
+pop 
+       0 ok
+ls
+       0
+
+# automated test
+push
+       0 ok
+push
+       1 ok
+push
+       2 ok
+push
+       3 ok
+push
+       4 ok
+push
+       5 ok
+push
+       6 ok
+push
+       7 ok
+push
+       8 ok
+push
+       9 ok
+push
+       10 ok
+push
+       11 ok
+push
+       12 ok
+push
+       13 ok
+push
+       14 ok
+push
+       15 ok
+push
+       16 ok
+push
+       17 ok
+push
+       18 ok
+push
+       19 ok
+push
+       20 ok
+push
+       21 ok
+push
+       22 ok
+push
+       23 ok
+push
+       24 ok
+push
+       25 ok
+push
+       26 ok
+push
+       27 ok
+push
+       28 ok
+push
+       29 ok
+push
+       30 ok
+push
+       31 ok
+push
+       32 ok
+push
+       33 ok
+push
+       34 ok
+push
+       35 ok
+push
+       36 ok
+push
+       37 ok
+push
+       38 ok
+push
+       39 ok
+push
+       40 ok
+push
+       41 ok
+push
+       42 ok
+push
+       43 ok
+push
+       44 ok
+push
+       45 ok
+push
+       46 ok
+push
+       47 ok
+push
+       48 ok
+push
+       49 ok
+push
+       50 ok
+push
+       51 ok
+push
+       52 ok
+push
+       53 ok
+push
+       54 ok
+push
+       55 ok
+push
+       56 ok
+push
+       57 ok
+push
+       58 ok
+push
+       59 ok
+push
+       60 ok
+push
+       61 ok
+push
+       62 ok
+push
+       63 ok
+push
+       64 ok
+push
+       65 ok
+push
+       66 ok
+push
+       67 ok
+push
+       68 ok
+push
+       69 ok
+push
+       70 ok
+push
+       71 ok
+push
+       72 ok
+push
+       73 ok
+push
+       74 ok
+push
+       75 ok
+push
+       76 ok
+push
+       77 ok
+push
+       78 ok
+push
+       79 ok
+push
+       80 ok
+push
+       81 ok
+push
+       82 ok
+push
+       83 ok
+push
+       84 ok
+push
+       85 ok
+push
+       86 ok
+push
+       87 ok
+push
+       88 ok
+push
+       89 ok
+push
+       90 ok
+push
+       91 ok
+push
+       92 ok
+push
+       93 ok
+push
+       94 ok
+push
+       95 ok
+push
+       96 ok
+push
+       97 ok
+push
+       98 ok
+push
+       99 ok
+
+ls
+       100
+               0
+               1
+               2
+               3
+               4
+               5
+               6
+               7
+               8
+               9
+               10
+               11
+               12
+               13
+               14
+               15
+               16
+               17
+               18
+               19
+               20
+               21
+               22
+               23
+               24
+               25
+               26
+               27
+               28
+               29
+               30
+               31
+               32
+               33
+               34
+               35
+               36
+               37
+               38
+               39
+               40
+               41
+               42
+               43
+               44
+               45
+               46
+               47
+               48
+               49
+               50
+               51
+               52
+               53
+               54
+               55
+               56
+               57
+               58
+               59
+               60
+               61
+               62
+               63
+               64
+               65
+               66
+               67
+               68
+               69
+               70
+               71
+               72
+               73
+               74
+               75
+               76
+               77
+               78
+               79
+               80
+               81
+               82
+               83
+               84
+               85
+               86
+               87
+               88
+               89
+               90
+               91
+               92
+               93
+               94
+               95
+               96
+               97
+               98
+               99
+
+pop
+       99 ok
+pop
+       98 ok
+pop
+       97 ok
+pop
+       96 ok
+pop
+       95 ok
+pop
+       94 ok
+pop
+       93 ok
+pop
+       92 ok
+pop
+       91 ok
+pop
+       90 ok
+pop
+       89 ok
+pop
+       88 ok
+pop
+       87 ok
+pop
+       86 ok
+pop
+       85 ok
+pop
+       84 ok
+pop
+       83 ok
+pop
+       82 ok
+pop
+       81 ok
+pop
+       80 ok
+pop
+       79 ok
+pop
+       78 ok
+pop
+       77 ok
+pop
+       76 ok
+pop
+       75 ok
+pop
+       74 ok
+pop
+       73 ok
+pop
+       72 ok
+pop
+       71 ok
+pop
+       70 ok
+pop
+       69 ok
+pop
+       68 ok
+pop
+       67 ok
+pop
+       66 ok
+pop
+       65 ok
+pop
+       64 ok
+pop
+       63 ok
+pop
+       62 ok
+pop
+       61 ok
+pop
+       60 ok
+pop
+       59 ok
+pop
+       58 ok
+pop
+       57 ok
+pop
+       56 ok
+pop
+       55 ok
+pop
+       54 ok
+pop
+       53 ok
+pop
+       52 ok
+pop
+       51 ok
+pop
+       50 ok
+pop
+       49 ok
+pop
+       48 ok
+pop
+       47 ok
+pop
+       46 ok
+pop
+       45 ok
+pop
+       44 ok
+pop
+       43 ok
+pop
+       42 ok
+pop
+       41 ok
+pop
+       40 ok
+pop
+       39 ok
+pop
+       38 ok
+pop
+       37 ok
+pop
+       36 ok
+pop
+       35 ok
+pop
+       34 ok
+pop
+       33 ok
+pop
+       32 ok
+pop
+       31 ok
+pop
+       30 ok
+pop
+       29 ok
+pop
+       28 ok
+pop
+       27 ok
+pop
+       26 ok
+pop
+       25 ok
+pop
+       24 ok
+pop
+       23 ok
+pop
+       22 ok
+pop
+       21 ok
+pop
+       20 ok
+pop
+       19 ok
+pop
+       18 ok
+pop
+       17 ok
+pop
+       16 ok
+pop
+       15 ok
+pop
+       14 ok
+pop
+       13 ok
+pop
+       12 ok
+pop
+       11 ok
+pop
+       10 ok
+pop
+       9 ok
+pop
+       8 ok
+pop
+       7 ok
+pop
+       6 ok
+pop
+       5 ok
+pop
+       4 ok
+pop
+       3 ok
+pop
+       2 ok
+pop
+       1 ok
+pop
+       0 ok
diff --git a/src/test/stop_1.c b/src/test/stop_1.c
new file mode 100644 (file)
index 0000000..be1c84e
--- /dev/null
@@ -0,0 +1,32 @@
+/*  
+ *  unit test for the stop library.
+ *
+ *  the input is the name of a stoplist file.  Currently, we only 
+ *  test creating then destroy this file.
+ */
+
+#include "firstinclude.h"
+#include "test.h"
+#include "error.h"
+#include "stop.h"
+#include "str.h"
+
+#include <stdio.h>
+
+int test_file(FILE * fp, int argc, char ** argv) {
+    char fname[1024];
+    struct stop * stop;
+
+    if (!fgets(fname, 1024, fp)) {
+        ERROR("reading filename from input stream");
+        return 0;
+    }
+    str_rtrim(fname);
+    stop = stop_new_file(NULL, NULL, fname);
+    if (!stop) {
+        ERROR1("opening stoplist file '%s'", fname);
+        return 0;
+    }
+    stop_delete(stop);
+    return 1;
+}
diff --git a/src/test/stop_1.cases b/src/test/stop_1.cases
new file mode 100644 (file)
index 0000000..f77b01b
--- /dev/null
@@ -0,0 +1 @@
+config/stoplist_sorted
diff --git a/src/test/str_1.c b/src/test/str_1.c
new file mode 100644 (file)
index 0000000..4f9aea9
--- /dev/null
@@ -0,0 +1,859 @@
+/* str_1.c is a unit test for the string library.  It has test cases
+ * hardwired into it, and so doesn't accept any input files.
+ *
+ * written nml 2003-10-22
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "test.h"
+#include "str.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#define rt_assert(b) frt_assert(b, __LINE__)
+
+void frt_assert(int boolean, unsigned int line) {
+    if (!boolean) {
+        fprintf(stderr, "str test on line %u failed\n", line);
+        exit(EXIT_FAILURE);
+    }
+}
+
+/* reference versions of ref_strlcat and ref_strlcpy were taken from OpenBSD
+ * under the following license */
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
+ * THE AUTHOR 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.
+ */
+
+size_t ref_strlcat(char *dst, const char *src, size_t siz) {
+       register char *d = dst;
+       register const char *s = src;
+       register size_t n = siz;
+       size_t dlen;
+
+       /* Find the end of dst and adjust bytes left but don't go past end */
+       while (n-- != 0 && *d != '\0')
+               d++;
+       dlen = d - dst;
+       n = siz - dlen;
+
+       if (n == 0)
+               return(dlen + strlen(s));
+       while (*s != '\0') {
+               if (n != 1) {
+                       *d++ = *s;
+                       n--;
+               }
+               s++;
+       }
+       *d = '\0';
+
+       return(dlen + (s - src));       /* count does not include NUL */
+}
+
+size_t ref_strlcpy(char *dst, const char *src, size_t siz) {
+       register char *d = dst;
+       register const char *s = src;
+       register size_t n = siz;
+
+       /* Copy as many bytes as will fit */
+       if (n != 0 && --n != 0) {
+               do {
+                       if ((*d++ = *s++) == 0)
+                               break;
+               } while (--n != 0);
+       }
+
+       /* Not enough room in dst, add NUL and traverse rest of src */
+       if (n == 0) {
+               if (siz != 0)
+                       *d = '\0';              /* NUL-terminate dst */
+               while (*s++)
+                       ;
+       }
+
+       return(s - src - 1);    /* count does not include NUL */
+}
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define STRMAX 30
+
+int str_len_test(const char *s) {
+    return str_len(s) == strlen(s);
+}
+
+int str_cmp_test(const char *s1, const char *s2) {
+    int ret = str_cmp(s1, s2);
+
+    if (ret > 0) {
+        return (strcmp(s1, s2) > 0);
+    } else if (ret < 0) {
+        return (strcmp(s1, s2) < 0);
+    } else {
+        return !strcmp(s1, s2);
+    }
+}
+
+int str_nncmp_test(const char *s1, const char *s2) {
+    unsigned int size1 = str_len(s1),
+                 size2 = str_len(s2);
+
+    int ret = str_nncmp(s1, size1, s2, size2);
+    int cmp;
+
+    if (size1 < size2) {
+        if (strncmp(s1, s2, size1) <= 0) {
+            cmp = -1;
+        } else {
+            cmp = 1;
+        }
+    } else if (size1 > size2) {
+        if (strncmp(s1, s2, size2) < 0) {
+            cmp = -1;
+        } else {
+            cmp = 1;
+        }
+    } else {
+        cmp = strncmp(s1, s2, size1);
+    }
+
+    return (((ret < 0) && (cmp < 0)) || (!ret && !cmp) 
+      || ((ret > 0) && (cmp > 0)));
+}
+
+int str_ncmp_test(const char *s1, const char *s2, size_t size) {
+    int ret = str_ncmp(s1, s2, size);
+
+    if (ret > 0) {
+        return (strncmp(s1, s2, size) > 0);
+    } else if (ret < 0) {
+        return (strncmp(s1, s2, size) < 0);
+    } else {
+        return !strncmp(s1, s2, size);
+    }
+}
+
+int str_casecmp_test(const char *s1, const char *s2) {
+    int ret = str_casecmp(s1, s2);
+
+    if (ret > 0) {
+        return (strcasecmp(s1, s2) > 0);
+    } else if (ret < 0) {
+        return (strcasecmp(s1, s2) < 0);
+    } else {
+        return !strcasecmp(s1, s2);
+    }
+}
+
+int str_ncasecmp_test(const char *s1, const char *s2, size_t size) {
+    int ret = str_ncasecmp(s1, s2, size);
+
+    if (ret > 0) {
+        return (strncasecmp(s1, s2, size) > 0);
+    } else if (ret < 0) {
+        return (strncasecmp(s1, s2, size) < 0);
+    } else {
+        return !strncasecmp(s1, s2, size);
+    }
+}
+
+int str_dup_test(const char *s) {
+    int ret;
+    char *dup = str_dup(s);
+
+    ret = !memcmp(s, dup, strlen(s) + 1);
+    free(dup);
+    return ret;
+}
+
+int str_ndup_test(const char *s, size_t size) {
+    char *dup = str_ndup(s, size);
+    char buf[STRMAX + 1];
+
+    if (str_len(s) > size) {
+        memcpy(buf, s, size);
+        buf[size] = '\0';
+    } else {
+        memcpy(buf, s, str_len(s));
+        buf[str_len(s)] = '\0';
+    }
+
+    if (str_cmp(dup, buf)) {
+        /* they're different, failed */
+        free(dup);
+        return 0;
+    } else {
+        free(dup);
+        return 1;
+    }
+}
+
+int str_cpy_test(const char *s) {
+    char buf[STRMAX + 1];
+    char buf2[STRMAX + 1];
+
+    memset(buf, 0xff, STRMAX + 1);
+    memset(buf2, 0xff, STRMAX + 1);
+
+    rt_assert(str_cpy(buf, s) == &buf[0]);
+    rt_assert(strcpy(buf2, s) == &buf2[0]);
+
+    return !memcmp(buf, buf2, STRMAX + 1);
+}
+
+int str_ncpy_test(const char *s, size_t size) {
+    char buf[STRMAX + 1];
+    char buf2[STRMAX + 1];
+
+    memset(buf, 0xff, STRMAX + 1);
+    memset(buf2, 0xff, STRMAX + 1);
+
+    rt_assert(str_ncpy(buf, s, size) == &buf[0]);
+    rt_assert(strncpy(buf2, s, size) == &buf2[0]);
+
+    return !memcmp(buf, buf2, STRMAX + 1);
+}
+
+int str_lcpy_test(const char *s, size_t size) {
+    char buf[STRMAX + 1];
+    char buf2[STRMAX + 1];
+    size_t sz, 
+           sz2;
+
+    memset(buf, 0xff, STRMAX + 1);
+    memset(buf2, 0xff, STRMAX + 1);
+
+    sz = str_lcpy(buf, s, size);
+    sz2 = ref_strlcpy(buf2, s, size);
+
+    return (sz == sz2) && !memcmp(buf, buf2, STRMAX + 1);
+}
+
+int str_cat_test(const char *s1, const char *s2) {
+    char buf[STRMAX + 1];
+    char buf2[STRMAX + 1];
+
+    memset(buf, 0xff, STRMAX + 1);
+    memset(buf2, 0xff, STRMAX + 1);
+    buf[0] = '\0';
+    buf2[0] = '\0';
+
+    rt_assert(str_cat(buf, s1) == &buf[0]);
+    rt_assert(strcat(buf2, s1) == &buf2[0]);
+
+    rt_assert(!memcmp(buf, buf2, STRMAX + 1));
+
+    rt_assert(str_cat(buf, s2) == &buf[0]);
+    rt_assert(strcat(buf2, s2) == &buf2[0]);
+
+    return !memcmp(buf, buf2, STRMAX + 1);
+}
+
+int str_ncat_test(const char *s1, const char *s2, size_t size) {
+    char buf[STRMAX + 1];
+    char buf2[STRMAX + 1];
+
+    memset(buf, 0xff, STRMAX + 1);
+    memset(buf2, 0xff, STRMAX + 1);
+    buf[0] = '\0';
+    buf2[0] = '\0';
+    buf[STRMAX] = '\0';
+    buf2[STRMAX] = '\0';
+
+    rt_assert(str_ncat(buf, s1, size) == &buf[0]);
+    rt_assert(strncat(buf2, s1, size) == &buf2[0]);
+
+    /* adjust size argument */
+    if (size > strlen(s1)) {
+        size -= strlen(s1);
+    } else {
+        size = 0;
+    }
+
+    rt_assert(!memcmp(buf, buf2, STRMAX + 1));
+
+    rt_assert(str_ncat(buf, s2, size) == &buf[0]);
+    rt_assert(strncat(buf2, s2, size) == &buf2[0]);
+
+    return !memcmp(buf, buf2, STRMAX + 1);
+}
+
+int str_lcat_test(const char *s1, const char *s2, size_t size) {
+    char buf[STRMAX + 1];
+    char buf2[STRMAX + 1];
+    size_t sz, 
+           sz2;
+
+    memset(buf, 0xff, STRMAX + 1);
+    memset(buf2, 0xff, STRMAX + 1);
+    buf[0] = '\0';
+    buf2[0] = '\0';
+
+    sz = str_lcat(buf, s1, size);
+    sz2 = ref_strlcat(buf2, s1, size);
+
+    rt_assert(sz == sz2);
+    rt_assert(!memcmp(buf, buf2, STRMAX + 1));
+
+    sz = str_lcat(buf, s2, size);
+    sz2 = ref_strlcat(buf2, s2, size);
+
+    return (sz == sz2) && !memcmp(buf, buf2, STRMAX + 1);
+}
+
+int str_ltrim_test(const char *s1) {
+    const char *s2;
+    unsigned int i;
+
+    /* find first non-space char in s1 */
+    for (i = 0; i < str_len(s1); i++) {
+        if (!isspace(s1[i])) {
+            break;
+        }
+    }
+
+    s2 = str_ltrim(s1);
+
+    return s2 == &s1[i];
+}
+
+int str_rtrim_test(const char *s1) {
+    char buf[STRMAX + 1];
+    unsigned int i,
+                 last = str_len(s1) - 1,
+                 trimmed,
+                 len = str_len(s1);
+
+    rt_assert(len < STRMAX);
+    strcpy(buf, s1);
+
+    /* find last non-space char in s1 */
+    for (i = 0; i < len; i++) {
+        if (!isspace(s1[i])) {
+            last = i;
+        }
+    }
+
+    trimmed = str_rtrim(buf);
+
+    return (buf[last + 1] == '\0') && (trimmed + str_len(buf) == len);
+}
+
+int str_chr_test(const char *s1, int c) {
+    char *one = strchr(s1, c),
+         *two = str_chr(s1, c);
+
+    return one == two;
+}
+
+int str_rchr_test(const char *s1, int c) {
+    char *one = strrchr(s1, c),
+         *two = str_rchr(s1, c);
+
+    return one == two;
+}
+
+int str_dirname_test(const char *s1, const char *s2) {
+    char buf[FILENAME_MAX + 1];
+
+    str_dirname(buf, FILENAME_MAX, s1);
+
+    return !str_cmp(buf, s2);
+}
+
+int str_basename_test(const char *s1, const char *s2) {
+    return !str_cmp(str_basename(s1), s2);
+}
+
+static int char_inset(char c, const char *set) {
+    while (*set) {
+        if (c == *set) {
+            return 1;
+        }
+        set++;
+    }
+    return 0;
+}
+
+int str_split_test(const char *s1, const char *delim) {
+    char *one = str_dup(s1);
+    const char *orig_pos = s1,
+               *new_pos;
+    char **arr;
+    int state = 0;   /* 1 for in delimiter, 0 otherwise */
+    unsigned int numsplit,
+                 i = 0;
+    int ret;
+
+    if (one && (arr = str_split(one, delim, &numsplit))) {
+        new_pos = arr[i];
+
+        while (*orig_pos && char_inset(*orig_pos, delim)) orig_pos++;
+
+        while (*orig_pos) {
+            if (state) {
+                /* in a delimiter */
+                if (!char_inset(*orig_pos, delim)) {
+                    /* switch states and should match first char next split */
+                    state = 0;
+                    if (i < numsplit + 1) {
+                        i++;
+                        new_pos = arr[i];
+                    } else {
+                        free(one);
+                        free(arr);
+                        return 0;
+                    }
+                    if (*new_pos != *orig_pos) {
+                        free(one);
+                        free(arr);
+                        return 0;
+                    } else {
+                        new_pos++;
+                    }
+                }
+            } else {
+                /* outside of a delimiter */
+                if (char_inset(*orig_pos, delim)) {
+                    /* switch states */
+                    state = 1;
+                } else if (*orig_pos != *new_pos) {
+                    free(one);
+                    free(arr);
+                    return 0;
+                } else {
+                    new_pos++;
+                }
+            }
+            orig_pos++;
+        }
+        /* make sure there's no more stuff from the split */
+        ret = (i + 1 == numsplit) && (!*new_pos);
+        free(one);
+        free(arr);
+        return ret;
+    } else {
+        if (one) {
+            free(one);
+        }
+        return 0;
+    }
+}
+
+int test_file(FILE *fp, int argc, char **argv) {
+
+    if (fp && (fp != stdin)) {
+        fprintf(stderr, "string library test run with file, "
+          "but contains embedded tests (fp %p stdin %p)\n", 
+          (void *) fp, (void *) stdin);
+        return EXIT_FAILURE;
+    }
+
+    /* test str_len */
+    rt_assert(str_len_test(""));
+    rt_assert(str_len_test("a"));
+    rt_assert(str_len_test("ab"));
+    rt_assert(str_len_test("ablaksjdflaksjdflkajsdfljaslfdj"));
+
+    /* test str_cmp */
+    rt_assert(str_cmp_test("", ""));
+    rt_assert(str_cmp_test("a", ""));
+    rt_assert(str_cmp_test("", "a"));
+    rt_assert(str_cmp_test("a", "a"));
+    rt_assert(str_cmp_test("a", "b"));
+    rt_assert(str_cmp_test("b", "a"));
+    rt_assert(str_cmp_test("aa", "a"));
+    rt_assert(str_cmp_test("a", "aa"));
+
+    /* test str_ncmp */
+    rt_assert(str_ncmp_test("", "", strlen("")));
+    rt_assert(str_ncmp_test("", "", strlen("") + 1));
+    rt_assert(str_ncmp_test("a", "a", strlen("")));
+    rt_assert(str_ncmp_test("a", "a", strlen("") + 1));
+    rt_assert(str_ncmp_test("a", "a", strlen("") - 1));
+    rt_assert(str_ncmp_test("a", "b", strlen("")));
+    rt_assert(str_ncmp_test("a", "b", strlen("") + 1));
+    rt_assert(str_ncmp_test("a", "b", strlen("") - 1));
+    rt_assert(str_ncmp_test("b", "a", strlen("")));
+    rt_assert(str_ncmp_test("b", "a", strlen("") + 1));
+    rt_assert(str_ncmp_test("b", "a", strlen("") - 1));
+    rt_assert(str_ncmp_test("aaaaab", "aaaaaa", strlen("aaaaaa"))); 
+    rt_assert(str_ncmp_test("aaaaab", "aaaaaa", strlen("aaaaaa") + 1)); 
+    rt_assert(str_ncmp_test("aaaaab", "aaaaaa", strlen("aaaaaa") - 1)); 
+    rt_assert(str_ncmp_test("aaaaab", "aaaaaa", strlen("aaaaaa") + 2)); 
+    rt_assert(str_ncmp_test("aaaaab", "aaaaaa", strlen("aaaaaa") - 2)); 
+    rt_assert(str_ncmp_test("aaaaab", "aaaaaa", 0)); 
+    rt_assert(str_ncmp_test("aaaaab", "aaaaaa", STRMAX)); 
+    rt_assert(str_ncmp_test("\xff", "aaaaaa", STRMAX)); 
+
+    /* test str_nncmp */
+    rt_assert(str_nncmp_test("", ""));
+    rt_assert(str_nncmp_test("", "a"));
+    rt_assert(str_nncmp_test("a", ""));
+    rt_assert(str_nncmp_test("a", "a"));
+    rt_assert(str_nncmp_test("a", "b"));
+    rt_assert(str_nncmp_test("", "b"));
+    rt_assert(str_nncmp_test("a", "ba"));
+    rt_assert(str_nncmp_test("aa", "b"));
+    rt_assert(str_nncmp_test("baa", "a"));
+    rt_assert(str_nncmp_test("b", "abb"));
+    rt_assert(str_nncmp_test("ba", "ab"));
+    rt_assert(str_nncmp_test("aaaaab", "aaaaaa"));
+    rt_assert(str_nncmp_test("aaaaaba", "aaaaaa"));
+    rt_assert(str_nncmp_test("aaaaa", "aaaaaa"));
+    rt_assert(str_nncmp_test("aaaa", "aaaaaa"));
+    rt_assert(str_nncmp_test("aaa", "aaaaaa"));
+    rt_assert(str_nncmp_test("aa", "aaaaa"));
+    rt_assert(str_nncmp_test("a", "aaaaaa"));
+    rt_assert(str_nncmp_test("\xff", "aaaaaa"));
+    rt_assert(str_nncmp_test("\xff", "aaaaa"));
+    rt_assert(str_nncmp_test("\xff", "aaaa"));
+    rt_assert(str_nncmp_test("\xff", "aaa"));
+    rt_assert(str_nncmp_test("\xff", "a"));
+    rt_assert(str_nncmp_test("\xff", ""));
+
+    /* test str_casecmp */
+    rt_assert(str_casecmp_test("", ""));
+    rt_assert(str_casecmp_test("a", ""));
+    rt_assert(str_casecmp_test("", "a"));
+    rt_assert(str_casecmp_test("a", "a"));
+    rt_assert(str_casecmp_test("A", "a"));
+    rt_assert(str_casecmp_test("a", "A"));
+    rt_assert(str_casecmp_test("a", "b"));
+    rt_assert(str_casecmp_test("A", "b"));
+    rt_assert(str_casecmp_test("a", "B"));
+    rt_assert(str_casecmp_test("b", "a"));
+    rt_assert(str_casecmp_test("aa", "a"));
+    rt_assert(str_casecmp_test("a", "aa"));
+    rt_assert(str_casecmp_test("aAa", "aaA"));
+
+    /* test str_ncasecasecmp */
+    rt_assert(str_ncasecmp_test("", "", strlen("")));
+    rt_assert(str_ncasecmp_test("", "", strlen("") + 1));
+    rt_assert(str_ncasecmp_test("a", "a", strlen("")));
+    rt_assert(str_ncasecmp_test("a", "a", strlen("") + 1));
+    rt_assert(str_ncasecmp_test("a", "a", strlen("") - 1));
+    rt_assert(str_ncasecmp_test("A", "a", strlen("")));
+    rt_assert(str_ncasecmp_test("A", "a", strlen("") + 1));
+    rt_assert(str_ncasecmp_test("A", "a", strlen("") - 1));
+    rt_assert(str_ncasecmp_test("a", "A", strlen("")));
+    rt_assert(str_ncasecmp_test("a", "A", strlen("") + 1));
+    rt_assert(str_ncasecmp_test("a", "A", strlen("") - 1));
+    rt_assert(str_ncasecmp_test("a", "B", strlen("")));
+    rt_assert(str_ncasecmp_test("a", "B", strlen("") + 1));
+    rt_assert(str_ncasecmp_test("a", "B", strlen("") - 1));
+    rt_assert(str_ncasecmp_test("a", "b", strlen("")));
+    rt_assert(str_ncasecmp_test("a", "b", strlen("") + 1));
+    rt_assert(str_ncasecmp_test("a", "b", strlen("") - 1));
+    rt_assert(str_ncasecmp_test("b", "A", strlen("")));
+    rt_assert(str_ncasecmp_test("b", "A", strlen("") + 1));
+    rt_assert(str_ncasecmp_test("b", "A", strlen("") - 1));
+    rt_assert(str_ncasecmp_test("b", "a", strlen("")));
+    rt_assert(str_ncasecmp_test("b", "a", strlen("") + 1));
+    rt_assert(str_ncasecmp_test("b", "a", strlen("") - 1));
+    rt_assert(str_ncasecmp_test("aaaaaA", "aaaaaa", strlen("aaaaaa"))); 
+    rt_assert(str_ncasecmp_test("aaaaaA", "aaaaaa", strlen("aaaaaa") + 1)); 
+    rt_assert(str_ncasecmp_test("aaaaaA", "aaaaaa", strlen("aaaaaa") - 1)); 
+    rt_assert(str_ncasecmp_test("aaaaaA", "aaaaaa", strlen("aaaaaa") + 2)); 
+    rt_assert(str_ncasecmp_test("aaaaaA", "aaaaaa", strlen("aaaaaa") - 2)); 
+    rt_assert(str_ncasecmp_test("aaaaaA", "aaaaaa", 0)); 
+    rt_assert(str_ncasecmp_test("aaaaaA", "aaaaaa", STRMAX)); 
+    rt_assert(str_ncasecmp_test("aaaaaB", "aaaaaa", strlen("aaaaaa"))); 
+    rt_assert(str_ncasecmp_test("aaaaaB", "aaaaaa", strlen("aaaaaa") + 1)); 
+    rt_assert(str_ncasecmp_test("aaaaaB", "aaaaaa", strlen("aaaaaa") - 1)); 
+    rt_assert(str_ncasecmp_test("aaaaaB", "aaaaaa", strlen("aaaaaa") + 2)); 
+    rt_assert(str_ncasecmp_test("aaaaaB", "aaaaaa", strlen("aaaaaa") - 2)); 
+    rt_assert(str_ncasecmp_test("aaaaaB", "aaaaaa", 0)); 
+    rt_assert(str_ncasecmp_test("aaaaaB", "aaaaaa", STRMAX)); 
+    rt_assert(str_ncasecmp_test("\xff", "aaaaaa", STRMAX)); 
+    rt_assert(str_ncasecmp_test("\xfa", "aaaaaa", STRMAX)); 
+    rt_assert(str_ncasecmp_test("\xf3", "aaaaaa", STRMAX)); 
+
+    /* test str_dup */
+    rt_assert(str_dup_test(""));
+    rt_assert(str_dup_test("a"));
+    rt_assert(str_dup_test("ab"));
+    rt_assert(str_dup_test("ablaksjdflaksjdflkajsdfljaslfdj"));
+
+    /* test str_ndup */
+    rt_assert(str_ndup_test("", 0));
+    rt_assert(str_ndup_test("", 1));
+    rt_assert(str_ndup_test("", 10));
+    rt_assert(str_ndup_test("a", 0));
+    rt_assert(str_ndup_test("a", 1));
+    rt_assert(str_ndup_test("a", 2));
+    rt_assert(str_ndup_test("ab", 0));
+    rt_assert(str_ndup_test("ab", 1));
+    rt_assert(str_ndup_test("ab", 2));
+    rt_assert(str_ndup_test("ab", 3));
+    rt_assert(str_ndup_test("ablaksjdflaksjdflkajsdfljaslfdj", 0));
+    rt_assert(str_ndup_test("ablaksjdflaksjdflkajsdfljaslfdj", 10));
+    rt_assert(str_ndup_test("ablaksjdflaksjdflkajsdfljaslfdj", 100));
+
+    /* test str_cpy */
+    rt_assert(str_cpy_test(""));
+    rt_assert(str_cpy_test("a"));
+    rt_assert(str_cpy_test("ab"));
+    rt_assert(str_cpy_test("ablaksjdflaksjdflkajsdfljaslfdj"));
+
+    /* test str_ncpy */
+    rt_assert(str_ncpy_test("", 0));
+    rt_assert(str_ncpy_test("", 1));
+    rt_assert(str_ncpy_test("", STRMAX));
+    rt_assert(str_ncpy_test("a", 0));
+    rt_assert(str_ncpy_test("a", strlen("a")));
+    rt_assert(str_ncpy_test("a", strlen("a") + 1));
+    rt_assert(str_ncpy_test("a", strlen("a") - 1));
+    rt_assert(str_ncpy_test("a", STRMAX));
+    rt_assert(str_ncpy_test("ab", 0));
+    rt_assert(str_ncpy_test("ab", strlen("ab")));
+    rt_assert(str_ncpy_test("ab", strlen("ab") + 1));
+    rt_assert(str_ncpy_test("ab", strlen("ab") - 1));
+    rt_assert(str_ncpy_test("ab", STRMAX));
+    rt_assert(str_ncpy_test("ablaksjdflaksjdflkajsdfljaslfdj", 
+      strlen("ablaksjdflaksjdflkajsdfljaslfdj")));
+    rt_assert(str_ncpy_test("ablaksjdflaksjdflkajsdfljaslfdj", 
+      strlen("ablaksjdflaksjdflkajsdfljaslfdj") + 1));
+    rt_assert(str_ncpy_test("ablaksjdflaksjdflkajsdfljaslfdj", 
+      strlen("ablaksjdflaksjdflkajsdfljaslfdj") - 1));
+    rt_assert(str_ncpy_test("ablaksjdflaksjdflkajsdfljaslfdj", STRMAX));
+
+    /* test str_lcpy */
+    rt_assert(str_lcpy_test("", 0));
+    rt_assert(str_lcpy_test("", 1));
+    rt_assert(str_lcpy_test("", STRMAX));
+    rt_assert(str_lcpy_test("a", 0));
+    rt_assert(str_lcpy_test("a", STRMAX));
+    rt_assert(str_lcpy_test("a", strlen("a")));
+    rt_assert(str_lcpy_test("a", strlen("a") + 1));
+    rt_assert(str_lcpy_test("a", strlen("a") + 2));
+    rt_assert(str_lcpy_test("a", strlen("a") - 1));
+    rt_assert(str_lcpy_test("ab", 0));
+    rt_assert(str_lcpy_test("ab", STRMAX));
+    rt_assert(str_lcpy_test("ab", strlen("ab")));
+    rt_assert(str_lcpy_test("ab", strlen("ab") + 1));
+    rt_assert(str_lcpy_test("ab", strlen("ab") + 2));
+    rt_assert(str_lcpy_test("ab", strlen("ab") - 1));
+    rt_assert(str_lcpy_test("ablaksjdflaksjdflkajsdfljaslfdj", 
+      strlen("ablaksjdflaksjdflkajsdfljaslfdj")));
+    rt_assert(str_lcpy_test("ablaksjdflaksjdflkajsdfljaslfdj", 
+      strlen("ablaksjdflaksjdflkajsdfljaslfdj") + 1));
+    rt_assert(str_lcpy_test("ablaksjdflaksjdflkajsdfljaslfdj", 
+      strlen("ablaksjdflaksjdflkajsdfljaslfdj") + 2));
+    rt_assert(str_lcpy_test("ablaksjdflaksjdflkajsdfljaslfdj", 
+      strlen("ablaksjdflaksjdflkajsdfljaslfdj") - 1));
+    rt_assert(str_lcpy_test("ablaksjdflaksjdflkajsdfljaslfdj", STRMAX));
+
+    /* test str_cat */
+    rt_assert(str_cat_test("", ""));
+    rt_assert(str_cat_test("a", ""));
+    rt_assert(str_cat_test("", "a"));
+    rt_assert(str_cat_test("aab", "aa"));
+    rt_assert(str_cat_test("aabalskjf", "aaalskjdf"));
+
+    /* test str_ncat */
+    rt_assert(str_ncat_test("", "", 0));
+    rt_assert(str_ncat_test("", "", 1));
+    rt_assert(str_ncat_test("", "", STRMAX));
+    rt_assert(str_ncat_test("a", "", strlen("a")));
+    rt_assert(str_ncat_test("a", "", strlen("a") + 1));
+    rt_assert(str_ncat_test("a", "", strlen("a") - 1));
+    rt_assert(str_ncat_test("a", "", 0));
+    rt_assert(str_ncat_test("a", "", STRMAX));
+    rt_assert(str_ncat_test("", "a", strlen("a")));
+    rt_assert(str_ncat_test("", "a", strlen("a") + 1));
+    rt_assert(str_ncat_test("", "a", strlen("a") - 1));
+    rt_assert(str_ncat_test("", "a", 0));
+    rt_assert(str_ncat_test("", "a", STRMAX));
+    rt_assert(str_ncat_test("aab", "aa", strlen("aab")));
+    rt_assert(str_ncat_test("aab", "aa", strlen("aab") + 1));
+    rt_assert(str_ncat_test("aab", "aa", strlen("aab") - 1));
+    rt_assert(str_ncat_test("aab", "aa", 0));
+    rt_assert(str_ncat_test("aab", "aa", STRMAX));
+    rt_assert(str_ncat_test("aab", "aa", strlen("aab") + strlen("aa")));
+    rt_assert(str_ncat_test("aab", "aa", strlen("aab") + strlen("aa") + 1));
+    rt_assert(str_ncat_test("aab", "aa", strlen("aab") + strlen("aa") - 1));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", 
+      strlen("aabalskjf") + strlen("aaalskjdf")));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", 
+      strlen("aabalskjf") + strlen("aaalskjdf") - 1));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", 
+      strlen("aabalskjf") + strlen("aaalskjdf") + 1));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", 0));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", 1));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", STRMAX));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf")));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf") + 1));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf") - 1));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf") / 2));
+    rt_assert(str_ncat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf") * 2));
+
+    /* test str_lcat */
+    rt_assert(str_lcat_test("", "", 0));
+    rt_assert(str_lcat_test("", "", 1));
+    rt_assert(str_lcat_test("", "", STRMAX));
+    rt_assert(str_lcat_test("a", "", strlen("a")));
+    rt_assert(str_lcat_test("a", "", strlen("a") + 1));
+    rt_assert(str_lcat_test("a", "", strlen("a") - 1));
+    rt_assert(str_lcat_test("a", "", 0));
+    rt_assert(str_lcat_test("a", "", STRMAX));
+    rt_assert(str_lcat_test("", "a", strlen("a")));
+    rt_assert(str_lcat_test("", "a", strlen("a") + 1));
+    rt_assert(str_lcat_test("", "a", strlen("a") - 1));
+    rt_assert(str_lcat_test("", "a", 0));
+    rt_assert(str_lcat_test("", "a", STRMAX));
+    rt_assert(str_lcat_test("aab", "aa", strlen("aab")));
+    rt_assert(str_lcat_test("aab", "aa", strlen("aab") + 1));
+    rt_assert(str_lcat_test("aab", "aa", strlen("aab") - 1));
+    rt_assert(str_lcat_test("aab", "aa", 0));
+    rt_assert(str_lcat_test("aab", "aa", STRMAX));
+    rt_assert(str_lcat_test("aab", "aa", strlen("aab") + strlen("aa")));
+    rt_assert(str_lcat_test("aab", "aa", strlen("aab") + strlen("aa") + 1));
+    rt_assert(str_lcat_test("aab", "aa", strlen("aab") + strlen("aa") - 1));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", 
+      strlen("aabalskjf") + strlen("aaalskjdf")));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", 
+      strlen("aabalskjf") + strlen("aaalskjdf") - 1));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", 
+      strlen("aabalskjf") + strlen("aaalskjdf") + 1));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", 0));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", 1));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", STRMAX));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf")));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf") + 1));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf") - 1));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf") / 2));
+    rt_assert(str_lcat_test("aabalskjf", "aaalskjdf", strlen("aabalskjf") * 2));
+
+    /* test ltrim */
+    rt_assert(str_ltrim_test(""));
+    rt_assert(str_ltrim_test("a"));
+    rt_assert(str_ltrim_test("llaskfjl"));
+    rt_assert(str_ltrim_test("a "));
+    rt_assert(str_ltrim_test("a \n\t"));
+    rt_assert(str_ltrim_test("a \n\ta"));
+    rt_assert(str_ltrim_test("a \n\t\f\v\r"));
+    rt_assert(str_ltrim_test(" \n\t\f\va"));
+    rt_assert(str_ltrim_test(" \n\t\f\v\ra \n\t\f\v\r"));
+    rt_assert(str_ltrim_test(" \n\t\f\v\r"));
+    rt_assert(str_ltrim_test(" \n\t\f\v\r\0\n   "));
+    rt_assert(str_ltrim_test(" \n\t\alskfj f\v\r"));
+
+    /* test rtrim */
+    rt_assert(str_rtrim_test(""));
+    rt_assert(str_rtrim_test("a"));
+    rt_assert(str_rtrim_test("llaskfjl"));
+    rt_assert(str_rtrim_test("a "));
+    rt_assert(str_rtrim_test(" a "));
+    rt_assert(str_rtrim_test("a\n\t\r\f\v"));
+    rt_assert(str_rtrim_test("a\n\t\r\f\vasldjf"));
+    rt_assert(str_rtrim_test("a\n\t\r\f\vasldjf   "));
+    rt_assert(str_rtrim_test("a \n\t\f\v"));
+    rt_assert(str_rtrim_test(" \n\t\f\va"));
+    rt_assert(str_rtrim_test(" \n\t\f\v\ra \n\t\f\v\r"));
+    rt_assert(str_rtrim_test(" \n\t\f\v\r"));
+    rt_assert(str_rtrim_test(" \n\t\f\v\r\0\n   "));
+    rt_assert(str_rtrim_test(" \n\t\alskfj f\v\r"));
+
+    /* test chr */
+    rt_assert(str_chr_test("", 'a'));
+    rt_assert(str_chr_test("", 'b'));
+    rt_assert(str_chr_test("", '\0'));
+    rt_assert(str_chr_test("ael;jas f,nerkj", 'a'));
+    rt_assert(str_chr_test("ael;jas f,nerkj", 'e'));
+    rt_assert(str_chr_test("ael;jas f,nerkj", 'l'));
+    rt_assert(str_chr_test("ael;jas f,nerkj", ';'));
+    rt_assert(str_chr_test("ael;jas f,nerkj", 'k'));
+    rt_assert(str_chr_test("ael;jas f,nerkj", 'j'));
+    rt_assert(str_chr_test("ael;jas f,nerkj", '\0'));
+
+    /* test rchr */
+    rt_assert(str_rchr_test("", 'a'));
+    rt_assert(str_rchr_test("", '\0'));
+    rt_assert(str_chr_test("ael;jas jf,nerkj", 'a'));
+    rt_assert(str_chr_test("ael;jas jf,nerkj", 'e'));
+    rt_assert(str_chr_test("ael;jas jf,nerkj", 'l'));
+    rt_assert(str_chr_test("ael;jas jf,nerkj", ';'));
+    rt_assert(str_chr_test("ael;jas jf,nerkj", 'j'));
+    rt_assert(str_chr_test("ael;jas jf,nerkj", 'k'));
+    rt_assert(str_chr_test("ael;jas jf,nerkj", '\0'));
+
+    /* test split (as best we can) */
+    rt_assert(str_split_test("", ""));
+    rt_assert(str_split_test("a", ""));
+    rt_assert(str_split_test(" a ", ""));
+    rt_assert(str_split_test("", "asdflasdkfj"));
+    rt_assert(str_split_test(" ", " \v\t"));
+    rt_assert(str_split_test("\v", " \v\t"));
+    rt_assert(str_split_test(" \v", " \v\t"));
+    rt_assert(str_split_test(" a ", " \v\t"));
+    rt_assert(str_split_test(" a", " \v\t"));
+    rt_assert(str_split_test("a ", " \v\t"));
+    rt_assert(str_split_test("a b", " \v\t"));
+    rt_assert(str_split_test("a b ", " \v\t"));
+    rt_assert(str_split_test(" a b", " \v\t"));
+    rt_assert(str_split_test(" aa bbbb", " \v\t"));
+    rt_assert(str_split_test("aa bbb", " \v\t"));
+    rt_assert(str_split_test("aa bbb ", " \v\t"));
+    rt_assert(str_split_test(" aa bbb ", " \v\t"));
+    rt_assert(str_split_test("the ants go marching", " \v\t"));
+    rt_assert(str_split_test("\tthe ants go marching\t ", " \v\t"));
+    rt_assert(str_split_test("the ants go marching\t\v ", " \v\t"));
+
+    rt_assert(str_dirname_test("", "."));
+    rt_assert(str_dirname_test("/blah", "/"));
+    rt_assert(str_dirname_test("/blah/", "/blah/"));
+    rt_assert(str_dirname_test("/blah/foo", "/blah/"));
+    rt_assert(str_dirname_test("   ", "."));
+    rt_assert(str_dirname_test(".", "."));
+    rt_assert(str_dirname_test("./", "./"));
+    rt_assert(str_dirname_test("..", "."));
+    rt_assert(str_dirname_test("../", "../"));
+
+    rt_assert(str_basename_test("", ""));
+    rt_assert(str_basename_test(".", "."));
+    rt_assert(str_basename_test("./", "./"));
+    rt_assert(str_basename_test("..", ".."));
+    rt_assert(str_basename_test("../", "../"));
+    rt_assert(str_basename_test("/", "/"));
+    rt_assert(str_basename_test("///////", "///////"));
+    rt_assert(str_basename_test("tmp///////", "tmp///////"));
+    rt_assert(str_basename_test("/tmp///////", "tmp///////"));
+    rt_assert(str_basename_test("//tmp///////", "tmp///////"));
+    rt_assert(str_basename_test("/blah", "blah"));
+    rt_assert(str_basename_test("/blah/", "blah/"));
+    rt_assert(str_basename_test("/blah/foo", "foo"));
+    return 1;
+}
+
diff --git a/src/testutils.c b/src/testutils.c
new file mode 100644 (file)
index 0000000..3469781
--- /dev/null
@@ -0,0 +1,159 @@
+#include "firstinclude.h"
+#include "testutils.h"
+#include "error.h"
+#include "str.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+struct lcrand * tu_rand = NULL;
+
+void tu_init_rand_or_die(unsigned seed) {
+    if (tu_rand != NULL)
+        lcrand_delete(tu_rand);
+    tu_rand = lcrand_new(seed);
+    if (tu_rand == NULL) {
+        ERROR("allocating tu_rand");
+        exit(EXIT_FAILURE);
+    }
+}
+
+unsigned int tu_rand_limit(unsigned limit) {
+    return lcrand_limit(tu_rand, limit);
+}
+
+double tu_rand_double_limit(double limit) {
+    return ((double) limit * lcrand(tu_rand)/(LCRAND_MAX + 1.0));
+}
+
+char tu_sample_data[TU_SAMPLE_DATA_LEN];
+
+int tu_sample_data_inited = 0;
+
+static int tu_sample_data_pos = 0;
+
+void tu_sample_data_rand_init() {
+    unsigned i;
+    for (i = 0; i < TU_SAMPLE_DATA_LEN; i++) {
+        tu_sample_data[i] = tu_rand_limit(256u);
+    }
+    tu_sample_data_inited = 1;
+}
+
+int tu_sample_data_file_init(const char * fname) {
+    int fd;
+    unsigned total_read = 0;
+    int nread;
+    fd = open(fname, O_RDONLY);
+    if (fd < 0) {
+        ERROR1("opening '%s' for sample data", fname);
+        return 0;
+    }
+    while (total_read < TU_SAMPLE_DATA_LEN) {
+        nread = read(fd, tu_sample_data + total_read, 
+          TU_SAMPLE_DATA_LEN - total_read);
+        if (nread < 0) {
+            ERROR1("reading data from '%s' for sample data", fname);
+            return 0;
+        }
+        total_read += nread;
+        if (total_read < TU_SAMPLE_DATA_LEN) {
+            off_t to;
+            to = lseek(fd, (off_t) 0, SEEK_SET);
+            if (to == (off_t) -1) {
+                ERROR1("seeking data file '%s'", fname);
+                return 0;
+            }
+        }
+    }
+    tu_sample_data_inited = 1;
+    return 1;
+}
+
+char * tu_get_rand_data(unsigned len) {
+    char * sample_pos;
+    if (!tu_sample_data_inited) {
+        tu_sample_data_rand_init();
+    }
+    assert(len < TU_SAMPLE_DATA_LEN);
+    if (tu_sample_data_pos + len > TU_SAMPLE_DATA_LEN)
+        tu_sample_data_pos = 0;
+    sample_pos = tu_sample_data + tu_sample_data_pos;
+    tu_sample_data_pos += len;
+    return sample_pos;
+}
+
+char * tu_get_rand_data_rand_len(unsigned max_len, unsigned * len) {
+    if (max_len == 0)
+        *len = 0;
+    else
+        *len = tu_rand_limit(max_len);
+    return tu_get_rand_data(*len);
+}
+
+struct tu_data_elements * tu_generate_elements_or_die(unsigned num_elements,
+  unsigned max_len) {
+    struct tu_data_elements * els = NULL;
+    unsigned i;
+    
+    if ( (els = malloc(sizeof(*els))) == NULL) {
+        perror("ERROR: allocating elems struct");
+        exit(EXIT_FAILURE);
+    }
+    els->num_elements = num_elements;
+    if ( (els->elements = malloc(sizeof(*els->elements) * num_elements))
+      == NULL) {
+        free(els);
+        perror("ERROR: allocating elems array");
+        exit(EXIT_FAILURE);
+    }
+    for (i = 0; i < num_elements; i++) {
+        els->elements[i].data = tu_get_rand_data_rand_len(max_len, 
+          &els->elements[i].len);
+    }
+    return els;
+}
+
+struct tu_data_elements * tu_generate_null_elements_or_die(unsigned 
+  num_elements) {
+    struct tu_data_elements * els = NULL;
+    unsigned i;
+    
+    if ( (els = malloc(sizeof(*els))) == NULL) {
+        perror("ERROR: allocating elems struct");
+        exit(EXIT_FAILURE);
+    }
+    els->num_elements = num_elements;
+    if ( (els->elements = malloc(sizeof(*els->elements) * num_elements))
+      == NULL) {
+        free(els);
+        perror("ERROR: allocating elems array");
+        exit(EXIT_FAILURE);
+    }
+    for (i = 0; i < num_elements; i++) {
+        els->elements[i].data = NULL;
+        els->elements[i].len = 0;
+    }
+    return els;
+}
+
+void tu_delete_elements(struct tu_data_elements * elements) {
+    free(elements->elements);
+    free(elements);
+}
+
+void tu_add_elements_to_list(struct tu_data_elements_list * list,
+  struct tu_data_elements * elements) {
+    if (list->head == NULL) {
+        assert(list->tail == NULL);
+        list->head = list->tail = elements;
+    } else {
+        assert(list->tail != NULL);
+        list->tail->next = elements;
+        list->tail = elements;
+    }
+}
diff --git a/src/trec_eval.c b/src/trec_eval.c
new file mode 100644 (file)
index 0000000..6f5e8f1
--- /dev/null
@@ -0,0 +1,1970 @@
+/* trec_eval.c implements standard information retrieval evaluation
+ * measures.  This code originated in the trec_eval program written by
+ * Chris Buckley and Gerard Salton.  They originally published under
+ * this license:
+ *
+ * Copyright (c) 1991, 1990, 1984 - Gerard Salton, Chris Buckley.
+ * Permission is granted for use of this file in unmodified form for
+ * research purposes. Please contact the SMART project to obtain
+ * permission for other uses. 
+ *
+ * This code was modified and redistributed with permission from Chris
+ * Buckley.
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "trec_eval.h"
+
+#include "chash.h"
+#include "str.h"
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Defined constants that are collection/purpose dependent */
+
+/* Number of cutoffs for recall,precision, and rel_precis measures. */
+
+/* CUTOFF_VALUES gives the number of retrieved docs that these
+ * evaluation measures are applied at. */
+#define NUM_CUTOFF  9
+#define CUTOFF_VALUES  {5, 10, 15, 20, 30, 100, 200, 500, 1000}
+
+/* Maximum fallout value, expressed in number of non-rel docs retrieved. */
+
+/* (Make the approximation that number of non-rel docs in collection */
+
+/* is equal to the number of number of docs in collection) */
+#define MAX_FALL_RET  142
+
+/* Maximum multiple of R (number of rel docs for this query) to calculate */
+
+/* R-based precision at */
+#define MAX_RPREC 2.0
+
+/* Defined constants that are collection/purpose independent.  If you
+ * change these, you probably need to change comments and documentation,
+ * and some variable names may not be appropriate any more! */
+#define NUM_RP_PTS  11
+#define THREE_PTS {2, 5, 8}
+#define NUM_FR_PTS  11
+#define NUM_PREC_PTS 11
+
+typedef struct {
+    int qid;                        /* query id (for overall average
+                                       figures, this gives number of
+                                       queries in run) */
+
+    /* Summary Numbers over all queries */
+    long num_rel;                   /* Number of relevant docs */
+    long num_ret;                   /* Number of retrieved docs */
+    long num_rel_ret;               /* Number of relevant retrieved docs */
+    float avg_doc_prec;             /* Average of precision over all
+                                       relevant documents (query
+                                       independent) */
+
+    /* Measures after num_ret docs */
+    float exact_recall;             /* Recall after num_ret docs */
+    float exact_precis;             /* Precision after num_ret docs */
+    float exact_rel_precis;         /* Relative Precision (or recall) */
+    /* Defined to be precision / max possible precision */
+
+    /* Measures after each document */
+    float recall_cut[NUM_CUTOFF];   /* Recall after cutoff[i] docs */
+
+    float precis_cut[NUM_CUTOFF];   /* precision after cutoff[i] docs.
+                                       If less than cutoff[i] docs
+                                       retrieved, then assume an
+                                       additional cutoff[i]-num_ret
+                                       non-relevant docs are retrieved. */
+    float rel_precis_cut            /* Relative precision after cutoff[i] */
+      [NUM_CUTOFF];                 /* docs */
+
+    /* Measures after each rel doc */
+    float av_recall_precis;         /* average(integral) of precision at
+                                       all rel doc ranks */
+    float int_av_recall_precis;     /* Same as above, but the precision
+                                       values have been interpolated, so
+                                       that prec(X) is actually MAX
+                                       prec(Y) for all Y >= X */
+    float int_recall_precis         /* interpolated precision at 0.1 */
+      [NUM_RP_PTS];                 /* increments of recall */
+    float int_av3_recall_precis;    /* interpolated average at 3 intermediate
+                                       points */
+    float int_av11_recall_precis;   /* interpolated average at NUM_RP_PTS
+                                       intermediate points (recall_level) */
+
+    /* Measures after each non-rel doc */
+    float fall_recall[NUM_FR_PTS];  /* max recall after each non-rel
+                                       doc, at 11 points starting at 0.0
+                                       and ending at MAX_FALL_RET
+                                       /num_docs */
+    float av_fall_recall;           /* Average of fallout-recall, after
+                                       each non-rel doc until fallout of
+                                       MAX_FALL_RET / num_docs achieved */
+
+    /* Measures after R-related cutoffs.  R is the number of relevant
+     * docs for a particular query, but note that these cutoffs are
+     * after R docs, whether relevant or non-relevant, have been
+     * retrieved.  R-related cutoffs are really only applicable to a
+     * situtation where there are many relevant docs per query (or lots
+     * of queries). */
+    float R_recall_precis;          /* Recall or precision after R docs
+                                       (note they are equal at this
+                                       point) */
+    float av_R_precis;              /* Average (or integral) of
+                                       precision at each doc until R
+                                       docs have been retrieved */
+    float R_prec_cut[NUM_PREC_PTS]; /* Precision measured after
+                                       multiples of R docs have been
+                                       retrieved.  11 equal points, with
+                                       max multiple having value
+                                       MAX_RPREC */
+    float int_R_recall_precis;      /* Interpolated precision after R
+                                       docs Prec(X) = MAX(prec(Y)) for
+                                       all Y>=X */
+    float int_av_R_precis;          /* Interpolated */
+    float int_R_prec_cut            /* Interpolated */
+      [NUM_PREC_PTS]; 
+} TREC_EVAL;
+
+typedef struct {
+    long int did;                   /* document id */
+    long int rank;                  /* Rank of this document */
+    char action;                    /* what action a user has taken with
+                                       doc */
+    char rel;                       /* whether doc judged relevant(1) or
+                                       not(0) */
+    char iter;                      /* Number of feedback runs for this
+                                       query */
+    char trtup_unused;              /* Presently unused field */
+    float sim;                      /* similarity of did to qid */
+} TR_TUP;
+
+typedef struct {
+    int qid;                        /* query id */
+    long int num_tr;                /* Number of tuples for tr_vec */
+    TR_TUP *tr;                     /* tuples.  Invariant: tr sorted
+                                       increasing did */
+} TR_VEC;
+
+static int init_tr_trec_eval(),
+    tr_trec_eval(),
+    close_tr_trec_eval();
+static int trvec_trec_eval();
+static int comp_tr_tup_did(const void *, const void *),
+    comp_sim_docno(const void *, const void *);
+static int get_trec_top();
+static int form_and_eval_trvec();
+
+typedef struct {
+    char *docno;
+    float sim;
+    long int rank;
+} TEXT_TR;
+
+typedef struct {
+    int qid;
+    long int num_text_tr;
+    long int max_num_text_tr;
+    TEXT_TR *text_tr;
+} TREC_TOP;
+
+#define TR_INCR 250
+
+#define MAX(A,B)  ((A) > (B) ? (A) : (B))
+#define MIN(A,B)  ((A) > (B) ? (B) : (A))
+
+#ifndef FALSE
+#define FALSE   0
+#endif
+#ifndef TRUE
+#define TRUE    1
+#endif
+
+#define UNDEF   -1
+
+#define MAX_LINE_LENGTH   100
+
+/* currently I'm assuming there are only 1000 queries _ever_ used at
+ * TREC, which is probably unrealistic. This assumption makes things
+ * easier, and if there are more queries used (ie higher query numbers
+ * used) then the following number just needs to be increased. */
+
+#define INTERPOLATED000     0
+#define INTERPOLATED010     1
+#define INTERPOLATED020     2
+#define INTERPOLATED030     3
+#define INTERPOLATED040     4
+#define INTERPOLATED050     5
+#define INTERPOLATED060     6
+#define INTERPOLATED070     7
+#define INTERPOLATED080     8
+#define INTERPOLATED090     9
+#define INTERPOLATED100    10
+#define PRECISION_AT_5      0
+#define PRECISION_AT_10     1
+#define PRECISION_AT_15     2
+#define PRECISION_AT_20     3
+#define PRECISION_AT_30     4
+#define PRECISION_AT_100    5
+#define PRECISION_AT_200    6
+#define PRECISION_AT_500    7
+#define PRECISION_AT_1000   8
+
+#define TREC_DOCUMENT_NUMBER_MAX_LENGTH 50
+
+typedef struct {
+    int query_id;                   /* Holds query ID */
+    char trec_document_number[TREC_DOCUMENT_NUMBER_MAX_LENGTH];
+                                    /* TREC document ID */
+    float score;                    /* accumulator score of document */
+} result_tuple;
+
+struct treceval_qrels {
+    struct chash *judgements;       /* Hash table that contains as keys
+                                       all relevance judgements in the
+                                       format of "QID TRECDOCNO", for
+                                       instance "381 FBIS3-1" */
+    int number_of_judged_queries;   /* This many queries have relevance
+                                       judgements */
+    int lowest_query_id;            /* The lowest query Id that has a
+                                       relevance judgement */
+
+    /* Each query contains this many judgements */
+    int *number_of_judgements_for_query; 
+};
+
+struct treceval {
+    result_tuple *tuples;           /* Stores unevaluated result tuples */
+    unsigned int cached_results;    /* Number of tuples in cache */
+    unsigned int cache_size;        /* Cache size in tuples */
+};
+
+static void evaluate_trec_results(unsigned int from_position,
+  unsigned int to_position, const struct treceval *result_cache,
+  const struct treceval_qrels *qrels,
+  struct treceval_results *evaluated_results) {
+    TREC_TOP trec_top;
+    TREC_EVAL eval_accum;
+    unsigned int up_to = from_position;
+
+    init_tr_trec_eval(&eval_accum);
+
+    trec_top.max_num_text_tr = 0;
+    trec_top.text_tr = NULL;
+
+    evaluated_results->queries = 0;
+    while (get_trec_top(&trec_top, result_cache, &up_to, to_position) != 0) {
+        form_and_eval_trvec(&eval_accum, &trec_top, qrels);
+        evaluated_results->queries++;
+    }
+
+    /* Finish evaluation computation */
+    close_tr_trec_eval(&eval_accum);
+
+    evaluated_results->retrieved = eval_accum.num_ret;
+    evaluated_results->relevant = eval_accum.num_rel;
+    evaluated_results->relevant_retrieved = eval_accum.num_rel_ret;
+    evaluated_results->interpolated_rp[INTERPOLATED000] =
+      eval_accum.int_recall_precis[0];
+    evaluated_results->interpolated_rp[INTERPOLATED010] =
+      eval_accum.int_recall_precis[1];
+    evaluated_results->interpolated_rp[INTERPOLATED020] =
+      eval_accum.int_recall_precis[2];
+    evaluated_results->interpolated_rp[INTERPOLATED030] =
+      eval_accum.int_recall_precis[3];
+    evaluated_results->interpolated_rp[INTERPOLATED040] =
+      eval_accum.int_recall_precis[4];
+    evaluated_results->interpolated_rp[INTERPOLATED050] =
+      eval_accum.int_recall_precis[5];
+    evaluated_results->interpolated_rp[INTERPOLATED060] =
+      eval_accum.int_recall_precis[6];
+    evaluated_results->interpolated_rp[INTERPOLATED070] =
+      eval_accum.int_recall_precis[7];
+    evaluated_results->interpolated_rp[INTERPOLATED080] =
+      eval_accum.int_recall_precis[8];
+    evaluated_results->interpolated_rp[INTERPOLATED090] =
+      eval_accum.int_recall_precis[9];
+    evaluated_results->interpolated_rp[INTERPOLATED100] =
+      eval_accum.int_recall_precis[10];
+    evaluated_results->average_precision = eval_accum.av_recall_precis;
+    evaluated_results->precision_at[PRECISION_AT_5] 
+      = eval_accum.precis_cut[0];
+    evaluated_results->precision_at[PRECISION_AT_10] 
+      = eval_accum.precis_cut[1];
+    evaluated_results->precision_at[PRECISION_AT_15] 
+      = eval_accum.precis_cut[2];
+    evaluated_results->precision_at[PRECISION_AT_20] 
+      = eval_accum.precis_cut[3];
+    evaluated_results->precision_at[PRECISION_AT_30] 
+      = eval_accum.precis_cut[4];
+    evaluated_results->precision_at[PRECISION_AT_100] 
+      = eval_accum.precis_cut[5];
+    evaluated_results->precision_at[PRECISION_AT_200]
+      = eval_accum.precis_cut[6];
+    evaluated_results->precision_at[PRECISION_AT_500] 
+      = eval_accum.precis_cut[7];
+    evaluated_results->precision_at[PRECISION_AT_1000] 
+      = eval_accum.precis_cut[8];
+    evaluated_results->rprecision = eval_accum.R_recall_precis;
+
+    if (trec_top.text_tr != NULL) {
+        free(trec_top.text_tr);
+    }
+    return;
+}
+
+static int form_and_eval_trvec(TREC_EVAL * eval_accum, TREC_TOP * trec_top,
+  struct treceval_qrels *qrels) {
+    TR_TUP *tr_tup;
+    long i;
+    TR_TUP *start_tr_tup = NULL; /* Space reserved for output TR_TUP
+                                    tuples */
+    long max_tr_tup = 0;
+    TR_VEC tr_vec;
+    char judgement[MAX_LINE_LENGTH];
+    void **dummy_pointer = NULL;
+
+    /* Reserve space for output tr_tups, if needed */
+    if (trec_top->num_text_tr > max_tr_tup) {
+        if (max_tr_tup > 0) {
+            (void) free((char *) start_tr_tup);
+        }
+        max_tr_tup += trec_top->num_text_tr;
+        if ((start_tr_tup = (TR_TUP *) malloc((unsigned) max_tr_tup
+          * sizeof(TR_TUP))) == NULL) {
+            return (UNDEF);
+        }
+    }
+
+    /* Sort trec_top by sim, breaking ties lexicographically using docno */
+    qsort((char *) trec_top->text_tr, (int) trec_top->num_text_tr,
+      sizeof(TEXT_TR), comp_sim_docno);
+
+    /* Add ranks to trec_top (starting at 1) */
+    for (i = 0; i < trec_top->num_text_tr; i++) {
+        trec_top->text_tr[i].rank = i + 1;
+    }
+
+    /* for each tuple in trec_top check the hash table which documents *
+     * are relevant. Once relevance is known, convert trec_top tuple *
+     * into TR_TUP. */
+    tr_tup = start_tr_tup;
+    for (i = 0; i < trec_top->num_text_tr; i++) {
+        sprintf(judgement, "%d %s", trec_top->qid,
+          trec_top->text_tr[i].docno);
+        if (chash_ptr_ptr_find(qrels->judgements, judgement,
+          &dummy_pointer) != CHASH_OK) {
+            /* Document is non-relevant */
+            tr_tup->rel = 0;
+        } else {
+            /* Document is relevant */
+            tr_tup->rel = 1;
+        }
+        tr_tup->did = i;
+        tr_tup->rank = trec_top->text_tr[i].rank;
+        tr_tup->sim = trec_top->text_tr[i].sim;
+        tr_tup->action = 0;
+        tr_tup->iter = 0;
+        tr_tup++;
+    }
+    /* Form and output the full TR_VEC object for this qid */
+    /* Sort trec_top tr_tups by did */
+    qsort((char *) start_tr_tup, (int) trec_top->num_text_tr, sizeof(TR_TUP),
+      comp_tr_tup_did);
+    tr_vec.qid = trec_top->qid;
+    tr_vec.num_tr = trec_top->num_text_tr;
+    tr_vec.tr = start_tr_tup;
+
+    /* Accumulate this tr_vec's eval figures in eval_accum */
+    tr_trec_eval(&tr_vec, eval_accum,
+      qrels->number_of_judgements_for_query[trec_top->qid -
+        qrels->lowest_query_id]);
+
+    free(start_tr_tup);
+
+    return (1);
+}
+
+static int comp_sim_docno(const void *vptr1, const void *vptr2) {
+    const TEXT_TR *ptr1 = vptr1,
+                  *ptr2 = vptr2;
+
+    if (ptr1->sim > ptr2->sim)
+        return (-1);
+    if (ptr1->sim < ptr2->sim)
+        return (1);
+    return (strcmp(ptr2->docno, ptr1->docno));
+}
+
+static int comp_tr_tup_did(const void *vptr1, const void *vptr2) {
+    const TR_TUP *ptr1 = vptr1,
+                 *ptr2 = vptr2;
+
+    return (ptr1->did - ptr2->did);
+}
+
+/* Get entire trec_top vector for next query */
+static int get_trec_top(TREC_TOP * trec_top, struct treceval *result_cache,
+  unsigned int *up_to, unsigned int to_position) {
+    int qid;
+
+    /* have already processed all tuples in this result set */
+    if (*up_to >= to_position) {
+        return 0;
+    }
+    trec_top->num_text_tr = 0;
+    qid = trec_top->qid =
+      result_cache->tuples[trec_top->num_text_tr + *up_to].query_id;
+
+    while (qid == trec_top->qid) {
+        /* Make sure enough space is reserved for next tuple */
+        if (trec_top->num_text_tr >= trec_top->max_num_text_tr) {
+            if (trec_top->max_num_text_tr == 0) {
+                if ((trec_top->text_tr = (TEXT_TR *) malloc((unsigned)
+                  TR_INCR * sizeof(TEXT_TR))) == NULL) {
+                    return (0);
+                }
+            } else if ((trec_top->text_tr = (TEXT_TR *) realloc((char *)
+                  trec_top->text_tr, (unsigned) (trec_top->max_num_text_tr
+                  + TR_INCR) * sizeof(TEXT_TR))) == NULL) {
+                return (0);
+            }
+            trec_top->max_num_text_tr += TR_INCR;
+        }
+        trec_top->text_tr[trec_top->num_text_tr].docno =
+          result_cache->tuples[trec_top->num_text_tr +
+          *up_to].trec_document_number;
+        trec_top->text_tr[trec_top->num_text_tr].sim =
+          result_cache->tuples[trec_top->num_text_tr + *up_to].score;
+        trec_top->num_text_tr++;
+
+        /* are we at the end of the results? */
+        if ((trec_top->num_text_tr + *up_to) >= to_position) {
+            *up_to += trec_top->num_text_tr;
+            return (1);
+        }
+
+        qid = result_cache->tuples[trec_top->num_text_tr + *up_to].query_id;
+    }
+
+    *up_to += trec_top->num_text_tr;
+    return (1);
+}
+
+/********************   PROCEDURE DESCRIPTION   ************************
+ *0 Given a tr file, evaluate it using trec, returning the evaluation in eval
+ *2 tr_trec_eval (tr_file, eval, inst)
+ *3   char *tr_file;
+ *3   TREC_EVAL *eval;
+ *3   int inst;
+ *4 init_tr_trec_eval (spec, unused)
+ *5   "eval.tr_file"
+ *5   "eval.tr_file.rmode"
+ *5   "eval.trace"
+ *4 close_tr_trec_eval (inst)
+ *7 Evaluate the given tr_file, returning the average over all queries of
+ *7 each query's evaluation.  Eval->qid will contain the number of queries
+ *7 evaluated. Tr_file is taken from the argument tr_file if
+ *7 that is valid, else from the spec parameter eval.tr_file.
+ *7 Return 1 if successful, 0 if no queries were evaluated, and UNDEF
+ *7 otherwise
+ *8 Call trvec_smeval for each query in tr_file, and simply average results.
+ *9 Note: Only the max iteration over all queries is averaged.  Thus, if
+ *9 query 1 had one iteration of feedback, and query 2 had two iterations of
+ *9 feedback, query 1 will not be included in the final average (or counted
+ *9 in eval->qid).
+***********************************************************************/
+
+static int init_tr_trec_eval(TREC_EVAL * eval) {
+    memset(eval, 0, sizeof(*eval));
+    return (0);
+}
+
+static int tr_trec_eval(TR_VEC * tr_vec, TREC_EVAL * eval,
+  long int num_rel) {
+    long i;
+    int max_iter_achieved;
+    TREC_EVAL query_eval;
+    int max_iter = 0;
+
+    /* Check that max_iter has not been exceeded.  If it has, then have
+     * to throw away all previous results. Also check to see that
+     * max_iter has been achieved.  If not, then no docs were retrieved
+     * for this query on this iteration */
+    max_iter_achieved = 0;
+    for (i = 0; i < tr_vec->num_tr; i++) {
+        if (tr_vec->tr[i].iter > max_iter) {
+            memset((char *) eval, 0, sizeof(TREC_EVAL));
+            max_iter = tr_vec->tr[i].iter;
+        }
+        if (tr_vec->tr[i].iter == max_iter) {
+            max_iter_achieved++;
+        }
+    }
+    if (max_iter_achieved == 0) {
+        return (0);
+    }
+
+    /* Evaluate this query */
+    if (1 == trvec_trec_eval(tr_vec, &query_eval, num_rel)) {
+        if (query_eval.num_ret > 0) {
+            eval->qid++;
+            eval->num_rel += query_eval.num_rel;
+            eval->num_ret += query_eval.num_ret;
+            eval->num_rel_ret += query_eval.num_rel_ret;
+            eval->avg_doc_prec += query_eval.avg_doc_prec;
+            eval->exact_recall += query_eval.exact_recall;
+            eval->exact_precis += query_eval.exact_precis;
+            eval->exact_rel_precis += query_eval.exact_rel_precis;
+            eval->av_recall_precis += query_eval.av_recall_precis;
+            eval->int_av_recall_precis += query_eval.int_av_recall_precis;
+            eval->int_av3_recall_precis += query_eval.int_av3_recall_precis;
+            eval->int_av11_recall_precis
+              += query_eval.int_av11_recall_precis;
+            eval->av_fall_recall += query_eval.av_fall_recall;
+            eval->R_recall_precis += query_eval.R_recall_precis;
+            eval->av_R_precis += query_eval.av_R_precis;
+            eval->int_R_recall_precis += query_eval.int_R_recall_precis;
+            eval->int_av_R_precis += query_eval.int_av_R_precis;
+            for (i = 0; i < NUM_CUTOFF; i++) {
+                eval->recall_cut[i] += query_eval.recall_cut[i];
+                eval->precis_cut[i] += query_eval.precis_cut[i];
+                eval->rel_precis_cut[i] += query_eval.rel_precis_cut[i];
+            }
+            for (i = 0; i < NUM_RP_PTS; i++)
+                eval->int_recall_precis[i]
+                  += query_eval.int_recall_precis[i];
+            for (i = 0; i < NUM_FR_PTS; i++)
+                eval->fall_recall[i] += query_eval.fall_recall[i];
+            for (i = 0; i < NUM_PREC_PTS; i++) {
+                eval->R_prec_cut[i] += query_eval.R_prec_cut[i];
+                eval->int_R_prec_cut[i] += query_eval.int_R_prec_cut[i];
+            }
+        }
+    }
+
+    return (0);
+}
+
+static int close_tr_trec_eval(TREC_EVAL * eval) {
+    long i;
+
+    /* Calculate averages (for those eval fields returning averages) */
+    if (eval->qid > 0) {
+        if (eval->num_rel > 0) {
+            eval->avg_doc_prec /= (float) eval->num_rel;
+        }
+        eval->exact_recall /= (float) eval->qid;
+        eval->exact_precis /= (float) eval->qid;
+        eval->exact_rel_precis /= (float) eval->qid;
+        eval->av_recall_precis /= (float) eval->qid;
+        eval->int_av_recall_precis /= (float) eval->qid;
+        eval->int_av3_recall_precis /= (float) eval->qid;
+        eval->int_av11_recall_precis /= (float) eval->qid;
+        eval->av_fall_recall /= (float) eval->qid;
+        eval->R_recall_precis /= (float) eval->qid;
+        eval->av_R_precis /= (float) eval->qid;
+        eval->int_R_recall_precis /= (float) eval->qid;
+        eval->int_av_R_precis /= (float) eval->qid;
+        for (i = 0; i < NUM_CUTOFF; i++) {
+            eval->recall_cut[i] /= (float) eval->qid;
+            eval->precis_cut[i] /= (float) eval->qid;
+            eval->rel_precis_cut[i] /= (float) eval->qid;
+        }
+        for (i = 0; i < NUM_RP_PTS; i++) {
+            eval->int_recall_precis[i] /= (float) eval->qid;
+        }
+        for (i = 0; i < NUM_FR_PTS; i++) {
+            eval->fall_recall[i] /= (float) eval->qid;
+        }
+        for (i = 0; i < NUM_PREC_PTS; i++) {
+            eval->R_prec_cut[i] /= (float) eval->qid;
+            eval->int_R_prec_cut[i] /= (float) eval->qid;
+        }
+    }
+
+    return (0);
+}
+
+/* cutoff values for recall precision output */
+const static int cutoff[NUM_CUTOFF] = CUTOFF_VALUES;
+const static int three_pts[3] = THREE_PTS;
+
+static int compare_iter_rank(const void *, const void *);
+
+static int trvec_trec_eval(TR_VEC * tr_vec, TREC_EVAL * eval,
+  long int num_rel) {
+    /* cutoff values for recall precision output */
+    double recall,
+      precis,
+      int_precis;                   /* current recall, precision and
+                                       interpolated precision values */
+    long i, j;
+    long rel_so_far;
+    long max_iter;
+
+    long cut_rp[NUM_RP_PTS];        /* number of rel docs needed to be
+                                       retrieved for each recall-prec
+                                       cutoff */
+    long cut_fr[NUM_FR_PTS];        /* number of non-rel docs needed to
+                                       be retrieved for each fall-recall
+                                       cutoff */
+    long cut_rprec[NUM_PREC_PTS];   /* Number of docs needed to be
+                                       retrieved for each R-based prec
+                                       cutoff */
+    long current_cutoff,
+        current_cut_rp,
+        current_cut_fr,
+        current_cut_rprec;
+
+    if (tr_vec == (TR_VEC *) NULL)
+        return (UNDEF);
+
+    /* Initialize everything to 0 */
+    memset((char *) eval, 0, sizeof(TREC_EVAL));
+    eval->qid = tr_vec->qid;
+
+    /* If no relevant docs, then just return */
+    if (tr_vec->num_tr == 0) {
+        return (0);
+    }
+
+    eval->num_rel = num_rel;
+
+    /* Evaluate only the docs on the last iteration of tr_vec */
+    /* Sort the tr tuples for this query by decreasing iter and
+     * increasing rank */
+    qsort((char *) tr_vec->tr, (int) tr_vec->num_tr, sizeof(TR_TUP),
+      compare_iter_rank);
+
+    max_iter = tr_vec->tr[0].iter;
+    rel_so_far = 0;
+    for (j = 0; j < tr_vec->num_tr; j++) {
+        if (tr_vec->tr[j].iter == max_iter) {
+            eval->num_ret++;
+            if (tr_vec->tr[j].rel)
+                rel_so_far++;
+        } else {
+            if (tr_vec->tr[j].rel)
+                eval->num_rel--;
+        }
+    }
+    eval->num_rel_ret = rel_so_far;
+
+    /* Discover cutoff values for this query */
+    current_cutoff = NUM_CUTOFF - 1;
+    while (current_cutoff > 0 && cutoff[current_cutoff] > eval->num_ret) {
+        current_cutoff--;
+    }
+    for (i = 0; i < NUM_RP_PTS; i++) {
+        cut_rp[i] = ((eval->num_rel * i) + NUM_RP_PTS - 2)
+          / (NUM_RP_PTS - 1);
+    }
+    current_cut_rp = NUM_RP_PTS - 1;
+    while (current_cut_rp > 0 && cut_rp[current_cut_rp]
+      > eval->num_rel_ret) {
+        current_cut_rp--;
+    }
+    for (i = 0; i < NUM_FR_PTS; i++) {
+        cut_fr[i] = ((MAX_FALL_RET * i) + NUM_FR_PTS - 2) / (NUM_FR_PTS - 1);
+    }
+    current_cut_fr = NUM_FR_PTS - 1;
+    while (current_cut_fr > 0
+      && cut_fr[current_cut_fr] > eval->num_ret - eval->num_rel_ret) {
+        current_cut_fr--;
+    }
+    for (i = 0; i < NUM_PREC_PTS; i++) {
+        cut_rprec[i] = (long int) (((MAX_RPREC * eval->num_rel * i)
+          + NUM_PREC_PTS - 2) / (NUM_PREC_PTS - 1));
+    }
+    current_cut_rprec = NUM_PREC_PTS - 1;
+    while (current_cut_rprec > 0
+      && cut_rprec[current_cut_rprec] > eval->num_ret) {
+        current_cut_rprec--;
+    }
+
+    /* Note for interpolated precision values (Prec(X) = MAX (PREC(Y))
+     * for all Y >= X) */
+    int_precis = (float) rel_so_far / (float) eval->num_ret;
+    for (j = eval->num_ret; j > 0; j--) {
+        recall = (float) rel_so_far / (float) eval->num_rel;
+        precis = (float) rel_so_far / (float) j;
+        if (int_precis < precis) {
+            int_precis = precis;
+        }
+        while (j == cutoff[current_cutoff]) {
+            eval->recall_cut[current_cutoff] = (float) recall;
+            eval->precis_cut[current_cutoff] = (float) precis;
+            eval->rel_precis_cut[current_cutoff]
+              = (float) (j > eval->num_rel ? recall : precis);
+            current_cutoff--;
+        }
+        while (j == cut_rprec[current_cut_rprec]) {
+            eval->R_prec_cut[current_cut_rprec] = (float) precis;
+            eval->int_R_prec_cut[current_cut_rprec] = (float) int_precis;
+            current_cut_rprec--;
+        }
+
+        if (j == eval->num_rel) {
+            eval->R_recall_precis = (float) precis;
+            eval->int_R_recall_precis = (float) int_precis;
+        }
+
+        if (j < eval->num_rel) {
+            eval->av_R_precis += (float) precis;
+            eval->int_av_R_precis += (float) int_precis;
+        }
+
+        if (tr_vec->tr[j - 1].rel) {
+            eval->int_av_recall_precis += (float) int_precis;
+            eval->av_recall_precis += (float) precis;
+            eval->avg_doc_prec += (float) precis;
+            while (rel_so_far == cut_rp[current_cut_rp]) {
+                eval->int_recall_precis[current_cut_rp] = (float) int_precis;
+                current_cut_rp--;
+            }
+            rel_so_far--;
+        } else {
+            /* Note: for fallout-recall, the recall at X non-rel docs is
+             * used for the recall 'after' (X-1) non-rel docs. Ie.
+             * recall_used(X-1 non-rel docs) = MAX (recall(Y)) for Y
+             * retrieved docs where X-1 non-rel retrieved */
+            while (current_cut_fr >= 0 &&
+              j - rel_so_far == cut_fr[current_cut_fr] + 1) {
+                eval->fall_recall[current_cut_fr] = (float) recall;
+                current_cut_fr--;
+            }
+            if (j - rel_so_far < MAX_FALL_RET) {
+                eval->av_fall_recall += (float) recall;
+            }
+        }
+    }
+
+    /* Fill in the 0.0 value for recall-precision (== max precision at
+     * any point in the retrieval ranking) */
+    eval->int_recall_precis[0] = (float) int_precis;
+
+    /* Fill in those cutoff values and averages that were not achieved
+     * because insufficient docs were retrieved. */
+    for (i = 0; i < NUM_CUTOFF; i++) {
+        if (eval->num_ret < cutoff[i]) {
+            eval->recall_cut[i] = ((float) eval->num_rel_ret /
+              (float) eval->num_rel);
+            eval->precis_cut[i] = ((float) eval->num_rel_ret /
+              (float) cutoff[i]);
+            eval->rel_precis_cut[i] = (cutoff[i] < eval->num_rel) ?
+              eval->precis_cut[i] : eval->recall_cut[i];
+        }
+    }
+    for (i = 0; i < NUM_FR_PTS; i++) {
+        if (eval->num_ret - eval->num_rel_ret < cut_fr[i]) {
+            eval->fall_recall[i] = (float) eval->num_rel_ret /
+              (float) eval->num_rel;
+        }
+    }
+    if (eval->num_ret - eval->num_rel_ret < MAX_FALL_RET) {
+        eval->av_fall_recall += ((MAX_FALL_RET -
+            (eval->num_ret - eval->num_rel_ret))
+          * ((float) eval->num_rel_ret / (float) eval->num_rel));
+    }
+    if (eval->num_rel > eval->num_ret) {
+        eval->R_recall_precis = (float) eval->num_rel_ret /
+          (float) eval->num_rel;
+        eval->int_R_recall_precis = (float) eval->num_rel_ret /
+          (float) eval->num_rel;
+        for (i = eval->num_ret; i < eval->num_rel; i++) {
+            eval->av_R_precis += (float) eval->num_rel_ret / (float) i;
+            eval->int_av_R_precis += (float) eval->num_rel_ret / (float) i;
+        }
+    }
+    for (i = 0; i < NUM_PREC_PTS; i++) {
+        if (eval->num_ret < cut_rprec[i]) {
+            eval->R_prec_cut[i] = (float) eval->num_rel_ret /
+              (float) cut_rprec[i];
+            eval->int_R_prec_cut[i] = (float) eval->num_rel_ret /
+              (float) cut_rprec[i];
+        }
+    }
+
+    /* The following cutoffs/averages are correct, since 0.0 should be
+     * averaged in for the non-retrieved docs: av_recall_precis,
+     * int_av_recall_prec, int_recall_prec, int_av3_recall_precis,
+     * int_av11_recall_precis */
+
+    /* Calculate other indirect evaluation measure averages. */
+    /* average recall-precis of 3 and 11 intermediate points */
+    eval->int_av3_recall_precis =
+      (eval->int_recall_precis[three_pts[0]] +
+      eval->int_recall_precis[three_pts[1]] +
+      eval->int_recall_precis[three_pts[2]]) / 3.0F;
+    for (i = 0; i < NUM_RP_PTS; i++) {
+        eval->int_av11_recall_precis += eval->int_recall_precis[i];
+    }
+    eval->int_av11_recall_precis /= NUM_RP_PTS;
+
+
+    /* Calculate all the other averages */
+    if (eval->num_rel_ret > 0) {
+        eval->av_recall_precis /= eval->num_rel;
+        eval->int_av_recall_precis /= eval->num_rel;
+    }
+
+    eval->av_fall_recall /= MAX_FALL_RET;
+
+    if (eval->num_rel) {
+        eval->av_R_precis /= eval->num_rel;
+        eval->int_av_R_precis /= eval->num_rel;
+        eval->exact_recall = (float) eval->num_rel_ret / eval->num_rel;
+        eval->exact_precis = (float) eval->num_rel_ret / eval->num_ret;
+        if (eval->num_rel > eval->num_ret)
+            eval->exact_rel_precis = eval->exact_precis;
+        else
+            eval->exact_rel_precis = eval->exact_recall;
+    }
+
+    return (1);
+}
+
+static int compare_iter_rank(const void *vptr1, const void *vptr2) {
+    const TR_TUP *tr1 = vptr1, 
+                 *tr2 = vptr2;
+
+    if (tr1->iter > tr2->iter) {
+        return (-1);
+    }
+    if (tr1->iter < tr2->iter) {
+        return (1);
+    }
+    if (tr1->rank < tr2->rank) {
+        return (-1);
+    }
+    if (tr1->rank > tr2->rank) {
+        return (1);
+    }
+    return (0);
+}
+
+/* Based on Falk Scholer's implementation in awk of the Wilcoxon
+ * Matched-Pairs Signed-Ranks Test or Wilcoxon Signed-Ranks Test */
+
+/** Performs a Wilcoxon signed rank test for a paired-difference experiment
+  * at the 0.05 and 0.10 significance levels.
+  *
+  * The null hypothesis (probability distributions of samples 1 and 2 
+  * are identical) is rejected if 
+  *     test statistic <= critical value for n = number of observations
+  *
+  * Note that this is a _two-tailed_ test, so that for a level of
+  * significance, ALPHA, the null hypothesis is rejected if the
+  * (absolute value of the) test statistic exceeds the critical value of
+  * the t-distribution at ALPHA/2  */
+
+#define WILCOXON_TABLE_SIZE 50
+#define Z_SCORE_TABLE_SIZE 410
+#define NEGATIVE -1
+#define POSITIVE 1
+
+struct data_point {
+    float absolute_difference;
+    int sign;
+};
+
+static int compare_data_points(struct data_point *data_point1,
+  struct data_point *data_point2) {
+    if (data_point1->absolute_difference
+      > data_point2->absolute_difference) {
+        return (1);
+    }
+    if (data_point1->absolute_difference
+      < data_point2->absolute_difference) {
+        return (-1);
+    }
+    return (0);
+}
+
+static int calculate_statistics(unsigned int statistic_id,
+  struct treceval_statistics *stats, unsigned int number_of_queries,
+  float *measurements[2]) {
+    unsigned int i = 0;
+    float difference = (float) 0;
+    struct data_point *data_points = NULL;
+    float *ranks;
+    unsigned int non_zero_results_counter = 0;
+    unsigned int counter = 0;
+    float average = (float) 0;
+    unsigned int old_position = 0;
+    float number_of_positive_differences = (float) 0;
+    float number_of_negative_differences = (float) 0;
+    int number_of_queries_improved = 0;
+    int number_of_queries_degraded = 0;
+    float z = (float) 0;
+    float rounded_z = (float) 0;
+    int test_stat = 0;
+
+    /* Wilcoxon's table of critical values of T at alpha = .1 and .05 */
+    const int wilcoxon_critical_values[WILCOXON_TABLE_SIZE][2] = { 
+      {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {1, -1},
+      {2, 1}, {4, 2}, {6, 6}, {8, 6}, {11, 8},
+      {14, 11}, {17, 14}, {21, 17}, {26, 21}, {30, 25},
+      {36, 30}, {41, 35}, {47, 40}, {54, 46}, {60, 52},
+      {68, 59}, {75, 66}, {83, 73}, {92, 81}, {101, 90},
+      {110, 98}, {120, 107}, {130, 117}, {141, 127}, {152, 137},
+      {163, 148}, {175, 159}, {188, 171}, {201, 183}, {214, 195},
+      {228, 208}, {242, 222}, {256, 235}, {271, 250}, {287, 264},
+      {303, 279}, {317, 295}, {336, 311}, {353, 327}, {371, 344},
+      {389, 361}, {408, 379}, {427, 397}, {446, 415}, {466, 434}
+    };
+
+    const float z_scores[Z_SCORE_TABLE_SIZE] = { 
+      0.00000F, 0.00399F, 0.00798F, 0.01197F, 0.01595F,
+      0.01994F, 0.02392F, 0.02790F, 0.03188F, 0.03586F,
+      0.03983F, 0.04380F, 0.04776F, 0.05172F, 0.05567F,
+      1.05962F, 0.06356F, 0.06749F, 0.07142F, 0.07535F,
+      0.07926F, 0.08317F, 0.08706F, 0.09095F, 0.09483F,
+      0.09871F, 0.10257F, 0.10642F, 0.11026F, 0.11409F,
+      0.11791F, 0.12172F, 0.12552F, 0.12930F, 0.13307F,
+      0.13683F, 0.14058F, 0.14431F, 0.14803F, 0.15173F,
+      0.15542F, 0.15910F, 0.16276F, 0.16640F, 0.17003F,
+      0.17364F, 0.17724F, 0.18082F, 0.18439F, 0.18793F,
+      0.19146F, 0.19497F, 0.19847F, 0.20194F, 0.20540F,
+      0.20884F, 0.21226F, 0.21566F, 0.21904F, 0.22240F,
+      0.22575F, 0.22907F, 0.23237F, 0.23565F, 0.23891F,
+      0.24215F, 0.24537F, 0.24857F, 0.25175F, 0.25490F,
+      0.25804F, 0.26115F, 0.26424F, 0.26730F, 0.27035F,
+      0.27337F, 0.27637F, 0.27935F, 0.28230F, 0.28524F,
+      0.28814F, 0.29103F, 0.29389F, 0.29673F, 0.29955F,
+      0.30234F, 0.30511F, 0.30785F, 0.31057F, 0.31327F,
+      0.31594F, 0.31859F, 0.32121F, 0.32381F, 0.32639F,
+      0.32894F, 0.33147F, 0.33398F, 0.33646F, 0.33891F,
+      0.34134F, 0.34375F, 0.34614F, 0.34849F, 0.35083F,
+      0.35314F, 0.35543F, 0.35769F, 0.35993F, 0.36214F,
+      0.36433F, 0.36650F, 0.36864F, 0.37076F, 0.37286F,
+      0.37493F, 0.37698F, 0.37900F, 0.38100F, 0.38298F,
+      0.38493F, 0.38686F, 0.38877F, 0.39065F, 0.39251F,
+      0.39435F, 0.39617F, 0.39796F, 0.39973F, 0.40147F,
+      0.40320F, 0.40490F, 0.40658F, 0.40824F, 0.40988F,
+      0.41149F, 0.41308F, 0.41466F, 0.41621F, 0.41774F,
+      0.41924F, 0.42073F, 0.42220F, 0.42364F, 0.42507F,
+      0.42647F, 0.42785F, 0.42922F, 0.43056F, 0.43189F,
+      0.43319F, 0.43448F, 0.43574F, 0.43699F, 0.43822F,
+      0.43943F, 0.44062F, 0.44179F, 0.44295F, 0.44408F,
+      0.44520F, 0.44630F, 0.44738F, 0.44845F, 0.44950F,
+      0.45053F, 0.45154F, 0.45254F, 0.45352F, 0.45449F,
+      0.45543F, 0.45637F, 0.45728F, 0.45818F, 0.45907F,
+      0.45994F, 0.46080F, 0.46164F, 0.46246F, 0.46327F,
+      0.46407F, 0.46485F, 0.46562F, 0.46638F, 0.46712F,
+      0.46784F, 0.46856F, 0.46926F, 0.46995F, 0.47062F,
+      0.47128F, 0.47193F, 0.47257F, 0.47320F, 0.47381F,
+      0.47441F, 0.47500F, 0.47558F, 0.47615F, 0.47670F,
+      0.47725F, 0.47778F, 0.47831F, 0.47882F, 0.47932F,
+      0.47982F, 0.48030F, 0.48077F, 0.48124F, 0.48169F,
+      0.48214F, 0.48257F, 0.48300F, 0.48341F, 0.48382F,
+      0.48422F, 0.48461F, 0.48500F, 0.48537F, 0.48574F,
+      0.48610F, 0.48645F, 0.48679F, 0.48713F, 0.48745F,
+      0.48778F, 0.48809F, 0.48840F, 0.48870F, 0.48899F,
+      0.48928F, 0.48956F, 0.48983F, 0.49010F, 0.49036F,
+      0.49061F, 0.49086F, 0.49111F, 0.49134F, 0.49158F,
+      0.49180F, 0.49202F, 0.49224F, 0.49245F, 0.49266F,
+      0.49286F, 0.49305F, 0.49324F, 0.49343F, 0.49361F,
+      0.49379F, 0.49396F, 0.49413F, 0.49430F, 0.49446F,
+      0.49461F, 0.49477F, 0.49492F, 0.49506F, 0.49520F,
+      0.49534F, 0.49547F, 0.49560F, 0.49573F, 0.49585F,
+      0.49598F, 0.49609F, 0.49621F, 0.49632F, 0.49643F,
+      0.49653F, 0.49664F, 0.49674F, 0.49683F, 0.49693F,
+      0.49702F, 0.49711F, 0.49720F, 0.49728F, 0.49736F,
+      0.49744F, 0.49752F, 0.49760F, 0.49767F, 0.49774F,
+      0.49781F, 0.49788F, 0.49795F, 0.49801F, 0.49807F,
+      0.49813F, 0.49819F, 0.49825F, 0.49831F, 0.49836F,
+      0.49841F, 0.49846F, 0.49851F, 0.49856F, 0.49861F,
+      0.49865F, 0.49869F, 0.49874F, 0.49878F, 0.49882F,
+      0.49886F, 0.49889F, 0.49893F, 0.49896F, 0.49900F,
+      0.49903F, 0.49906F, 0.49910F, 0.49913F, 0.49916F,
+      0.49918F, 0.49921F, 0.49924F, 0.49926F, 0.49929F,
+      0.49931F, 0.49934F, 0.49936F, 0.49938F, 0.49940F,
+      0.49942F, 0.49944F, 0.49946F, 0.49948F, 0.49950F,
+      0.49952F, 0.49953F, 0.49955F, 0.49957F, 0.49958F,
+      0.49960F, 0.49961F, 0.49962F, 0.49964F, 0.49965F,
+      0.49966F, 0.49968F, 0.49969F, 0.49970F, 0.49971F,
+      0.49972F, 0.49973F, 0.49974F, 0.49975F, 0.49976F,
+      0.49977F, 0.49978F, 0.49978F, 0.49979F, 0.49980F,
+      0.49981F, 0.49981F, 0.49982F, 0.49983F, 0.49983F,
+      0.49984F, 0.49985F, 0.49985F, 0.49986F, 0.49986F,
+      0.49987F, 0.49987F, 0.49988F, 0.49988F, 0.49989F,
+      0.49989F, 0.49990F, 0.49990F, 0.49990F, 0.49991F,
+      0.49991F, 0.49992F, 0.49992F, 0.49992F, 0.49992F,
+      0.49993F, 0.49993F, 0.49993F, 0.49994F, 0.49994F,
+      0.49994F, 0.49994F, 0.49995F, 0.49995F, 0.49995F,
+      0.49995F, 0.49995F, 0.49996F, 0.49996F, 0.49996F,
+      0.49996F, 0.49996F, 0.49996F, 0.49997F, 0.49997F,
+      0.49997F, 0.49997F, 0.49997F, 0.49997F, 0.49997F,
+      0.49997F, 0.49998F, 0.49998F, 0.49998F, 0.49998F
+    };
+
+    if (((data_points = malloc(sizeof(*data_points) * number_of_queries))
+      == NULL)
+      || ((ranks = malloc(sizeof(float) * number_of_queries)) == NULL)) {
+        return (-1);
+    }
+
+    for (i = 0; i < number_of_queries; i++) {
+        difference = measurements[0][i] - measurements[1][i];
+        if (difference < (float) 0) {
+            data_points[non_zero_results_counter].sign = NEGATIVE;
+            data_points[non_zero_results_counter].absolute_difference
+              = -difference;
+            non_zero_results_counter++;
+        } else if (difference > 0) {
+            data_points[non_zero_results_counter].sign = POSITIVE;
+            data_points[non_zero_results_counter].absolute_difference
+              = difference;
+            non_zero_results_counter++;
+        }
+    }
+    qsort(data_points, non_zero_results_counter, sizeof(*(data_points)),
+      (int (*)(const void *, const void *)) compare_data_points);
+
+    /* Resolve rankings of absolute_differences */
+    counter = 0;
+    while (counter < non_zero_results_counter) {
+        /* reset average at start of every turn */
+        average = (float) 0;
+        old_position = counter;
+        /* counting duplicates */
+        while ((counter < (non_zero_results_counter - 1))
+          && (data_points[counter].absolute_difference
+          == data_points[counter + 1].absolute_difference)) {
+            average += counter;
+            counter++;
+        }
+
+        if (counter > old_position) {
+            average += counter;
+            counter++;
+            average /= (float) (counter - old_position);
+            for (i = old_position; i < counter; i++) {
+                ranks[i] = average + (float) 1;
+            }
+        } else {
+            ranks[counter] = (float) (counter + 1);
+            counter++;
+        }
+    }
+
+    /* Summing the '+' and '-' ranks */
+    for (i = 0; i < non_zero_results_counter; i++) {
+        if (data_points[i].sign == POSITIVE) {
+            number_of_positive_differences += ranks[i];
+            number_of_queries_degraded++;
+        } else {
+            number_of_negative_differences += ranks[i];
+            number_of_queries_improved++;
+        }
+    }
+
+    free(ranks);
+    free(data_points);
+
+    /* Calculate large-sample approximation (n >= 25) Rejection region:
+     * (a) 2-tailed test: z > z_alpha/2 or z < -z_alpha/2 (b)
+     * right-tailed: z > z_alpha (c) left-tailed: z < -z_alpha */
+
+    z = (float) ((number_of_positive_differences 
+      - (((float) (non_zero_results_counter
+      * (non_zero_results_counter + 1))) / ((float) 4)))
+      / sqrt(((float) (non_zero_results_counter * (non_zero_results_counter +
+            1) * ((2 * non_zero_results_counter) + 1))) / ((float) 24)));
+
+    z *= (float) 100;
+    rounded_z = (float) ((int) z);
+    if ((z - rounded_z) >= 0.5) {
+        rounded_z += (float) 1;
+    }
+    rounded_z /= (float) 100;
+    z = rounded_z;
+
+    /* Generate test statistic (the smaller of PosSum and NegSum) */
+    if (number_of_positive_differences > number_of_negative_differences) {
+        test_stat = (int) number_of_negative_differences;
+    } else {
+        test_stat = (int) number_of_positive_differences;
+    }
+
+    stats->stats[statistic_id].improved = number_of_queries_improved;
+    stats->stats[statistic_id].degraded = number_of_queries_degraded;
+    stats->stats[statistic_id].z_score = z;
+
+    if (non_zero_results_counter == 0) {
+        stats->stats[statistic_id].hypothesis = NO_DIFF;
+    } else if ((non_zero_results_counter > WILCOXON_TABLE_SIZE)
+      || (wilcoxon_critical_values[non_zero_results_counter - 1][0] == -1)) {
+        stats->stats[statistic_id].hypothesis = OUT_OF_RANGE;
+    } else {
+        if (stats->tailedness == ONE_TAILED) {
+            if (test_stat <=
+              wilcoxon_critical_values[non_zero_results_counter - 1][1]) {
+                stats->stats[statistic_id].hypothesis = REJECTED;
+                stats->stats[statistic_id].confidence = 0.05F;
+            } else {
+                stats->stats[statistic_id].hypothesis = NOT_REJECTED;
+                stats->stats[statistic_id].confidence = 0.05F;
+            }
+        } else {
+            if (test_stat <=
+              wilcoxon_critical_values[non_zero_results_counter - 1][1]) {
+                stats->stats[statistic_id].hypothesis = REJECTED;
+                stats->stats[statistic_id].confidence = 0.05F;
+            } else if (test_stat <=
+              wilcoxon_critical_values[non_zero_results_counter - 1][0]) {
+                stats->stats[statistic_id].hypothesis = REJECTED;
+                stats->stats[statistic_id].confidence = 0.1F;
+            } else {
+                stats->stats[statistic_id].hypothesis = NOT_REJECTED;
+                stats->stats[statistic_id].confidence = 0.1F;
+            }
+        }
+    }
+
+    if (z < (float) 0) {
+        z *= (float) -1;
+    }
+    if (stats->tailedness == ONE_TAILED) {
+        /* 4.09 is largest z-score in lookup table... */
+        if ((z * (float) 100) >= Z_SCORE_TABLE_SIZE) {
+            /* value in table is for area */
+            stats->stats[statistic_id].sign = '<';
+            stats->stats[statistic_id].actual_confidence =
+              (float) (1 - (0.49998 + 0.5));
+        } else {
+            /* value in table is for area; mu=0 to z */
+            stats->stats[statistic_id].sign = '=';
+            stats->stats[statistic_id].actual_confidence =
+              ((float) 1 - (z_scores[(int) (z * (float) 100)] + 0.5F));
+        }
+    } else {
+        /* 4.09 is largest z-score in lookup table... */
+        if ((z * (float) 100) >= Z_SCORE_TABLE_SIZE) {
+            /* value in table is for area */
+            stats->stats[statistic_id].sign = '<';
+            stats->stats[statistic_id].actual_confidence =
+              ((float) 1 - (0.49998F * (float) 2));
+        } else {
+            /* value in table is for area; mu=0 to z */
+            stats->stats[statistic_id].sign = '=';
+            stats->stats[statistic_id].actual_confidence =
+              ((float) 1 - (z_scores[(int) (z * (float) 100)] * (float) 2));
+        }
+    }
+
+    return non_zero_results_counter;
+}
+
+static void print_stat(const struct treceval_statistics *stats,
+  const unsigned int id, FILE * output) {
+    if (stats->stats[id].hypothesis == NO_DIFF) {
+        fprintf(stdout, "(runs identical, no stats computed)\n");
+    } else if (stats->stats[id].hypothesis == OUT_OF_RANGE) {
+        fprintf(stdout, "(out of range)    %6.3f    %c%6.5f\n",
+          stats->stats[id].z_score, stats->stats[id].sign,
+          stats->stats[id].actual_confidence);
+    } else {
+        if (stats->stats[id].hypothesis == REJECTED) {
+            fprintf(stdout, "rejected at %2.2f  %6.3f    %c %6.5f\n",
+              stats->stats[id].confidence, stats->stats[id].z_score,
+              stats->stats[id].sign, stats->stats[id].actual_confidence);
+        } else {
+            fprintf(stdout, "not rejd at %2.2f  %6.3f    %c %6.5f\n",
+              stats->stats[id].confidence, stats->stats[id].z_score,
+              stats->stats[id].sign, stats->stats[id].actual_confidence);
+        }
+    }
+}
+
+int treceval_stats_print(const struct treceval_statistics *stats,
+  FILE *output) {
+    if (stats->tailedness == ONE_TAILED) {
+        fprintf(output, "Wilcoxon signed rank test (one-tailed)\n");
+    } else {
+        fprintf(output, "Wilcoxon signed rank test (two-tailed)\n");
+    }
+    if (stats->sample_size <= 0) {
+        return (0);
+    }
+    fprintf(output, "Running Statistics over %d queries.\n",
+      stats->sample_size);
+    fprintf(output, "---------------------------------------------------"
+      "----------------------\n");
+    fprintf(output, "measures        improved degraded   Null Hypothesis"
+      "   z-score   actual p\n");
+    fprintf(output, "Avg Precision      %2d       %2d      ",
+      stats->stats[0].improved, stats->stats[0].degraded);
+    print_stat(stats, 0, output);
+    fprintf(output, "Precision@   5     %2d       %2d      ",
+      stats->stats[1].improved, stats->stats[1].degraded);
+    print_stat(stats, 1, output);
+    fprintf(output, "Precision@  10     %2d       %2d      ",
+      stats->stats[2].improved, stats->stats[2].degraded);
+    print_stat(stats, 2, output);
+    fprintf(output, "Precision@  15     %2d       %2d      ",
+      stats->stats[3].improved, stats->stats[3].degraded);
+    print_stat(stats, 3, output);
+    fprintf(output, "Precision@  20     %2d       %2d      ",
+      stats->stats[4].improved, stats->stats[4].degraded);
+    print_stat(stats, 4, output);
+    fprintf(output, "Precision@  30     %2d       %2d      ",
+      stats->stats[5].improved, stats->stats[5].degraded);
+    print_stat(stats, 5, output);
+    fprintf(output, "Precision@ 100     %2d       %2d      ",
+      stats->stats[6].improved, stats->stats[6].degraded);
+    print_stat(stats, 6, output);
+    fprintf(output, "Precision@ 200     %2d       %2d      ",
+      stats->stats[7].improved, stats->stats[7].degraded);
+    print_stat(stats, 7, output);
+    fprintf(output, "Precision@ 500     %2d       %2d      ",
+      stats->stats[8].improved, stats->stats[8].degraded);
+    print_stat(stats, 8, output);
+    fprintf(output, "Precision@1000     %2d       %2d      ",
+      stats->stats[9].improved, stats->stats[9].degraded);
+    print_stat(stats, 9, output);
+    fprintf(output, "R Precision        %2d       %2d      ",
+      stats->stats[10].improved, stats->stats[10].degraded);
+    print_stat(stats, 10, output);
+    fprintf(output, "---------------------------------------------------"
+      "----------------------\n");
+
+    return (1);
+}
+
+static int compare_query_ids(result_tuple *tuple1, result_tuple *tuple2) {
+    if (tuple1->query_id > tuple2->query_id) {
+        return (1);
+    }
+    if (tuple1->query_id < tuple2->query_id) {
+        return (-1);
+    }
+    return (0);
+}
+
+int treceval_stats_calculate(const struct treceval *trec_results_a,
+  const struct treceval *trec_results_b, struct treceval_statistics *stats,
+  const struct treceval_qrels *qrels,
+  treceval_statistics_tailedness tailedness) {
+    unsigned int i = 0;
+    unsigned int start1 = 0;
+    unsigned int start2 = 0;
+    unsigned int end1 = 0;
+    unsigned int end2 = 0;
+    unsigned int query_count = 0;
+    unsigned int max_query_count = 0;
+    unsigned int evaluated1 = 1;
+    unsigned int evaluated2 = 1;
+    struct treceval_results *evaluations[2];
+    float *measurements[2];
+
+    qsort(trec_results_a->tuples, trec_results_a->cached_results,
+      sizeof(*(trec_results_a->tuples)),
+      (int (*)(const void *, const void *)) compare_query_ids);
+    qsort(trec_results_b->tuples, trec_results_b->cached_results,
+      sizeof(*(trec_results_a->tuples)),
+      (int (*)(const void *, const void *)) compare_query_ids);
+
+    stats->tailedness = tailedness;
+
+    /* checking whether both results are empty in which case it is
+     * useless to calculate statistics */
+    if ((trec_results_a->cached_results == 0)
+      || (trec_results_b->cached_results == 0)) {
+        /* need to zero results */
+        stats->sample_size = 0;
+        for (i = 0; i < 11; i++) {
+            stats->stats[i].improved = 0;
+            stats->stats[i].degraded = 0;
+            stats->stats[i].hypothesis = OUT_OF_RANGE;
+            stats->stats[i].confidence = (float) 0;
+            stats->stats[i].z_score = (float) 0;
+            stats->stats[i].actual_confidence = (float) 0;
+            stats->stats[i].sign = '?';
+        }
+        return 0;
+    }
+
+    /* counting query IDs in the first pass only, so we can set enough
+     * results aside */
+    while ((end1 < trec_results_a->cached_results)
+      || (end2 < trec_results_b->cached_results)) {
+        /* if this input has been evaluated last time 'round (see next
+         * comment) then advance the input for the next evaluation */
+        if (evaluated1) {
+            start1 = end1;
+            for (; end1 < trec_results_a->cached_results; end1++) {
+                if (trec_results_a->tuples[end1].query_id !=
+                  trec_results_a->tuples[start1].query_id) {
+                    break;
+                }
+            }
+        }
+        if (evaluated2) {
+            start2 = end2;
+            for (; end2 < trec_results_b->cached_results; end2++) {
+                if (trec_results_b->tuples[end2].query_id !=
+                  trec_results_b->tuples[start2].query_id) {
+                    break;
+                }
+            }
+        }
+
+        /* Checking that both are evaluating the same query. If not,
+         * then have to make sure that only the one with the current
+         * query_id gets evaluated whereas the results for the other is
+         * zeroed. Also have to keep track of which one of the input
+         * should be advanced next. */
+        evaluated1 = 1;
+        evaluated2 = 1;
+        if (trec_results_a->tuples[start1].query_id !=
+          trec_results_b->tuples[start2].query_id) {
+            if (trec_results_a->tuples[start1].query_id >
+              trec_results_b->tuples[start2].query_id) {
+                evaluated1 = 0;
+            } else {
+                evaluated2 = 0;
+            }
+        }
+
+        max_query_count++;
+    }
+    end1 = 0;
+    end2 = 0;
+
+    /* setting aside memory */
+    if (((evaluations[0] =
+      malloc(sizeof(struct treceval_results) * max_query_count)) == NULL)
+      || ((evaluations[1] =
+      malloc(sizeof(struct treceval_results) * max_query_count)) == NULL)) {
+        return (0);
+    }
+    if (((measurements[0] = malloc(sizeof(float) * max_query_count)) == NULL)
+      || ((measurements[1] 
+          = malloc(sizeof(float) * max_query_count)) == NULL)) {
+        return (0);
+    }
+
+    /* need to keep going until both inputs are exhausted */
+    while ((end1 < trec_results_a->cached_results)
+      || (end2 < trec_results_b->cached_results)) {
+        /* if this input has been evaluated last time 'round (see next
+         * comment) then advance the input for the next evaluation */
+        if (evaluated1) {
+            start1 = end1;
+            for (; end1 < trec_results_a->cached_results; end1++) {
+                if (trec_results_a->tuples[end1].query_id !=
+                  trec_results_a->tuples[start1].query_id) {
+                    break;
+                }
+            }
+        }
+        if (evaluated2) {
+            start2 = end2;
+            for (; end2 < trec_results_b->cached_results; end2++) {
+                if (trec_results_b->tuples[end2].query_id !=
+                  trec_results_b->tuples[start2].query_id) {
+                    break;
+                }
+            }
+        }
+
+        /* Checking that both are evaluating the same query. If not,
+         * then have to make sure that only the one with the current
+         * query_id gets evaluated whereas the results for the other is
+         * zeroed. Also have to keep track of which one of the input
+         * should be advanced next. At the same time I changed the two
+         * corresponding lines 50 lines above. */
+        evaluated1 = 1;
+        evaluated2 = 1;
+        /* FIXME: just fixed a bug whereby I interchanged the
+         * evaluated2/1 lines with each other (without too much thinking
+         * about the problem) and everything seems to be working.
+         * However if there is another problem, it might be worth
+         * investigating this first. */
+        if (trec_results_a->tuples[start1].query_id ==
+          trec_results_b->tuples[start2].query_id) {
+            evaluate_trec_results(start1, end1 - 1, trec_results_a, qrels,
+              &evaluations[0][query_count]);
+            evaluate_trec_results(start2, end2 - 1, trec_results_b, qrels,
+              &evaluations[1][query_count]);
+        } else if (trec_results_a->tuples[start1].query_id <
+          trec_results_b->tuples[start2].query_id) {
+            evaluate_trec_results(start1, end1 - 1, trec_results_a, qrels,
+              &evaluations[0][query_count]);
+            evaluate_trec_results(0, 0, trec_results_b, qrels,
+              &evaluations[1][query_count]);
+            evaluated2 = 0;
+        } else {
+            evaluate_trec_results(0, 0, trec_results_a, qrels,
+              &evaluations[0][query_count]);
+            evaluate_trec_results(start2, end2 - 1, trec_results_b, qrels,
+              &evaluations[1][query_count]);
+            evaluated1 = 0;
+        }
+
+        query_count++;
+    }
+
+    stats->sample_size = max_query_count;
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].average_precision;
+        measurements[1][i] = evaluations[1][i].average_precision;
+    }
+    if (calculate_statistics(0, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[0];
+        measurements[1][i] = evaluations[1][i].precision_at[0];
+    }
+    if (calculate_statistics(1, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[1];
+        measurements[1][i] = evaluations[1][i].precision_at[1];
+    }
+    if (calculate_statistics(2, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[2];
+        measurements[1][i] = evaluations[1][i].precision_at[2];
+    }
+    if (calculate_statistics(3, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[3];
+        measurements[1][i] = evaluations[1][i].precision_at[3];
+    }
+    if (calculate_statistics(4, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[4];
+        measurements[1][i] = evaluations[1][i].precision_at[4];
+    }
+    if (calculate_statistics(5, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[5];
+        measurements[1][i] = evaluations[1][i].precision_at[5];
+    }
+    if (calculate_statistics(6, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[6];
+        measurements[1][i] = evaluations[1][i].precision_at[6];
+    }
+    if (calculate_statistics(7, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[7];
+        measurements[1][i] = evaluations[1][i].precision_at[7];
+    }
+    if (calculate_statistics(8, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].precision_at[8];
+        measurements[1][i] = evaluations[1][i].precision_at[8];
+    }
+    if (calculate_statistics(9, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+    for (i = 0; i < max_query_count; i++) {
+        measurements[0][i] = evaluations[0][i].rprecision;
+        measurements[1][i] = evaluations[1][i].rprecision;
+    }
+    if (calculate_statistics(10, stats, max_query_count, measurements) < 0) {
+        return (0);
+    }
+
+    free(measurements[0]);
+    free(measurements[1]);
+    free(evaluations[0]);
+    free(evaluations[1]);
+    return 1;
+}
+
+/* Assumes that the first entry in the relevance judgement contains a
+ * result for the query with the smallest ID. */
+struct treceval_qrels *treceval_qrels_new(const char *qrels_file_name) {
+    unsigned int i = 0;
+    struct treceval_qrels *qrels = NULL;
+    FILE *qrels_file = NULL;
+    char line[MAX_LINE_LENGTH];
+    char *line_pointer = NULL;
+    char *document_number_pointer = NULL;
+    char judgement[MAX_LINE_LENGTH];
+    int query_id = 0;
+    char *judgement_string = NULL;
+
+    if ((qrels = malloc(sizeof(struct treceval_qrels))) == NULL) {
+        return NULL;
+    }
+    qrels->number_of_judged_queries = 50;
+    qrels->lowest_query_id = -1;
+    qrels->number_of_judgements_for_query = NULL;
+
+    /* setting aside memeory for hash table */
+    if ((qrels->judgements = chash_ptr_new(8, 0.8F, 
+      (unsigned int (*)(const void *)) str_hash,
+      (int (*)(const void *, const void *)) str_cmp)) == NULL) {
+        return NULL;
+    }
+
+    if ((qrels->number_of_judgements_for_query =
+        malloc(sizeof(int) * qrels->number_of_judged_queries)) == NULL) {
+        return NULL;
+    }
+    for (i = 0; i < (unsigned int) qrels->number_of_judged_queries; i++) {
+        qrels->number_of_judgements_for_query[i] = 0;
+    }
+
+    if ((qrels_file = fopen(qrels_file_name, "r")) == NULL) {
+        return NULL;
+    }
+
+    /* populating relevance judgements hash table */
+    while (fgets(line, MAX_LINE_LENGTH, qrels_file) != NULL) {
+        /* Only care whether a document is relevant. */
+        if (line[strlen(line) - 2] != '0') {
+            line_pointer = line;
+            /* getting Query ID first */
+            while (*line_pointer != ' ') {
+                line_pointer++;
+            }
+            *line_pointer = '\0';
+            query_id = atoi(line);
+            /* need to set the lowest query ID if that hasn't been done
+             * before */
+            if (qrels->lowest_query_id == -1) {
+                qrels->lowest_query_id = query_id;
+            }
+            /* if the query ID had been set before and it was larger
+             * than the current query ID we give up */
+            else if (query_id < qrels->lowest_query_id) {
+                return NULL;
+            }
+            /* if the current query ID is larger than the number of IDs
+             * we have set space aside for, we need to increas space for
+             * new queries.  Note that we assume that we need to have
+             * enough space for all query IDs, from the lowest to the
+             * highest (ie we don't deal with the fact that we might
+             * have a (potentially large) gap in IDs and therefore might
+             * waste (lots of) space. */
+            else if (query_id >=
+              (qrels->lowest_query_id + qrels->number_of_judged_queries)) {
+                /* need to set aside memory for more queries */
+                if ((qrels->number_of_judgements_for_query =
+                  realloc(qrels->number_of_judgements_for_query, sizeof(int)
+                  * (qrels->number_of_judged_queries + 50))) == NULL) {
+                    return NULL;
+                }
+                /* need to initialise judgement counts for new queries */
+                for (i = qrels->number_of_judged_queries;
+                  i < (unsigned int) (qrels->number_of_judged_queries + 50); 
+                  i++) {
+                    qrels->number_of_judgements_for_query[i] = 0;
+                }
+                qrels->number_of_judged_queries += 50;
+            }
+
+            /* Extracting document number. */
+            strcpy(judgement, line);
+            strcat(judgement, " ");
+            line_pointer += 3;
+            document_number_pointer = line_pointer;
+            while (*line_pointer != ' ') {
+                line_pointer++;
+            }
+            *line_pointer = '\0';
+            strcat(judgement, document_number_pointer);
+
+            /* Adding judgement in form "QID TRECDOCNO" (for instance
+             * "381 FBIS3-1") into hash table. Just need to check for
+             * presence when checking if document is relevant. */
+            if ((judgement_string = malloc(sizeof(*judgement_string)
+              * (strlen(judgement) + 1))) == NULL) {
+                return NULL;
+            }
+            str_cpy(judgement_string, judgement);
+            chash_ptr_ptr_insert(qrels->judgements, judgement_string, NULL);
+
+            /* Incrementing the count of judgements for this query (so
+             * that average precision can be calculated later. */
+            qrels->number_of_judgements_for_query[query_id -
+              qrels->lowest_query_id]++;
+        }
+    }
+
+    fclose(qrels_file);
+    return qrels;
+}
+
+struct treceval *treceval_new() {
+    struct treceval *new_trec_eval = NULL;
+
+    if ((new_trec_eval = malloc(sizeof(struct treceval))) == NULL) {
+        return NULL;
+    }
+    new_trec_eval->cached_results = 0;
+    new_trec_eval->cache_size = 50;
+
+    /* setting aside memory for cached results */
+    if ((new_trec_eval->tuples =
+        malloc(sizeof(result_tuple) * new_trec_eval->cache_size)) == NULL) {
+        return NULL;
+    }
+
+    return new_trec_eval;
+}
+
+void treceval_qrels_delete(struct treceval_qrels **qrels) {
+    void **dummy_pointer = NULL;
+    char *previous_judgement = NULL;
+    struct chash_iter *iterator = chash_iter_new((*qrels)->judgements);
+    const void *key = NULL;
+
+    if (*qrels != NULL) {
+        if ((*qrels)->number_of_judgements_for_query != NULL) {
+            free((*qrels)->number_of_judgements_for_query);
+        }
+        if ((*qrels)->judgements != NULL) {
+            while (chash_iter_ptr_ptr_next(iterator, &key,
+              &dummy_pointer) == CHASH_OK) {
+                if (previous_judgement != NULL) {
+                    free(previous_judgement);
+                }
+                previous_judgement = (char *) key;
+            }
+            if (previous_judgement != NULL) {
+                free(previous_judgement);
+            }
+            chash_iter_delete(iterator);
+            chash_delete((*qrels)->judgements);
+        }
+        free(*qrels);
+        *qrels = NULL;
+    }
+}
+
+void treceval_delete(struct treceval **trec_results) {
+    if (*trec_results != NULL) {
+        if ((*trec_results)->tuples != NULL) {
+            free((*trec_results)->tuples);
+        }
+        free((*trec_results));
+        *trec_results = NULL;
+    }
+}
+
+int treceval_add_result(struct treceval *trec_results,
+  const unsigned int query_id, const char *trec_document_number, 
+  const float score) {
+
+    /* if the current cache is exhausted, need to increase the cache size */
+    if (trec_results->cached_results == trec_results->cache_size) {
+        trec_results->cache_size *= 2;
+        if ((trec_results->tuples =
+            realloc(trec_results->tuples,
+              sizeof(result_tuple) * trec_results->cache_size)) == NULL) {
+            return (0);
+        }
+    }
+
+    /* copying the result fields into the cache tuple */
+    trec_results->tuples[trec_results->cached_results].query_id = query_id;
+    if (strlen(trec_document_number)
+      >= (TREC_DOCUMENT_NUMBER_MAX_LENGTH - 1)) {
+        return (0);
+    }
+    strcpy(trec_results->tuples[trec_results->cached_results].
+      trec_document_number, trec_document_number);
+    trec_results->tuples[trec_results->cached_results].score = score;
+    trec_results->cached_results++;
+
+    return 1;
+}
+
+void treceval_print_results(struct treceval_results *evaluated_results,
+  const unsigned int number_of_results, FILE *output, int interpolated) {
+    unsigned int i = 0,
+                 j = 0;
+
+    fprintf(output, "        Run:    ");
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6d", i);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "No. of QIDs:    ");
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6d", evaluated_results[i].queries);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "Total number of documents over all queries\n");
+    fprintf(output, "    Retrieved:  ");
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6d", evaluated_results[i].retrieved);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "    Relevant:   ");
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6d", evaluated_results[i].relevant);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "    Rel_ret:    ");
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6d", evaluated_results[i].relevant_retrieved);
+    }
+    fprintf(output, "\n");
+
+    if (interpolated) {
+        fprintf(output, "Interpolated Recall - Precision Averages:\n");
+        fprintf(output, "    at 0.00     ");
+        j = 0;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.10     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.20     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.30     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.40     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.50     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.60     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.70     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.80     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 0.90     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+
+        fprintf(output, "    at 1.00     ");
+        j++;
+        for (i = 0; i < number_of_results; i++) {
+            fprintf(output, "   %6.4f", 
+              evaluated_results[i].interpolated_rp[j]);
+        }
+        fprintf(output, "\n");
+    }
+
+    fprintf(output, "Average precision (non-interpolated) ");
+    fprintf(output, "for all rel docs\n");
+    fprintf(output, "  P(avg)        ");
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].average_precision);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "Precision:\n  At    5 docs: ");
+    j = 0;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "  At   10 docs: ");
+    j++;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "  At   15 docs: ");
+    j++;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "  At   20 docs: ");
+    j++;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "  At   30 docs: ");
+    j++;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "  At  100 docs: ");
+    j++;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "  At  200 docs: ");
+    j++;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "  At  500 docs: ");
+    j++;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "  At 1000 docs: ");
+    j++;
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].precision_at[j]);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "R-Precision (precision after R (= num_rel for a ");
+    fprintf(output, "query) docs retrieved):\n");
+    fprintf(output, "    Exact:      ");
+    for (i = 0; i < number_of_results; i++) {
+        fprintf(output, "   %6.4f", evaluated_results[i].rprecision);
+    }
+    fprintf(output, "\n");
+
+    fprintf(output, "\n");
+}
+
+int treceval_evaluate_query(const unsigned int query_id,
+  struct treceval_results *evaluated_results,
+  const struct treceval_qrels *qrels, const struct treceval *trec_results) {
+    unsigned int i = 0;
+
+    unsigned int start = 0;
+    unsigned int end = 0;
+
+    /* sorting tuples first */
+    qsort(trec_results->tuples, trec_results->cached_results,
+      sizeof(*(trec_results->tuples)),
+      (int (*)(const void *, const void *)) compare_query_ids);
+
+    /* checking whether there are no results or the query_id is out of
+     * bounds */
+    if ((trec_results->cached_results == 0)
+      || (((unsigned int) trec_results->tuples[0].query_id) > query_id)
+      || ((unsigned int)
+          trec_results->tuples[trec_results->cached_results - 1].query_id
+        < query_id)) {
+
+        /* abusing way of zeroing the evaluated_results values */
+        evaluate_trec_results(0, 0, trec_results, qrels, evaluated_results);
+        return 0;
+    }
+
+    for (i = 0; i < trec_results->cached_results; i++) {
+        if (((unsigned int) trec_results->tuples[i].query_id) == query_id) {
+            start = i;
+            break;
+        }
+    }
+    for (; i < trec_results->cached_results; i++) {
+        if (((unsigned int) trec_results->tuples[i].query_id) != query_id) {
+            end = i - 1;
+        }
+    }
+    /* if this is the last query in the results then the next query id
+     * cannot be found */
+    if (end == 0) {
+        end = trec_results->cached_results - 1;
+    }
+    evaluate_trec_results(start, end, trec_results, qrels,
+      evaluated_results);
+    return 1;
+}
+
+int treceval_evaluate(const struct treceval *trec_results,
+  const struct treceval_qrels *qrels,
+  struct treceval_results *evaluated_results) {
+    /* sorting tuples first */
+    qsort(trec_results->tuples, trec_results->cached_results,
+      sizeof(*(trec_results->tuples)),
+      (int (*)(const void *, const void *)) compare_query_ids);
+    evaluate_trec_results(0, trec_results->cached_results, trec_results,
+      qrels, evaluated_results);
+    return 1;
+}
+
diff --git a/src/trecrun.c b/src/trecrun.c
new file mode 100644 (file)
index 0000000..dd49654
--- /dev/null
@@ -0,0 +1,1218 @@
+/* trecrun.c is a tool that answers queries in trec topic files and
+ * outputs the answers in a format suitable for evaluation by the
+ * trec_eval set of scripts
+ *
+ * trec_eval is available from ftp://ftp.cs.cornell.edu/pub/smart/
+ * or http://trec.nist.gov/trec_eval/
+ *
+ * written nml 2003-06-06
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "config.h"
+#include "def.h"
+#include "getlongopt.h"
+#include "mlparse_wrap.h"
+#include "docmap.h"           /* needed to set cache values on index load */
+#include "index.h"
+#include "str.h"
+#include "summarise.h"
+#include "trec_eval.h"
+#include "timings.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static void print_usage(FILE *output, const char *progname) {
+    const char *name = strrchr(progname, '/');
+
+    if (name) {
+        name++;
+    } else {
+        name = progname;
+    }
+
+    fprintf(output, "usage: '%s index', where index is the name of the index "
+      "to query\n", name);
+    fprintf(output, "  query options:\n");
+    fprintf(output, "    -f,--file=[topic_file]: add topic_file to list of "
+      "topic files\n");
+    fprintf(output, "    -F,--file-list=[file]: add files listed in file to "
+      "list of topic files\n");
+    fprintf(output, "    -r,--runid=[run_id]: output run_id as id for this "
+      "evaluation\n");
+    fprintf(output, "    -n,--number-results=[num]: number of results to "
+      "output per query\n");
+    fprintf(output, "    -t,--title: use title in query\n");
+    fprintf(output, "    -d,--description: use description in query\n");
+    fprintf(output, "    -a,--narrative: use narrative in query\n");
+    fprintf(output, "    --print-queries: print topic queries to stderr\n");
+    fprintf(output, "    --timing: print total querying time to stderr\n");
+    fprintf(output, "              (excludes index loading time)\n");
+    fprintf(output, "    --big-and-fast: use more memory\n");
+    fprintf(output, "    --dummy: insert dummy results for topics with no "
+      "results\n");
+    fprintf(output, "    --non-stop: don't halt on empty topics\n");
+    fprintf(output, "    --query-stop=[filename]: use filename as stoplist\n");
+    fprintf(output, 
+      "                             (or use default if no file give)\n");
+    fprintf(output, "    --qrels=[filename]: evaluate effectiveness using "
+      "the given TREC qrels\n");
+    fprintf(output, "    -h,--help: this message\n");
+    fprintf(output, "    -v,--version: print version\n");
+
+    fprintf(output, "\n");
+    fprintf(output, "  query metric options:\n");
+    fprintf(output, "    --anh-impact: evaluate using impact-ordered lists\n"
+      "                  (must have specified --anh-impact while indexing)\n");
+    fprintf(output, "    -o,--okapi: use Okapi BM25 metric\n");
+    fprintf(output, "    -1,--k1=[float]: set Okapi BM25 k1 value\n");
+    fprintf(output, "    -3,--k3=[float]: set Okapi BM25 k3 value\n");
+    fprintf(output, "    -b,--b=[float]: set Okapi BM25 b value\n");
+    fprintf(output, "    -p,--pivoted-cosine=[float]: use pivoted cosine "
+      "metric, with given pivot\n");
+    fprintf(output, "    -c,--cosine: use cosine metric\n");
+    fprintf(output, "    --hawkapi=[float]: use Dave Hawking's metric, "
+      "with alpha given\n");
+    fprintf(output, "    --dirichlet=[uint]: use Dirichlet-smoothed LM "
+      "metric, with mu given\n");
+    return;
+}
+
+/* struct to hold arguments */
+struct args {
+    char **topic_file;                 /* topic files containing queries */
+    unsigned int topic_files;          /* number of topic files */
+    struct index *idx;                 /* index to query */
+    char *run_id;                      /* run_id to output */
+    unsigned int numresults;           /* number of results per topic */
+    unsigned int numaccumulators;      /* accumulator limit for eval */
+    int title;                         /* whether to use title */
+    int descr;                         /* whether to use description */
+    int narr;                          /* whether to use narrative */
+    enum index_search_opts sopts;      /* search options */
+    struct index_search_opt sopt;      /* search options structure */
+    int lopts;                         /* index load options */
+    struct index_load_opt lopt;        /* index load options structure */
+    int print_queries;                 /* whether to print out queries */
+    int timing;                        /* whether to time only */
+    struct treceval_qrels *qrels;      /* qrels structure if we want results 
+                                        * evaluated */
+    unsigned int memory;               /* amount of memory to use */
+    int phrase;                        /* whether to run as phrases */
+    unsigned int sloppiness;           /* sloppiness of phrases to run */
+    unsigned int cutoff;               /* phrase must occur within this many 
+                                        * words */
+    int dummy;                         /* whether to print dummy results */
+    int cont;                          /* whether to continue evaluation 
+                                        * through errors */
+    char *stoplist;                    /* stop file */
+};
+
+static void free_args(struct args *args) {
+    unsigned int i;
+
+    if (args->topic_file) {
+        for (i = 0; i < args->topic_files; i++) {
+            if (args->topic_file[i]) {
+                free(args->topic_file[i]);
+                args->topic_file[i] = NULL;
+            }
+        }
+        free(args->topic_file);
+    }
+
+    if (args->stoplist) {
+        free(args->stoplist);
+    }
+
+    if (args->idx) {
+        index_delete(args->idx);
+        args->idx = NULL;
+    }
+
+    if (args->run_id) {
+        free(args->run_id);
+        args->run_id = NULL;
+    }
+
+    if (args->qrels) {
+        treceval_qrels_delete(&args->qrels);
+    }
+
+    free(args);
+    return;
+}
+
+/* internal function to add a topic file to the args */
+static int add_topic_file(struct args *args, const char *file) {
+    void *ptr;
+    struct stat statbuf;
+
+    if ((stat((const char *) file, &statbuf) == 0)
+      && (ptr 
+        = realloc(args->topic_file, sizeof(char*) * (args->topic_files + 1)))
+      && (args->topic_file = ptr) 
+      && (args->topic_file[args->topic_files] = str_dup(file))) {
+
+        args->topic_files++;
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+/* internal function to add a file of topic files to the args */
+static int add_topic_file_file(struct args *args, const char *file) {
+    char filenamebuf[FILENAME_MAX + 1];
+    char format[50];
+    FILE *fp;
+
+    snprintf(format, 50, "%%%ds", FILENAME_MAX);
+
+    if ((fp = fopen((const char *) file, "rb"))) {
+        while (fscanf(fp, format, filenamebuf) && !feof(fp) && !ferror(fp)) {
+            filenamebuf[FILENAME_MAX] = '\0';
+            if (!add_topic_file(args, filenamebuf)) {
+                return 0;
+            }
+        }
+        fclose(fp);
+        return 1;
+    }
+
+    return 0;
+}
+
+/* internal function to load an index from a parameters file */
+static struct index *load_index(const char *prefix, unsigned int memory,
+  int lopts, struct index_load_opt * lopt) {
+    char filename[FILENAME_MAX + 1];
+    struct index *idx;
+
+    if ((idx = index_load((const char *) prefix, memory, lopts, lopt)) 
+      || ((snprintf((char *) filename, FILENAME_MAX, "%s.%s", prefix, 
+          INDSUF))
+        && (idx = index_load((const char *) filename, memory, INDEX_LOAD_NOOPT, 
+            NULL)))) {
+
+        return idx;
+    } else {
+        return NULL;
+    }
+}
+
+enum {
+    OPT_FILE, OPT_FILELIST, OPT_NUMRESULTS, OPT_RUNID, OPT_PRINTQUERIES,
+    OPT_OKAPI, OPT_DIRICHLET, OPT_HAWKAPI,
+    OPT_K1, OPT_K3, OPT_B, OPT_PIVOTED_COSINE,
+    OPT_COSINE, OPT_TITLE, OPT_DESCRIPTION, OPT_NARRATIVE, OPT_HELP,
+    OPT_VERSION, OPT_QRELS, OPT_TIMING, OPT_ACCUMULATOR_LIMIT,
+    OPT_IGNORE_VERSION, OPT_MEMORY, OPT_ANH_IMPACT, OPT_PHRASE, OPT_DUMMY, 
+    OPT_CUTOFF, OPT_PARSEBUF, OPT_TABLESIZE, OPT_BIG_AND_FAST, OPT_NONSTOP,
+    OPT_STOP
+};
+
+static struct args *parse_args(unsigned int argc, char **argv, FILE *output) {
+    struct args *args;
+    int err = 0,
+        quiet = 0,
+        id;
+    long int num;                /* temporary space for numeric conversion */
+    char *tmp;                   /* temporary space */
+    unsigned int ind;
+    const char *arg;
+    struct getlongopt *parser;
+    enum getlongopt_ret ret = GETLONGOPT_OK;
+
+    struct getlongopt_opt opts[] = {
+        {"file", 'f', GETLONGOPT_ARG_REQUIRED, OPT_FILE},
+        {"file-list", 'F', GETLONGOPT_ARG_REQUIRED, OPT_FILELIST},
+        {"number-results", 'n', GETLONGOPT_ARG_REQUIRED, OPT_NUMRESULTS},
+        {"runid", 'r', GETLONGOPT_ARG_REQUIRED, OPT_RUNID},
+        {"print-queries", '\0', GETLONGOPT_ARG_NONE, OPT_PRINTQUERIES},
+        {"timing", '\0', GETLONGOPT_ARG_NONE, OPT_TIMING},
+
+        {"okapi", 'o', GETLONGOPT_ARG_NONE, OPT_OKAPI},
+        {"dirichlet", '\0', GETLONGOPT_ARG_REQUIRED, OPT_DIRICHLET},
+        {"hawkapi", '\0', GETLONGOPT_ARG_REQUIRED, OPT_HAWKAPI},
+        {"k1", '1', GETLONGOPT_ARG_REQUIRED, OPT_K1},
+        {"k3", '3', GETLONGOPT_ARG_REQUIRED, OPT_K3},
+        {"b", 'b', GETLONGOPT_ARG_REQUIRED, OPT_B},
+        {"pivoted-cosine", 'p', GETLONGOPT_ARG_REQUIRED, OPT_PIVOTED_COSINE},
+        {"cosine", 'c', GETLONGOPT_ARG_NONE, OPT_COSINE},
+        {"anh-impact", '\0', GETLONGOPT_ARG_NONE, OPT_ANH_IMPACT},
+
+        {"title", 't', GETLONGOPT_ARG_NONE, OPT_TITLE},
+        {"description", 'd', GETLONGOPT_ARG_NONE, OPT_DESCRIPTION},
+        {"narrative", 'a', GETLONGOPT_ARG_NONE, OPT_NARRATIVE},
+        {"qrels", 'q', GETLONGOPT_ARG_REQUIRED, OPT_QRELS},
+        {"accumulator-limit", 'A', GETLONGOPT_ARG_REQUIRED, 
+            OPT_ACCUMULATOR_LIMIT},
+        {"ignore-version", '\0', GETLONGOPT_ARG_NONE, OPT_IGNORE_VERSION},
+
+        {"help", 'h', GETLONGOPT_ARG_NONE, OPT_HELP},
+        {"version", 'v', GETLONGOPT_ARG_NONE, OPT_VERSION},
+        {"memory", 'm', GETLONGOPT_ARG_REQUIRED, OPT_MEMORY},
+        {"parse-buffer", 'm', GETLONGOPT_ARG_REQUIRED, OPT_PARSEBUF},
+        {"tablesize", 'm', GETLONGOPT_ARG_REQUIRED, OPT_TABLESIZE},
+        {"big-and-fast", 'm', GETLONGOPT_ARG_NONE, OPT_BIG_AND_FAST},
+        {"phrase", '\0', GETLONGOPT_ARG_OPTIONAL, OPT_PHRASE},
+        {"term-cutoff", '\0', GETLONGOPT_ARG_REQUIRED, OPT_CUTOFF},
+        {"dummy", '\0', GETLONGOPT_ARG_NONE, OPT_DUMMY},
+        {"non-stop", '\0', GETLONGOPT_ARG_NONE, OPT_NONSTOP},
+        {"query-stop", '\0', GETLONGOPT_ARG_OPTIONAL, OPT_STOP},
+        {NULL, 'V', GETLONGOPT_ARG_NONE, OPT_VERSION}
+    };
+
+    if ((args = malloc(sizeof(*args))) 
+      && (parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+          sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        if (args) {
+            free(args);
+        }
+        fprintf(output, "failed to initialise option parsing\n");
+        return NULL;
+    }
+
+    args->stoplist = NULL;
+    args->topic_files = 0;
+    args->topic_file = NULL;
+    args->run_id = NULL;
+    args->idx = NULL;
+    args->numresults = 0;
+    args->numaccumulators = 0;
+    args->sopts = INDEX_SEARCH_NOOPT;
+    args->lopts = INDEX_LOAD_NOOPT;
+    args->title = 0;
+    args->descr = 0;
+    args->narr = 0;
+    args->qrels = NULL;
+    args->sopt.u.okapi_k3.k1 = 1.2F;
+    args->sopt.u.okapi_k3.k3 = 1e10;
+    args->sopt.u.okapi_k3.b = 0.75;
+    args->lopt.docmap_cache = DOCMAP_CACHE_TRECNO;
+    args->print_queries = args->timing = 0;
+    args->memory = MEMORY_DEFAULT;
+    args->phrase = 0;
+    args->cutoff = 0;
+    args->dummy = 0;
+    args->cont = 0;
+
+    /* parse arguments */
+    while (!err 
+      && ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK)) {
+        switch (id) {
+        case OPT_RUNID:
+            /* set run_id */
+            if (!args->run_id) {
+                if (!(args->run_id = str_dup(arg))) {
+                    fprintf(output, "couldn't set run_id '%s': %s\n", arg, 
+                      strerror(errno));
+                    err = quiet = 1;
+                }
+            } else if (args->run_id) {
+                fprintf(output, "run_id already set to '%s'\n", args->run_id);
+                err = 1;
+                quiet = 0;
+            }
+            break;
+
+        case OPT_STOP:
+            if (args->stoplist) {
+                err = 1;
+                fprintf(output, "query stoplist specified multiple times\n");
+                quiet = 0;
+            } else if (!arg || (args->stoplist = str_dup(arg))) {
+                args->lopts |= INDEX_LOAD_QSTOP;
+                args->lopt.qstop_file = args->stoplist;
+            } else {
+                err = quiet = 1;
+                fprintf(output, "can't copy query stoplist name\n");
+            } 
+            break;
+
+        case OPT_MEMORY:
+            /* set memory */
+            args->memory = atoi(arg);
+            break;
+
+        case OPT_PARSEBUF:
+            errno = 0;
+            num = strtol(arg, &tmp, 10);
+            if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                args->lopts |= INDEX_LOAD_PARSEBUF;
+                args->lopt.parsebuf = num;
+            } else {
+                fprintf(output, "error converting parsebuf value '%s'\n", 
+                  arg);
+                err = 1;
+            }
+            break;
+
+        case OPT_TABLESIZE:
+            errno = 0;
+            num = strtol(arg, &tmp, 10);
+            if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) {
+                args->lopts |= INDEX_LOAD_TABLESIZE;
+                args->lopt.tablesize = num;
+            } else {
+                fprintf(output, "error converting tablesize value '%s'\n", 
+                  arg);
+                err = 1;
+            }
+            break;
+
+        case OPT_BIG_AND_FAST:
+            /* use big memory options */
+            if (args->memory == MEMORY_DEFAULT) {
+                args->memory = BIG_MEMORY_DEFAULT;
+            }
+            if (!(args->lopts & INDEX_NEW_PARSEBUF)) {
+                args->lopts |= INDEX_LOAD_PARSEBUF;
+                args->lopt.parsebuf = BIG_PARSE_BUFFER;
+            }
+            if (!(args->lopts & INDEX_NEW_TABLESIZE)) {
+                args->lopts |= INDEX_LOAD_TABLESIZE;
+                args->lopt.tablesize = BIG_TABLESIZE;
+            }
+            break;
+
+        case OPT_QRELS:
+            /* they want it evaluated against some qrels */
+            if (!args->qrels) {
+                if ((args->qrels = treceval_qrels_new(arg))) {
+                    /* succeeded, do nothing */
+                } else {
+                    fprintf(output, "failed to load qrels from '%s'\n", arg);
+                    err = 1;
+                }
+            } else {
+                fprintf(output, "qrels specified multiple times\n");
+                err = 1;
+            }
+            break;
+
+        case OPT_IGNORE_VERSION:
+            args->lopts |= INDEX_LOAD_IGNORE_VERSION;
+            break;
+
+        case OPT_ACCUMULATOR_LIMIT:
+            /* set number of accumulators to use. */
+            errno = 0;
+            num = strtol(arg, &tmp, 10);
+            if (!errno && !*tmp) {
+                args->sopt.accumulator_limit = num;
+                args->sopts |= INDEX_SEARCH_ACCUMULATOR_LIMIT;
+            } else {
+                fprintf(output, 
+                  "error converting accumulator limit value '%s'\n", arg);
+                err = 1;
+            }
+            break;
+
+        case OPT_NONSTOP:
+            args->cont = 1;
+            break;
+
+        case OPT_DUMMY:
+            args->dummy = 1;
+            break;
+
+        case OPT_CUTOFF:
+            args->cutoff = atoi(arg);
+            break;
+
+        case OPT_PHRASE:
+            /* they want to run it as a phrase, optionally sloppy */
+            args->phrase = 1;
+            if (arg) {
+                char *end;
+                long int tmpnum = strtol(arg, &end, 0);
+
+                if (!*end && (tmpnum <= UINT_MAX)) {
+                    args->sloppiness = tmpnum;
+                } else {
+                    fprintf(output, "couldn't convert '%s' to number\n", 
+                      arg);
+                }
+            } else {
+                args->sloppiness = 0;
+            }
+            break;
+
+        case OPT_NUMRESULTS:
+            /* set number of results per topic */
+            if (!args->numresults) {
+                char *end;
+                long int tmpnum = strtol(arg, &end, 0);
+
+                if (!*end && (tmpnum <= UINT_MAX)) {
+                    args->numresults = tmpnum;
+                } else {
+                    fprintf(output, "couldn't convert '%s' to number\n", 
+                      arg);
+                }
+            } else {
+                fprintf(output, "number of results is already set to %u\n", 
+                  args->numresults);
+                err = 1;
+            }
+            break;
+
+        case OPT_FILE:
+            /* add topic file */
+            if (!(add_topic_file(args, arg))) {
+                fprintf(output, "couldn't add file '%s': %s\n", arg, 
+                  strerror(errno));
+                err = quiet = 1;
+            }
+            break;
+
+        case OPT_FILELIST:
+            /* add topic file file */
+            if (!(add_topic_file_file(args, arg))) {
+                fprintf(output, "couldn't add list '%s': %s\n", arg, 
+                  strerror(errno));
+                err = quiet = 1;
+            }
+            break;
+
+        case OPT_HELP:
+            /* they want help */
+            err = 1;
+            output = stdout;
+            break;
+
+        case OPT_VERSION:
+            /* they want version info */
+            printf("version %s\n", PACKAGE_VERSION);
+            err = quiet = 1;
+            output = stdout;
+            break;
+
+        case OPT_ANH_IMPACT:
+            args->sopts |= INDEX_SEARCH_ANH_IMPACT_RANK;
+            break;
+
+        case OPT_HAWKAPI:
+            /* they want to use hawkapi */
+            args->sopts |= INDEX_SEARCH_HAWKAPI_RANK;
+            if (!sscanf(arg, "%f", &args->sopt.u.hawkapi.alpha)) {
+                fprintf(stderr, "failed to read alpha parameter\n");
+                err = 1;
+            }
+            break;
+
+        case OPT_DIRICHLET:
+            /* they want to use dirichlet */
+            args->sopts |= INDEX_SEARCH_DIRICHLET_RANK;
+            if (!sscanf(arg, "%f", &args->sopt.u.dirichlet.mu)) {
+                fprintf(stderr, "failed to read mu parameter\n");
+                err = 1;
+            }
+            break;
+
+        case OPT_OKAPI:
+            /* they want to use okapi */
+            args->sopts |= INDEX_SEARCH_OKAPI_RANK;
+            break;
+
+        case OPT_K1:
+            /* set okapi k1 parameter */
+            if (sscanf(arg, "%f", &args->sopt.u.okapi_k3.k1)) {
+                /* do nothing */
+            } else {
+                fprintf(output, "can't read k1 value '%s'\n", arg);
+                err = 1;
+            }
+            break;
+
+        case OPT_K3:
+            /* set okapi k3 parameter */
+            if (sscanf(arg, "%f", &args->sopt.u.okapi_k3.k3)) {
+                /* do nothing */
+            } else {
+                fprintf(output, "can't read k3 value '%s'\n", arg);
+                err = 1;
+            }
+            break;
+
+        case OPT_B:
+            /* set okapi b parameter */
+            if (sscanf(arg, "%f", &args->sopt.u.okapi_k3.b)) {
+                /* do nothing */
+            } else {
+                fprintf(output, "can't read b value '%s'\n", arg);
+                err = 1;
+            }
+            break;
+
+        case OPT_TIMING:
+            /* print queries */
+            args->timing = 1;
+            break;
+
+        case OPT_PRINTQUERIES:
+            /* print queries */
+            args->print_queries = 1;
+            break;
+
+        case OPT_TITLE:
+            /* use title in query */
+            args->title = 1;
+            break;
+
+        case OPT_DESCRIPTION:
+            /* use description in query */
+            args->descr = 1;
+            break;
+
+        case OPT_NARRATIVE:
+            /* use narrative in query */
+            args->narr = 1;
+            break;
+
+        case OPT_PIVOTED_COSINE:
+            /* they want to use pivoted cosine */
+            if (sscanf(arg, "%f", &args->sopt.u.pcosine.pivot)) {
+                args->sopts |= INDEX_SEARCH_PCOSINE_RANK;
+
+                /* arrange for weights to be loaded into memory */
+                args->lopts |= INDEX_LOAD_DOCMAP_CACHE;
+                args->lopt.docmap_cache |= DOCMAP_CACHE_WEIGHT;
+
+                if (args->sopt.u.pcosine.pivot < 0.0) {
+                    fprintf(output, "cosine pivot can't be negative\n");
+                    err = 1;
+                }
+            } else {
+                fprintf(output, "can't read pivot value '%s'\n", arg);
+                err = 1;
+            }
+            break;
+
+        case OPT_COSINE:
+            /* they want to use the cosine metric */
+            args->sopts |= INDEX_SEARCH_COSINE_RANK;
+
+            /* arrange for weights to be loaded into memory */
+            args->lopts |= INDEX_LOAD_DOCMAP_CACHE;
+            args->lopt.docmap_cache |= DOCMAP_CACHE_WEIGHT;
+            break;
+
+        default:
+            /* shouldn't happen */
+            assert(0);
+        }
+    }
+
+    ind = getlongopt_optind(parser) + 1;
+    getlongopt_delete(parser);
+
+    if (err || ret == GETLONGOPT_END) {
+        /* succeeded, do nothing */
+    } else {
+        if (ret == GETLONGOPT_UNKNOWN) {
+            fprintf(stderr, "unknown option '%s'\n", argv[ind]);
+        } else if (ret == GETLONGOPT_MISSING_ARG) {
+            fprintf(stderr, "missing argument to option '%s'\n", argv[ind]);
+        } else {
+            fprintf(stderr, "unexpected error parsing options (around '%s')\n",
+              argv[ind]);
+        }
+        free(args);
+        return NULL;
+    }
+        
+    /* remaining arguments should be index */
+    while (!err && (ind < (unsigned int) argc)) {
+        if (!args->idx) {
+            if (!(args->idx = load_index(argv[ind], args->memory,
+                      args->lopts, &args->lopt))) {
+
+                fprintf(output, "couldn't load index from '%s': %s\n", 
+                  argv[ind], strerror(errno));
+                err = quiet = 1;
+            }
+        } else {
+            fprintf(output, "index already loaded\n");
+            err = 1;
+            quiet = 0;
+        }
+        ind++;
+    }
+
+    /* set run_id if they haven't */
+    if (!err && !args->run_id 
+      && !(args->run_id = str_dup(PACKAGE))) {
+        fprintf(output, "couldn't set default run_id: %s\n", strerror(errno));
+        err = quiet = 1;
+    }
+
+    /* set number of results if they haven't */
+    if (!err && !args->numresults) {
+        args->numresults = 1000;
+    }
+
+    /* set number of accumulators if they haven't */
+    if (!err && !args->numaccumulators) {
+        args->numaccumulators = ACCUMULATOR_LIMIT;
+    }
+
+    /* check that they've given a topic file */
+    if (!err && !args->topic_files) {
+        fprintf(output, "no topic files given\n");
+        err = 1;
+    }
+
+    /* check that they've given an index */
+    if (!err && !args->idx) {
+        fprintf(output, "no index given\n");
+        err = 1;
+    }
+
+    if (!(args->title || args->descr || args->narr)) {
+        /* title only run is default */
+        args->title = 1;
+    }
+
+    if (err) {
+        if (!quiet) {
+            fprintf(output, "\n");
+            print_usage(output, *argv);
+        }
+        free_args(args);
+        return NULL;
+    } else {
+        return args;
+    }
+}
+
+/* small function to append a string to a buffer */
+static char *strappend(char **buf, unsigned int *len, unsigned int *cap, 
+  char *str, unsigned int strlen) {
+
+    while (*cap <= *len + strlen) {
+        void *ptr = realloc(*buf, *cap * 2 + 1);
+
+        if (ptr) {
+            *buf = ptr;
+            *cap = *cap * 2 + 1;
+        } else {
+            return NULL;
+        }
+    }
+
+    memcpy(*buf + *len, str, strlen);
+    *len += strlen;
+    return *buf;
+}
+
+/* small macro to append a string to the buffer, exiting with an error message
+ * on failure */
+#define APPEND(buf, buflen, bufcap, str, strlen)                              \
+    if (!strappend(&buf, &buflen, &bufcap, str, strlen)) {                    \
+        if (buf) {                                                            \
+            free(buf);                                                        \
+        }                                                                     \
+        fprintf(stderr, "error allocating memory for query, length %u + %u\n",\
+          buflen, strlen);                                                    \
+        return NULL;                                                          \
+    } else 
+
+/* internal function to parse the topic file and extract a query and
+ * querynum from it */
+static char *get_next_query(struct mlparse_wrap *parser, char *querynum, 
+  unsigned int querynum_len, int title, int descr, int narr, 
+  unsigned int *words, struct args *args) {
+    int innum = 0,                       /* parsing the topic number */
+        intitle = 0,                     /* whether we're parsing the title */
+        indescr = 0,                     /* whether we're parsing description */
+        innarr = 0,                      /* whether we're parsing narrative */
+        firstword = 0;                   /* whether its the first word of a 
+                                          * field */
+    enum mlparse_ret ret;                /* return value from parser */
+    char *buf = NULL,                    /* query buffer */
+         word[TERMLEN_MAX + 1];          /* last word parsed */
+    unsigned int buflen = 0,             /* length of the query */
+                 bufcapacity = 0,        /* capacity of the query buffer */
+                 wordlen;                /* length of the last word parsed */
+
+    *words = 0;
+
+    do {
+        ret = mlparse_wrap_parse(parser, word, &wordlen, 0);
+    } while (ret != MLPARSE_TAG && ret != MLPARSE_ERR && ret != MLPARSE_EOF);
+
+    /* check that we got a 'top' tag */
+    if (ret == MLPARSE_TAG && str_casecmp(word, "top")) {
+        fprintf(stderr, "expected to parse 'top' tag from topic file\n");
+        return NULL;
+    } else if (ret == MLPARSE_ERR) {
+        fprintf(stderr, "error parsing topic file\n");
+        return NULL;
+    } else if (ret == MLPARSE_EOF) {
+        return NULL;
+    } else {
+        assert(ret == MLPARSE_TAG);
+    }
+
+    *querynum = 0;
+
+    /* set up phrase if requested by user */
+    if (args->phrase) {
+        APPEND(buf, buflen, bufcapacity, "\"", 1);
+    }
+
+    /* parse the rest of the top entry */
+    while ((ret = mlparse_wrap_parse(parser, word, &wordlen, 0)) 
+      != MLPARSE_ERR) {
+        switch (ret) {
+        case MLPARSE_TAG:
+            if (!str_casecmp(word, "num")) {
+                /* query number */
+                innum = 1;
+                intitle = 0;
+                indescr = 0;
+                innarr = 0;
+                firstword = 1;
+            } else if (!str_casecmp(word, "title")) {
+                /* query title */
+                if (title) {
+                    intitle = 1;
+                } else {
+                    intitle = 0;
+                }
+                indescr = 0;
+                innarr = 0;
+                innum = 0;
+                firstword = 1;
+            } else if (!str_casecmp(word, "desc")) {
+                /* query description */
+                if (descr) {
+                    indescr = 1;
+                } else {
+                    indescr = 0;
+                }
+                intitle = 0;
+                innarr = 0;
+                innum = 0;
+                firstword = 1;
+            } else if (!str_casecmp(word, "narr")) {
+                /* query narrative */
+                if (narr) {
+                    innarr = 1;
+                } else {
+                    innarr = 0;
+                }
+                indescr = 0;
+                intitle = 0;
+                innum = 0;
+                firstword = 1;
+            } else if (!str_casecmp(word, "/top")) {
+                /* finished this topic, return the query */
+                if (*querynum) {
+                    if (buf) {
+                        /* optionally terminate phrase */
+                        if (args->phrase) {
+#define TMPBUFLEN 100
+                            char tmpbuf[TMPBUFLEN + 1];
+                            unsigned int n;
+
+                            APPEND(buf, buflen, bufcapacity, "\"", 1);
+                            if (args->sloppiness) {
+
+                                n = snprintf(tmpbuf, TMPBUFLEN, " [sloppy:%u] ",
+                                    args->sloppiness);
+                                assert(n < TMPBUFLEN);
+                                APPEND(buf, buflen, bufcapacity, tmpbuf, n);
+
+                                /* ensure sloppy directive is processed */
+                                (*words)++; 
+                            }
+                            if (args->cutoff) {
+                                n = snprintf(tmpbuf, TMPBUFLEN, " [cutoff:%u] ",
+                                    args->cutoff);
+                                assert(n < TMPBUFLEN);
+                                APPEND(buf, buflen, bufcapacity, tmpbuf, n);
+
+                                /* ensure cutoff directive is processed */
+                                (*words)++; 
+                            }
+#undef TMPBUFLEN
+                        }
+
+                        /* terminate string and return it */
+                        APPEND(buf, buflen, bufcapacity, "\0", 1);
+                        return buf;
+                    } else {
+                        APPEND(buf, buflen, bufcapacity, "\0", 1);
+                        return buf;
+                    }
+                } else {
+                    fprintf(stderr, 
+                      "didn't find topic number in topic file\n");
+                    return NULL;
+                }
+            } else {
+                /* unexpected tag, ignore it */
+                innum = 0;
+                innarr = 0;
+                indescr = 0;
+                intitle = 0;
+            }
+            break;
+
+        case MLPARSE_EOF:
+            if (*querynum || buf) {
+                fprintf(stderr, "unexpected eof while parsing\n");
+            }
+            return NULL;
+
+        /* ignore this stuff */
+        case MLPARSE_PARAM:
+        case MLPARSE_CONT | MLPARSE_PARAM:
+        case MLPARSE_PARAMVAL:
+        case MLPARSE_CONT | MLPARSE_PARAMVAL:
+        case MLPARSE_CDATA:
+        case MLPARSE_END | MLPARSE_CDATA:
+        case MLPARSE_WHITESPACE:
+            break;
+
+        /* XXX: comments shouldn't just be ignored (as control flow, the stuff
+         * inside comments should be ignored) */
+        case MLPARSE_COMMENT | MLPARSE_END:
+        case MLPARSE_COMMENT:
+            break;
+
+        case MLPARSE_WORD:
+        case MLPARSE_END | MLPARSE_WORD:
+            /* include everything in tags indicated by arguments, except
+             * that TREC topic files often start the topic with 'Topic:',
+             * the description with 'Description:' and narrative with
+             * 'Narrative:' :o( */
+            if ((intitle && (!firstword 
+                || str_nncmp(word, wordlen, "Topic:", str_len("Topic:"))))
+              || (indescr && (!firstword 
+                  || str_nncmp(word, wordlen, "Description:", 
+                      str_len("Description:"))))
+              || (innarr && (!firstword 
+                  || str_nncmp(word, wordlen, "Narrative:", 
+                      str_len("Narrative:"))))) {
+
+                /* we have to add the word to the buffer */
+                (*words)++;
+                APPEND(buf, buflen, bufcapacity, word, wordlen);
+                APPEND(buf, buflen, bufcapacity, " ", 1);
+            } else if (innum 
+              && (!firstword 
+                || str_nncmp(word, wordlen, "Number:", str_len("Number:")))) {
+
+                if (wordlen < querynum_len) {
+                    str_ncpy(querynum, word, wordlen);
+                    querynum[wordlen] = '\0';
+                    str_toupper(querynum);
+                } else {
+                    fprintf(stderr, "querynum '%s' too long\n", word);
+                    return NULL;
+                } 
+            }
+            firstword = 0;
+            break;
+
+        case MLPARSE_CONT | MLPARSE_WORD:
+        case MLPARSE_CONT | MLPARSE_TAG:
+            /* ignore (XXX: should also ignore subsequent word as well) */
+            break;
+
+        default:
+            /* not expecting anything else */
+            if (buf) {
+                free(buf);
+            }
+            fprintf(stderr, "error parsing topic file\n");
+            return NULL;
+            break;
+        }
+    }
+
+    /* must have received an error */
+    if (buf) {
+        free(buf);
+    }
+    fprintf(stderr, "error parsing topic file\n");
+    return NULL;
+}
+
+/* internal function to execute queries from a topic file against an
+ * index and output the results in trec_eval format */
+static int process_topic_file(FILE *fp, struct args *args, FILE *output, 
+  struct treceval *teresults) {
+    struct index_stats stats;
+    char *query,
+         *querynum = NULL;
+    struct index_result *results = NULL;
+    unsigned int returned,
+                 i;
+    int est;
+    double total_results;
+    struct mlparse_wrap *parser;
+    struct timeval now, then;
+    struct timeval topic_now, topic_then;
+
+    gettimeofday(&topic_then, NULL);
+
+    if (!index_stats(args->idx, &stats)) {
+        return 0;
+    }
+
+    if ((parser = mlparse_wrap_new_file(stats.maxtermlen, LOOKAHEAD, fp, 
+        BUFSIZ, 0))
+      && (results = malloc(sizeof(*results) * args->numresults))
+      && (querynum = malloc(stats.maxtermlen + 2))) {
+
+        while ((query = get_next_query(parser, 
+            querynum, stats.maxtermlen + 1, args->title, args->descr, 
+            args->narr, &args->sopt.word_limit, args))) {
+
+            /* check that we actually got a query */
+            if (!str_len(query)) {
+                if (!args->cont) {
+                    fprintf(stderr, "failed to extract query for topic %s\n", 
+                      querynum);
+                }
+                if (atoi((const char *) querynum) == 201) {
+                    fprintf(stderr, "looks like it occurred on TREC topics "
+                      "201-250, which is probably because you specified a "
+                      "title-only run and it doesn't contain titles\n");
+                }
+
+                if (args->cont && strlen(querynum)) {
+                    /* continue evaluation */
+                    if (args->dummy) {
+                        /* no results, insert dummy result if requested */
+                        fprintf(output, "%s\tQ0\t%s\t%u\t%f\t%s\n", querynum,
+                          "XXXX-XXX-XXXXXXX", 1, 0.0, args->run_id);
+                    }
+                } else {
+                    /* give up evaluation */
+                    free(query);
+                    free(results);
+                    free(querynum);
+                    mlparse_wrap_delete(parser);
+                    return 0;
+                }
+            }
+            args->sopt.summary_type = INDEX_SUMMARISE_NONE;
+
+            /* FIXME: detect errors */
+
+            gettimeofday(&then, NULL);
+            if (index_search(args->idx, (const char *) query, 0, 
+                args->numresults, results, &returned, 
+                &total_results, &est, (args->sopts | INDEX_SEARCH_WORD_LIMIT | 
+                INDEX_SEARCH_SUMMARY_TYPE), &args->sopt)) {
+                char aux_buf[512];
+
+                gettimeofday(&now, NULL);
+
+                if (args->print_queries) {
+                    fprintf(stderr, 
+                      "query '%s' completed in %lu microseconds\n", query,
+                      (unsigned long int) now.tv_usec - then.tv_usec 
+                        + (now.tv_sec - then.tv_sec) * 1000000);
+                }
+
+                /* print results */
+                for (i = 0; i < returned; i++) {
+                    char *docno = NULL;
+
+                    /* hack: any document that doesn't have a TREC docno will
+                     * inherit the docno of the previous document (until we 
+                     * find one that has a docno) */
+
+                    if (results[i].auxilliary && results[i].auxilliary[0]) {
+                        strncpy(aux_buf, results[i].auxilliary, 
+                          sizeof(aux_buf));
+                        docno = aux_buf;
+                    } else {
+                        int ret = 1;
+                        unsigned long int docnum = results[i].docno;
+                        unsigned int aux_len = 0;
+
+                        /* retrieve TREC docno for progressively higher docs */
+                        while (ret && (docnum > 0) && !aux_len) {
+                            docnum--;
+                            ret = index_retrieve_doc_aux(args->idx, docnum,
+                              aux_buf, sizeof(aux_buf) - 1, &aux_len);
+                            /* XXX assume trec docno always < 512 bytes long */
+                        }
+                        if (ret && aux_len) {
+                            docno = aux_buf;
+                        }
+                    }
+                    aux_buf[sizeof(aux_buf) - 1] = '\0';
+
+                    if (teresults 
+                      && docno
+                      && treceval_add_result(teresults, atoi(querynum), 
+                          docno, (float) results[i].score)) {
+                        /* they want evaluated results, stuck it in the results
+                         * structure */
+                    } else if (!teresults && docno) {
+                        str_toupper(docno);
+
+                        /* print out query_id, iter (ignored - so we print
+                         * out number of seconds taken), docno, rank
+                         * (ignored), score, run_id */
+                        fprintf(output, "%s\tQ0\t%s\t%u\t%f\t%s\n", querynum, 
+                          docno, i + 1, results[i].score, 
+                          args->run_id);
+                    } else if (teresults && docno) {
+                        fprintf(stderr, "failed to add to treceval results\n");
+                        free(results);
+                        free(querynum);
+                        free(docno);
+                        free(query);
+                        mlparse_wrap_delete(parser);
+                        return 0;
+                    } else {
+                        /* couldn't copy the docno */
+                        fprintf(stderr, "docno ('%s') copy failed: %s\n", 
+                          results[i].auxilliary, strerror(errno));
+                        free(query);
+                        free(results);
+                        free(querynum);
+                        mlparse_wrap_delete(parser);
+                        return 0;
+                    }
+                }
+
+                if (returned == 0 && args->dummy) {
+                    /* no results, insert dummy result if requested */
+                    fprintf(output, "%s\tQ0\t%s\t%u\t%f\t%s\n", querynum,    
+                      "XXXX-XXX-XXXXXXX", 1, 0.0, args->run_id);
+                }
+            } else {
+                /* error searching */
+                fprintf(stderr, "error searching index\n");
+                free(query);
+                mlparse_wrap_delete(parser);
+                return 0;
+            }
+
+            free(query);
+            querynum[0] = '\0';
+        }
+
+        if (!feof(fp)) {
+            fprintf(stderr, "parser or read error\n");
+            free(results);
+            free(querynum);
+            mlparse_wrap_delete(parser);
+            return 0;
+        }
+        free(results);
+        free(querynum);
+
+        gettimeofday(&topic_now, NULL);
+
+        if (args->timing) {
+            fprintf(stderr, "topic processed in %lu microseconds\n", 
+              (unsigned long int) topic_now.tv_usec - topic_then.tv_usec 
+                + (topic_now.tv_sec - topic_then.tv_sec) * 1000000);
+        }
+
+        mlparse_wrap_delete(parser);
+        return 1;
+    } else {
+        if (parser) {
+            if (results) {
+                free(results);
+            }
+            mlparse_wrap_delete(parser);
+        }
+    }
+
+    return 0;
+}
+
+int main(int argc, char **argv) {
+    struct args *args;
+    unsigned int i;
+    FILE *fp,
+         *output;
+    struct treceval *results = NULL;
+
+    if (isatty(STDOUT_FILENO)) {
+        output = stdout;
+    } else {
+        output = stderr;
+    }
+
+    args = parse_args(argc, argv, output);
+
+    if (args == NULL) {
+        return EXIT_FAILURE;
+    } 
+
+    if (args->qrels) {
+        if (!(results = treceval_new())) {
+            fprintf(stderr, "failed to initialise results structure\n");
+        }
+    }
+
+    if (args) {
+        for (i = 0; i < args->topic_files; i++) {
+            if ((fp = fopen((const char *) args->topic_file[i], "rb"))) {
+                if (!process_topic_file(fp, args, stdout, results)) {
+                    if (results) {
+                        treceval_delete(&results);
+                    }
+                    fprintf(output, "failed to process topic file '%s'\n", 
+                      args->topic_file[i]);
+                    fclose(fp);
+                    free_args(args);
+                    return EXIT_FAILURE;
+                }
+                fclose(fp);
+            } else {
+                if (results) {
+                    treceval_delete(&results);
+                }
+                fprintf(output, "couldn't open topic file '%s': %s\n", 
+                  args->topic_file[i], strerror(errno));
+                free_args(args);
+                return EXIT_FAILURE;
+            }
+        }
+
+        if (results) {
+            struct treceval_results eval;
+
+            treceval_evaluate(results, args->qrels, &eval);
+
+            treceval_print_results(&eval, 1, stdout, 0);
+
+            treceval_delete(&results);
+        }
+
+        free_args(args);
+    }
+
+    return EXIT_SUCCESS;
+}
+
diff --git a/src/vec.c b/src/vec.c
new file mode 100644 (file)
index 0000000..ba85b90
--- /dev/null
+++ b/src/vec.c
@@ -0,0 +1,511 @@
+/* vec.c implements the byte vector described in vec.h 
+ *
+ * based on code by Hugh Williams
+ *
+ * written nml 2003-02-28
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "vec.h"  
+
+#include "bit.h"  
+
+#include <assert.h>
+#include <limits.h>
+#include <math.h>
+#include <string.h>
+
+/* internal array of the maximum number that will fit in each vbyte byte */
+static const unsigned int vbyte_range[] = {
+    /* this detects the size of integers on this architecture (a bit ugly, 
+     * yes).  Having this array lets us encode/decode vbytes faster */
+#if (UINT_MAX <= 4294967295)
+    127U,
+    16383U,
+    2097151U,
+    268435455U,
+    4294967295U
+#elif (UINT_MAX == 18446744073709551615)
+    127U,
+    16383U,
+    2097151U,
+    268435455U,
+    34359738367U,
+    4398046511103U,
+    562949953421311U,
+    72057594037927935U,
+    9223372036854775807U,
+    18446744073709551615U
+#else
+#error "unknown integer size"
+#endif
+};
+
+unsigned int vec_vbyte_write(struct vec* v, unsigned long int n) {
+    if (n <= vbyte_range[0]) {
+        if (v->pos < v->end) {
+            *v->pos++ = (char) n;
+            return 1;
+        } else {
+            return 0;
+        }
+    } else if (n <= vbyte_range[1]) {
+        if (v->pos + 1 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 2;
+        } else {
+            return 0;
+        }
+    } else if (n <= vbyte_range[2]) {
+        if (v->pos + 2 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 3;
+        } else {
+            return 0;
+        }
+    } else if (n <= vbyte_range[3]) {
+        if (v->pos + 3 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 4;
+        } else {
+            return 0;
+        }
+    } else if (n <= vbyte_range[4]) {
+        if (v->pos + 4 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 5;
+        } else {
+            return 0;
+        }
+#if (UINT_MAX > 4294967295)
+    } else if (n <= vbyte_range[5]) {
+        if (v->pos + 5 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 6;
+        } else {
+            return 0;
+        }
+    } else if (n <= vbyte_range[6]) {
+        if (v->pos + 6 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 7;
+        } else {
+            return 0;
+        }
+    } else if (n <= vbyte_range[7]) {
+        if (v->pos + 7 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 8;
+        } else {
+            return 0;
+        }
+    } else if (n <= vbyte_range[8]) {
+        if (v->pos + 8 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 9;
+        } else {
+            return 0;
+        }
+    } else if (n <= vbyte_range[9]) {
+        if (v->pos + 9 < v->end) {
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = 0x80 | (char) (n & 0x7f); n >>= 7;
+            *v->pos++ = (char) n;
+            return 10;
+        } else {
+            return 0;
+        }
+#endif
+    } else {
+        assert("can't get here" && 0);
+        return 0;
+    }
+}
+
+unsigned int vec_vbyte_read(struct vec* v, unsigned long int* n) {
+    unsigned long int localn = 0;
+    unsigned int bytes = 0,
+                 count = 0, 
+                 get;
+
+    while (v->pos < v->end) {
+        bytes++;
+        if (((get = ((unsigned char) *v->pos++)) & 0x80) == 0x80) {
+            /* For each time we get a group of 7 bits, need to left-shift the 
+               latest group by an additional 7 places, since the groups were 
+               effectively stored in reverse order.*/
+            localn |= ((get & 0x7f) << count);
+            count += 7;
+        } else if ((count + 7 < sizeof(*n) * 8)
+          || ((count < sizeof(*n) * 8) 
+            && (get < (1U << ((sizeof(*n) * 8 - count) + 1))))) {
+
+            /* Now get the final 7 bits, which need to be left-shifted by a 
+               factor of 7. */
+            *n = localn | (get << count);
+            return bytes;
+        } else {
+            /* we've overflowed, return error */
+            v->pos -= bytes;
+            return 0;
+        }
+    }
+
+    /* we've run out of space, return error */
+    v->pos -= bytes;
+    return 0;
+}
+
+unsigned int vec_vbyte_scan(struct vec* v, unsigned int num, 
+  unsigned int *byteptr) {
+    unsigned int nread = 0,        /* number of vbytes scanned */
+                 bytes = 0,        /* number of bytes in current vbyte */
+                 sumbytes = 0;     /* number of total bytes scanned */
+
+    while (num--) {
+        assert(bytes == 0);
+
+        while (v->pos < v->end) {
+            bytes++;
+            if (!(*v->pos++ & 0x80)) {
+                nread++;
+                sumbytes += bytes;
+                bytes = 0;
+                break;
+            }
+        }
+
+        /* note that this case doesn't just catch situations where there wasn't
+         * enough bytes to scan a number, but it doesn't matter because 
+         * it works out the same (bytes will be 0) */
+        if (v->pos >= v->end) {
+            v->pos -= bytes;
+            *byteptr = sumbytes;
+            return nread;
+        }
+    }
+
+    *byteptr = sumbytes;
+    return nread;
+}
+
+unsigned int vec_vbyte_len(unsigned long int n) {
+    if (n <= vbyte_range[0]) {
+        return 1;
+    } else if (n <= vbyte_range[1]) {
+        return 2;
+    } else if (n <= vbyte_range[2]) {
+        return 3;
+    } else if (n <= vbyte_range[3]) {
+        return 4;
+    } else if (n <= vbyte_range[4]) {
+        return 5;
+#if (UINT_MAX > 4294967295)
+    } else if (n <= vbyte_range[5]) {
+        return 6;
+    } else if (n <= vbyte_range[6]) {
+        return 7;
+    } else if (n <= vbyte_range[7]) {
+        return 8;
+    } else if (n <= vbyte_range[8]) {
+        return 9;
+    } else if (n <= vbyte_range[9]) {
+        return 10;
+#endif
+    } else {
+        assert("can't get here" && 0);
+        return 0;
+    }
+}
+
+unsigned int vec_byte_read(struct vec *v, char *dst, unsigned int n) {
+    if (((unsigned int) VEC_LEN(v)) < n) {
+        n = VEC_LEN(v);
+    }
+
+    memcpy(dst, v->pos, n);
+    v->pos += n;
+    return n;
+}
+
+unsigned int vec_byte_write(struct vec *v, char *src, unsigned int n) {
+    if (((unsigned int) VEC_LEN(v)) < n) {
+        n = VEC_LEN(v);
+    }
+
+    memcpy(v->pos, src, n);
+    v->pos += n;
+    return n;
+}
+
+unsigned int vec_byte_scan(struct vec *v, unsigned int n) {
+    if (((unsigned int) VEC_LEN(v)) < n) {
+        n = VEC_LEN(v);
+    }
+
+    v->pos += n;
+    return n;
+}
+
+unsigned int vec_flt_write(struct vec *v, float flt, unsigned int precision) {
+    int exp;
+    unsigned int biased_exp,
+                 quant_frac;
+    float frac = (float) frexpf(flt, &exp);
+    char *pos = v->pos;
+  
+    assert(precision);
+
+    /* convert signed exp into an unsigned integer (requires 8 bits) */
+    if (exp >= 0) {
+        biased_exp = exp << 1;
+    } else {
+        biased_exp = (-exp << 1) | 1;
+    }
+    assert(biased_exp < 256);
+
+    /* convert signed fraction into an unsigned integer (requires 
+     * precision + 1 bits) */
+    if (flt >= 0) {
+        quant_frac = ((unsigned int) (frac * bit_lmask(precision))) << 1;
+    } else {
+        quant_frac 
+          = ((unsigned int) ((-frac * bit_lmask(precision))) << 1) | 1;
+    }
+    assert(quant_frac <= ((bit_lmask(precision) << 1) | 1));
+
+    if (v->pos < v->end) {
+        *v->pos++ = biased_exp;
+    }
+
+    while (v->pos < v->end && precision + 1 > 8) {
+        *v->pos++ = quant_frac & 0xff;
+        quant_frac >>= 8;
+        precision -= 8;
+    }
+
+    if (v->pos < v->end) {
+        /* note that we *have* to write out another byte because we have the
+         * sign bit remaining */
+        assert(quant_frac <= 0xff);
+        *v->pos++ = quant_frac;
+        return v->pos - pos;
+    } else {
+        v->pos = pos;
+        return 0;
+    }
+}
+
+unsigned int vec_flt_read(struct vec *v, float *flt, unsigned int precision) {
+    int exp;
+    unsigned char biased_exp;
+    unsigned int quant_frac = 0,
+                 bits = 0;
+    float frac;
+    char *pos = v->pos;
+
+    assert(precision);
+
+    if (v->pos < v->end) {
+        biased_exp = (unsigned char) *v->pos++;
+        while (v->pos < v->end && bits + 8 < precision + 1) {
+            quant_frac |= ((unsigned char) *v->pos++) << bits;
+            bits += 8;
+        }
+
+        if (v->pos < v->end) {
+            quant_frac |= ((unsigned char) *v->pos++) << bits;
+
+            if (!(biased_exp & 1)) {
+                exp = biased_exp >> 1;
+            } else {
+                exp = -(biased_exp >> 1);
+            }
+
+            if (!(quant_frac & 1)) {
+                frac = ((float) (quant_frac >> 1)) / bit_lmask(precision);
+            } else {
+                frac = -((float) (quant_frac >> 1)) / bit_lmask(precision);
+            }
+
+            *flt = (float) ldexpf(frac, exp);
+            return v->pos - pos;
+        }
+    }
+
+    v->pos = pos;
+    return 0;
+}
+
+unsigned int vec_len(struct vec *v) {
+    return VEC_LEN(v);
+}
+
+/* macro to generate code for array reading/writing functions for different
+ * unsigned integer types */
+#define VEC_INTARR(name, type)                                                \
+    unsigned int vec_##name##_arr_read(struct vec *v, type *arr,              \
+      unsigned int arrlen, unsigned int *bytes_ptr) {                         \
+        unsigned char get = 0;                                                \
+        unsigned int count = 0,                                               \
+                     bytes = 0,                                               \
+                     nbytes,                                                  \
+                     bitcount;                                                \
+        char *pos;                                                            \
+        type n,                                                               \
+             tmp,                                                             \
+             *end = arr + arrlen;                                             \
+                                                                              \
+        while (v->pos < v->end && arr < end) {                                \
+            n = 0;                                                            \
+            bitcount = 0;                                                     \
+            nbytes = 0;                                                       \
+            pos = v->pos;                                                     \
+                                                                              \
+            while (v->pos < v->end && ((get = *v->pos) & 0x80)) {             \
+                tmp = get & 0x7f;                                             \
+                tmp <<= bitcount;                                             \
+                n |= tmp;                                                     \
+                bitcount += 7;                                                \
+                bytes++;                                                      \
+                v->pos++;                                                     \
+            }                                                                 \
+                                                                              \
+            if (v->pos < v->end) {                                            \
+                tmp = get;                                                    \
+                tmp <<= bitcount;                                             \
+                n |= tmp;                                                     \
+                bytes++;                                                      \
+                count++;                                                      \
+                *arr++ = n;                                                   \
+                v->pos++;                                                     \
+            } else {                                                          \
+                v->pos = pos;                                                 \
+                *bytes_ptr = bytes;                                           \
+                return count;                                                 \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        *bytes_ptr = bytes;                                                   \
+        return count;                                                         \
+    }                                                                         \
+                                                                              \
+    unsigned int vec_##name##_arr_write(struct vec *v, type *arr,             \
+      unsigned int arrlen, unsigned int *bytes_ptr) {                         \
+        unsigned int bytes = 0,                                               \
+                     count = 0,                                               \
+                     nbytes;                                                  \
+        char *pos;                                                            \
+        type n,                                                               \
+             *end = arr + arrlen;                                             \
+                                                                              \
+        while (v->pos < v->end && arr < end) {                                \
+            n = *arr;                                                         \
+            nbytes = 0;                                                       \
+            pos = v->pos;                                                     \
+                                                                              \
+            while (v->pos < v->end && n > 127) {                              \
+                nbytes++;                                                     \
+                *v->pos++ = 0x80 | (char) (n & 0x7f);                                \
+                n >>= 7;                                                      \
+            }                                                                 \
+                                                                              \
+            if (v->pos < v->end) {                                            \
+                bytes += nbytes + 1;                                          \
+                count++;                                                      \
+                *v->pos++ = (char) n;                                                \
+                arr++;                                                        \
+            } else {                                                          \
+                v->pos = pos;                                                 \
+                *bytes_ptr = bytes;                                           \
+                return count;                                                 \
+            }                                                                 \
+        }                                                                     \
+                                                                              \
+        *bytes_ptr = bytes;                                                   \
+        return count;                                                         \
+    }
+
+VEC_INTARR(vbyte, unsigned long int)
+VEC_INTARR(int, unsigned int)
+VEC_INTARR(maxint, uintmax_t)
+
+unsigned int vec_flt_arr_read(struct vec *v, float *arr, unsigned int arrlen,
+  unsigned int precision, unsigned int *bytes_ptr) {
+    unsigned int bytes = 0,
+                 len,
+                 count = 0;
+    float *end = arr + arrlen;
+
+    while (arr < end && (len = vec_flt_read(v, arr, precision))) {
+        arr++;
+        bytes += len;
+        count++;
+    }
+
+    *bytes_ptr = bytes;
+    return count;
+}
+
+unsigned int vec_flt_arr_write(struct vec *v, float *arr, unsigned int arrlen,
+  unsigned int precision, unsigned int *bytes_ptr) {
+    unsigned int bytes = 0,
+                 len,
+                 count = 0;
+    float *end = arr + arrlen;
+
+    while (arr < end && (len = vec_flt_write(v, *arr, precision))) {
+        arr++;
+        bytes += len;
+        count++;
+    }
+
+    *bytes_ptr = bytes;
+    return count;
+}
+
diff --git a/src/vocab.c b/src/vocab.c
new file mode 100644 (file)
index 0000000..5eef8d8
--- /dev/null
@@ -0,0 +1,317 @@
+/* vocab.c implements compression and decompression routines for
+ * vocabulary entries
+ *
+ * written nml 2003-02-10
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "vocab.h"
+
+#include "bit.h"
+#include "vec.h"
+#include "error.h"
+#include "zvalgrind.h"
+
+#include <assert.h>
+#include <string.h>
+#include <limits.h>
+
+unsigned int vocab_len(struct vocab_vector *vocab) {
+    unsigned int len = 1;   /* 1 for combination of attr, type and location */
+
+    if (vocab->attr & VOCAB_ATTRIBUTES_PERLIST) {
+        len += vec_vbyte_len(vocab->attribute);
+    }
+
+    len += vec_vbyte_len(vocab->header.doc.docs) 
+      + vec_vbyte_len(vocab->header.doc.occurs)
+      + vec_vbyte_len(vocab->header.doc.last)
+      + vec_vbyte_len(vocab->size);
+
+    switch (vocab->type) {
+    case VOCAB_VTYPE_DOC:
+    case VOCAB_VTYPE_DOCWP:
+        break;
+
+    case VOCAB_VTYPE_IMPACT:
+        break;
+
+    default: return 0;
+    }
+
+    switch (vocab->location) {
+    case VOCAB_LOCATION_VOCAB:
+        len += vocab->size;
+        break;
+       
+    case VOCAB_LOCATION_FILE:
+        len += vec_vbyte_len(vocab->loc.file.fileno) 
+          + vec_vbyte_len(vocab->loc.file.offset) 
+          + vec_vbyte_len(vocab->loc.file.capacity);
+        break;
+
+    default: return 0;
+    }
+
+    return len;
+}
+
+enum vocab_ret vocab_decode(struct vocab_vector *vocab, struct vec *v) {
+    unsigned long int tmp;
+    unsigned int bytes = 0,
+                 ret;
+    unsigned char byte;
+
+    VALGRIND_CHECK_WRITABLE(vocab, sizeof(*vocab));
+
+    /* if debugging, clear the vocab vector first */
+    assert((memset(vocab, 0, sizeof(*vocab)), 1));
+
+    /* check that memory can be accessed, then mark vocab entry as 
+     * uninitialised */
+    VALGRIND_MAKE_WRITABLE(vocab, sizeof(*vocab));
+    VALGRIND_CHECK_READABLE(v->pos, VEC_LEN(v));
+
+    /* first, get first byte which contains attribute, location and type
+     * indications */
+    if (v->pos < v->end) {
+        vec_byte_read(v, (char *) &byte, 1);
+        bytes++;
+        vocab->attr = byte & BIT_LMASK(2);
+        byte >>= 2;
+        vocab->location = byte & BIT_LMASK(2);
+        byte >>= 2;
+        vocab->type = byte;
+
+        if (vocab->attr & VOCAB_ATTRIBUTES_PERLIST) {
+            if ((ret = vec_vbyte_read(v, &tmp))) {
+                vocab->attribute = (unsigned int) tmp;
+                bytes += ret;
+            } else {
+                if (((unsigned int) VEC_LEN(v)) <= vec_vbyte_len(UINT_MAX)) {
+                    v->pos -= bytes;
+                    return VOCAB_ENOSPC;
+                } else {
+                    v->pos -= bytes;
+                    return VOCAB_EOVERFLOW;
+                }
+            }
+        }
+
+        /* get common header entries */
+        if ((ret = vec_vbyte_read(v, &vocab->size))
+          && (bytes += ret)
+          && (ret = vec_vbyte_read(v, &vocab->header.doc.docs))
+          && (bytes += ret)
+          && (ret = vec_vbyte_read(v, &vocab->header.doc.occurs))
+          && (bytes += ret)
+          && (ret = vec_vbyte_read(v, &vocab->header.doc.last))
+          && (bytes += ret)) {
+            /* succeeded, do nothing */
+        } else {
+            if (((unsigned int) VEC_LEN(v)) <= vec_vbyte_len(UINT_MAX)) {
+                v->pos -= bytes;
+                return VOCAB_ENOSPC;
+            } else {
+                v->pos -= bytes;
+                return VOCAB_EOVERFLOW;
+            }
+        }
+
+        /* get specific header entries */
+        switch (vocab->type) {
+        case VOCAB_VTYPE_DOC:
+        case VOCAB_VTYPE_DOCWP:
+            /* ok, so i cheated a little and just read the common, uh, not
+             * common ones above (they're not common because future vector 
+             * types might not have them)... */
+            break;
+
+        case VOCAB_VTYPE_IMPACT:
+            break;
+
+        default: 
+            v->pos -= bytes; 
+            return VOCAB_EINVAL;
+        }
+
+        /* get location */
+        switch (vocab->location) {
+        case VOCAB_LOCATION_VOCAB:
+            if (((unsigned int) VEC_LEN(v)) >= vocab->size) {
+                /* note that we increment vector over in-vocab vector so that
+                 * successive _decode calls will work as planned */
+                vocab->loc.vocab.vec = v->pos;
+                v->pos += vocab->size;
+                bytes += vocab->size;
+            } else {
+                v->pos -= bytes; 
+                return VOCAB_ENOSPC;
+            }
+            break;
+       
+        case VOCAB_LOCATION_FILE:
+            if ((ret = vec_vbyte_read(v, &tmp))
+              && ((vocab->loc.file.fileno = tmp), (bytes += ret))
+              && (ret = vec_vbyte_read(v, &vocab->loc.file.offset))
+              && (bytes += ret)
+              && (ret = vec_vbyte_read(v, &tmp))
+              && ((vocab->loc.file.capacity = tmp), (bytes += ret))) {
+                /* succeeded, do nothing */
+            } else {
+                if (((unsigned int) VEC_LEN(v)) <= vec_vbyte_len(UINT_MAX)) {
+                    v->pos -= bytes;
+                    return VOCAB_ENOSPC;
+                } else {
+                    v->pos -= bytes;
+                    return VOCAB_EOVERFLOW;
+                }
+            }
+            break;
+
+        default: 
+            v->pos -= bytes;
+            return VOCAB_EINVAL;
+        }
+
+        return VOCAB_OK;
+    } else {
+        return VOCAB_END;
+    }
+}
+
+enum vocab_ret vocab_encode(struct vocab_vector *vocab, struct vec *v) {
+    unsigned int bytes = 0,
+                 ret;
+    unsigned char byte;
+
+    /* first, write byte which contains attribute, location and type
+     * indications */
+    if (v->pos < v->end) {
+        bytes++;
+        byte = vocab->type << 4 | vocab->location << 2 | vocab->attr;
+        vec_byte_write(v, (char *) &byte, 1);
+
+        if (vocab->attr & VOCAB_ATTRIBUTES_PERLIST) {
+            if ((ret = vec_vbyte_write(v, vocab->attribute))) {
+                bytes += ret;
+            } else {
+                v->pos -= bytes;
+                return VOCAB_ENOSPC;
+            }
+        }
+
+        /* get common header entries */
+        if ((ret = vec_vbyte_write(v, vocab->size))
+          && (bytes += ret)
+          && (ret = vec_vbyte_write(v, vocab->header.doc.docs))
+          && (bytes += ret)
+          && (ret = vec_vbyte_write(v, vocab->header.doc.occurs))
+          && (bytes += ret)
+          && (ret = vec_vbyte_write(v, vocab->header.doc.last))
+          && (bytes += ret)) {
+            /* succeeded, do nothing */
+        } else {
+            v->pos -= bytes;
+            return VOCAB_ENOSPC;
+        }
+
+        /* get specific header entries */
+        switch (vocab->type) {
+        case VOCAB_VTYPE_DOC:
+        case VOCAB_VTYPE_DOCWP:
+            /* ok, so i cheated a little and just read the common, uh, not
+             * common ones above (they're not common because future vector 
+             * types might not have them)... */
+            break;
+
+        case VOCAB_VTYPE_IMPACT:
+            break;
+
+        default: 
+            v->pos -= bytes; 
+            return VOCAB_EINVAL;
+        }
+
+        /* get location */
+        switch (vocab->location) {
+        case VOCAB_LOCATION_VOCAB:
+            if (((unsigned int) VEC_LEN(v)) >= vocab->size) {
+                /* note that we increment vector over in-vocab vector so that
+                 * successive _encode calls will work as planned */
+                v->pos += vocab->size;
+                bytes += vocab->size;
+            } else {
+                v->pos -= bytes; 
+                return VOCAB_ENOSPC;
+            }
+            break;
+       
+        case VOCAB_LOCATION_FILE:
+            if ((ret = vec_vbyte_write(v, vocab->loc.file.fileno))
+              && (bytes += ret)
+              && (ret = vec_vbyte_write(v, vocab->loc.file.offset))
+              && (bytes += ret)
+              && (ret = vec_vbyte_write(v, vocab->loc.file.capacity))
+              && (bytes += ret)) {
+                /* succeeded, do nothing */
+            } else {
+                v->pos -= bytes;
+                return VOCAB_ENOSPC;
+            }
+            break;
+
+        default: 
+            v->pos -= bytes;
+            return VOCAB_EINVAL;
+        }
+
+        return VOCAB_OK;
+    } else {
+        return VOCAB_ENOSPC;
+    }
+}
+
+unsigned long int vocab_docs(struct vocab_vector *vocab) {
+    switch (vocab->type) {
+    case VOCAB_VTYPE_DOC:
+        return vocab->header.doc.docs;
+    case VOCAB_VTYPE_DOCWP:
+        return vocab->header.docwp.docs;
+    case VOCAB_VTYPE_IMPACT:
+        return vocab->header.impact.docs;
+    default:
+        assert("shouldn't happen");
+        return 0;
+    }
+}
+
+unsigned long int vocab_occurs(struct vocab_vector *vocab) {
+    switch (vocab->type) {
+    case VOCAB_VTYPE_DOC:
+        return vocab->header.doc.occurs;
+    case VOCAB_VTYPE_DOCWP:
+        return vocab->header.docwp.occurs;
+    case VOCAB_VTYPE_IMPACT:
+        return vocab->header.impact.occurs;
+    default:
+        assert("shouldn't happen");
+        return 0;
+    }
+}
+
+unsigned long int vocab_last(struct vocab_vector *vocab) {
+    switch (vocab->type) {
+    case VOCAB_VTYPE_DOC:
+        return vocab->header.doc.last;
+    case VOCAB_VTYPE_DOCWP:
+        return vocab->header.docwp.last;
+    case VOCAB_VTYPE_IMPACT:
+        return vocab->header.impact.last;
+    default:
+        assert("shouldn't happen");
+        return 0;
+    }
+}
diff --git a/tools/btree.c b/tools/btree.c
new file mode 100644 (file)
index 0000000..1e289d1
--- /dev/null
@@ -0,0 +1,400 @@
+/* btree.c implements a small program to build, search and print a
+ * btree.
+ *
+ * written nml 2004-09-22
+ *
+ */
+
+#include "iobtree.h"
+#include "freemap.h"
+#include "fdset.h"
+#include "getlongopt.h"
+#include "str.h"
+#include "getmaxfsize.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <unistd.h>
+
+/* maximum length of terms read from file */
+#define BUFSIZE 1024
+
+enum mode {
+    MODE_ERR, MODE_BUILD, MODE_SEARCH, MODE_PRINT
+};
+
+struct args {
+    char *prefix;               /* btree file name prefix */
+    enum mode mode;             /* what we want to do */
+    FILE *input;                /* input stream of words */
+    unsigned int limit;         /* limit on number of words to read */
+    unsigned int pagesize;      /* size of btree pages */
+    int leaf_strategy;          /* leaf node bucket strategy */
+    int node_strategy;          /* internal node bucket strategy */
+    unsigned int entrysize;     /* size of data with each entry */
+};
+
+static void free_args(struct args *args) {
+    if (args->prefix) {
+        free(args->prefix);
+        args->prefix = NULL;
+    }
+    if (args->input) {
+        fclose(args->input);
+        args->input = NULL;
+    }
+    return;
+}
+
+static struct args *parse_args(unsigned int argc, char **argv, 
+  struct args *args, FILE *output) {
+    struct getlongopt *parser;   /* option parser */
+    int id;                      /* id of parsed option */
+    const char *arg;             /* argument of parsed option */
+    unsigned int ind;            /* current index in argv array */
+    enum getlongopt_ret ret;     /* return value from option parser */
+
+    struct getlongopt_opt opts[] = {
+        {"build", 'b', GETLONGOPT_ARG_NONE, 'b'},
+        {"search", 's', GETLONGOPT_ARG_NONE, 's'},
+        {"print", 'p', GETLONGOPT_ARG_NONE, 'p'},
+        {"input", 'i', GETLONGOPT_ARG_REQUIRED, 'i'},
+        {"prefix", 'f', GETLONGOPT_ARG_REQUIRED, 'f'},
+        {"limit", 'l', GETLONGOPT_ARG_REQUIRED, 'l'},
+        {"pagesize", '\0', GETLONGOPT_ARG_REQUIRED, 'P'},
+        {"leaf-strategy", '\0', GETLONGOPT_ARG_REQUIRED, 'L'},
+        {"node-strategy", '\0', GETLONGOPT_ARG_REQUIRED, 'N'},
+        {"entry-size", '\0', GETLONGOPT_ARG_REQUIRED, 'Z'},
+    };
+
+    args->mode = MODE_ERR;
+    args->input = stdin;
+    args->prefix = NULL;
+    args->limit = 0;
+    args->pagesize = 8096;
+    args->leaf_strategy = args->node_strategy = 1;
+    args->entrysize = 0;
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+        /* succeeded, do nothing */
+    } else {
+        fprintf(output, "failed to initialise options parser\n");
+        return NULL;
+    }
+
+    while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch (id) {
+        case 'Z':
+            args->entrysize = strtol(arg, NULL, 0);
+            break;
+
+        case 'P':
+            args->pagesize = strtol(arg, NULL, 0);
+            break;
+
+        case 'L':
+            args->leaf_strategy = strtol(arg, NULL, 0);
+            break;
+
+        case 'N':
+            args->node_strategy = strtol(arg, NULL, 0);
+            break;
+
+        case 'b':
+            /* build btree */
+            args->mode = MODE_BUILD;
+            break;
+
+        case 's':
+            /* search btree */
+            args->mode = MODE_SEARCH;
+            break;
+
+        case 'p':
+            /* print btree */
+            args->mode = MODE_PRINT;
+            break;
+
+        case 'f':
+            /* change prefix */
+            if ((args->prefix = str_dup(arg))) {
+                /* succeeded, do nothing */
+            } else {
+                fprintf(output, "failed to dup '%s': %s\n", arg, 
+                  strerror(errno));
+                return NULL;
+            }
+            break;
+
+        case 'i':
+            /* get input from file */
+            if ((args->input = fopen(arg, "rb"))) {
+                /* succeeded, do nothing */
+            } else {
+                fprintf(output, "failed to open '%s': %s\n", arg, 
+                  strerror(errno));
+                return NULL;
+            }
+            break;
+
+        case 'l':
+            args->limit = strtol(arg, NULL, 0);
+            break;
+        }
+    }
+
+    /* finish up with the option parser */
+    ind = getlongopt_optind(parser) + 1;
+    getlongopt_delete(parser);
+
+    if (ret == GETLONGOPT_END) {
+        /* succeeded, do nothing */
+    } else {
+        if (ret == GETLONGOPT_UNKNOWN) {
+            fprintf(output, "unknown option '%s'\n", argv[ind]);
+        } else if (ret == GETLONGOPT_MISSING_ARG) {
+            fprintf(output, "missing argument to option '%s'\n", argv[ind]);
+        } else if (ret == GETLONGOPT_ERR) {
+            fprintf(output, "unexpected error parsing options (around '%s')\n",
+              argv[ind]);
+        } else {
+            /* shouldn't happen */
+            assert(0);
+        }
+        return NULL;
+    }
+
+    if (!args->prefix && !(args->prefix = str_dup("btree"))) {
+        fprintf(output, "couldn't dup\n");
+        return NULL;
+    }
+
+    /* should be no other arguments */
+    if ((ind < argc)) {
+        fprintf(output, "too many arguments\n");
+        return NULL;
+    }
+
+    return args;
+}
+
+static int addfile(void *opaque, unsigned int file, unsigned int *maxsize) {
+    struct fdset *fds = opaque;
+    int fd;
+
+    /* we don't care if the file exists or not... */
+    if ((((fd = fdset_create(fds, 0, file)) >= 0)
+        || ((fd == -EEXIST) 
+          && ((fd = fdset_pin(fds, 0, file, 0, SEEK_CUR)) 
+            >= 0)))
+      && getmaxfsize(fd, UINT_MAX, maxsize)
+      && (fdset_unpin(fds, 0, file, fd) == FDSET_OK)) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+static void build(struct iobtree *btree, FILE *input, unsigned int limit, 
+  unsigned int entrysize) {
+    int limited = limit,
+        toobig = 0;
+    char buf[BUFSIZE + 1];
+    unsigned int inserted = 0, 
+                 bytes = 0,
+                 failed = 0,
+                 len;
+
+    buf[BUFSIZE] = '\0';
+    while ((!limited || limit) && fgets(buf, BUFSIZE, input)) {
+        if (buf[0]) {
+            limit--;
+
+            str_rtrim(buf);
+            len = str_len(buf);
+            if (iobtree_alloc(btree, buf, len, entrysize, &toobig)) {
+                bytes += len;
+                inserted++;
+            } else {
+                failed++;
+                fprintf(stderr, "failed to insert '%s'\n", buf);
+            }
+        }
+    }
+
+    printf("inserted %u strings (%u bytes), with data length %u.  %u failed\n",
+      inserted, bytes, entrysize, failed);
+}
+
+static void search(struct iobtree *btree, FILE *input, unsigned int limit) {
+    int limited = limit;
+    char buf[BUFSIZE + 1];
+    unsigned int datalen;
+    unsigned int searches = 0,
+                 found = 0;
+
+    buf[BUFSIZE] = '\0';
+    while ((!limited || limit) && fgets(buf, BUFSIZE, input)) {
+        if (buf[0]) {
+            limit--;
+            searches++;
+            if (iobtree_find(btree, buf, str_len(buf), 0, &datalen)) {
+                found++;
+            }
+        }
+    }
+
+    printf("searched %u times, found %u, (final data length %u)\n", searches, 
+      found, datalen);
+}
+
+static void print(struct iobtree *btree, FILE *output) {
+    unsigned int state[3] = {0, 0, 0},
+                 termlen,
+                 datalen,
+                 i;
+    void *data;
+    const char *term;
+
+    while ((term 
+        = iobtree_next_term(btree, state, &termlen, &data, &datalen))) {
+
+        fputc('\'', output);
+        for (i = 0; i < termlen; i++) {
+            fputc(term[i], output);
+        }
+        fprintf(output, "' (%u) %u bytes data\n", termlen, datalen);
+    }
+}
+
+int main(int argc, char **argv) {
+    struct args args;
+    struct fdset *fdset;
+    struct iobtree *btree = NULL;
+    struct freemap *freemap = NULL;
+    unsigned long int offset;
+    unsigned int fileno,
+                 overhead = sizeof(fileno) + sizeof(offset) 
+      + sizeof(args.pagesize) + sizeof(args.leaf_strategy) 
+      + sizeof(args.node_strategy);
+    int fd = -1;
+    FILE *output = stderr;
+
+    if (isatty(STDOUT_FILENO)) {
+        output = stdout;
+    }
+
+    if (parse_args(argc, argv, &args, output)) {
+
+        /* create fdset and freemap */
+        if ((fdset = fdset_new(0644, 0))
+          && (fdset_set_type_name(fdset, 0, args.prefix, 
+              str_len(args.prefix), 1) == FDSET_OK)
+          && (freemap = freemap_new(FREEMAP_STRATEGY_FIRST, 0, fdset, addfile))
+          && freemap_malloc(freemap, &fileno, &offset, &overhead, 
+              FREEMAP_OPT_LOCATION | FREEMAP_OPT_EXACT, 0, 0)) {
+            /* succeded, continue */
+        } else {
+            fprintf(output, "failed to init fstuff\n");
+            if (fdset) {
+                if (freemap) {
+                    freemap_delete(freemap);
+                }
+                fdset_delete(fdset);
+            }
+            free_args(&args);
+            return EXIT_FAILURE;
+        }
+
+        if (args.mode == MODE_BUILD) {
+            if ((btree = iobtree_new(args.pagesize, args.leaf_strategy, 
+                args.node_strategy, freemap, fdset, 0))) {
+
+                build(btree, args.input, args.limit, args.entrysize);
+                iobtree_flush(btree);
+            } else {
+                fprintf(output, "btree initialisation failed\n");
+            }
+
+            /* write out fileno and offset */
+            iobtree_root(btree, &fileno, &offset);
+            if (((fd = fdset_pin(fdset, 0, 0, 0, SEEK_SET)) >= 0)
+              && (write(fd, &fileno, sizeof(fileno)) == sizeof(fileno))
+              && (write(fd, &offset, sizeof(offset)) == sizeof(offset))
+              && (write(fd, &args.pagesize, sizeof(args.pagesize)) 
+                  == sizeof(args.pagesize))
+              && (write(fd, &args.leaf_strategy, sizeof(args.leaf_strategy)) 
+                  == sizeof(args.leaf_strategy))
+              && (write(fd, &args.node_strategy, sizeof(args.node_strategy)) 
+                  == sizeof(args.node_strategy))
+              && (fdset_unpin(fdset, 0, 0, fd) == FDSET_OK)) {
+                unsigned int pages,
+                             leaves,
+                             nodes;
+
+                pages = iobtree_pages(btree, &leaves, &nodes);
+                assert(pages == leaves + nodes);
+                printf("%u leaves, %u nodes, %u pagesize, "
+                  "%u disksize (%u overhead)\n", leaves, nodes, args.pagesize,
+                  (unsigned int) freemap_space(freemap), overhead);
+            } else {
+                fprintf(output, "failed to write root info\n");
+            }
+        } else if (args.mode == MODE_SEARCH) {
+            /* load up the btree */
+            if (((fd = fdset_pin(fdset, 0, 0, 0, SEEK_SET)) >= 0)
+              && (read(fd, &fileno, sizeof(fileno)) == sizeof(fileno))
+              && (read(fd, &offset, sizeof(offset)) == sizeof(offset))
+              && (read(fd, &args.pagesize, sizeof(args.pagesize)) 
+                  == sizeof(args.pagesize))
+              && (read(fd, &args.leaf_strategy, sizeof(args.leaf_strategy)) 
+                  == sizeof(args.leaf_strategy))
+              && (read(fd, &args.node_strategy, sizeof(args.node_strategy)) 
+                  == sizeof(args.node_strategy))
+              && (fdset_unpin(fdset, 0, 0, fd) == FDSET_OK)
+              && (btree = iobtree_load(args.pagesize, args.leaf_strategy, 
+                  args.node_strategy, freemap, fdset, 0, fileno, offset))) {
+                search(btree, args.input, args.limit);
+            } else {
+                fprintf(output, "failed to read root info\n");
+            }
+        } else if (args.mode == MODE_PRINT) {
+            /* load up the btree */
+            if (((fd = fdset_pin(fdset, 0, 0, 0, SEEK_SET)) >= 0)
+              && (read(fd, &fileno, sizeof(fileno)) == sizeof(fileno))
+              && (read(fd, &offset, sizeof(offset)) == sizeof(offset))
+              && (read(fd, &args.pagesize, sizeof(args.pagesize)) 
+                  == sizeof(args.pagesize))
+              && (read(fd, &args.leaf_strategy, sizeof(args.leaf_strategy)) 
+                  == sizeof(args.leaf_strategy))
+              && (read(fd, &args.node_strategy, sizeof(args.node_strategy)) 
+                  == sizeof(args.node_strategy))
+              && (fdset_unpin(fdset, 0, 0, fd) == FDSET_OK)
+              && (btree = iobtree_load(args.pagesize, args.leaf_strategy, 
+                  args.node_strategy, freemap, fdset, 0, fileno, offset))) {
+                print(btree, stdout);
+            } else {
+                fprintf(output, "failed to read root info\n");
+            }
+        } else {
+            fprintf(output, 
+               "what do you want to do? (--build, --print, --search)\n");
+        }
+
+        if (btree) {
+            iobtree_delete(btree);
+        }
+        fdset_delete(fdset);
+        freemap_delete(freemap);
+        free_args(&args);
+        return EXIT_SUCCESS;
+    } else {
+        return EXIT_FAILURE;
+    }
+}
+
diff --git a/tools/cat.c b/tools/cat.c
new file mode 100644 (file)
index 0000000..1b0e6e1
--- /dev/null
@@ -0,0 +1,649 @@
+/* cat.c implements a tool to cat out an index fileset produced by
+ * the search engine
+ *
+ * written nml 2003-02-25
+ *
+ */
+
+#include "firstinclude.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "def.h"
+#include "index.h"
+#include "_index.h"
+#include "docmap.h"
+#include "getlongopt.h"
+#include "iobtree.h"
+#include "str.h"
+#include "vec.h"
+#include "vocab.h"
+#include "fdset.h"
+#include "bucket.h"
+
+int cat_vocab(FILE *output, struct index *idx, int verbose) {
+    unsigned int state[3] = {0, 0, 0};
+    const char *term;
+    void *addr;
+    unsigned int i,
+                 termlen;
+    unsigned int terms = 0;
+    struct vocab_vector vocab;
+    struct vec v;
+    enum vocab_ret ret;
+
+    while ((term 
+        = iobtree_next_term(idx->vocab, state, &termlen, &addr, &i))) {
+
+        v.pos = addr;
+        v.end = v.pos + i;
+
+        /* decode the vocab stuff */
+        while ((ret = vocab_decode(&vocab, &v)) == VOCAB_OK) {
+            putc('\'', output);
+            for (i = 0; i < termlen; i++) {
+                putc(term[i], output);
+            }
+            putc('\'', output);
+            putc(' ', output);
+
+            if (verbose) {
+                switch (vocab.location) {
+                case VOCAB_LOCATION_VOCAB:
+                    fprintf(output, "(location vocab) ");
+                    break;
+
+                default:
+                    fprintf(output, "(location %u %lu %u) ", 
+                      vocab.loc.file.fileno, 
+                      vocab.loc.file.offset, vocab.loc.file.capacity);
+                    break;
+                };
+            }
+            fprintf(output, "docs %lu occurrances %lu length %lu last %lu\n", 
+              vocab.header.doc.docs, vocab.header.doc.occurs, 
+              vocab.size, vocab.header.doc.last);
+        }
+
+        if (ret != VOCAB_END) {
+            fprintf(stderr, "failed to decode vocab entry\n");
+            return 0;
+        }
+        terms++;
+    }
+
+    if (term || (terms != iobtree_size(idx->vocab))) {
+        fprintf(stderr, "couldn't read all terms (%u vs %u)\n", terms, 
+          iobtree_size(idx->vocab));
+        return 0;
+    }
+
+    fprintf(output, "\n%u terms total\n", terms);
+
+    return 1;
+}
+
+/* small function to output an off_t, avoiding (extremely) irritating warning
+ * when using ll printf conversion and gcc */
+static void off_out(FILE *output, off_t offset) {
+    char buf[20]; /* note that a 64-bit number can only have 20 digits */
+    unsigned int pos = 0;
+
+    if (!offset) {
+        putc('0', output);
+        return;
+    }
+
+    if (offset < 0) {
+        putc('-', output);
+        offset *= -1;
+    }
+
+    while (offset > 0) {
+        assert(pos <= 20);
+        buf[pos++] = (offset % 10) + '0';
+        offset /= 10;
+    }
+
+    while (pos--) {
+        putc(buf[pos], output);
+    }
+
+    return;
+}
+
+int cat_docmap(FILE *output, struct index *idx, int verbose) {
+    off_t offset;
+    unsigned long int size,
+                      i;
+    unsigned int sourcefile,
+                 bytes,
+                 words,
+                 aux_len,
+                 dwords;
+    enum docmap_flag flags;
+    double weight;
+    char aux[4096];
+    enum docmap_ret dm_ret;
+    enum mime_types type;
+
+    size = docmap_entries(idx->map);
+
+    for (i = 0; i < size; i++) {
+        if ( (dm_ret = docmap_get_location(idx->map, i, &sourcefile,
+                  &offset, &bytes, &type, &flags) != DOCMAP_OK)
+          || (dm_ret = docmap_get_trecno(idx->map, i, aux, sizeof(aux) - 1,
+                  &aux_len) != DOCMAP_OK)
+          || (dm_ret = docmap_get_words(idx->map, i, &words) != DOCMAP_OK)
+          || (dm_ret = docmap_get_distinct_words(idx->map, i,
+                  &dwords) != DOCMAP_OK)
+          || (dm_ret = docmap_get_weight(idx->map, i, &weight) != DOCMAP_OK))
+            return 0;
+
+        aux[aux_len] = '\0';
+        /* output document stats */
+        if (verbose) {
+            fprintf(output, "%lu location (%u ", i, sourcefile);
+            off_out(output, offset);
+            fprintf(output, "), "
+              "size %u (%u words, %u distinct words, %f weight) type %s%s%s\n", 
+              bytes, words, dwords, weight, 
+              mime_string(type), aux ? ": " : "", aux ? aux : "");
+        } else {
+            fprintf(output, "%lu, size %u (%u words, %u distinct words, "
+              "%f weight)%s%s\n", i, bytes, words, dwords, weight, 
+              aux ? ": " : "", aux ? aux : "");
+        }
+    }
+
+    fprintf(output, "\n%lu entries\n", size);
+    return 1;
+}
+
+int cat_index(FILE *output, struct index *idx, int verbose) {
+    unsigned long int docno_d,        /* current document number delta */
+                      docno,          /* current document number */
+                      occurences,     /* number of times term appears in doc */
+                      wordno,         /* the word offset of the occurance */
+                      wordno_d,       /* delta of word offset */
+                      i,
+                      j;
+    struct vec v;
+    struct vec vocabv;
+    unsigned int state[3] = {0, 0, 0};
+    const char *term;
+    void *addr,
+         *buf = NULL;
+    unsigned int termlen,
+                 terms = 0,
+                 tmp;
+    struct vocab_vector vocab;
+    int fd = -1;
+    enum vocab_ret ret;
+
+    while ((term 
+        = iobtree_next_term(idx->vocab, state, &termlen, &addr, &tmp))) {
+
+        vocabv.pos = addr;
+        vocabv.end = vocabv.pos + tmp;
+        while ((ret = vocab_decode(&vocab, &vocabv)) == VOCAB_OK) {
+            putc('\'', output);
+            for (i = 0; i < termlen; i++) {
+                putc(term[i], output);
+            }
+
+            fprintf(output, "' docs %lu, last %lu, occs %lu", 
+              vocab.header.doc.docs, vocab.header.doc.last, 
+              vocab.header.doc.occurs);
+
+            switch (vocab.type) {
+            case VOCAB_VTYPE_DOC:
+                fprintf(output, " doc");
+                break;
+            case VOCAB_VTYPE_DOCWP:
+                fprintf(output, " docwp");
+                break;
+            case VOCAB_VTYPE_IMPACT:
+                fprintf(output, " impact");
+                break;
+            }
+            
+            switch (vocab.location) {
+            case VOCAB_LOCATION_VOCAB:
+                v.pos = ((char *) addr) + vocab_len(&vocab) - vocab.size;
+                v.end = v.pos + vocab.size;
+                buf = NULL;
+
+                if (verbose) {
+                    fprintf(output, " (location vocab, size %lu)", vocab.size);
+                }
+                break;
+
+            default:
+                if (verbose) {
+                    fprintf(output, " (location %u %lu %u size %lu)", 
+                      vocab.loc.file.fileno, vocab.loc.file.offset, 
+                      vocab.loc.file.capacity, vocab.size);
+                }
+                tmp = 0;
+                if (((fd = fdset_pin(idx->fd, idx->index_type, 
+                    vocab.loc.file.fileno, vocab.loc.file.offset, SEEK_SET)) 
+                      >= 0)
+                  && (buf = v.pos = malloc(vocab.size))
+                  && (read(fd, buf, vocab.size) == (ssize_t) vocab.size)
+                  && (tmp = 1)
+                  && (fdset_unpin(idx->fd, idx->index_type, 
+                      vocab.loc.file.fileno, fd) == FDSET_OK)) {
+                    /* succeeded */
+                    v.end = v.pos + vocab.size;
+                } else {
+                    if (fd >= 0) {
+                        fdset_unpin(idx->fd, idx->index_type, 
+                          vocab.loc.file.fileno, fd);
+                        if (tmp) {
+                            free(buf);
+                        }
+                    }
+
+                    fprintf(stderr, "couldn't read vector\n");
+                    return 0;
+                }
+                break;
+            };
+
+            /* decode vector */
+            fprintf(output, ":");
+            if (vocab.type == VOCAB_VTYPE_DOC 
+              || vocab.type == VOCAB_VTYPE_DOCWP) {
+                docno = 0;
+                for (i = 0; i < vocab.header.doc.docs; i++) {
+                    if ((vec_vbyte_read(&v, &docno_d)) 
+                      && (vec_vbyte_read(&v, &occurences))) {
+                        docno += docno_d;
+                        fprintf(output, " (%ld %ld", docno + i, occurences);
+                        if (vocab.type == VOCAB_VTYPE_DOCWP) {
+                            fprintf(output, " [");
+                            wordno = 0;
+                            for (j = 0; j < occurences; j++) {
+                                if (vec_vbyte_read(&v, &wordno_d)) {
+                                    wordno += wordno_d;
+                                    fprintf(output, " %ld", wordno + j);
+                                } else {
+                                    fprintf(stderr, 
+                                      "error reading offset from vectors\n");
+                                    if (buf) {
+                                        free(buf);
+                                    }
+                                    return 0;
+                                }
+                            }
+                            fprintf(output, " ]");
+                        } 
+                        fprintf(output, ")");
+                    } else {
+                        fprintf(stderr, "error reading docno from vectors\n");
+                        if (buf) {
+                            free(buf);
+                        }
+                        return 0;
+                    }
+                }
+
+                if (docno + i - 1 != vocab.header.doc.last) {
+                    fprintf(output, " (incorrect last value (%lu vs %lu)!)\n",
+                      docno + i - 1, vocab.header.doc.last);
+                    if (buf) {
+                        free(buf);
+                    }
+                    return 0;
+                }
+            } else if (vocab.type == VOCAB_VTYPE_IMPACT) {
+                unsigned long int docno,
+                                  docno_d;
+                unsigned long int blocksize = 0;
+                unsigned long int impact;
+
+                while (VEC_LEN(&v)) {
+                    docno = -1;
+                    vec_vbyte_read(&v, &blocksize);
+                    vec_vbyte_read(&v, &impact);
+                    fprintf(output, " (%ld %ld [", impact, blocksize);
+                    for (i = 0; i < blocksize; i++) {
+                        vec_vbyte_read(&v, &docno_d);
+                        docno += docno_d + 1;
+                        fprintf(output, " %ld", docno);
+                    }
+                    fprintf(output, " ])");
+                }
+            }
+
+            if (buf) {
+                free(buf);
+                buf = NULL;
+            }
+
+            putc('\n', output);
+        }
+        if (ret != VOCAB_END) {
+            fprintf(stderr, "could decode vocab item\n");
+            return 0;
+        }
+
+        terms++;
+    }
+
+    if (term || (terms != iobtree_size(idx->vocab))) {
+        fprintf(stderr, "didn't get all terms\n");
+        return 0;
+    }
+
+    return 1;
+}
+
+/* moved this function in from vbyte.c because we want to get rid of vbyte.c and
+ * i can't be bothered updating the intermediate catting functionality to use
+ * vec.c instead */
+static unsigned int vbyte_read(FILE* fp, unsigned long int* n) {
+    unsigned int ret = 1;
+    unsigned int count = 0; 
+    uint8_t byte;
+
+    *n = 0;
+    while (fread(&byte, 1, 1, fp)) {
+        if (byte & 0x80) {
+            /* For each time we get a group of 7 bits, need to left-shift the 
+               latest group by an additional 7 places, since the groups were 
+               effectively stored in reverse order.*/
+            *n |= ((byte & 0x7f) << count);
+            ret++;
+            count += 7;
+        } else if (ret > (sizeof(*n))) {
+            if (ret == (sizeof(*n) + 1) 
+              && (byte < (1 << (sizeof(*n) + 1)))) {
+                /* its a large, but valid number */
+                *n |= byte << count;
+                return ret;
+            } else {
+                /* we've overflowed */
+
+                /* pretend we detected it as it happened */
+                fseek(fp, - (int) (ret - (sizeof(*n) + 1)), SEEK_CUR);
+                errno = EOVERFLOW;
+                return 0;
+            }
+        } else {
+            *n |= byte << count;
+            return ret;
+        }
+    }
+
+    /* got a read error */
+    return 0;
+}
+
+int cat_intermediate(FILE* output, FILE* idx, int verbose) {
+    char term[TERMLEN_MAX + 1];          /* the current index word */
+    unsigned long int numdocs,           /* number of docs word occurs in */
+                      termlen,           /* length of current index word */
+                      docno_d,           /* current document number delta */
+                      docno,             /* current document number */
+                      occurs,            /* total number of times term occurs */
+                      occurences,        /* number of times term is in doc */
+                      wordno,            /* the word offset of the occurance */
+                      wordno_d,          /* delta of word offset */
+                      last,              /* last docno encoded */
+                      size,              /* size of the vector */
+                      i,
+                      j;
+    struct vec v;
+    char *buf;
+
+    /* read word length ... */
+    while (((vbyte_read(idx, &termlen)) > 0) && (termlen <= TERMLEN_MAX) 
+      /* ...and the word... */
+      && (fread(term, 1, termlen, idx) == termlen)
+      /* ...and the number of documents its in... */
+      && ((vbyte_read(idx, &numdocs)) > 0)
+      /* ...and the total number of occurrances... */
+      && ((vbyte_read(idx, &occurs)) > 0)
+      /* ...and the last value ... */
+      && (vbyte_read(idx, &last))
+      /* ...and read the size of the vector */
+      && ((vbyte_read(idx, &size)) > 0)) {
+        term[termlen] = '\0';
+        fprintf(output, "%s occurs in %lu docs (%lu total)", term, numdocs, 
+          occurs);
+        docno = 0;
+        if (verbose) {
+            fprintf(output, " (last %lu)", last);
+        }
+        fprintf(output, ":");
+        /* read the vector */
+        if ((buf = malloc(size)) && fread(buf, size, 1, idx)) {
+            v.pos = buf;
+            v.end = v.pos + size;
+
+            fprintf(output, " (len %lu)", size);
+            for (i = 0; i < numdocs; i++) {
+                if ((vec_vbyte_read(&v, &docno_d)) 
+                  && (vec_vbyte_read(&v, &occurences))) {
+                    docno += docno_d;
+                    fprintf(output, " (%ld %ld [", docno + i, occurences);
+                    wordno = 0;
+
+                    for (j = 0; j < occurences; j++) {
+                        if (vec_vbyte_read(&v, &wordno_d)) {
+                            wordno += wordno_d;
+                            fprintf(output, " %ld", wordno + j);
+                        } else {
+                            fprintf(stderr, 
+                              "error reading offset from vectors "
+                              "(at %lu docno)\n", docno + i);
+                            return 0;
+                        }
+                    }
+                    fprintf(output, " ])");
+                } else {
+                    fprintf(stderr, "error reading docno from vectors "
+                      "(at %u of %lu bytes, %lu of %lu docs)\n", 
+                      (unsigned int) (v.pos - buf), size, i, numdocs);
+                    return 0;
+                }
+            }
+
+            if (docno + numdocs - 1 != last) {
+                fprintf(output, "(wrong last value %lu vs %lu!)\n", 
+                  docno + i, last);
+                return 0;
+            }
+
+            free(buf);
+        } else {
+            fprintf(stderr, "error reading vector\n");
+            return 0;
+        }
+        fprintf(output, "\n");
+    } 
+
+    return 1;
+}
+
+FILE* file_open(const char* prefix, const char* suffix) {
+    FILE* fp = NULL;
+    unsigned int len = strlen(prefix) + strlen(suffix);
+    char* buf = malloc(len + 1);
+
+    if (buf) {
+        strcpy(buf, prefix);
+        strcat(buf, suffix);
+        fp = fopen(buf, "rb");
+        free(buf);
+    }
+
+    return fp;
+}
+
+void print_usage(FILE *stream, const char *progname) {
+    fprintf(stream, "usage: %s index\n", progname);
+    fprintf(stream, "  options:\n");
+    fprintf(stream, "    -i,--intermediate: treat given file as intermediate "
+      "merge file\n");
+    fprintf(stream, "    -d,--docmap: print document map for given index\n");
+    fprintf(stream, "    -x,--vocab: print vocabulary for given index\n");
+    fprintf(stream, "    -v,--verbose: verbose output\n");
+    fprintf(stream, "    -h,--help: this message\n");
+}
+
+int main(int argc, char** argv) {
+    FILE* vectors;
+    int intermediate = 0,
+        docmap = 0,
+        verbose = 0,
+        idx_flag = 0,
+        id;
+    struct index *idx;
+    struct getlongopt *parser;
+    enum getlongopt_ret ret;
+    const char *arg;
+    unsigned int ind;
+
+    struct getlongopt_opt opts[] = {
+        {"help", 'h', GETLONGOPT_ARG_NONE, 'h'},
+        {"verbose", 'v', GETLONGOPT_ARG_NONE, 'v'},
+        {"intermediate", 'i', GETLONGOPT_ARG_NONE, 'i'},
+        {"docmap", 'd', GETLONGOPT_ARG_NONE, 'd'},
+        {"vocab", 'x', GETLONGOPT_ARG_NONE, 'x'}
+    };
+
+    if ((parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, 
+        sizeof(opts) / sizeof(*opts)))) {
+
+        while ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK) {
+            switch (id) {
+            case 'h':
+                print_usage(stdout, argv[0]);
+                return EXIT_SUCCESS;
+
+            case 'x':
+                idx_flag = 1;
+                break;
+
+            case 'v':
+                verbose = 1;
+                break;
+
+            case 'i':
+                intermediate = 1;
+                break;
+
+            case 'd':
+                docmap = 1;
+                break;
+
+            default:
+                /* shouldn't happen */
+                assert(0);
+            }
+        }
+    } else {
+        fprintf(stderr, "failed to initialise option parser\n");
+        return EXIT_FAILURE;
+    }
+
+    ind = getlongopt_optind(parser) + 1;
+    getlongopt_delete(parser);
+
+    if (ret == GETLONGOPT_END) {
+        /* succeeded, do nothing */
+    } else {
+        if (ret == GETLONGOPT_UNKNOWN) {
+            fprintf(stderr, "unknown option '%s'\n", argv[ind]);
+        } else if (ret == GETLONGOPT_MISSING_ARG) {
+            fprintf(stderr, "missing argument to option '%s'\n", argv[ind]);
+        } else if (ret == GETLONGOPT_ERR) {
+            fprintf(stderr, "unexpected error parsing options (around '%s')\n",
+              argv[ind]);
+        } else {
+            /* shouldn't happen */
+            assert(0);
+        }
+        return EXIT_FAILURE;
+    }
+
+    /* rest of arguments should be files */
+    if (ind == (unsigned int) argc) {
+        print_usage(stderr, *argv);
+        return EXIT_SUCCESS;
+    } else {
+        while (ind < (unsigned int) argc) {
+            if (intermediate) {
+                if ((vectors = file_open(argv[ind], ""))) {
+                    if (!cat_intermediate(stdout, vectors, verbose)) {
+                        fprintf(stderr, "unable to cat index for '%s'\n", 
+                          argv[ind]);
+                        fclose(vectors);
+                        return EXIT_FAILURE;
+                    }
+                    fclose(vectors);
+                } else {
+                    fprintf(stderr, "unable to open intermediate file %s\n", 
+                      argv[ind]);
+                    return EXIT_FAILURE;
+                }
+            } else if (docmap) {
+                if ((idx = index_load(argv[ind], MEMORY_DEFAULT, 
+                    INDEX_LOAD_NOOPT, NULL))) {
+
+                    if (!cat_docmap(stdout, idx, verbose)) {
+                        fprintf(stderr, "unable to cat docmap for '%s'\n", 
+                          argv[ind]);
+                        index_delete(idx);
+                        return EXIT_FAILURE;
+                    }
+                    index_delete(idx);
+                } else {
+                    fprintf(stderr, "unable to open index %s\n", argv[ind]);
+                    return EXIT_FAILURE;
+                }
+            } else if (idx_flag) {
+                if ((idx = index_load(argv[ind], MEMORY_DEFAULT, 
+                    INDEX_LOAD_NOOPT, NULL))) {
+
+                    if (!cat_vocab(stdout, idx, verbose)) {
+                        fprintf(stderr, "unable to cat vocab for '%s'\n", 
+                          argv[ind]);
+                        index_delete(idx);
+                        return EXIT_FAILURE;
+                    }
+                    index_delete(idx);
+                } else {
+                    fprintf(stderr, "unable to open index %s\n", argv[ind]);
+                    return EXIT_FAILURE;
+                }
+            } else {
+                if ((idx = index_load(argv[ind], MEMORY_DEFAULT, 
+                    INDEX_LOAD_NOOPT, NULL))) {
+
+                    if (!cat_index(stdout, idx, verbose)) {
+                        fprintf(stderr, "unable to cat index for '%s'\n", 
+                          argv[ind]);
+                        index_delete(idx);
+                        return EXIT_FAILURE;
+                    }
+                    index_delete(idx);
+                } else {
+                    fprintf(stderr, "unable to open index %s\n", argv[ind]);
+                    return EXIT_FAILURE;
+                }
+            }
+            ind++;
+        }
+    }
+
+    return EXIT_SUCCESS;
+}
+
diff --git a/tools/dict.c b/tools/dict.c
new file mode 100644 (file)
index 0000000..b78aa90
--- /dev/null
@@ -0,0 +1,248 @@
+/* 
+ *  Tool for querying the vocab.
+ *
+ *  Usage: 
+ *    zet_dict -f <index-prefix>
+ *    zet_dict -h                   # for help
+ *
+ *  This tool loads the vocabulary for the index specified by the
+ *  "-f <prefix>" argument, or by default the index with the prefix
+ *  "index".  It then reads queries from standard input, and writes
+ *  results out to standard output.  In interactive mode, a prompt
+ *  will be printed before each command.
+ *
+ *  Queries must be contained on a single line.  There is currently
+ *  no way of extending a query across multiple lines.
+ *
+ *  The following queries are currently recognised:
+ *
+ *    veclen <term>
+ *        Get the length in bytes of the inverted list for the
+ *        term <term>
+ *
+ */
+
+#include "firstinclude.h"
+
+#include <ctype.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "iobtree.h"
+#include "index.h"
+#include "_index.h"
+#include "vocab.h"
+#include "vec.h"
+#include "getlongopt.h"
+
+#define QUERY_BUF_SIZE 4096
+#define QUERY_MAX_ARGS 1024
+
+static void print_usage(FILE * stream, const char * progname);
+static int get_query(FILE * stream, char * buf, int buf_size);
+static int do_query(char * query, struct index * idx);
+
+int main(int argc, char ** argv) {
+    const char * prefix = "index";
+    struct getlongopt * opt_parser;
+    int help_flag = 0;
+    enum getlongopt_ret opt_ret;
+    const char * arg;
+    int id;
+    unsigned int ind;
+    struct index * idx;
+    char query_buf[QUERY_BUF_SIZE];
+    int ret;
+
+    struct getlongopt_opt opts[] = {
+        {"help", 'h', GETLONGOPT_ARG_NONE, 'h'},
+        {"prefix", 'f', GETLONGOPT_ARG_REQUIRED, 'f'}
+    };
+
+    if ( (opt_parser = getlongopt_new(argc - 1, (const char **) &argv[1],
+              opts, sizeof(opts) / sizeof(*opts))) == NULL) {
+        fprintf(stderr, "failed to initialise option parser\n");
+        return EXIT_FAILURE;
+    }
+      
+    while ( (opt_ret = getlongopt(opt_parser, &id, &arg)) == GETLONGOPT_OK) {
+        switch(id) {
+        case 'h':
+            help_flag = 1;
+            break;
+
+        case 'f':
+            prefix = arg;
+            break;
+
+        default:
+            assert(0);
+        }
+    }
+
+    ind = getlongopt_optind(opt_parser) + 1;
+    getlongopt_delete(opt_parser);
+
+    if (opt_ret != GETLONGOPT_END) {
+        if (opt_ret == GETLONGOPT_UNKNOWN) {
+            fprintf(stderr, "unknown option '%s'\n", argv[ind]);
+        } else if (opt_ret == GETLONGOPT_MISSING_ARG) {
+            fprintf(stderr, "missing argument to option '%s'\n", argv[ind]);
+        } else if (opt_ret == GETLONGOPT_ERR) {
+            fprintf(stderr, "unexpected error parsing options (around '%s')\n",
+              argv[ind]);
+        }
+        print_usage(stderr, argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    if (ind != argc) {
+        fprintf(stderr, "Trailing arguments\n");
+        print_usage(stderr, argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    if (help_flag) {
+        print_usage(stdout, argv[0]);
+        return EXIT_SUCCESS;
+    }
+
+    if ((idx = index_load(prefix, 0, INDEX_LOAD_NOOPT, NULL)) == NULL) {
+        fprintf(stderr, "Error loading index with prefix '%s'\n", prefix);
+        return EXIT_FAILURE;
+    }
+
+    while ( (ret = get_query(stdin, query_buf, QUERY_BUF_SIZE)) > 0
+      && (ret = do_query(query_buf, idx)) > 0)
+        ;
+    if (ret == 0)
+        return EXIT_SUCCESS;
+    else
+        return EXIT_FAILURE;
+}
+
+static int get_query(FILE * stream, char * buf, int buf_size) {
+    int query_len;
+    if (isatty(fileno(stream))) {
+        fprintf(stdout, "> ");
+        fflush(stdout);
+    }
+    if (fgets(buf, buf_size, stream) == NULL) {
+        if (feof(stream))
+            return 0;
+        else
+            return -1;
+    }
+    query_len = strlen(buf);
+    if (buf[query_len - 1] == '\n')
+        buf[query_len - 1] = '\0';
+    return 1;
+}
+
+static int tokenize_query(char * query, char ** args, int args_size);
+
+static int print_veclen(FILE * stream, char * term, struct index * idx);
+
+static int print_vocab_size(FILE * stream, struct index * idx);
+
+static int do_query(char * query, struct index * idx) {
+    char * args[QUERY_MAX_ARGS];
+    int num_args = tokenize_query(query, args, QUERY_MAX_ARGS);
+
+    if (num_args < 0) {
+        fprintf(stderr, "Malformed query\n");
+        return 1;
+    } else if (num_args == 0) {
+        return 1;
+    }
+
+    if (strcmp(args[0], "veclen") == 0) {
+        if (num_args != 2) {
+            fprintf(stderr, "'veclen' requires single term as argument\n");
+            return 1;
+        } else {
+             print_veclen(stdout, args[1], idx);
+        }
+    } else if (strcmp(args[0], "vocab_size") == 0) {
+        if (num_args != 1) {
+            fprintf(stderr, "'vocab_size' takes no arguments\n");
+            return 1;
+        } else {
+            print_vocab_size(stdout, idx);
+        }
+    } else if (strcmp(args[0], "exit") == 0 || strcmp(args[0], "quit") == 0) {
+        return 0;
+    } else {
+        fprintf(stderr, "Unknown query '%s'\n", args[0]);
+    }
+    return 1;
+}
+
+static int print_vocab_size(FILE * stream, struct index * idx) {
+    struct index_stats stats;
+    index_stats(idx, &stats);
+    fprintf(stream, "%lu\n", stats.dterms);
+    return 0;
+}
+
+static int get_vocab_vector(struct iobtree * vocab, char * term,
+  struct vocab_vector * vocab_vector) {
+    void * data;
+    unsigned int veclen;
+    struct vec v;
+
+    data = iobtree_find(vocab, term, strlen(term), 0, &veclen);
+    if (data == NULL)  /* XXX how to detect error? */
+        return 0;
+    v.pos = data;
+    v.end = v.pos + veclen;
+    if (!(vocab_decode(vocab_vector, &v))) 
+        return -1;
+    return 1;
+}
+
+static int print_veclen(FILE * stream, char * term, struct index * idx) {
+    struct iobtree * vocab = idx->vocab;
+    struct vocab_vector vocab_vector;
+    int ret;
+
+    if ( (ret = get_vocab_vector(vocab, term, &vocab_vector)) == 1) {
+        fprintf(stream, "%lu\n", vocab_vector.size);
+    } else if (ret == 0) {
+        fprintf(stream, "-1\n");
+    } else {
+        fprintf(stderr, "Error reading vocab entry for '%s'\n", term);
+    }
+    return ret;
+}
+
+static int tokenize_query(char * query, char ** args, int args_size) {
+    char * qp = query;
+    int num_args = 0;
+
+    while (*qp != '\0') {
+        while (isspace(*qp)) {
+            *qp = '\0';
+            qp++;
+        }
+        if (*qp != '\0') {
+            if (num_args == args_size)
+                return -1;
+            args[num_args] = qp;
+            num_args++;
+        }
+        while (!isspace(*qp) && *qp != '\0') {
+            qp++;
+        }
+    }
+    return num_args;
+}
+
+static void print_usage(FILE * stream, const char * progname) {
+    fprintf(stderr, "Usage:\n");
+    fprintf(stderr, "\t%s [-f prefix]\n", progname);
+    fprintf(stderr, "\t%s -h     # for help\n", progname);
+}
diff --git a/tools/diff.c b/tools/diff.c
new file mode 100644 (file)
index 0000000..48673ce
--- /dev/null
@@ -0,0 +1,555 @@
+/* diff.c implements a tool to compare two index files produced by
+ * the search engine
+ *
+ * written nml 2003-05-06
+ *
+ */
+
+#include "firstinclude.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "def.h"
+#include "docmap.h"
+#include "str.h"
+#include "vec.h"
+#include "index.h"
+#include "_index.h"
+#include "iobtree.h"
+#include "vocab.h"
+#include "bucket.h"
+#include "fdset.h"
+
+/* internal function to load a list into a buffer, pointing ptr vec at it.
+ * Returns 1 on success, 0 on error, < 0 if no futher vectors could be loaded */
+static int getvec(struct index *idx, struct vec *v, void **buf, 
+  unsigned int *bufsize, struct vec *ptr, const char *term, 
+  unsigned int termlen) {
+    unsigned int readsize;
+    struct vocab_vector vv;
+    int fd;
+    int ret;
+
+    if ((ret = vocab_decode(&vv, v)) == VOCAB_OK) {
+        readsize = vv.size;
+
+        switch (vv.location) {
+        case VOCAB_LOCATION_VOCAB:
+            ptr->pos = vv.loc.vocab.vec;
+            ptr->end = ptr->pos + vv.size;
+            return 1;
+
+        case VOCAB_LOCATION_FILE:
+            /* ensure we have enough space */
+            if (*bufsize < readsize) {
+                void *ptr;
+
+                if ((ptr = realloc(*buf, readsize))) {
+                    *buf = ptr;
+                    *bufsize = readsize;
+                } else {
+                    fprintf(stderr, "getvocab: failed to get memory\n");
+                    return 0;
+                }
+            }
+
+            if (((fd = fdset_pin(idx->fd, idx->index_type, vv.loc.file.fileno, 
+                vv.loc.file.offset, SEEK_SET)) >= 0) 
+              && (read(fd, *buf, readsize) == (ssize_t) readsize)
+              && fdset_unpin(idx->fd, idx->index_type, vv.loc.file.fileno, fd) 
+                == FDSET_OK) {
+
+                /* succeeded */
+                ptr->pos = *buf;
+                ptr->end = ptr->pos + vv.size;
+                return 1;
+            }
+            break;
+        }
+    } else if (ret == VOCAB_END) {
+        return -1;
+    }
+    fprintf(stderr, "getvocab: failed to decode vocab\n");
+    return 0;
+}
+
+/* internal function to compare the contents of two vocab entries.  Returns 0 
+ * if the vocab entries are different, > 0 if they're identical and < 0 if an
+ * error occurred. */
+static int vvdiff(struct index *one, struct index *two, struct vec *vone, 
+  struct vec *vtwo, FILE *output, const char *term, unsigned int termlen, 
+  unsigned int *discon_one, unsigned int *discon_two, 
+  
+  void **buf1, unsigned int *bufsize1, void **buf2, unsigned int *bufsize2) {
+    struct vec list1,
+               list2;
+    unsigned int docno1,
+                 docno2,
+                 wordno1 = 0,
+                 wordno2 = 0,
+                 docs1,
+                 docs2,
+                 occurs1,
+                 occurs2,
+                 o1,
+                 o2,
+                 i,
+                 bytes,
+                 entries1,
+                 entries2;
+    unsigned long int last1,
+                      last2,
+                      f_dt1 = 0,
+                      f_dt2 = 0,
+                      delta;
+    struct vocab_vector vv1,
+                        vv2;
+    int ret;
+
+    /* examine first vocab entry */
+    last1 = docs1 = occurs1 = 0;
+    list1 = *vone;
+    entries1 = 0;
+    while ((ret = vocab_decode(&vv1, &list1)) == VOCAB_OK) {
+        entries1++;
+
+        if ((vv1.type == VOCAB_VTYPE_DOCWP) || (vv1.type == VOCAB_VTYPE_DOC)) {
+            docs1 += vv1.header.doc.docs;
+            occurs1 += vv1.header.doc.occurs;
+            if (last1 < vv1.header.doc.last) {
+                last1 = vv1.header.doc.last;
+            }
+        }
+    }
+    if (ret != VOCAB_END) {
+        assert(!CRASH);
+        fprintf(stderr, "failed to decode vector one\n");
+        return -1;
+    }
+
+    /* examine second vocab entry */
+    last2 = docs2 = occurs2 = 0;
+    list2 = *vtwo;
+    entries2 = 0;
+    while ((ret = vocab_decode(&vv2, &list2)) == VOCAB_OK) {
+        entries2++;
+        if ((vv2.type == VOCAB_VTYPE_DOCWP) || (vv2.type == VOCAB_VTYPE_DOC)) {
+            docs2 += vv2.header.doc.docs;
+            occurs2 += vv2.header.doc.occurs;
+            if (last2 < vv2.header.doc.last) {
+                last2 = vv2.header.doc.last;
+            }
+        }
+    }
+    if (ret != VOCAB_END) {
+        assert(!CRASH);
+        fprintf(stderr, "failed to decode vector one\n");
+        return -1;
+    }
+
+    ret = 1;
+    if (docs1 != docs2) {
+        fprintf(output, "number of documents for '");
+        for (i = 0; i < termlen; i++) {
+            putc(term[i], output);
+        }
+        fprintf(output, "' differ (%u vs %u)\n", docs1, docs2);
+        ret = 0;
+    } 
+    o1 = occurs1;
+    o2 = occurs2;
+    if (occurs1 != occurs2) {
+        fprintf(output, "number of occurrances for '");
+        for (i = 0; i < termlen; i++) {
+            putc(term[i], output);
+        }
+        fprintf(output, "' differ (%u vs %u)\n", occurs1, occurs2);
+        ret = 0;
+    } 
+    if (last1 != last2) {
+        fprintf(output, "last document number for '");
+        for (i = 0; i < termlen; i++) {
+            putc(term[i], output);
+        }
+        fprintf(output, "' differs (%lu vs %lu)\n", last1, last2);
+        ret = 0;
+    } 
+
+    /* return if we've detected differences here */
+    if (!ret) {
+        fprintf(output, "(term diff stops...)\n");
+        return ret;
+    } 
+    assert(ret == 1);
+
+    list1.pos = list2.pos = list1.end = list2.end = NULL;
+    
+    /* shortcut list diff for simple entries */
+    if (entries1 == 1 && entries2 == 1) {
+        if (getvec(one, vone, buf1, bufsize1, &list1, term, termlen) > 0
+          && getvec(two, vtwo, buf2, bufsize2, &list2, term, termlen) > 0) {
+            if ((VEC_LEN(&list1) == VEC_LEN(&list2)) 
+              && !memcmp(list1.pos, list2.pos, VEC_LEN(&list1))) {
+                assert(ret == 1);
+                return 1;
+            } else {
+                fprintf(output, "vectors for '");
+                for (i = 0; i < termlen; i++) {
+                    putc(term[i], output);
+                }
+                fprintf(output, "' differ\n");
+                return 0;
+            }
+        } else {
+            assert(!CRASH);
+            fprintf(stderr, "failed to get a vector\n");
+            return -1;
+        }
+    } else {
+        if (!entries1) {
+            fprintf(stderr, "no entries in index one for '");
+            for (i = 0; i < termlen; i++) {
+                putc(term[i], output);
+            }
+            fprintf(output, "'");
+            return -1;
+        } else if (entries1 > 1) {
+            (*discon_one)++;
+        } 
+
+        if (!entries2) {
+            fprintf(stderr, "no entries in index two for '");
+            for (i = 0; i < termlen; i++) {
+                putc(term[i], output);
+            }
+            fprintf(output, "'");
+        } else if (entries2 > 1) {
+            (*discon_two)++;
+        }
+    }
+
+    /* decode the two sets of vectors to ensure that they have the same 
+     * content */
+    docno1 = docno2 = -1;
+    while (occurs1) {
+        /* get next occurrance from one */
+        if (!f_dt1--) {
+            while (!vec_vbyte_read(&list1, &delta)) {
+                int getvecret;
+                /* need to read next list location and load it */
+                if ((getvecret 
+                  = getvec(one, vone, buf1, bufsize1, &list1, term, 
+                    termlen)) > 0) {
+
+                    docno1 = -1;
+                } else if (getvecret < 0) {
+                    fprintf(output, "index one lacks occurrances for '");
+                    for (i = 0; i < termlen; i++) {
+                        putc(term[i], output);
+                    }
+                    fprintf(output, "' (%u vs %u)\n", o1, o2);
+                    return 0;
+                } else {
+                    assert(!CRASH);
+                    fprintf(stderr, "failed to get next vector one\n");
+                    return -1;
+                }
+            }
+            bytes = vec_vbyte_read(&list1, &f_dt1); 
+            if (!bytes) {
+                assert(!CRASH);
+                fprintf(stderr, "failed to read from vector one\n");
+                return -1;
+            }
+            f_dt1--;
+            docno1 += delta + 1;
+            wordno1 = -1;
+        }
+        bytes = vec_vbyte_read(&list1, &delta); assert(bytes);
+        if (!bytes) {
+            assert(!CRASH);
+            fprintf(stderr, "failed to read occ from vector one\n");
+            return -1;
+        }
+        wordno1 += delta + 1;
+        occurs1--;
+
+        /* get next occurrance from two */
+        if (!f_dt2--) {
+            while (!vec_vbyte_read(&list2, &delta)) {
+                int getvecret;
+                /* need to read next list location and load it */
+                if (!(getvecret 
+                  = getvec(two, vtwo, buf2, bufsize2, &list2, term, 
+                    termlen))) {
+
+                    assert(!CRASH);
+                    fprintf(stderr, "failed to get next vector two\n");
+                    return -1;
+                } else if (getvecret < 0) {
+                    fprintf(output, "index two lacks occurrances for '");
+                    for (i = 0; i < termlen; i++) {
+                        putc(term[i], output);
+                    }
+                    fprintf(output, "' (%u vs %u)\n", o1, o2);
+                    return 0;
+                }
+                docno2 = -1;
+            }
+            bytes = vec_vbyte_read(&list2, &f_dt2); assert(bytes);
+            if (!bytes) {
+                assert(!CRASH);
+                fprintf(stderr, "failed to read from vector two\n");
+                return -1;
+            }
+            f_dt2--;
+            docno2 += delta + 1;
+            wordno2 = -1;
+        }
+        bytes = vec_vbyte_read(&list2, &delta); assert(bytes);
+        if (!bytes) {
+            assert(!CRASH);
+            fprintf(stderr, "failed to read occ from vector two\n");
+            return -1;
+        }
+        wordno2 += delta + 1;
+        occurs2--;
+
+        if (docno1 == docno2 && f_dt1 == f_dt2 && wordno1 == wordno2) {
+            /* occurrance is the same */
+        } else if (docno1 != docno2) {
+            fprintf(output, "docno's %u and %u differ in '", docno1, docno2);
+            for (i = 0; i < termlen; i++) {
+                putc(term[i], output);
+            }
+            fprintf(output, "'\n");
+            return 0;
+        } else if (f_dt1 != f_dt2) {
+            fprintf(output, "f_dt's %lu and %lu differ in '", f_dt1, f_dt2);
+            for (i = 0; i < termlen; i++) {
+                putc(term[i], output);
+            }
+            fprintf(output, "'\n");
+            return 0;
+        } else {
+            fprintf(output, "wordno's %u and %u differ in '", wordno1, wordno2);
+            for (i = 0; i < termlen; i++) {
+                putc(term[i], output);
+            }
+            fprintf(output, "'\n");
+            return 0;
+        }
+    }
+
+    assert(ret == 1);
+    return 1;
+}
+
+int diff(struct index *one, struct index *two, FILE *output) {
+    const char *term1,
+               *term2;
+    unsigned int termlen1,
+                 termlen2,
+                 discon1 = 0, 
+                 discon2 = 0,
+                 bufsize1 = 0,
+                 bufsize2 = 0,
+                 len1,
+                 len2,
+                 i,
+                 size;
+    int ret = 0;
+    unsigned int state1[3] = {0, 0, 0},
+                 state2[3] = {0, 0, 0};
+    struct vec v1,
+               v2;
+    void *buf1 = NULL,
+         *buf2 = NULL;
+
+    size = docmap_entries(one->map);
+    if (docmap_entries(two->map) < size) {
+        size = docmap_entries(two->map);
+    }
+
+    /* check the document mappings */
+    for (i = 0; i < size; i++) {
+        unsigned int sourcefile1,
+                     sourcefile2,
+                     bytes1,
+                     bytes2,
+                     dwords1,
+                     dwords2,
+                     aux_len1,
+                     aux_len2,
+                     words1,
+                     words2;
+        off_t offset1,
+              offset2;
+        enum docmap_flag flags1,
+                          flags2;
+        enum mime_types mtype1,
+                        mtype2;
+        double weight1,
+               weight2;
+        char aux1[4096], aux2[4096];
+
+        if (docmap_get_location(one->map, i, &sourcefile1, &offset1, 
+              &bytes1, &mtype1, &flags1) != DOCMAP_OK
+          || docmap_get_location(two->map, i, &sourcefile2, &offset2, 
+              &bytes2, &mtype2, &flags2) != DOCMAP_OK
+          || docmap_get_trecno(one->map, i, aux1, sizeof(aux1) - 1, 
+              &aux_len1) != DOCMAP_OK
+          || docmap_get_trecno(two->map, i, aux2, sizeof(aux2) - 1,
+              &aux_len2) != DOCMAP_OK
+          || docmap_get_words(one->map, i, &words1) != DOCMAP_OK
+          || docmap_get_words(two->map, i, &words2) != DOCMAP_OK
+          || docmap_get_distinct_words(one->map, i, &dwords1) != DOCMAP_OK
+          || docmap_get_distinct_words(two->map, i, &dwords2) != DOCMAP_OK
+          || docmap_get_weight(one->map, i, &weight1) != DOCMAP_OK
+          || docmap_get_weight(two->map, i, &weight2) != DOCMAP_OK)
+            return 0;
+
+        aux1[aux_len1] = '\0';
+        aux2[aux_len2] = '\0';
+
+        /* sourcefile and offset are allowed to be different, but the rest must
+         * be the same */
+        if (bytes1 != bytes2) {
+            fprintf(output, "docno %u contains different number of bytes "
+              "(%u and %u) in indexes\n", i, bytes1, bytes2);
+            ret = 1;
+        }
+        if (mtype1 != mtype2) {
+            fprintf(output, "docno %u is of different types "
+              "(%s and %s) in indexes\n", i, mime_string(mtype1),
+              mime_string(mtype2));
+            ret = 1;
+        }
+        if (dwords1 != dwords2) {
+            fprintf(output, "docno %u contains different number of distinct "
+              "words (%u and %u) in indexes\n", i, dwords1, dwords2);
+            ret = 1;
+        }
+        if (words1 != words2) {
+            fprintf(output, "docno %u contains different number of words "
+              "(%u and %u) in indexes\n", i, words1, words2);
+            ret = 1;
+        }
+        if (((aux1 || aux2) && !(aux1 && aux2))  /* logical xor */
+          || (aux1 && (str_cmp(aux1, aux2)))) {
+            fprintf(output, "docno %u contains different auxilliary strings "
+              "('%s' and '%s') in indexes\n", i, 
+              aux1 ? (const char *) aux1 : "(null)", 
+              aux2 ? (const char *) aux2 : "(null)");
+            ret = 1;
+        }
+        if ((weight1 != weight2) 
+          && ((weight1 > (weight2 * 1.05)) || (weight1 < (weight2 * 0.95)))) {
+            fprintf(output, "docno %u contains different weights "
+              "(%f and %f) in indexes\n", i, weight1, weight2);
+            ret = 1;
+        }
+    }
+    /* check number of entries match */
+    if (docmap_entries(one->map) != docmap_entries(two->map)) {
+        fprintf(output, "indexes have different number of documents "
+          "(%lu and %lu)\n", docmap_entries(one->map), 
+          docmap_entries(two->map));
+        ret = 1;
+    }
+    fflush(output);
+
+    /* check the inverted lists */
+    while ((term1 
+        = iobtree_next_term(one->vocab, state1, &termlen1, 
+            (void **) &v1.pos, &len1))
+      && (term2
+        = iobtree_next_term(two->vocab, state2, &termlen2, 
+            (void **) &v2.pos, &len2))) {
+        int vvret;
+
+        v1.end = v1.pos + len1;
+        v2.end = v2.pos + len2;
+
+        if (!str_nncmp(term1, termlen1, term2, termlen2)) {
+            if ((vvret = vvdiff(one, two, &v1, &v2, output, term1, termlen1, 
+                  &discon1, &discon2, &buf1, &bufsize1, &buf2, &bufsize2)) 
+                > 0) {
+
+                /* compared identical */
+            } else if (vvret == 0) {
+                /* differed */
+                ret = 1;
+            } else {
+                /* error */
+                assert(!CRASH);
+                fprintf(stderr, "error while comparing vocab entries for '");
+                for (i = 0; i < termlen1; i++) {
+                    putc(term1[i], stderr);
+                }
+                fprintf(stderr, "'\n");
+                return 1;
+            }
+        } else if (str_nncmp(term1, termlen1, term2, termlen2) < 0) {
+            fprintf(output, "index two lacks term '");
+            for (i = 0; i < termlen1; i++) {
+                putc(term1[i], output);
+            }
+            printf("' (diff stops...)\n");
+            return 1;
+        } else {
+            fprintf(output, "index one lacks term '");
+            for (i = 0; i < termlen2; i++) {
+                putc(term2[i], output);
+            }
+            printf("' (diff stops...)\n");
+            return 1;
+        }
+    }
+
+    if (discon1 || discon2) {
+        printf("informational: %u vs %u discontiguous vectors\n", discon1, 
+          discon2);
+    }
+
+    if (buf1) {
+        free(buf1);
+    }
+    if (buf2) {
+        free(buf2);
+    }
+
+    return ret;
+}
+
+int main(int argc, char **argv) {
+    struct index *one,
+                 *two;
+
+    if (argc != 3) {
+        fprintf(stderr, "usage: %s file1 file2\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    /* open first index */
+    if (!(one = index_load(argv[1], 0, INDEX_LOAD_NOOPT, NULL))) {
+        fprintf(stderr, "couldn't open %s: %s\n", argv[1], strerror(errno));
+        return EXIT_FAILURE;
+    /* open second index */
+    } else if (!(two = index_load(argv[2], 0, INDEX_LOAD_NOOPT, NULL))) {
+        index_delete(one);
+        fprintf(stderr, "couldn't open %s: %s\n", argv[2], strerror(errno));
+        return EXIT_FAILURE;
+    }
+
+    diff(one, two, stdout);
+
+    index_delete(one);
+    index_delete(two);
+    return EXIT_SUCCESS;
+}
+
diff --git a/tools/file.c b/tools/file.c
new file mode 100644 (file)
index 0000000..47edb9c
--- /dev/null
@@ -0,0 +1,47 @@
+/* file.c implements file diagnosis through the mime facility of
+ * the search engine
+ *
+ * written nml 2004-06-11
+ *
+ */
+
+#include "firstinclude.h"
+
+#include "mime.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv) {
+    FILE *fp;
+    char buf[BUFSIZ];
+    unsigned int i,
+                 len;
+    enum mime_types type;
+
+    if (argc < 2) {
+        printf("usage: %s file+\n", *argv);
+        return EXIT_SUCCESS;
+    }
+
+    for (i = 1; i < argc; i++) {
+        if ((fp = fopen(argv[i], "rb"))) {
+            rewind(fp);
+            if ((len = fread(buf, 1, BUFSIZ, fp)) || !ferror(fp)) {
+                type = mime_content_guess(buf, len);
+                printf("%s: %s\n", argv[i], mime_string(type));
+            } else {
+                perror(*argv);
+                fclose(fp);
+                return EXIT_FAILURE;
+            }
+        } else {
+            perror(*argv);
+            return EXIT_FAILURE;
+        }
+    }
+
+    return EXIT_SUCCESS;
+}
+
+
diff --git a/tools/hashtime.c b/tools/hashtime.c
new file mode 100644 (file)
index 0000000..2d990e4
--- /dev/null
@@ -0,0 +1,166 @@
+/* hashtime.c is a small program to time construction and searching of
+ * a chash string hashtable from a file.  Input is two files with
+ * line-seperated strings (no other whitespace), the first of which will be
+ * used for construction, the second which will be used for searching.
+ *
+ * written nml 2005-04-20
+ *
+ */
+
+#include "chash.h"
+#include "str.h"
+#include "bit.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+void replace_endl(char *str, unsigned int len) {
+    unsigned int i;
+
+    for (i = 0; i < len; i++) {
+        if (str[i] == '\n') {
+            str[i] = '\0';
+        }
+    }
+}
+
+int main(int argc, char **argv) {
+    char *fstr,
+         *pos,
+         *end;
+    struct timeval now,
+                   then;
+    FILE *construct,
+         *search;
+    unsigned int construct_len,
+                 search_len,
+                 len,
+                 numfound,
+                 total,
+                 slots,
+                 bits;
+    struct chash *hash;
+    int found;
+    void **dummy;
+    unsigned long int micros;
+
+    if (argc != 4) {
+        fprintf(stderr, "usage: %s constructfile searchfile\n", *argv);
+        return EXIT_FAILURE;
+    }
+
+    bits = bit_log2(atoi(argv[3])) + 1;
+    slots = bit_pow2(bits);
+
+    if (!(construct = fopen(argv[1], "rb"))) {
+        fprintf(stderr, "failed to open file '%s': %s\n", argv[1], 
+          strerror(errno));
+        return EXIT_FAILURE;
+    }
+
+    if (!(search = fopen(argv[2], "rb"))) {
+        fclose(construct);
+        fprintf(stderr, "failed to open file '%s': %s\n", argv[2], 
+          strerror(errno));
+        return EXIT_FAILURE;
+    }
+
+    /* determine lengths of files */
+    fseek(construct, 0, SEEK_END);
+    fseek(search, 0, SEEK_END);
+    if (((construct_len = ftell(construct)) == -1) 
+      || (fseek(construct, 0, SEEK_SET) == -1)
+      || ((search_len = ftell(search)) == -1) 
+      || (fseek(search, 0, SEEK_SET) == -1)) {
+        fclose(construct);
+        fclose(search);
+        fprintf(stderr, "failed to get lengths of files\n");
+        return EXIT_SUCCESS;
+    }
+    printf("%u slots, %u bits\n", slots, bits);
+    printf("construct: %s, %u bytes\nsearch: %s, %u bytes\n", argv[1], 
+      construct_len, argv[2], search_len);
+
+    /* get enough memory to hold either */
+    if (!(fstr = malloc(construct_len > search_len 
+        ? construct_len : search_len))) {
+        fclose(construct);
+        fclose(search);
+        fprintf(stderr, "failed to get %u memory\n", 
+          construct_len > search_len ? construct_len : search_len);
+        return EXIT_SUCCESS;
+    }
+
+    /* read construction file */
+    fread(fstr, construct_len, 1, construct);
+    replace_endl(fstr, construct_len);
+
+    /* construct a hashtable from it */
+
+    /* timings start */
+    gettimeofday(&then, NULL);
+    hash = chash_str_new(bits, 100000.0, str_nhash);
+
+    pos = fstr;
+    total = 0;
+    numfound = 0;
+    end = fstr + construct_len;
+    while ((pos < end) && (len = str_len(pos))) {
+        chash_nstr_ptr_find_insert(hash, pos, len, &dummy, NULL, &found);
+        pos += len + 1;
+        numfound += found;
+        total++;
+    }
+
+    gettimeofday(&now, NULL);
+    printf("construction: %u strings used, %u unique inserted in ", total, 
+      total - numfound);
+    micros = now.tv_usec - then.tv_usec + (now.tv_sec - then.tv_sec) * 1000000;
+    printf("%f seconds (%lu microseconds)\n", micros / 1000000.0, micros);
+
+    /* now search using search file */
+    fread(fstr, search_len, 1, search);
+    replace_endl(fstr, search_len);
+
+    /* timings start */
+    gettimeofday(&then, NULL);
+
+    pos = fstr;
+    end = fstr + search_len;
+    while ((pos < end) && (len = str_len(pos))) {
+        chash_nstr_ptr_find(hash, pos, len, &dummy);
+        pos += len + 1;
+    }
+
+    gettimeofday(&now, NULL);
+
+    /* do it again to count how many we found */
+    pos = fstr;
+    total = 0;
+    numfound = 0;
+    while ((pos < end) && (len = str_len(pos))) {
+        enum chash_ret ret = chash_nstr_ptr_find(hash, pos, len, &dummy);
+        assert(ret == CHASH_OK || ret == CHASH_ENOENT);
+        pos += len + 1;
+        numfound += found;
+        total++;
+        ret = CHASH_OK; /* to stop compiler whining about unused variable */
+    }
+
+    gettimeofday(&now, NULL);
+    printf("search: %u strings used, %u found in ", total, numfound);
+    micros = now.tv_usec - then.tv_usec + (now.tv_sec - then.tv_sec) * 1000000;
+    printf("%f seconds (%lu microseconds)\n", micros / 1000000.0, micros);
+
+    chash_delete(hash);
+    free(fstr);
+    fclose(construct);
+    fclose(search);
+
+    return EXIT_SUCCESS;
+}
+
diff --git a/tools/impactify.c b/tools/impactify.c
new file mode 100644 (file)
index 0000000..327add7
--- /dev/null
@@ -0,0 +1,45 @@
+/* impactify.c adds impact-ordered inverted lists to index.
+ *
+ * written wew 2005-01-19
+ */
+
+#include "firstinclude.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "index.h"
+#include "impact_build.h"
+#include "error.h"
+
+int main(int argc, char ** argv) {
+    char * name;
+    /* will be options later. */
+    /*double pivot = DEFAULT_PIVOT;
+    double slope = DEFAULT_SLOPE;
+    unsigned int quant_bits = DEFAULT_QUANT_BITS; */
+    enum impact_ret impact_ret;
+    struct index * index;
+    struct index_load_opt lopt;
+
+    if (argc != 2) {
+        fprintf(stderr, "Usage: %s <index-prefix>\n", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    memset(&lopt, 0, sizeof(lopt));
+
+    name = argv[1];
+    index = index_load(name, 0, INDEX_LOAD_NOOPT, &lopt);
+    if (index == NULL) {
+        fprintf(stderr, "Error loading index with prefix '%s'\n", name);
+        exit(EXIT_FAILURE);
+    }
+    impact_ret = impact_order_index(index);
+    if (impact_ret != IMPACT_OK) {
+        ERROR1("impactification of %s failed", name);
+        exit(EXIT_FAILURE);
+    }
+    return EXIT_SUCCESS;
+}
diff --git a/txt/README b/txt/README
new file mode 100644 (file)
index 0000000..c317eb4
--- /dev/null
@@ -0,0 +1,14 @@
+moby.txt contains the full text of Herman Melville's
+"Moby Dick; or The Whale" (1851), converted into TREC
+format, with each paragraph forming a document.  We use a
+CHAPTER, PARAGRAPH heading in place of the TREC document
+number.  It can be indexed with a command similar to:
+
+  zet -i -t TREC moby.txt
+
+and then, from the same directory,
+
+  zet -q capitalise
+
+to run queries and get document summaries in the results,
+with query terms highlighted by capitalisation.
diff --git a/txt/moby.txt b/txt/moby.txt
new file mode 100644 (file)
index 0000000..4eb8e04
--- /dev/null
@@ -0,0 +1,27486 @@
+<DOC>
+<DOCNO>Chapter 0, Paragraph 0</DOCNO>
+ETYMOLOGY.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 1</DOCNO>
+(Supplied by a Late Consumptive Usher to a Grammar School)
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 2</DOCNO>
+The pale Usher--threadbare in coat, heart, body, and brain; I see him
+now.  He was ever dusting his old lexicons and grammars, with a queer
+handkerchief, mockingly embellished with all the gay flags of all the
+known nations of the world.  He loved to dust his old grammars; it
+somehow mildly reminded him of his mortality.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 3</DOCNO>
+"While you take in hand to school others, and to teach them by what
+name a whale-fish is to be called in our tongue leaving out, through
+ignorance, the letter H, which almost alone maketh the signification
+of the word, you deliver that which is not true." --HACKLUYT
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 4</DOCNO>
+"WHALE. ... Sw. and Dan. HVAL.  This animal is named from roundness
+or rolling; for in Dan. HVALT is arched or vaulted." --WEBSTER'S
+DICTIONARY
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 5</DOCNO>
+"WHALE. ... It is more immediately from the Dut. and Ger. WALLEN;
+A.S. WALW-IAN, to roll, to wallow." --RICHARDSON'S DICTIONARY
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 6</DOCNO>
+KETOS,               GREEK.
+CETUS,               LATIN.
+WHOEL,               ANGLO-SAXON.
+HVALT,               DANISH.
+WAL,                 DUTCH.
+HWAL,                SWEDISH.
+WHALE,               ICELANDIC.
+WHALE,               ENGLISH.
+BALEINE,             FRENCH.
+BALLENA,             SPANISH.
+PEKEE-NUEE-NUEE,     FEGEE.
+PEKEE-NUEE-NUEE,     ERROMANGOAN.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 7</DOCNO>
+EXTRACTS (Supplied by a Sub-Sub-Librarian).
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 8</DOCNO>
+It will be seen that this mere painstaking burrower and grub-worm of
+a poor devil of a Sub-Sub appears to have gone through the long
+Vaticans and street-stalls of the earth, picking up whatever random
+allusions to whales he could anyways find in any book whatsoever,
+sacred or profane.  Therefore you must not, in every case at least,
+take the higgledy-piggledy whale statements, however authentic, in
+these extracts, for veritable gospel cetology.  Far from it.  As
+touching the ancient authors generally, as well as the poets here
+appearing, these extracts are solely valuable or entertaining, as
+affording a glancing bird's eye view of what has been promiscuously
+said, thought, fancied, and sung of Leviathan, by many nations and
+generations, including our own.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 9</DOCNO>
+So fare thee well, poor devil of a Sub-Sub, whose commentator I am.
+Thou belongest to that hopeless, sallow tribe which no wine of this
+world will ever warm; and for whom even Pale Sherry would be too
+rosy-strong; but with whom one sometimes loves to sit, and feel
+poor-devilish, too; and grow convivial upon tears; and say to them
+bluntly, with full eyes and empty glasses, and in not altogether
+unpleasant sadness--Give it up, Sub-Subs!  For by how much the more
+pains ye take to please the world, by so much the more shall ye for
+ever go thankless!  Would that I could clear out Hampton Court and
+the Tuileries for ye!  But gulp down your tears and hie aloft to the
+royal-mast with your hearts; for your friends who have gone before
+are clearing out the seven-storied heavens, and making refugees of
+long-pampered Gabriel, Michael, and Raphael, against your coming.
+Here ye strike but splintered hearts together--there, ye shall strike
+unsplinterable glasses!
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 10</DOCNO>
+EXTRACTS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 11</DOCNO>
+"And God created great whales." --GENESIS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 12</DOCNO>
+"Leviathan maketh a path to shine after him; One would think the deep
+to be hoary." --JOB.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 13</DOCNO>
+"Now the Lord had prepared a great fish to swallow up Jonah."
+--JONAH.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 14</DOCNO>
+"There go the ships; there is that Leviathan whom thou hast made to
+play therein." --PSALMS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 15</DOCNO>
+"In that day, the Lord with his sore, and great, and strong sword,
+shall punish Leviathan the piercing serpent, even Leviathan that
+crooked serpent; and he shall slay the dragon that is in the sea."
+--ISAIAH
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 16</DOCNO>
+"And what thing soever besides cometh within the chaos of this
+monster's mouth, be it beast, boat, or stone, down it goes all
+incontinently that foul great swallow of his, and perisheth in the
+bottomless gulf of his paunch." --HOLLAND'S PLUTARCH'S MORALS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 17</DOCNO>
+"The Indian Sea breedeth the most and the biggest fishes that are:
+among which the Whales and Whirlpooles called Balaene, take up as
+much in length as four acres or arpens of land." --HOLLAND'S PLINY.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 18</DOCNO>
+"Scarcely had we proceeded two days on the sea, when about sunrise a
+great many Whales and other monsters of the sea, appeared.  Among the
+former, one was of a most monstrous size. ...  This came towards us,
+open-mouthed, raising the waves on all sides, and beating the sea
+before him into a foam." --TOOKE'S LUCIAN.  "THE TRUE HISTORY."
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 19</DOCNO>
+"He visited this country also with a view of catching horse-whales,
+which had bones of very great value for their teeth, of which he
+brought some to the king. ...  The best whales were catched in his
+own country, of which some were forty-eight, some fifty yards long.
+He said that he was one of six who had killed sixty in two days."
+--OTHER OR OCTHER'S VERBAL NARRATIVE TAKEN DOWN FROM HIS MOUTH BY
+KING ALFRED, A.D. 890.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 20</DOCNO>
+"And whereas all the other things, whether beast or vessel, that
+enter into the dreadful gulf of this monster's (whale's) mouth, are
+immediately lost and swallowed up, the sea-gudgeon retires into it in
+great security, and there sleeps." --MONTAIGNE.  --APOLOGY FOR
+RAIMOND SEBOND.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 21</DOCNO>
+"Let us fly, let us fly!  Old Nick take me if is not Leviathan
+described by the noble prophet Moses in the life of patient Job."
+--RABELAIS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 22</DOCNO>
+"This whale's liver was two cartloads." --STOWE'S ANNALS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 23</DOCNO>
+"The great Leviathan that maketh the seas to seethe like boiling
+pan." --LORD BACON'S VERSION OF THE PSALMS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 24</DOCNO>
+"Touching that monstrous bulk of the whale or ork we have received
+nothing certain.  They grow exceeding fat, insomuch that an
+incredible quantity of oil will be extracted out of one whale."
+--IBID.  "HISTORY OF LIFE AND DEATH."
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 25</DOCNO>
+"The sovereignest thing on earth is parmacetti for an inward bruise."
+--KING HENRY.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 26</DOCNO>
+"Very like a whale." --HAMLET.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 27</DOCNO>
+"Which to secure, no skill of leach's art
+Mote him availle, but to returne againe
+To his wound's worker, that with lowly dart,
+Dinting his breast, had bred his restless paine,
+Like as the wounded whale to shore flies thro' the maine."
+--THE FAERIE QUEEN.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 28</DOCNO>
+"Immense as whales, the motion of whose vast bodies can in a peaceful
+calm trouble the ocean til it boil." --SIR WILLIAM DAVENANT.  PREFACE
+TO GONDIBERT.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 29</DOCNO>
+"What spermacetti is, men might justly doubt, since the learned
+Hosmannus in his work of thirty years, saith plainly, Nescio quid
+sit." --SIR T. BROWNE.  OF SPERMA CETI AND THE SPERMA CETI WHALE.
+VIDE HIS V. E.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 30</DOCNO>
+"Like Spencer's Talus with his modern flail
+He threatens ruin with his ponderous tail.
+...
+Their fixed jav'lins in his side he wears,
+And on his back a grove of pikes appears." --WALLER'S BATTLE OF THE
+SUMMER ISLANDS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 31</DOCNO>
+"By art is created that great Leviathan, called a Commonwealth or
+State--(in Latin, Civitas) which is but an artificial man." --OPENING
+SENTENCE OF HOBBES'S LEVIATHAN.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 32</DOCNO>
+"Silly Mansoul swallowed it without chewing, as if it had been a
+sprat in the mouth of a whale." --PILGRIM'S PROGRESS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 33</DOCNO>
+"That sea beast
+Leviathan, which God of all his works
+Created hugest that swim the ocean stream." --PARADISE LOST.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 34</DOCNO>
+---"There Leviathan,
+Hugest of living creatures, in the deep
+Stretched like a promontory sleeps or swims,
+And seems a moving land; and at his gills
+Draws in, and at his breath spouts out a sea." --IBID.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 35</DOCNO>
+"The mighty whales which swim in a sea of water, and have a sea of
+oil swimming in them." --FULLLER'S PROFANE AND HOLY STATE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 36</DOCNO>
+"So close behind some promontory lie
+The huge Leviathan to attend their prey,
+And give no chance, but swallow in the fry,
+Which through their gaping jaws mistake the way."
+--DRYDEN'S ANNUS MIRABILIS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 37</DOCNO>
+"While the whale is floating at the stern of the ship, they cut off
+his head, and tow it with a boat as near the shore as it will come;
+but it will be aground in twelve or thirteen feet water." --THOMAS
+EDGE'S TEN VOYAGES TO SPITZBERGEN, IN PURCHAS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 38</DOCNO>
+"In their way they saw many whales sporting in the ocean, and in
+wantonness fuzzing up the water through their pipes and vents, which
+nature has placed on their shoulders." --SIR T. HERBERT'S VOYAGES
+INTO ASIA AND AFRICA.  HARRIS COLL.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 39</DOCNO>
+"Here they saw such huge troops of whales, that they were forced to
+proceed with a great deal of caution for fear they should run their
+ship upon them." --SCHOUTEN'S SIXTH CIRCUMNAVIGATION.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 40</DOCNO>
+"We set sail from the Elbe, wind N.E. in the ship called The
+Jonas-in-the-Whale. ...  Some say the whale can't open his mouth, but
+that is a fable. ...  They frequently climb up the masts to see
+whether they can see a whale, for the first discoverer has a ducat
+for his pains. ...  I was told of a whale taken near Shetland, that
+had above a barrel of herrings in his belly. ...  One of our
+harpooneers told me that he caught once a whale in Spitzbergen that
+was white all over." --A VOYAGE TO GREENLAND, A.D. 1671 HARRIS COLL.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 41</DOCNO>
+"Several whales have come in upon this coast (Fife) Anno 1652, one
+eighty feet in length of the whale-bone kind came in, which (as I was
+informed), besides a vast quantity of oil, did afford 500 weight of
+baleen.  The jaws of it stand for a gate in the garden of Pitferren."
+--SIBBALD'S FIFE AND KINROSS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 42</DOCNO>
+"Myself have agreed to try whether I can master and kill this
+Sperma-ceti whale, for I could never hear of any of that sort that
+was killed by any man, such is his fierceness and swiftness."
+--RICHARD STRAFFORD'S LETTER FROM THE BERMUDAS.  PHIL. TRANS.  A.D.
+1668.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 43</DOCNO>
+"Whales in the sea God's voice obey." --N. E. PRIMER.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 44</DOCNO>
+"We saw also abundance of large whales, there being more in those
+southern seas, as I may say, by a hundred to one; than we have to the
+northward of us." --CAPTAIN COWLEY'S VOYAGE ROUND THE GLOBE, A.D.
+1729.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 45</DOCNO>
+"... and the breath of the whale is frequendy attended with such an
+insupportable smell, as to bring on a disorder of the brain."
+--ULLOA'S SOUTH AMERICA.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 46</DOCNO>
+"To fifty chosen sylphs of special note,
+We trust the important charge, the petticoat.
+Oft have we known that seven-fold fence to fail,
+Tho' stuffed with hoops and armed with ribs of whale." --RAPE
+OF THE LOCK.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 47</DOCNO>
+"If we compare land animals in respect to magnitude, with those that
+take up their abode in the deep, we shall find they will appear
+contemptible in the comparison.  The whale is doubtless the largest
+animal in creation." --GOLDSMITH, NAT. HIST.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 48</DOCNO>
+"If you should write a fable for little fishes, you would make them
+speak like great wales." --GOLDSMITH TO JOHNSON.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 49</DOCNO>
+"In the afternoon we saw what was supposed to be a rock, but it was
+found to be a dead whale, which some Asiatics had killed, and were
+then towing ashore.  They seemed to endeavor to conceal themselves
+behind the whale, in order to avoid being seen by us." --COOK'S
+VOYAGES.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 50</DOCNO>
+"The larger whales, they seldom venture to attack.  They stand in so
+great dread of some of them, that when out at sea they are afraid to
+mention even their names, and carry dung, lime-stone, juniper-wood,
+and some other articles of the same nature in their boats, in order
+to terrify and prevent their too near approach." --UNO VON TROIL'S
+LETTERS ON BANKS'S AND SOLANDER'S VOYAGE TO ICELAND IN 1772.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 51</DOCNO>
+"The Spermacetti Whale found by the Nantuckois, is an active, fierce
+animal, and requires vast address and boldness in the fishermen."
+--THOMAS JEFFERSON'S WHALE MEMORIAL TO THE FRENCH MINISTER IN 1778.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 52</DOCNO>
+"And pray, sir, what in the world is equal to it?" --EDMUND BURKE'S
+REFERENCE IN PARLIAMENT TO THE NANTUCKET WHALE-FISHERY.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 53</DOCNO>
+"Spain--a great whale stranded on the shores of Europe." --EDMUND
+BURKE. (SOMEWHERE.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 54</DOCNO>
+"A tenth branch of the king's ordinary revenue, said to be grounded
+on the consideration of his guarding and protecting the seas from
+pirates and robbers, is the right to royal fish, which are whale and
+sturgeon.  And these, when either thrown ashore or caught near the
+coast, are the property of the king." --BLACKSTONE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 55</DOCNO>
+"Soon to the sport of death the crews repair:
+Rodmond unerring o'er his head suspends
+The barbed steel, and every turn attends."
+--FALCONER'S SHIPWRECK.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 56</DOCNO>
+"Bright shone the roofs, the domes, the spires,
+And rockets blew self driven,
+To hang their momentary fire
+Around the vault of heaven.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 57</DOCNO>
+"So fire with water to compare,
+The ocean serves on high,
+Up-spouted by a whale in air,
+To express unwieldy joy." --COWPER, ON THE QUEEN'S
+VISIT TO LONDON.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 58</DOCNO>
+"Ten or fifteen gallons of blood are thrown out of the heart at a
+stroke, with immense velocity." --JOHN HUNTER'S ACCOUNT OF THE
+DISSECTION OF A WHALE.  (A SMALL SIZED ONE.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 59</DOCNO>
+"The aorta of a whale is larger in the bore than the main pipe of the
+water-works at London Bridge, and the water roaring in its passage
+through that pipe is inferior in impetus and velocity to the blood
+gushing from the whale's heart." --PALEY'S THEOLOGY.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 60</DOCNO>
+"The whale is a mammiferous animal without hind feet." --BARON
+CUVIER.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 61</DOCNO>
+"In 40 degrees south, we saw Spermacetti Whales, but did not take any
+till the first of May, the sea being then covered with them."
+--COLNETT'S VOYAGE FOR THE PURPOSE OF EXTENDING THE SPERMACETI WHALE
+FISHERY.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 62</DOCNO>
+"In the free element beneath me swam,
+Floundered and dived, in play, in chace, in battle,
+Fishes of every colour, form, and kind;
+Which language cannot paint, and mariner
+Had never seen; from dread Leviathan
+To insect millions peopling every wave:
+Gather'd in shoals immense, like floating islands,
+Led by mysterious instincts through that waste
+And trackless region, though on every side
+Assaulted by voracious enemies,
+Whales, sharks, and monsters, arm'd in front or jaw,
+With swords, saws, spiral horns, or hooked fangs."
+--MONTGOMERY'S WORLD BEFORE THE FLOOD.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 63</DOCNO>
+"Io!  Paean!  Io! sing.
+To the finny people's king.
+Not a mightier whale than this
+In the vast Atlantic is;
+Not a fatter fish than he,
+Flounders round the Polar Sea." --CHARLES LAMB'S TRIUMPH OF THE
+WHALE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 64</DOCNO>
+"In the year 1690 some persons were on a high hill observing the
+whales spouting and sporting with each other, when one observed:
+there--pointing to the sea--is a green pasture where our children's
+grand-children will go for bread." --OBED MACY'S HISTORY OF
+NANTUCKET.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 65</DOCNO>
+"I built a cottage for Susan and myself and made a gateway in the
+form of a Gothic Arch, by setting up a whale's jaw bones."
+--HAWTHORNE'S TWICE TOLD TALES.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 66</DOCNO>
+"She came to bespeak a monument for her first love, who had been
+killed by a whale in the Pacific ocean, no less than forty years
+ago." --IBID.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 67</DOCNO>
+"No, Sir, 'tis a Right Whale," answered Tom; "I saw his sprout; he
+threw up a pair of as pretty rainbows as a Christian would wish to
+look at.  He's a raal oil-butt, that fellow!" --COOPER'S PILOT.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 68</DOCNO>
+"The papers were brought in, and we saw in the Berlin Gazette that
+whales had been introduced on the stage there." --ECKERMANN'S
+CONVERSATIONS WITH GOETHE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 69</DOCNO>
+"My God!  Mr. Chace, what is the matter?"  I answered, "we have been
+stove by a whale." --"NARRATIVE OF THE SHIPWRECK OF THE WHALE SHIP
+ESSEX OF NANTUCKET, WHICH WAS ATTACKED AND FINALLY DESTROYED BY A
+LARGE SPERM WHALE IN THE PACIFIC OCEAN."  BY OWEN CHACE OF NANTUCKET,
+FIRST MATE OF SAID VESSEL.  NEW YORK, 1821.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 70</DOCNO>
+"A mariner sat in the shrouds one night,
+The wind was piping free;
+Now bright, now dimmed, was the moonlight pale,
+And the phospher gleamed in the wake of the whale,
+As it floundered in the sea." --ELIZABETH OAKES SMITH.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 71</DOCNO>
+"The quantity of line withdrawn from the boats engaged in the capture
+of this one whale, amounted altogether to 10,440 yards or nearly six
+English miles. ...
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 72</DOCNO>
+"Sometimes the whale shakes its tremendous tail in the air, which,
+cracking like a whip, resounds to the distance of three or four
+miles." --SCORESBY.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 73</DOCNO>
+"Mad with the agonies he endures from these fresh attacks, the
+infuriated Sperm Whale rolls over and over; he rears his enormous
+head, and with wide expanded jaws snaps at everything around him; he
+rushes at the boats with his head; they are propelled before him with
+vast swiftness, and sometimes utterly destroyed. ...  It is a matter
+of great astonishment that the consideration of the habits of so
+interesting, and, in a commercial point of view, so important an
+animal (as the Sperm Whale) should have been so entirely neglected,
+or should have excited so little curiosity among the numerous, and
+many of them competent observers, that of late years, must have
+possessed the most abundant and the most convenient opportunities of
+witnessing their habitudes." --THOMAS BEALE'S HISTORY OF THE SPERM
+WHALE, 1839.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 74</DOCNO>
+"The Cachalot" (Sperm Whale) "is not only better armed than the True
+Whale" (Greenland or Right Whale) "in possessing a formidable weapon
+at either extremity of its body, but also more frequently displays a
+disposition to employ these weapons offensively and in manner at once
+so artful, bold, and mischievous, as to lead to its being regarded as
+the most dangerous to attack of all the known species of the whale
+tribe." --FREDERICK DEBELL BENNETT'S WHALING VOYAGE ROUND THE GLOBE,
+1840.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 75</DOCNO>
+October 13.  "There she blows," was sung out from the mast-head.
+"Where away?" demanded the captain.
+"Three points off the lee bow, sir."
+"Raise up your wheel.  Steady!"  "Steady, sir."
+"Mast-head ahoy!  Do you see that whale now?"
+"Ay ay, sir!  A shoal of Sperm Whales!  There she blows!  There she
+breaches!"
+"Sing out! sing out every time!"
+"Ay Ay, sir!  There she blows! there--there--THAR she
+blows--bowes--bo-o-os!"
+"How far off?"
+"Two miles and a half."
+"Thunder and lightning! so near!  Call all hands." --J. ROSS BROWNE'S
+ETCHINGS OF A WHALING CRUIZE.  1846.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 76</DOCNO>
+"The Whale-ship Globe, on board of which vessel occurred the horrid
+transactions we are about to relate, belonged to the island of
+Nantucket." --"NARRATIVE OF THE GLOBE," BY LAY AND HUSSEY SURVIVORS.
+A.D. 1828.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 77</DOCNO>
+Being once pursued by a whale which he had wounded, he parried the
+assault for some time with a lance; but the furious monster at length
+rushed on the boat; himself and comrades only being preserved by
+leaping into the water when they saw the onset was inevitable."
+--MISSIONARY JOURNAL OF TYERMAN AND BENNETT.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 78</DOCNO>
+"Nantucket itself," said Mr. Webster, "is a very striking and
+peculiar portion of the National interest.  There is a population of
+eight or nine thousand persons living here in the sea, adding largely
+every year to the National wealth by the boldest and most persevering
+industry." --REPORT OF DANIEL WEBSTER'S SPEECH IN THE U.  S.  SENATE,
+ON THE APPLICATION FOR THE ERECTION OF A BREAKWATER AT NANTUCKET.
+1828.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 79</DOCNO>
+"The whale fell directly over him, and probably killed him in a
+moment." --"THE WHALE AND HIS CAPTORS, OR THE WHALEMAN'S ADVENTURES
+AND THE WHALE'S BIOGRAPHY, GATHERED ON THE HOMEWARD CRUISE OF THE
+COMMODORE PREBLE."  BY REV. HENRY T. CHEEVER.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 80</DOCNO>
+"If you make the least damn bit of noise," replied Samuel, "I will
+send you to hell." --LIFE OF SAMUEL COMSTOCK (THE MUTINEER), BY HIS
+BROTHER, WILLIAM COMSTOCK.  ANOTHER VERSION OF THE WHALE-SHIP GLOBE
+NARRATIVE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 81</DOCNO>
+"The voyages of the Dutch and English to the Northern Ocean, in
+order, if possible, to discover a passage through it to India, though
+they failed of their main object, laid-open the haunts of the whale."
+--MCCULLOCH'S COMMERCIAL DICTIONARY.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 82</DOCNO>
+"These things are reciprocal; the ball rebounds, only to bound
+forward again; for now in laying open the haunts of the whale, the
+whalemen seem to have indirectly hit upon new clews to that same
+mystic North-West Passage." --FROM "SOMETHING" UNPUBLISHED.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 83</DOCNO>
+"It is impossible to meet a whale-ship on the ocean without being
+struck by her near appearance.  The vessel under short sail, with
+look-outs at the mast-heads, eagerly scanning the wide expanse around
+them, has a totally different air from those engaged in regular
+voyage." --CURRENTS AND WHALING.  U.S. EX. EX.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 84</DOCNO>
+"Pedestrians in the vicinity of London and elsewhere may recollect
+having seen large curved bones set upright in the earth, either to
+form arches over gateways, or entrances to alcoves, and they may
+perhaps have been told that these were the ribs of whales." --TALES
+OF A WHALE VOYAGER TO THE ARCTIC OCEAN.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 85</DOCNO>
+"It was not till the boats returned from the pursuit of these whales,
+that the whites saw their ship in bloody possession of the savages
+enrolled among the crew." --NEWSPAPER ACCOUNT OF THE TAKING AND
+RETAKING OF THE WHALE-SHIP HOBOMACK.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 86</DOCNO>
+"It is generally well known that out of the crews of Whaling vessels
+(American) few ever return in the ships on board of which they
+departed." --CRUISE IN A WHALE BOAT.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 87</DOCNO>
+"Suddenly a mighty mass emerged from the water, and shot up
+perpendicularly into the air.  It was the while." --MIRIAM COFFIN OR
+THE WHALE FISHERMAN.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 88</DOCNO>
+"The Whale is harpooned to be sure; but bethink you, how you would
+manage a powerful unbroken colt, with the mere appliance of a rope
+tied to the root of his tail." --A CHAPTER ON WHALING IN RIBS AND
+TRUCKS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 89</DOCNO>
+"On one occasion I saw two of these monsters (whales) probably male
+and female, slowly swimming, one after the other, within less than a
+stone's throw of the shore" (Terra Del Fuego), "over which the beech
+tree extended its branches." --DARWIN'S VOYAGE OF A NATURALIST.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 90</DOCNO>
+"'Stern all!' exclaimed the mate, as upon turning his head, he saw
+the distended jaws of a large Sperm Whale close to the head of the
+boat, threatening it with instant destruction;--'Stern all, for your
+lives!'" --WHARTON THE WHALE KILLER.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 91</DOCNO>
+"So be cheery, my lads, let your hearts never fail,
+While the bold harpooneer is striking the whale!" --NANTUCKET SONG.
+</DOC>
+<DOC>
+<DOCNO>Chapter 0, Paragraph 92</DOCNO>
+"Oh, the rare old Whale, mid storm and gale
+In his ocean home will be
+A giant in might, where might is right,
+And King of the boundless sea." --WHALE SONG.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 1</DOCNO>
+Loomings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 2</DOCNO>
+Call me Ishmael.  Some years ago--never mind how long
+precisely--having little or no money in my purse, and nothing
+particular to interest me on shore, I thought I would sail about a
+little and see the watery part of the world.  It is a way I have of
+driving off the spleen and regulating the circulation.  Whenever I
+find myself growing grim about the mouth; whenever it is a damp,
+drizzly November in my soul; whenever I find myself involuntarily
+pausing before coffin warehouses, and bringing up the rear of every
+funeral I meet; and especially whenever my hypos get such an upper
+hand of me, that it requires a strong moral principle to prevent me
+from deliberately stepping into the street, and methodically knocking
+people's hats off--then, I account it high time to get to sea as soon
+as I can.  This is my substitute for pistol and ball.  With a
+philosophical flourish Cato throws himself upon his sword; I quietly
+take to the ship.  There is nothing surprising in this.  If they but
+knew it, almost all men in their degree, some time or other, cherish
+very nearly the same feelings towards the ocean with me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 3</DOCNO>
+There now is your insular city of the Manhattoes, belted round by
+wharves as Indian isles by coral reefs--commerce surrounds it with
+her surf.  Right and left, the streets take you waterward.  Its
+extreme downtown is the battery, where that noble mole is washed by
+waves, and cooled by breezes, which a few hours previous were out of
+sight of land.  Look at the crowds of water-gazers there.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 4</DOCNO>
+Circumambulate the city of a dreamy Sabbath afternoon.  Go from
+Corlears Hook to Coenties Slip, and from thence, by Whitehall,
+northward.  What do you see?--Posted like silent sentinels all around
+the town, stand thousands upon thousands of mortal men fixed in ocean
+reveries.  Some leaning against the spiles; some seated upon the
+pier-heads; some looking over the bulwarks of ships from China; some
+high aloft in the rigging, as if striving to get a still better
+seaward peep.  But these are all landsmen; of week days pent up in
+lath and plaster--tied to counters, nailed to benches, clinched to
+desks.  How then is this?  Are the green fields gone?  What do they
+here?
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 5</DOCNO>
+But look! here come more crowds, pacing straight for the water, and
+seemingly bound for a dive.  Strange!  Nothing will content them but
+the extremest limit of the land; loitering under the shady lee of
+yonder warehouses will not suffice.  No.  They must get just as nigh
+the water as they possibly can without falling in.  And there they
+stand--miles of them--leagues.  Inlanders all, they come from lanes
+and alleys, streets and avenues--north, east, south, and west.  Yet
+here they all unite.  Tell me, does the magnetic virtue of the
+needles of the compasses of all those ships attract them thither?
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 6</DOCNO>
+Once more.  Say you are in the country; in some high land of lakes.
+Take almost any path you please, and ten to one it carries you down
+in a dale, and leaves you there by a pool in the stream.  There is
+magic in it.  Let the most absent-minded of men be plunged in his
+deepest reveries--stand that man on his legs, set his feet a-going,
+and he will infallibly lead you to water, if water there be in all
+that region.  Should you ever be athirst in the great American
+desert, try this experiment, if your caravan happen to be supplied
+with a metaphysical professor.  Yes, as every one knows, meditation
+and water are wedded for ever.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 7</DOCNO>
+But here is an artist.  He desires to paint you the dreamiest,
+shadiest, quietest, most enchanting bit of romantic landscape in all
+the valley of the Saco.  What is the chief element he employs?  There
+stand his trees, each with a hollow trunk, as if a hermit and a
+crucifix were within; and here sleeps his meadow, and there sleep his
+cattle; and up from yonder cottage goes a sleepy smoke.  Deep into
+distant woodlands winds a mazy way, reaching to overlapping spurs of
+mountains bathed in their hill-side blue.  But though the picture
+lies thus tranced, and though this pine-tree shakes down its sighs
+like leaves upon this shepherd's head, yet all were vain, unless the
+shepherd's eye were fixed upon the magic stream before him.  Go visit
+the Prairies in June, when for scores on scores of miles you wade
+knee-deep among Tiger-lilies--what is the one charm
+wanting?--Water--there is not a drop of water there!  Were Niagara
+but a cataract of sand, would you travel your thousand miles to see
+it?  Why did the poor poet of Tennessee, upon suddenly receiving two
+handfuls of silver, deliberate whether to buy him a coat, which he
+sadly needed, or invest his money in a pedestrian trip to Rockaway
+Beach?  Why is almost every robust healthy boy with a robust healthy
+soul in him, at some time or other crazy to go to sea?  Why upon your
+first voyage as a passenger, did you yourself feel such a mystical
+vibration, when first told that you and your ship were now out of
+sight of land?  Why did the old Persians hold the sea holy?  Why did
+the Greeks give it a separate deity, and own brother of Jove?  Surely
+all this is not without meaning.  And still deeper the meaning of
+that story of Narcissus, who because he could not grasp the
+tormenting, mild image he saw in the fountain, plunged into it and
+was drowned.  But that same image, we ourselves see in all rivers and
+oceans.  It is the image of the ungraspable phantom of life; and this
+is the key to it all.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 8</DOCNO>
+Now, when I say that I am in the habit of going to sea whenever I
+begin to grow hazy about the eyes, and begin to be over conscious of
+my lungs, I do not mean to have it inferred that I ever go to sea as
+a passenger.  For to go as a passenger you must needs have a purse,
+and a purse is but a rag unless you have something in it.  Besides,
+passengers get sea-sick--grow quarrelsome--don't sleep of nights--do
+not enjoy themselves much, as a general thing;--no, I never go as a
+passenger; nor, though I am something of a salt, do I ever go to sea
+as a Commodore, or a Captain, or a Cook.  I abandon the glory and
+distinction of such offices to those who like them.  For my part, I
+abominate all honourable respectable toils, trials, and tribulations
+of every kind whatsoever.  It is quite as much as I can do to take
+care of myself, without taking care of ships, barques, brigs,
+schooners, and what not.  And as for going as cook,--though I confess
+there is considerable glory in that, a cook being a sort of officer
+on ship-board--yet, somehow, I never fancied broiling fowls;--though
+once broiled, judiciously buttered, and judgmatically salted and
+peppered, there is no one who will speak more respectfully, not to
+say reverentially, of a broiled fowl than I will.  It is out of the
+idolatrous dotings of the old Egyptians upon broiled ibis and roasted
+river horse, that you see the mummies of those creatures in their
+huge bake-houses the pyramids.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 9</DOCNO>
+No, when I go to sea, I go as a simple sailor, right before the mast,
+plumb down into the forecastle, aloft there to the royal mast-head.
+True, they rather order me about some, and make me jump from spar to
+spar, like a grasshopper in a May meadow.  And at first, this sort of
+thing is unpleasant enough.  It touches one's sense of honour,
+particularly if you come of an old established family in the land,
+the Van Rensselaers, or Randolphs, or Hardicanutes.  And more than
+all, if just previous to putting your hand into the tar-pot, you have
+been lording it as a country schoolmaster, making the tallest boys
+stand in awe of you.  The transition is a keen one, I assure you,
+from a schoolmaster to a sailor, and requires a strong decoction of
+Seneca and the Stoics to enable you to grin and bear it.  But even
+this wears off in time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 10</DOCNO>
+What of it, if some old hunks of a sea-captain orders me to get a
+broom and sweep down the decks?  What does that indignity amount to,
+weighed, I mean, in the scales of the New Testament?  Do you think
+the archangel Gabriel thinks anything the less of me, because I
+promptly and respectfully obey that old hunks in that particular
+instance?  Who ain't a slave?  Tell me that.  Well, then, however the
+old sea-captains may order me about--however they may thump and punch
+me about, I have the satisfaction of knowing that it is all right;
+that everybody else is one way or other served in much the same
+way--either in a physical or metaphysical point of view, that is; and
+so the universal thump is passed round, and all hands should rub each
+other's shoulder-blades, and be content.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 11</DOCNO>
+Again, I always go to sea as a sailor, because they make a point of
+paying me for my trouble, whereas they never pay passengers a single
+penny that I ever heard of.  On the contrary, passengers themselves
+must pay.  And there is all the difference in the world between
+paying and being paid.  The act of paying is perhaps the most
+uncomfortable infliction that the two orchard thieves entailed upon
+us.  But BEING PAID,--what will compare with it?  The urbane activity
+with which a man receives money is really marvellous, considering
+that we so earnestly believe money to be the root of all earthly
+ills, and that on no account can a monied man enter heaven.  Ah! how
+cheerfully we consign ourselves to perdition!
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 12</DOCNO>
+Finally, I always go to sea as a sailor, because of the wholesome
+exercise and pure air of the fore-castle deck.  For as in this world,
+head winds are far more prevalent than winds from astern (that is, if
+you never violate the Pythagorean maxim), so for the most part the
+Commodore on the quarter-deck gets his atmosphere at second hand from
+the sailors on the forecastle.  He thinks he breathes it first; but
+not so.  In much the same way do the commonalty lead their leaders in
+many other things, at the same time that the leaders little suspect
+it.  But wherefore it was that after having repeatedly smelt the sea
+as a merchant sailor, I should now take it into my head to go on a
+whaling voyage; this the invisible police officer of the Fates, who
+has the constant surveillance of me, and secretly dogs me, and
+influences me in some unaccountable way--he can better answer than
+any one else.  And, doubtless, my going on this whaling voyage,
+formed part of the grand programme of Providence that was drawn up a
+long time ago.  It came in as a sort of brief interlude and solo
+between more extensive performances.  I take it that this part of the
+bill must have run something like this:
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 13</DOCNO>
+"GRAND CONTESTED ELECTION FOR THE PRESIDENCY OF THE UNITED STATES.
+"WHALING VOYAGE BY ONE ISHMAEL.
+"BLOODY BATTLE IN AFFGHANISTAN."
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 14</DOCNO>
+Though I cannot tell why it was exactly that those stage managers,
+the Fates, put me down for this shabby part of a whaling voyage, when
+others were set down for magnificent parts in high tragedies, and
+short and easy parts in genteel comedies, and jolly parts in
+farces--though I cannot tell why this was exactly; yet, now that I
+recall all the circumstances, I think I can see a little into the
+springs and motives which being cunningly presented to me under
+various disguises, induced me to set about performing the part I did,
+besides cajoling me into the delusion that it was a choice resulting
+from my own unbiased freewill and discriminating judgment.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 15</DOCNO>
+Chief among these motives was the overwhelming idea of the great
+whale himself.  Such a portentous and mysterious monster roused all
+my curiosity.  Then the wild and distant seas where he rolled his
+island bulk; the undeliverable, nameless perils of the whale; these,
+with all the attending marvels of a thousand Patagonian sights and
+sounds, helped to sway me to my wish.  With other men, perhaps, such
+things would not have been inducements; but as for me, I am tormented
+with an everlasting itch for things remote.  I love to sail forbidden
+seas, and land on barbarous coasts.  Not ignoring what is good, I am
+quick to perceive a horror, and could still be social with it--would
+they let me--since it is but well to be on friendly terms with all
+the inmates of the place one lodges in.
+</DOC>
+<DOC>
+<DOCNO>Chapter 1, Paragraph 16</DOCNO>
+By reason of these things, then, the whaling voyage was welcome; the
+great flood-gates of the wonder-world swung open, and in the wild
+conceits that swayed me to my purpose, two and two there floated into
+my inmost soul, endless processions of the whale, and, mid most of
+them all, one grand hooded phantom, like a snow hill in the air.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 1</DOCNO>
+The Carpet-Bag.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 2</DOCNO>
+I stuffed a shirt or two into my old carpet-bag, tucked it under my
+arm, and started for Cape Horn and the Pacific.  Quitting the good
+city of old Manhatto, I duly arrived in New Bedford.  It was a
+Saturday night in December.  Much was I disappointed upon learning
+that the little packet for Nantucket had already sailed, and that no
+way of reaching that place would offer, till the following Monday.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 3</DOCNO>
+As most young candidates for the pains and penalties of whaling stop
+at this same New Bedford, thence to embark on their voyage, it may as
+well be related that I, for one, had no idea of so doing.  For my
+mind was made up to sail in no other than a Nantucket craft, because
+there was a fine, boisterous something about everything connected
+with that famous old island, which amazingly pleased me.  Besides
+though New Bedford has of late been gradually monopolising the
+business of whaling, and though in this matter poor old Nantucket is
+now much behind her, yet Nantucket was her great original--the Tyre
+of this Carthage;--the place where the first dead American whale was
+stranded.  Where else but from Nantucket did those aboriginal
+whalemen, the Red-Men, first sally out in canoes to give chase to the
+Leviathan?  And where but from Nantucket, too, did that first
+adventurous little sloop put forth, partly laden with imported
+cobblestones--so goes the story--to throw at the whales, in order to
+discover when they were nigh enough to risk a harpoon from the
+bowsprit?
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 4</DOCNO>
+Now having a night, a day, and still another night following before
+me in New Bedford, ere I could embark for my destined port, it
+became a matter of concernment where I was to eat and sleep
+meanwhile.  It was a very dubious-looking, nay, a very dark and
+dismal night, bitingly cold and cheerless.  I knew no one in the
+place.  With anxious grapnels I had sounded my pocket, and only
+brought up a few pieces of silver,--So, wherever you go, Ishmael,
+said I to myself, as I stood in the middle of a dreary street
+shouldering my bag, and comparing the gloom towards the north with
+the darkness towards the south--wherever in your wisdom you may
+conclude to lodge for the night, my dear Ishmael, be sure to inquire
+the price, and don't be too particular.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 5</DOCNO>
+With halting steps I paced the streets, and passed the sign of "The
+Crossed Harpoons"--but it looked too expensive and jolly there.
+Further on, from the bright red windows of the "Sword-Fish Inn,"
+there came such fervent rays, that it seemed to have melted the
+packed snow and ice from before the house, for everywhere else the
+congealed frost lay ten inches thick in a hard, asphaltic
+pavement,--rather weary for me, when I struck my foot against the
+flinty projections, because from hard, remorseless service the soles
+of my boots were in a most miserable plight.  Too expensive and
+jolly, again thought I, pausing one moment to watch the broad glare
+in the street, and hear the sounds of the tinkling glasses within.
+But go on, Ishmael, said I at last; don't you hear? get away from
+before the door; your patched boots are stopping the way.  So on I
+went.  I now by instinct followed the streets that took me waterward,
+for there, doubtless, were the cheapest, if not the cheeriest inns.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 6</DOCNO>
+Such dreary streets! blocks of blackness, not houses, on either
+hand, and here and there a candle, like a candle moving about in a
+tomb.  At this hour of the night, of the last day of the week, that
+quarter of the town proved all but deserted.  But presently I came to
+a smoky light proceeding from a low, wide building, the door of which
+stood invitingly open.  It had a careless look, as if it were meant
+for the uses of the public; so, entering, the first thing I did was
+to stumble over an ash-box in the porch.  Ha! thought I, ha, as the
+flying particles almost choked me, are these ashes from that
+destroyed city, Gomorrah?  But "The Crossed Harpoons," and "The
+Sword-Fish?"--this, then must needs be the sign of "The Trap."
+However, I picked myself up and hearing a loud voice within, pushed
+on and opened a second, interior door.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 7</DOCNO>
+It seemed the great Black Parliament sitting in Tophet.  A hundred
+black faces turned round in their rows to peer; and beyond, a black
+Angel of Doom was beating a book in a pulpit.  It was a negro church;
+and the preacher's text was about the blackness of darkness, and the
+weeping and wailing and teeth-gnashing there.  Ha, Ishmael, muttered
+I, backing out, Wretched entertainment at the sign of 'The Trap!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 8</DOCNO>
+Moving on, I at last came to a dim sort of light not far from the
+docks, and heard a forlorn creaking in the air; and looking up, saw a
+swinging sign over the door with a white painting upon it, faintly
+representing a tall straight jet of misty spray, and these words
+underneath--"The Spouter Inn:--Peter Coffin."
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 9</DOCNO>
+Coffin?--Spouter?--Rather ominous in that particular connexion,
+thought I.  But it is a common name in Nantucket, they say, and I
+suppose this Peter here is an emigrant from there.  As the light
+looked so dim, and the place, for the time, looked quiet enough, and
+the dilapidated little wooden house itself looked as if it might have
+been carted here from the ruins of some burnt district, and as the
+swinging sign had a poverty-stricken sort of creak to it, I thought
+that here was the very spot for cheap lodgings, and the best of pea
+coffee.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 10</DOCNO>
+It was a queer sort of place--a gable-ended old house, one side
+palsied as it were, and leaning over sadly.  It stood on a sharp
+bleak corner, where that tempestuous wind Euroclydon kept up a worse
+howling than ever it did about poor Paul's tossed craft.  Euroclydon,
+nevertheless, is a mighty pleasant zephyr to any one in-doors, with
+his feet on the hob quietly toasting for bed.  "In judging of that
+tempestuous wind called Euroclydon," says an old writer--of whose
+works I possess the only copy extant--"it maketh a marvellous
+difference, whether thou lookest out at it from a glass window where
+the frost is all on the outside, or whether thou observest it from
+that sashless window, where the frost is on both sides, and of which
+the wight Death is the only glazier."  True enough, thought I, as
+this passage occurred to my mind--old black-letter, thou reasonest
+well.  Yes, these eyes are windows, and this body of mine is the
+house.  What a pity they didn't stop up the chinks and the crannies
+though, and thrust in a little lint here and there.  But it's too
+late to make any improvements now.  The universe is finished; the
+copestone is on, and the chips were carted off a million years ago.
+Poor Lazarus there, chattering his teeth against the curbstone for
+his pillow, and shaking off his tatters with his shiverings, he might
+plug up both ears with rags, and put a corn-cob into his mouth, and
+yet that would not keep out the tempestuous Euroclydon.  Euroclydon!
+says old Dives, in his red silken wrapper--(he had a redder one
+afterwards) pooh, pooh!  What a fine frosty night; how Orion
+glitters; what northern lights!  Let them talk of their oriental
+summer climes of everlasting conservatories; give me the privilege of
+making my own summer with my own coals.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 11</DOCNO>
+But what thinks Lazarus?  Can he warm his blue hands by holding them
+up to the grand northern lights?  Would not Lazarus rather be in
+Sumatra than here?  Would he not far rather lay him down lengthwise
+along the line of the equator; yea, ye gods! go down to the fiery pit
+itself, in order to keep out this frost?
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 12</DOCNO>
+Now, that Lazarus should lie stranded there on the curbstone before
+the door of Dives, this is more wonderful than that an iceberg should
+be moored to one of the Moluccas.  Yet Dives himself, he too lives
+like a Czar in an ice palace made of frozen sighs, and being a
+president of a temperance society, he only drinks the tepid tears of
+orphans.
+</DOC>
+<DOC>
+<DOCNO>Chapter 2, Paragraph 13</DOCNO>
+But no more of this blubbering now, we are going a-whaling, and there
+is plenty of that yet to come.  Let us scrape the ice from our
+frosted feet, and see what sort of a place this "Spouter" may be.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 1</DOCNO>
+The Spouter-Inn.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 2</DOCNO>
+Entering that gable-ended Spouter-Inn, you found yourself in a wide,
+low, straggling entry with old-fashioned wainscots, reminding one of
+the bulwarks of some condemned old craft.  On one side hung a very
+large oilpainting so thoroughly besmoked, and every way defaced,
+that in the unequal crosslights by which you viewed it, it was only
+by diligent study and a series of systematic visits to it, and
+careful inquiry of the neighbors, that you could any way arrive at an
+understanding of its purpose.  Such unaccountable masses of shades
+and shadows, that at first you almost thought some ambitious young
+artist, in the time of the New England hags, had endeavored to
+delineate chaos bewitched.  But by dint of much and earnest
+contemplation, and oft repeated ponderings, and especially by
+throwing open the little window towards the back of the entry, you at
+last come to the conclusion that such an idea, however wild, might
+not be altogether unwarranted.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 3</DOCNO>
+But what most puzzled and confounded you was a long, limber,
+portentous, black mass of something hovering in the centre of the
+picture over three blue, dim, perpendicular lines floating in a
+nameless yeast.  A boggy, soggy, squitchy picture truly, enough to
+drive a nervous man distracted.  Yet was there a sort of indefinite,
+half-attained, unimaginable sublimity about it that fairly froze you
+to it, till you involuntarily took an oath with yourself to find out
+what that marvellous painting meant.  Ever and anon a bright, but,
+alas, deceptive idea would dart you through.--It's the Black Sea in a
+midnight gale.--It's the unnatural combat of the four primal
+elements.--It's a blasted heath.--It's a Hyperborean winter
+scene.--It's the breaking-up of the icebound stream of Time.  But at
+last all these fancies yielded to that one portentous something in
+the picture's midst.  THAT once found out, and all the rest were
+plain.  But stop; does it not bear a faint resemblance to a gigantic
+fish? even the great leviathan himself?
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 4</DOCNO>
+In fact, the artist's design seemed this: a final theory of my own,
+partly based upon the aggregated opinions of many aged persons with
+whom I conversed upon the subject.  The picture represents a
+Cape-Horner in a great hurricane; the half-foundered ship weltering
+there with its three dismantled masts alone visible; and an
+exasperated whale, purposing to spring clean over the craft, is in
+the enormous act of impaling himself upon the three mast-heads.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 5</DOCNO>
+The opposite wall of this entry was hung all over with a heathenish
+array of monstrous clubs and spears.  Some were thickly set with
+glittering teeth resembling ivory saws; others were tufted with knots
+of human hair; and one was sickle-shaped, with a vast handle sweeping
+round like the segment made in the new-mown grass by a long-armed
+mower.  You shuddered as you gazed, and wondered what monstrous
+cannibal and savage could ever have gone a death-harvesting with such
+a hacking, horrifying implement.  Mixed with these were rusty old
+whaling lances and harpoons all broken and deformed.  Some were
+storied weapons.  With this once long lance, now wildly elbowed,
+fifty years ago did Nathan Swain kill fifteen whales between a
+sunrise and a sunset.  And that harpoon--so like a corkscrew now--was
+flung in Javan seas, and run away with by a whale, years afterwards
+slain off the Cape of Blanco.  The original iron entered nigh the
+tail, and, like a restless needle sojourning in the body of a man,
+travelled full forty feet, and at last was found imbedded in the
+hump.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 6</DOCNO>
+Crossing this dusky entry, and on through yon low-arched way--cut
+through what in old times must have been a great central chimney with
+fireplaces all round--you enter the public room.  A still duskier
+place is this, with such low ponderous beams above, and such old
+wrinkled planks beneath, that you would almost fancy you trod some
+old craft's cockpits, especially of such a howling night, when this
+corner-anchored old ark rocked so furiously.  On one side stood a
+long, low, shelf-like table covered with cracked glass cases, filled
+with dusty rarities gathered from this wide world's remotest nooks.
+Projecting from the further angle of the room stands a dark-looking
+den--the bar--a rude attempt at a right whale's head.  Be that how it
+may, there stands the vast arched bone of the whale's jaw, so wide, a
+coach might almost drive beneath it.  Within are shabby shelves,
+ranged round with old decanters, bottles, flasks; and in those jaws
+of swift destruction, like another cursed Jonah (by which name indeed
+they called him), bustles a little withered old man, who, for their
+money, dearly sells the sailors deliriums and death.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 7</DOCNO>
+Abominable are the tumblers into which he pours his poison.  Though
+true cylinders without--within, the villanous green goggling glasses
+deceitfully tapered downwards to a cheating bottom.  Parallel
+meridians rudely pecked into the glass, surround these footpads'
+goblets.  Fill to THIS mark, and your charge is but a penny; to THIS
+a penny more; and so on to the full glass--the Cape Horn measure,
+which you may gulp down for a shilling.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 8</DOCNO>
+Upon entering the place I found a number of young seamen gathered
+about a table, examining by a dim light divers specimens of
+SKRIMSHANDER.  I sought the landlord, and telling him I desired to be
+accommodated with a room, received for answer that his house was
+full--not a bed unoccupied.  "But avast," he added, tapping his
+forehead, "you haint no objections to sharing a harpooneer's blanket,
+have ye?  I s'pose you are goin' a-whalin', so you'd better get used
+to that sort of thing."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 9</DOCNO>
+I told him that I never liked to sleep two in a bed; that if I should
+ever do so, it would depend upon who the harpooneer might be, and
+that if he (the landlord) really had no other place for me, and the
+harpooneer was not decidedly objectionable, why rather than wander
+further about a strange town on so bitter a night, I would put up
+with the half of any decent man's blanket.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 10</DOCNO>
+"I thought so.  All right; take a seat.  Supper?--you want supper?
+Supper'll be ready directly."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 11</DOCNO>
+I sat down on an old wooden settle, carved all over like a bench on
+the Battery.  At one end a ruminating tar was still further adorning
+it with his jack-knife, stooping over and diligently working away at
+the space between his legs.  He was trying his hand at a ship under
+full sail, but he didn't make much headway, I thought.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 12</DOCNO>
+At last some four or five of us were summoned to our meal in an
+adjoining room.  It was cold as Iceland--no fire at all--the landlord
+said he couldn't afford it.  Nothing but two dismal tallow candles,
+each in a winding sheet.  We were fain to button up our monkey
+jackets, and hold to our lips cups of scalding tea with our half
+frozen fingers.  But the fare was of the most substantial kind--not
+only meat and potatoes, but dumplings; good heavens! dumplings for
+supper!  One young fellow in a green box coat, addressed himself to
+these dumplings in a most direful manner.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 13</DOCNO>
+"My boy," said the landlord, "you'll have the nightmare to a dead
+sartainty."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 14</DOCNO>
+"Landlord," I whispered, "that aint the harpooneer is it?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 15</DOCNO>
+"Oh, no," said he, looking a sort of diabolically funny, "the
+harpooneer is a dark complexioned chap.  He never eats dumplings, he
+don't--he eats nothing but steaks, and he likes 'em rare."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 16</DOCNO>
+"The devil he does," says I.  "Where is that harpooneer?  Is he
+here?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 17</DOCNO>
+"He'll be here afore long," was the answer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 18</DOCNO>
+I could not help it, but I began to feel suspicious of this "dark
+complexioned" harpooneer.  At any rate, I made up my mind that if it
+so turned out that we should sleep together, he must undress and get
+into bed before I did.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 19</DOCNO>
+Supper over, the company went back to the bar-room, when, knowing not
+what else to do with myself, I resolved to spend the rest of the
+evening as a looker on.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 20</DOCNO>
+Presently a rioting noise was heard without.  Starting up, the
+landlord cried, "That's the Grampus's crew.  I seed her reported in
+the offing this morning; a three years' voyage, and a full ship.
+Hurrah, boys; now we'll have the latest news from the Feegees."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 21</DOCNO>
+A tramping of sea boots was heard in the entry; the door was flung
+open, and in rolled a wild set of mariners enough.  Enveloped in
+their shaggy watch coats, and with their heads muffled in woollen
+comforters, all bedarned and ragged, and their beards stiff with
+icicles, they seemed an eruption of bears from Labrador.  They had
+just landed from their boat, and this was the first house they
+entered.  No wonder, then, that they made a straight wake for the
+whale's mouth--the bar--when the wrinkled little old Jonah, there
+officiating, soon poured them out brimmers all round.  One complained
+of a bad cold in his head, upon which Jonah mixed him a pitch-like
+potion of gin and molasses, which he swore was a sovereign cure for
+all colds and catarrhs whatsoever, never mind of how long standing,
+or whether caught off the coast of Labrador, or on the weather side
+of an ice-island.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 22</DOCNO>
+The liquor soon mounted into their heads, as it generally does even
+with the arrantest topers newly landed from sea, and they began
+capering about most obstreperously.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 23</DOCNO>
+I observed, however, that one of them held somewhat aloof, and though
+he seemed desirous not to spoil the hilarity of his shipmates by his
+own sober face, yet upon the whole he refrained from making as much
+noise as the rest.  This man interested me at once; and since the
+sea-gods had ordained that he should soon become my shipmate (though
+but a sleeping-partner one, so far as this narrative is concerned),
+I will here venture upon a little description of him.  He stood full
+six feet in height, with noble shoulders, and a chest like a
+coffer-dam.  I have seldom seen such brawn in a man.  His face was
+deeply brown and burnt, making his white teeth dazzling by the
+contrast; while in the deep shadows of his eyes floated some
+reminiscences that did not seem to give him much joy.  His voice at
+once announced that he was a Southerner, and from his fine stature, I
+thought he must be one of those tall mountaineers from the
+Alleghanian Ridge in Virginia.  When the revelry of his companions
+had mounted to its height, this man slipped away unobserved, and I
+saw no more of him till he became my comrade on the sea.  In a few
+minutes, however, he was missed by his shipmates, and being, it
+seems, for some reason a huge favourite with them, they raised a cry
+of "Bulkington!  Bulkington! where's Bulkington?" and darted out of
+the house in pursuit of him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 24</DOCNO>
+It was now about nine o'clock, and the room seeming almost
+supernaturally quiet after these orgies, I began to congratulate
+myself upon a little plan that had occurred to me just previous to
+the entrance of the seamen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 25</DOCNO>
+No man prefers to sleep two in a bed.  In fact, you would a good deal
+rather not sleep with your own brother.  I don't know how it is, but
+people like to be private when they are sleeping.  And when it comes
+to sleeping with an unknown stranger, in a strange inn, in a strange
+town, and that stranger a harpooneer, then your objections
+indefinitely multiply.  Nor was there any earthly reason why I as a
+sailor should sleep two in a bed, more than anybody else; for sailors
+no more sleep two in a bed at sea, than bachelor Kings do ashore.  To
+be sure they all sleep together in one apartment, but you have your
+own hammock, and cover yourself with your own blanket, and sleep in
+your own skin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 26</DOCNO>
+The more I pondered over this harpooneer, the more I abominated the
+thought of sleeping with him.  It was fair to presume that being a
+harpooneer, his linen or woollen, as the case might be, would not be
+of the tidiest, certainly none of the finest.  I began to twitch all
+over.  Besides, it was getting late, and my decent harpooneer ought
+to be home and going bedwards.  Suppose now, he should tumble in upon
+me at midnight--how could I tell from what vile hole he had been
+coming?
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 27</DOCNO>
+"Landlord!  I've changed my mind about that harpooneer.--I shan't
+sleep with him.  I'll try the bench here."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 28</DOCNO>
+"Just as you please; I'm sorry I cant spare ye a tablecloth for a
+mattress, and it's a plaguy rough board here"--feeling of the knots
+and notches.  "But wait a bit, Skrimshander; I've got a carpenter's
+plane there in the bar--wait, I say, and I'll make ye snug enough."
+So saying he procured the plane; and with his old silk handkerchief
+first dusting the bench, vigorously set to planing away at my bed,
+the while grinning like an ape.  The shavings flew right and left;
+till at last the plane-iron came bump against an indestructible knot.
+The landlord was near spraining his wrist, and I told him for
+heaven's sake to quit--the bed was soft enough to suit me, and I did
+not know how all the planing in the world could make eider down of a
+pine plank.  So gathering up the shavings with another grin, and
+throwing them into the great stove in the middle of the room, he went
+about his business, and left me in a brown study.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 29</DOCNO>
+I now took the measure of the bench, and found that it was a foot too
+short; but that could be mended with a chair.  But it was a foot too
+narrow, and the other bench in the room was about four inches higher
+than the planed one--so there was no yoking them.  I then placed the
+first bench lengthwise along the only clear space against the wall,
+leaving a little interval between, for my back to settle down in.
+But I soon found that there came such a draught of cold air over me
+from under the sill of the window, that this plan would never do at
+all, especially as another current from the rickety door met the one
+from the window, and both together formed a series of small
+whirlwinds in the immediate vicinity of the spot where I had thought
+to spend the night.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 30</DOCNO>
+The devil fetch that harpooneer, thought I, but stop, couldn't I
+steal a march on him--bolt his door inside, and jump into his bed,
+not to be wakened by the most violent knockings?  It seemed no bad
+idea; but upon second thoughts I dismissed it.  For who could tell
+but what the next morning, so soon as I popped out of the room, the
+harpooneer might be standing in the entry, all ready to knock me
+down!
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 31</DOCNO>
+Still, looking round me again, and seeing no possible chance of
+spending a sufferable night unless in some other person's bed, I
+began to think that after all I might be cherishing unwarrantable
+prejudices against this unknown harpooneer.  Thinks I, I'll wait
+awhile; he must be dropping in before long.  I'll have a good look at
+him then, and perhaps we may become jolly good bedfellows after
+all--there's no telling.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 32</DOCNO>
+But though the other boarders kept coming in by ones, twos, and
+threes, and going to bed, yet no sign of my harpooneer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 33</DOCNO>
+"Landlord! said I, "what sort of a chap is he--does he always keep
+such late hours?"  It was now hard upon twelve o'clock.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 34</DOCNO>
+The landlord chuckled again with his lean chuckle, and seemed to be
+mightily tickled at something beyond my comprehension.  "No," he
+answered, "generally he's an early bird--airley to bed and airley to
+rise--yes, he's the bird what catches the worm.  But to-night he
+went out a peddling, you see, and I don't see what on airth keeps him
+so late, unless, may be, he can't sell his head."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 35</DOCNO>
+"Can't sell his head?--What sort of a bamboozingly story is this you
+are telling me?" getting into a towering rage.  "Do you pretend to
+say, landlord, that this harpooneer is actually engaged this blessed
+Saturday night, or rather Sunday morning, in peddling his head around
+this town?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 36</DOCNO>
+"That's precisely it," said the landlord, "and I told him he couldn't
+sell it here, the market's overstocked."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 37</DOCNO>
+"With what?" shouted I.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 38</DOCNO>
+"With heads to be sure; ain't there too many heads in the world?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 39</DOCNO>
+"I tell you what it is, landlord," said I quite calmly, "you'd better
+stop spinning that yarn to me--I'm not green."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 40</DOCNO>
+"May be not," taking out a stick and whittling a toothpick, "but I
+rayther guess you'll be done BROWN if that ere harpooneer hears you a
+slanderin' his head."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 41</DOCNO>
+"I'll break it for him," said I, now flying into a passion again at
+this unaccountable farrago of the landlord's.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 42</DOCNO>
+"It's broke a'ready," said he.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 43</DOCNO>
+"Broke," said I--"BROKE, do you mean?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 44</DOCNO>
+"Sartain, and that's the very reason he can't sell it, I guess."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 45</DOCNO>
+"Landlord," said I, going up to him as cool as Mt. Hecla in a
+snow-storm--"landlord, stop whittling.  You and I must understand one
+another, and that too without delay.  I come to your house and want a
+bed; you tell me you can only give me half a one; that the other half
+belongs to a certain harpooneer.  And about this harpooneer, whom I
+have not yet seen, you persist in telling me the most mystifying and
+exasperating stories tending to beget in me an uncomfortable feeling
+towards the man whom you design for my bedfellow--a sort of
+connexion, landlord, which is an intimate and confidential one in the
+highest degree.  I now demand of you to speak out and tell me who and
+what this harpooneer is, and whether I shall be in all respects safe
+to spend the night with him.  And in the first place, you will be so
+good as to unsay that story about selling his head, which if true I
+take to be good evidence that this harpooneer is stark mad, and I've
+no idea of sleeping with a madman; and you, sir, YOU I mean,
+landlord, YOU, sir, by trying to induce me to do so knowingly, would
+thereby render yourself liable to a criminal prosecution."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 46</DOCNO>
+"Wall," said the landlord, fetching a long breath, "that's a purty
+long sarmon for a chap that rips a little now and then.  But be easy,
+be easy, this here harpooneer I have been tellin' you of has just
+arrived from the south seas, where he bought up a lot of 'balmed New
+Zealand heads (great curios, you know), and he's sold all on 'em but
+one, and that one he's trying to sell to-night, cause to-morrow's
+Sunday, and it would not do to be sellin' human heads about the
+streets when folks is goin' to churches.  He wanted to, last Sunday,
+but I stopped him just as he was goin' out of the door with four
+heads strung on a string, for all the airth like a string of inions."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 47</DOCNO>
+This account cleared up the otherwise unaccountable mystery, and
+showed that the landlord, after all, had had no idea of fooling
+me--but at the same time what could I think of a harpooneer who
+stayed out of a Saturday night clean into the holy Sabbath, engaged
+in such a cannibal business as selling the heads of dead idolators?
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 48</DOCNO>
+"Depend upon it, landlord, that harpooneer is a dangerous man."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 49</DOCNO>
+"He pays reg'lar," was the rejoinder.  "But come, it's getting
+dreadful late, you had better be turning flukes--it's a nice bed;
+Sal and me slept in that ere bed the night we were spliced.  There's
+plenty of room for two to kick about in that bed; it's an almighty
+big bed that.  Why, afore we give it up, Sal used to put our Sam and
+little Johnny in the foot of it.  But I got a dreaming and sprawling
+about one night, and somehow, Sam got pitched on the floor, and came
+near breaking his arm.  Arter that, Sal said it wouldn't do.  Come
+along here, I'll give ye a glim in a jiffy;" and so saying he lighted
+a candle and held it towards me, offering to lead the way.  But I
+stood irresolute; when looking at a clock in the corner, he exclaimed
+"I vum it's Sunday--you won't see that harpooneer to-night; he's come
+to anchor somewhere--come along then; DO come; WON'T ye come?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 50</DOCNO>
+I considered the matter a moment, and then up stairs we went, and I
+was ushered into a small room, cold as a clam, and furnished, sure
+enough, with a prodigious bed, almost big enough indeed for any four
+harpooneers to sleep abreast.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 51</DOCNO>
+"There," said the landlord, placing the candle on a crazy old sea
+chest that did double duty as a wash-stand and centre table; "there,
+make yourself comfortable now, and good night to ye."  I turned
+round from eyeing the bed, but he had disappeared.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 52</DOCNO>
+Folding back the counterpane, I stooped over the bed.  Though none of
+the most elegant, it yet stood the scrutiny tolerably well.  I then
+glanced round the room; and besides the bedstead and centre table,
+could see no other furniture belonging to the place, but a rude
+shelf, the four walls, and a papered fireboard representing a man
+striking a whale.  Of things not properly belonging to the room,
+there was a hammock lashed up, and thrown upon the floor in one
+corner; also a large seaman's bag, containing the harpooneer's
+wardrobe, no doubt in lieu of a land trunk.  Likewise, there was a
+parcel of outlandish bone fish hooks on the shelf over the
+fire-place, and a tall harpoon standing at the head of the bed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 53</DOCNO>
+But what is this on the chest?  I took it up, and held it close to
+the light, and felt it, and smelt it, and tried every way possible to
+arrive at some satisfactory conclusion concerning it.  I can compare
+it to nothing but a large door mat, ornamented at the edges with
+little tinkling tags something like the stained porcupine quills
+round an Indian moccasin.  There was a hole or slit in the middle of
+this mat, as you see the same in South American ponchos.  But could
+it be possible that any sober harpooneer would get into a door mat,
+and parade the streets of any Christian town in that sort of guise?
+I put it on, to try it, and it weighed me down like a hamper, being
+uncommonly shaggy and thick, and I thought a little damp, as though
+this mysterious harpooneer had been wearing it of a rainy day.  I
+went up in it to a bit of glass stuck against the wall, and I never
+saw such a sight in my life.  I tore myself out of it in such a hurry
+that I gave myself a kink in the neck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 54</DOCNO>
+I sat down on the side of the bed, and commenced thinking about this
+head-peddling harpooneer, and his door mat.  After thinking some time
+on the bed-side, I got up and took off my monkey jacket, and then
+stood in the middle of the room thinking.  I then took off my coat,
+and thought a little more in my shirt sleeves.  But beginning to feel
+very cold now, half undressed as I was, and remembering what the
+landlord said about the harpooneer's not coming home at all that
+night, it being so very late, I made no more ado, but jumped out of
+my pantaloons and boots, and then blowing out the light tumbled into
+bed, and commended myself to the care of heaven.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 55</DOCNO>
+Whether that mattress was stuffed with corn-cobs or broken crockery,
+there is no telling, but I rolled about a good deal, and could not
+sleep for a long time.  At last I slid off into a light doze, and had
+pretty nearly made a good offing towards the land of Nod, when I
+heard a heavy footfall in the passage, and saw a glimmer of light
+come into the room from under the door.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 56</DOCNO>
+Lord save me, thinks I, that must be the harpooneer, the infernal
+head-peddler.  But I lay perfectly still, and resolved not to say a
+word till spoken to.  Holding a light in one hand, and that identical
+New Zealand head in the other, the stranger entered the room, and
+without looking towards the bed, placed his candle a good way off
+from me on the floor in one corner, and then began working away at
+the knotted cords of the large bag I before spoke of as being in the
+room.  I was all eagerness to see his face, but he kept it averted
+for some time while employed in unlacing the bag's mouth.  This
+accomplished, however, he turned round--when, good heavens! what a
+sight!  Such a face!  It was of a dark, purplish, yellow colour, here
+and there stuck over with large blackish looking squares.  Yes, it's
+just as I thought, he's a terrible bedfellow; he's been in a fight,
+got dreadfully cut, and here he is, just from the surgeon.  But at
+that moment he chanced to turn his face so towards the light, that I
+plainly saw they could not be sticking-plasters at all, those black
+squares on his cheeks.  They were stains of some sort or other.  At
+first I knew not what to make of this; but soon an inkling of the
+truth occurred to me.  I remembered a story of a white man--a
+whaleman too--who, falling among the cannibals, had been tattooed by
+them.  I concluded that this harpooneer, in the course of his distant
+voyages, must have met with a similar adventure.  And what is it,
+thought I, after all!  It's only his outside; a man can be honest in
+any sort of skin.  But then, what to make of his unearthly
+complexion, that part of it, I mean, lying round about, and
+completely independent of the squares of tattooing.  To be sure, it
+might be nothing but a good coat of tropical tanning; but I never
+heard of a hot sun's tanning a white man into a purplish yellow one.
+However, I had never been in the South Seas; and perhaps the sun
+there produced these extraordinary effects upon the skin.  Now, while
+all these ideas were passing through me like lightning, this
+harpooneer never noticed me at all.  But, after some difficulty
+having opened his bag, he commenced fumbling in it, and presently
+pulled out a sort of tomahawk, and a seal-skin wallet with the hair
+on.  Placing these on the old chest in the middle of the room, he
+then took the New Zealand head--a ghastly thing enough--and crammed
+it down into the bag.  He now took off his hat--a new beaver
+hat--when I came nigh singing out with fresh surprise.  There was no
+hair on his head--none to speak of at least--nothing but a small
+scalp-knot twisted up on his forehead.  His bald purplish head now
+looked for all the world like a mildewed skull.  Had not the stranger
+stood between me and the door, I would have bolted out of it quicker
+than ever I bolted a dinner.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 57</DOCNO>
+Even as it was, I thought something of slipping out of the window,
+but it was the second floor back.  I am no coward, but what to make
+of this head-peddling purple rascal altogether passed my
+comprehension.  Ignorance is the parent of fear, and being completely
+nonplussed and confounded about the stranger, I confess I was now as
+much afraid of him as if it was the devil himself who had thus broken
+into my room at the dead of night.  In fact, I was so afraid of him
+that I was not game enough just then to address him, and demand a
+satisfactory answer concerning what seemed inexplicable in him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 58</DOCNO>
+Meanwhile, he continued the business of undressing, and at last
+showed his chest and arms.  As I live, these covered parts of him
+were checkered with the same squares as his face; his back, too, was
+all over the same dark squares; he seemed to have been in a Thirty
+Years' War, and just escaped from it with a sticking-plaster shirt.
+Still more, his very legs were marked, as if a parcel of dark green
+frogs were running up the trunks of young palms.  It was now quite
+plain that he must be some abominable savage or other shipped aboard
+of a whaleman in the South Seas, and so landed in this Christian
+country.  I quaked to think of it.  A peddler of heads too--perhaps
+the heads of his own brothers.  He might take a fancy to
+mine--heavens! look at that tomahawk!
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 59</DOCNO>
+But there was no time for shuddering, for now the savage went about
+something that completely fascinated my attention, and convinced me
+that he must indeed be a heathen.  Going to his heavy grego, or
+wrapall, or dreadnaught, which he had previously hung on a chair, he
+fumbled in the pockets, and produced at length a curious little
+deformed image with a hunch on its back, and exactly the colour of a
+three days' old Congo baby.  Remembering the embalmed head, at first
+I almost thought that this black manikin was a real baby preserved
+in some similar manner.  But seeing that it was not at all limber,
+and that it glistened a good deal like polished ebony, I concluded
+that it must be nothing but a wooden idol, which indeed it proved to
+be.  For now the savage goes up to the empty fire-place, and removing
+the papered fire-board, sets up this little hunch-backed image, like
+a tenpin, between the andirons.  The chimney jambs and all the bricks
+inside were very sooty, so that I thought this fire-place made a very
+appropriate little shrine or chapel for his Congo idol.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 60</DOCNO>
+I now screwed my eyes hard towards the half hidden image, feeling but
+ill at ease meantime--to see what was next to follow.  First he takes
+about a double handful of shavings out of his grego pocket, and
+places them carefully before the idol; then laying a bit of ship
+biscuit on top and applying the flame from the lamp, he kindled the
+shavings into a sacrificial blaze.  Presently, after many hasty
+snatches into the fire, and still hastier withdrawals of his fingers
+(whereby he seemed to be scorching them badly), he at last succeeded
+in drawing out the biscuit; then blowing off the heat and ashes a
+little, he made a polite offer of it to the little negro.  But the
+little devil did not seem to fancy such dry sort of fare at all; he
+never moved his lips.  All these strange antics were accompanied by
+still stranger guttural noises from the devotee, who seemed to be
+praying in a sing-song or else singing some pagan psalmody or other,
+during which his face twitched about in the most unnatural manner.
+At last extinguishing the fire, he took the idol up very
+unceremoniously, and bagged it again in his grego pocket as
+carelessly as if he were a sportsman bagging a dead woodcock.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 61</DOCNO>
+All these queer proceedings increased my uncomfortableness, and
+seeing him now exhibiting strong symptoms of concluding his business
+operations, and jumping into bed with me, I thought it was high time,
+now or never, before the light was put out, to break the spell in
+which I had so long been bound.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 62</DOCNO>
+But the interval I spent in deliberating what to say, was a fatal
+one.  Taking up his tomahawk from the table, he examined the head of
+it for an instant, and then holding it to the light, with his mouth
+at the handle, he puffed out great clouds of tobacco smoke.  The next
+moment the light was extinguished, and this wild cannibal, tomahawk
+between his teeth, sprang into bed with me.  I sang out, I could not
+help it now; and giving a sudden grunt of astonishment he began
+feeling me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 63</DOCNO>
+Stammering out something, I knew not what, I rolled away from him
+against the wall, and then conjured him, whoever or whatever he might
+be, to keep quiet, and let me get up and light the lamp again.  But
+his guttural responses satisfied me at once that he but ill
+comprehended my meaning.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 64</DOCNO>
+"Who-e debel you?"--he at last said--"you no speak-e, dam-me, I
+kill-e."  And so saying the lighted tomahawk began flourishing about
+me in the dark.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 65</DOCNO>
+"Landlord, for God's sake, Peter Coffin!" shouted I.  "Landlord!
+Watch!  Coffin!  Angels! save me!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 66</DOCNO>
+"Speak-e! tell-ee me who-ee be, or dam-me, I kill-e!" again growled
+the cannibal, while his horrid flourishings of the tomahawk scattered
+the hot tobacco ashes about me till I thought my linen would get on
+fire.  But thank heaven, at that moment the landlord came into the
+room light in hand, and leaping from the bed I ran up to him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 67</DOCNO>
+"Don't be afraid now," said he, grinning again, "Queequeg here
+wouldn't harm a hair of your head."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 68</DOCNO>
+"Stop your grinning," shouted I, "and why didn't you tell me that
+that infernal harpooneer was a cannibal?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 69</DOCNO>
+"I thought ye know'd it;--didn't I tell ye, he was a peddlin' heads
+around town?--but turn flukes again and go to sleep.  Queequeg, look
+here--you sabbee me, I sabbee--you this man sleepe you--you sabbee?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 70</DOCNO>
+"Me sabbee plenty"--grunted Queequeg, puffing away at his pipe and
+sitting up in bed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 71</DOCNO>
+"You gettee in," he added, motioning to me with his tomahawk, and
+throwing the clothes to one side.  He really did this in not only a
+civil but a really kind and charitable way.  I stood looking at him a
+moment.  For all his tattooings he was on the whole a clean, comely
+looking cannibal.  What's all this fuss I have been making about,
+thought I to myself--the man's a human being just as I am: he has
+just as much reason to fear me, as I have to be afraid of him.
+Better sleep with a sober cannibal than a drunken Christian.
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 72</DOCNO>
+"Landlord," said I, "tell him to stash his tomahawk there, or pipe,
+or whatever you call it; tell him to stop smoking, in short, and I
+will turn in with him.  But I don't fancy having a man smoking in bed
+with me.  It's dangerous.  Besides, I ain't insured."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 73</DOCNO>
+This being told to Queequeg, he at once complied, and again politely
+motioned me to get into bed--rolling over to one side as much as to
+say--I won't touch a leg of ye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 74</DOCNO>
+"Good night, landlord," said I, "you may go."
+</DOC>
+<DOC>
+<DOCNO>Chapter 3, Paragraph 75</DOCNO>
+I turned in, and never slept better in my life.
+</DOC>
+<DOC>
+<DOCNO>Chapter 4, Paragraph 1</DOCNO>
+The Counterpane.
+</DOC>
+<DOC>
+<DOCNO>Chapter 4, Paragraph 2</DOCNO>
+Upon waking next morning about daylight, I found Queequeg's arm
+thrown over me in the most loving and affectionate manner.  You had
+almost thought I had been his wife.  The counterpane was of
+patchwork, full of odd little parti-coloured squares and triangles;
+and this arm of his tattooed all over with an interminable Cretan
+labyrinth of a figure, no two parts of which were of one precise
+shade--owing I suppose to his keeping his arm at sea unmethodically
+in sun and shade, his shirt sleeves irregularly rolled up at various
+times--this same arm of his, I say, looked for all the world like a
+strip of that same patchwork quilt.  Indeed, partly lying on it as
+the arm did when I first awoke, I could hardly tell it from the
+quilt, they so blended their hues together; and it was only by the
+sense of weight and pressure that I could tell that Queequeg was
+hugging me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 4, Paragraph 3</DOCNO>
+My sensations were strange.  Let me try to explain them.  When I was
+a child, I well remember a somewhat similar circumstance that befell
+me; whether it was a reality or a dream, I never could entirely
+settle.  The circumstance was this.  I had been cutting up some caper
+or other--I think it was trying to crawl up the chimney, as I had
+seen a little sweep do a few days previous; and my stepmother who,
+somehow or other, was all the time whipping me, or sending me to bed
+supperless,--my mother dragged me by the legs out of the chimney and
+packed me off to bed, though it was only two o'clock in the afternoon
+of the 21st June, the longest day in the year in our hemisphere.  I
+felt dreadfully.  But there was no help for it, so up stairs I went
+to my little room in the third floor, undressed myself as slowly as
+possible so as to kill time, and with a bitter sigh got between the
+sheets.
+</DOC>
+<DOC>
+<DOCNO>Chapter 4, Paragraph 4</DOCNO>
+I lay there dismally calculating that sixteen entire hours must
+elapse before I could hope for a resurrection.  Sixteen hours in bed!
+the small of my back ached to think of it.  And it was so light too;
+the sun shining in at the window, and a great rattling of coaches in
+the streets, and the sound of gay voices all over the house.  I felt
+worse and worse--at last I got up, dressed, and softly going down in
+my stockinged feet, sought out my stepmother, and suddenly threw
+myself at her feet, beseeching her as a particular favour to give me a
+good slippering for my misbehaviour; anything indeed but condemning
+me to lie abed such an unendurable length of time.  But she was the
+best and most conscientious of stepmothers, and back I had to go to
+my room.  For several hours I lay there broad awake, feeling a great
+deal worse than I have ever done since, even from the greatest
+subsequent misfortunes.  At last I must have fallen into a troubled
+nightmare of a doze; and slowly waking from it--half steeped in
+dreams--I opened my eyes, and the before sun-lit room was now wrapped
+in outer darkness.  Instantly I felt a shock running through all my
+frame; nothing was to be seen, and nothing was to be heard; but a
+supernatural hand seemed placed in mine.  My arm hung over the
+counterpane, and the nameless, unimaginable, silent form or phantom,
+to which the hand belonged, seemed closely seated by my bed-side.
+For what seemed ages piled on ages, I lay there, frozen with the most
+awful fears, not daring to drag away my hand; yet ever thinking that
+if I could but stir it one single inch, the horrid spell would be
+broken.  I knew not how this consciousness at last glided away from
+me; but waking in the morning, I shudderingly remembered it all, and
+for days and weeks and months afterwards I lost myself in confounding
+attempts to explain the mystery.  Nay, to this very hour, I often
+puzzle myself with it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 4, Paragraph 5</DOCNO>
+Now, take away the awful fear, and my sensations at feeling the
+supernatural hand in mine were very similar, in their strangeness,
+to those which I experienced on waking up and seeing Queequeg's pagan
+arm thrown round me.  But at length all the past night's events
+soberly recurred, one by one, in fixed reality, and then I lay only
+alive to the comical predicament.  For though I tried to move his
+arm--unlock his bridegroom clasp--yet, sleeping as he was, he still
+hugged me tightly, as though naught but death should part us twain.
+I now strove to rouse him--"Queequeg!"--but his only answer was a
+snore.  I then rolled over, my neck feeling as if it were in a
+horse-collar; and suddenly felt a slight scratch.  Throwing aside the
+counterpane, there lay the tomahawk sleeping by the savage's side, as
+if it were a hatchet-faced baby.  A pretty pickle, truly, thought I;
+abed here in a strange house in the broad day, with a cannibal and a
+tomahawk!  "Queequeg!--in the name of goodness, Queequeg, wake!"  At
+length, by dint of much wriggling, and loud and incessant
+expostulations upon the unbecomingness of his hugging a fellow male
+in that matrimonial sort of style, I succeeded in extracting a grunt;
+and presently, he drew back his arm, shook himself all over like a
+Newfoundland dog just from the water, and sat up in bed, stiff as a
+pike-staff, looking at me, and rubbing his eyes as if he did not
+altogether remember how I came to be there, though a dim
+consciousness of knowing something about me seemed slowly dawning
+over him.  Meanwhile, I lay quietly eyeing him, having no serious
+misgivings now, and bent upon narrowly observing so curious a
+creature.  When, at last, his mind seemed made up touching the
+character of his bedfellow, and he became, as it were, reconciled to
+the fact; he jumped out upon the floor, and by certain signs and
+sounds gave me to understand that, if it pleased me, he would dress
+first and then leave me to dress afterwards, leaving the whole
+apartment to myself.  Thinks I, Queequeg, under the circumstances,
+this is a very civilized overture; but, the truth is, these savages
+have an innate sense of delicacy, say what you will; it is marvellous
+how essentially polite they are.  I pay this particular compliment to
+Queequeg, because he treated me with so much civility and
+consideration, while I was guilty of great rudeness; staring at him
+from the bed, and watching all his toilette motions; for the time my
+curiosity getting the better of my breeding.  Nevertheless, a man
+like Queequeg you don't see every day, he and his ways were well
+worth unusual regarding.
+</DOC>
+<DOC>
+<DOCNO>Chapter 4, Paragraph 6</DOCNO>
+He commenced dressing at top by donning his beaver hat, a very tall
+one, by the by, and then--still minus his trowsers--he hunted up his
+boots.  What under the heavens he did it for, I cannot tell, but his
+next movement was to crush himself--boots in hand, and hat on--under
+the bed; when, from sundry violent gaspings and strainings, I
+inferred he was hard at work booting himself; though by no law of
+propriety that I ever heard of, is any man required to be private
+when putting on his boots.  But Queequeg, do you see, was a creature
+in the transition stage--neither caterpillar nor butterfly.  He was
+just enough civilized to show off his outlandishness in the strangest
+possible manners.  His education was not yet completed.  He was an
+undergraduate.  If he had not been a small degree civilized, he very
+probably would not have troubled himself with boots at all; but then,
+if he had not been still a savage, he never would have dreamt of
+getting under the bed to put them on.  At last, he emerged with his
+hat very much dented and crushed down over his eyes, and began
+creaking and limping about the room, as if, not being much accustomed
+to boots, his pair of damp, wrinkled cowhide ones--probably not made
+to order either--rather pinched and tormented him at the first go off
+of a bitter cold morning.
+</DOC>
+<DOC>
+<DOCNO>Chapter 4, Paragraph 7</DOCNO>
+Seeing, now, that there were no curtains to the window, and that the
+street being very narrow, the house opposite commanded a plain view
+into the room, and observing more and more the indecorous figure that
+Queequeg made, staving about with little else but his hat and boots
+on; I begged him as well as I could, to accelerate his toilet
+somewhat, and particularly to get into his pantaloons as soon as
+possible.  He complied, and then proceeded to wash himself.  At that
+time in the morning any Christian would have washed his face; but
+Queequeg, to my amazement, contented himself with restricting his
+ablutions to his chest, arms, and hands.  He then donned his
+waistcoat, and taking up a piece of hard soap on the wash-stand
+centre table, dipped it into water and commenced lathering his face.
+I was watching to see where he kept his razor, when lo and behold, he
+takes the harpoon from the bed corner, slips out the long wooden
+stock, unsheathes the head, whets it a little on his boot, and
+striding up to the bit of mirror against the wall, begins a vigorous
+scraping, or rather harpooning of his cheeks.  Thinks I, Queequeg,
+this is using Rogers's best cutlery with a vengeance.  Afterwards I
+wondered the less at this operation when I came to know of what fine
+steel the head of a harpoon is made, and how exceedingly sharp the
+long straight edges are always kept.
+</DOC>
+<DOC>
+<DOCNO>Chapter 4, Paragraph 8</DOCNO>
+The rest of his toilet was soon achieved, and he proudly marched out
+of the room, wrapped up in his great pilot monkey jacket, and
+sporting his harpoon like a marshal's baton.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 1</DOCNO>
+Breakfast.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 2</DOCNO>
+I quickly followed suit, and descending into the bar-room accosted
+the grinning landlord very pleasantly.  I cherished no malice towards
+him, though he had been skylarking with me not a little in the matter
+of my bedfellow.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 3</DOCNO>
+However, a good laugh is a mighty good thing, and rather too scarce a
+good thing; the more's the pity.  So, if any one man, in his own
+proper person, afford stuff for a good joke to anybody, let him not
+be backward, but let him cheerfully allow himself to spend and be
+spent in that way.  And the man that has anything bountifully
+laughable about him, be sure there is more in that man than you
+perhaps think for.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 4</DOCNO>
+The bar-room was now full of the boarders who had been dropping in
+the night previous, and whom I had not as yet had a good look at.
+They were nearly all whalemen; chief mates, and second mates, and
+third mates, and sea carpenters, and sea coopers, and sea
+blacksmiths, and harpooneers, and ship keepers; a brown and brawny
+company, with bosky beards; an unshorn, shaggy set, all wearing
+monkey jackets for morning gowns.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 5</DOCNO>
+You could pretty plainly tell how long each one had been ashore.
+This young fellow's healthy cheek is like a sun-toasted pear in hue,
+and would seem to smell almost as musky; he cannot have been three
+days landed from his Indian voyage.  That man next him looks a few
+shades lighter; you might say a touch of satin wood is in him.  In
+the complexion of a third still lingers a tropic tawn, but slightly
+bleached withal; HE doubtless has tarried whole weeks ashore.  But
+who could show a cheek like Queequeg? which, barred with various
+tints, seemed like the Andes' western slope, to show forth in one
+array, contrasting climates, zone by zone.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 6</DOCNO>
+"Grub, ho!" now cried the landlord, flinging open a door, and in we
+went to breakfast.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 7</DOCNO>
+They say that men who have seen the world, thereby become quite at
+ease in manner, quite self-possessed in company.  Not always, though:
+Ledyard, the great New England traveller, and Mungo Park, the Scotch
+one; of all men, they possessed the least assurance in the parlor.
+But perhaps the mere crossing of Siberia in a sledge drawn by dogs as
+Ledyard did, or the taking a long solitary walk on an empty stomach,
+in the negro heart of Africa, which was the sum of poor Mungo's
+performances--this kind of travel, I say, may not be the very best
+mode of attaining a high social polish.  Still, for the most part,
+that sort of thing is to be had anywhere.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 8</DOCNO>
+These reflections just here are occasioned by the circumstance that
+after we were all seated at the table, and I was preparing to hear
+some good stories about whaling; to my no small surprise, nearly
+every man maintained a profound silence.  And not only that, but they
+looked embarrassed.  Yes, here were a set of sea-dogs, many of whom
+without the slightest bashfulness had boarded great whales on the
+high seas--entire strangers to them--and duelled them dead without
+winking; and yet, here they sat at a social breakfast table--all of
+the same calling, all of kindred tastes--looking round as sheepishly
+at each other as though they had never been out of sight of some
+sheepfold among the Green Mountains.  A curious sight; these bashful
+bears, these timid warrior whalemen!
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 9</DOCNO>
+But as for Queequeg--why, Queequeg sat there among them--at the head
+of the table, too, it so chanced; as cool as an icicle.  To be sure I
+cannot say much for his breeding.  His greatest admirer could not
+have cordially justified his bringing his harpoon into breakfast with
+him, and using it there without ceremony; reaching over the table
+with it, to the imminent jeopardy of many heads, and grappling the
+beefsteaks towards him.  But THAT was certainly very coolly done by
+him, and every one knows that in most people's estimation, to do
+anything coolly is to do it genteelly.
+</DOC>
+<DOC>
+<DOCNO>Chapter 5, Paragraph 10</DOCNO>
+We will not speak of all Queequeg's peculiarities here; how he
+eschewed coffee and hot rolls, and applied his undivided attention to
+beefsteaks, done rare.  Enough, that when breakfast was over he
+withdrew like the rest into the public room, lighted his
+tomahawk-pipe, and was sitting there quietly digesting and smoking
+with his inseparable hat on, when I sallied out for a stroll.
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 1</DOCNO>
+The Street.
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 2</DOCNO>
+If I had been astonished at first catching a glimpse of so outlandish
+an individual as Queequeg circulating among the polite society of a
+civilized town, that astonishment soon departed upon taking my first
+daylight stroll through the streets of New Bedford.
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 3</DOCNO>
+In thoroughfares nigh the docks, any considerable seaport will
+frequently offer to view the queerest looking nondescripts from
+foreign parts.  Even in Broadway and Chestnut streets, Mediterranean
+mariners will sometimes jostle the affrighted ladies.  Regent Street
+is not unknown to Lascars and Malays; and at Bombay, in the Apollo
+Green, live Yankees have often scared the natives.  But New Bedford
+beats all Water Street and Wapping.  In these last-mentioned haunts
+you see only sailors; but in New Bedford, actual cannibals stand
+chatting at street corners; savages outright; many of whom yet carry
+on their bones unholy flesh.  It makes a stranger stare.
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 4</DOCNO>
+But, besides the Feegeeans, Tongatobooarrs, Erromanggoans,
+Pannangians, and Brighggians, and, besides the wild specimens of the
+whaling-craft which unheeded reel about the streets, you will see
+other sights still more curious, certainly more comical.  There
+weekly arrive in this town scores of green Vermonters and New
+Hampshire men, all athirst for gain and glory in the fishery.  They
+are mostly young, of stalwart frames; fellows who have felled
+forests, and now seek to drop the axe and snatch the whale-lance.
+Many are as green as the Green Mountains whence they came.  In some
+things you would think them but a few hours old.  Look there! that
+chap strutting round the corner.  He wears a beaver hat and
+swallow-tailed coat, girdled with a sailor-belt and sheath-knife.
+Here comes another with a sou'-wester and a bombazine cloak.
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 5</DOCNO>
+No town-bred dandy will compare with a country-bred one--I mean a
+downright bumpkin dandy--a fellow that, in the dog-days, will mow his
+two acres in buckskin gloves for fear of tanning his hands.  Now when
+a country dandy like this takes it into his head to make a
+distinguished reputation, and joins the great whale-fishery, you
+should see the comical things he does upon reaching the seaport.  In
+bespeaking his sea-outfit, he orders bell-buttons to his waistcoats;
+straps to his canvas trowsers.  Ah, poor Hay-Seed! how bitterly will
+burst those straps in the first howling gale, when thou art driven,
+straps, buttons, and all, down the throat of the tempest.
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 6</DOCNO>
+But think not that this famous town has only harpooneers, cannibals,
+and bumpkins to show her visitors.  Not at all.  Still New Bedford is
+a queer place.  Had it not been for us whalemen, that tract of land
+would this day perhaps have been in as howling condition as the coast
+of Labrador.  As it is, parts of her back country are enough to
+frighten one, they look so bony.  The town itself is perhaps the
+dearest place to live in, in all New England.  It is a land of oil,
+true enough: but not like Canaan; a land, also, of corn and wine.
+The streets do not run with milk; nor in the spring-time do they pave
+them with fresh eggs.  Yet, in spite of this, nowhere in all America
+will you find more patrician-like houses; parks and gardens more
+opulent, than in New Bedford.  Whence came they? how planted upon
+this once scraggy scoria of a country?
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 7</DOCNO>
+Go and gaze upon the iron emblematical harpoons round yonder lofty
+mansion, and your question will be answered.  Yes; all these brave
+houses and flowery gardens came from the Atlantic, Pacific, and
+Indian oceans.  One and all, they were harpooned and dragged up
+hither from the bottom of the sea.  Can Herr Alexander perform a feat
+like that?
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 8</DOCNO>
+In New Bedford, fathers, they say, give whales for dowers to their
+daughters, and portion off their nieces with a few porpoises a-piece.
+You must go to New Bedford to see a brilliant wedding; for, they
+say, they have reservoirs of oil in every house, and every night
+recklessly burn their lengths in spermaceti candles.
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 9</DOCNO>
+In summer time, the town is sweet to see; full of fine maples--long
+avenues of green and gold.  And in August, high in air, the beautiful
+and bountiful horse-chestnuts, candelabra-wise, proffer the passer-by
+their tapering upright cones of congregated blossoms.  So omnipotent
+is art; which in many a district of New Bedford has superinduced
+bright terraces of flowers upon the barren refuse rocks thrown aside
+at creation's final day.
+</DOC>
+<DOC>
+<DOCNO>Chapter 6, Paragraph 10</DOCNO>
+And the women of New Bedford, they bloom like their own red roses.
+But roses only bloom in summer; whereas the fine carnation of their
+cheeks is perennial as sunlight in the seventh heavens.  Elsewhere
+match that bloom of theirs, ye cannot, save in Salem, where they tell
+me the young girls breathe such musk, their sailor sweethearts smell
+them miles off shore, as though they were drawing nigh the odorous
+Moluccas instead of the Puritanic sands.
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 1</DOCNO>
+The Chapel.
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 2</DOCNO>
+In this same New Bedford there stands a Whaleman's Chapel, and few
+are the moody fishermen, shortly bound for the Indian Ocean or
+Pacific, who fail to make a Sunday visit to the spot.  I am sure that
+I did not.
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 3</DOCNO>
+Returning from my first morning stroll, I again sallied out upon this
+special errand.  The sky had changed from clear, sunny cold, to
+driving sleet and mist.  Wrapping myself in my shaggy jacket of the
+cloth called bearskin, I fought my way against the stubborn storm.
+Entering, I found a small scattered congregation of sailors, and
+sailors' wives and widows.  A muffled silence reigned, only broken at
+times by the shrieks of the storm.  Each silent worshipper seemed
+purposely sitting apart from the other, as if each silent grief were
+insular and incommunicable.  The chaplain had not yet arrived; and
+there these silent islands of men and women sat steadfastly eyeing
+several marble tablets, with black borders, masoned into the wall on
+either side the pulpit.  Three of them ran something like the
+following, but I do not pretend to quote:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 4</DOCNO>
+SACRED
+TO THE MEMORY
+OF
+JOHN TALBOT,
+Who, at the age of eighteen, was lost overboard,
+Near the Isle of Desolation, off Patagonia,
+November 1st, 1836.
+THIS TABLET
+Is erected to his Memory
+BY HIS
+SISTER.
+_____________
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 5</DOCNO>
+SACRED
+TO THE MEMORY
+OF
+ROBERT LONG, WILLIS ELLERY,
+NATHAN COLEMAN, WALTER CANNY, SETH MACY,
+AND SAMUEL GLEIG,
+Forming one of the boats' crews
+OF
+THE SHIP ELIZA
+Who were towed out of sight by a Whale,
+On the Off-shore Ground in the
+PACIFIC,
+December 31st, 1839.
+THIS MARBLE
+Is here placed by their surviving
+SHIPMATES.
+_____________
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 6</DOCNO>
+SACRED
+TO THE MEMORY
+OF
+The late
+CAPTAIN EZEKIEL HARDY,
+Who in the bows of his boat was killed by a
+Sperm Whale on the coast of Japan,
+AUGUST 3d, 1833.
+THIS TABLET
+Is erected to his Memory
+BY
+HIS WIDOW.
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 7</DOCNO>
+Shaking off the sleet from my ice-glazed hat and jacket, I seated
+myself near the door, and turning sideways was surprised to see
+Queequeg near me.  Affected by the solemnity of the scene, there was
+a wondering gaze of incredulous curiosity in his countenance.  This
+savage was the only person present who seemed to notice my entrance;
+because he was the only one who could not read, and, therefore, was
+not reading those frigid inscriptions on the wall.  Whether any of
+the relatives of the seamen whose names appeared there were now among
+the congregation, I knew not; but so many are the unrecorded
+accidents in the fishery, and so plainly did several women present
+wear the countenance if not the trappings of some unceasing grief,
+that I feel sure that here before me were assembled those, in whose
+unhealing hearts the sight of those bleak tablets sympathetically
+caused the old wounds to bleed afresh.
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 8</DOCNO>
+Oh! ye whose dead lie buried beneath the green grass; who standing
+among flowers can say--here, HERE lies my beloved; ye know not the
+desolation that broods in bosoms like these.  What bitter blanks in
+those black-bordered marbles which cover no ashes!  What despair in
+those immovable inscriptions!  What deadly voids and unbidden
+infidelities in the lines that seem to gnaw upon all Faith, and
+refuse resurrections to the beings who have placelessly perished
+without a grave.  As well might those tablets stand in the cave of
+Elephanta as here.
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 9</DOCNO>
+In what census of living creatures, the dead of mankind are included;
+why it is that a universal proverb says of them, that they tell no
+tales, though containing more secrets than the Goodwin Sands; how it
+is that to his name who yesterday departed for the other world, we
+prefix so significant and infidel a word, and yet do not thus entitle
+him, if he but embarks for the remotest Indies of this living earth;
+why the Life Insurance Companies pay death-forfeitures upon
+immortals; in what eternal, unstirring paralysis, and deadly,
+hopeless trance, yet lies antique Adam who died sixty round centuries
+ago; how it is that we still refuse to be comforted for those who we
+nevertheless maintain are dwelling in unspeakable bliss; why all the
+living so strive to hush all the dead; wherefore but the rumor of a
+knocking in a tomb will terrify a whole city.  All these things are
+not without their meanings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 10</DOCNO>
+But Faith, like a jackal, feeds among the tombs, and even from these
+dead doubts she gathers her most vital hope.
+</DOC>
+<DOC>
+<DOCNO>Chapter 7, Paragraph 11</DOCNO>
+It needs scarcely to be told, with what feelings, on the eve of a
+Nantucket voyage, I regarded those marble tablets, and by the murky
+light of that darkened, doleful day read the fate of the whalemen who
+had gone before me.  Yes, Ishmael, the same fate may be thine.  But
+somehow I grew merry again.  Delightful inducements to embark, fine
+chance for promotion, it seems--aye, a stove boat will make me an
+immortal by brevet.  Yes, there is death in this business of
+whaling--a speechlessly quick chaotic bundling of a man into
+Eternity.  But what then?  Methinks we have hugely mistaken this
+matter of Life and Death.  Methinks that what they call my shadow
+here on earth is my true substance.  Methinks that in looking at
+things spiritual, we are too much like oysters observing the sun
+through the water, and thinking that thick water the thinnest of air.
+Methinks my body is but the lees of my better being.  In fact take
+my body who will, take it I say, it is not me.  And therefore three
+cheers for Nantucket; and come a stove boat and stove body when they
+will, for stave my soul, Jove himself cannot.
+</DOC>
+<DOC>
+<DOCNO>Chapter 8, Paragraph 1</DOCNO>
+The Pulpit.
+</DOC>
+<DOC>
+<DOCNO>Chapter 8, Paragraph 2</DOCNO>
+I had not been seated very long ere a man of a certain venerable
+robustness entered; immediately as the storm-pelted door flew back
+upon admitting him, a quick regardful eyeing of him by all the
+congregation, sufficiently attested that this fine old man was the
+chaplain.  Yes, it was the famous Father Mapple, so called by the
+whalemen, among whom he was a very great favourite.  He had been a
+sailor and a harpooneer in his youth, but for many years past had
+dedicated his life to the ministry.  At the time I now write of,
+Father Mapple was in the hardy winter of a healthy old age; that sort
+of old age which seems merging into a second flowering youth, for
+among all the fissures of his wrinkles, there shone certain mild
+gleams of a newly developing bloom--the spring verdure peeping forth
+even beneath February's snow.  No one having previously heard his
+history, could for the first time behold Father Mapple without the
+utmost interest, because there were certain engrafted clerical
+peculiarities about him, imputable to that adventurous maritime life
+he had led.  When he entered I observed that he carried no umbrella,
+and certainly had not come in his carriage, for his tarpaulin hat ran
+down with melting sleet, and his great pilot cloth jacket seemed
+almost to drag him to the floor with the weight of the water it had
+absorbed.  However, hat and coat and overshoes were one by one
+removed, and hung up in a little space in an adjacent corner; when,
+arrayed in a decent suit, he quietly approached the pulpit.
+</DOC>
+<DOC>
+<DOCNO>Chapter 8, Paragraph 3</DOCNO>
+Like most old fashioned pulpits, it was a very lofty one, and since a
+regular stairs to such a height would, by its long angle with the
+floor, seriously contract the already small area of the chapel, the
+architect, it seemed, had acted upon the hint of Father Mapple, and
+finished the pulpit without a stairs, substituting a perpendicular
+side ladder, like those used in mounting a ship from a boat at sea.
+The wife of a whaling captain had provided the chapel with a handsome
+pair of red worsted man-ropes for this ladder, which, being itself
+nicely headed, and stained with a mahogany colour, the whole
+contrivance, considering what manner of chapel it was, seemed by no
+means in bad taste.  Halting for an instant at the foot of the
+ladder, and with both hands grasping the ornamental knobs of the
+man-ropes, Father Mapple cast a look upwards, and then with a truly
+sailor-like but still reverential dexterity, hand over hand, mounted
+the steps as if ascending the main-top of his vessel.
+</DOC>
+<DOC>
+<DOCNO>Chapter 8, Paragraph 4</DOCNO>
+The perpendicular parts of this side ladder, as is usually the case
+with swinging ones, were of cloth-covered rope, only the rounds were
+of wood, so that at every step there was a joint.  At my first
+glimpse of the pulpit, it had not escaped me that however convenient
+for a ship, these joints in the present instance seemed unnecessary.
+For I was not prepared to see Father Mapple after gaining the height,
+slowly turn round, and stooping over the pulpit, deliberately drag up
+the ladder step by step, till the whole was deposited within, leaving
+him impregnable in his little Quebec.
+</DOC>
+<DOC>
+<DOCNO>Chapter 8, Paragraph 5</DOCNO>
+I pondered some time without fully comprehending the reason for this.
+Father Mapple enjoyed such a wide reputation for sincerity and
+sanctity, that I could not suspect him of courting notoriety by any
+mere tricks of the stage.  No, thought I, there must be some sober
+reason for this thing; furthermore, it must symbolize something
+unseen.  Can it be, then, that by that act of physical isolation, he
+signifies his spiritual withdrawal for the time, from all outward
+worldly ties and connexions?  Yes, for replenished with the meat and
+wine of the word, to the faithful man of God, this pulpit, I see, is
+a self-containing stronghold--a lofty Ehrenbreitstein, with a
+perennial well of water within the walls.
+</DOC>
+<DOC>
+<DOCNO>Chapter 8, Paragraph 6</DOCNO>
+But the side ladder was not the only strange feature of the place,
+borrowed from the chaplain's former sea-farings.  Between the marble
+cenotaphs on either hand of the pulpit, the wall which formed its
+back was adorned with a large painting representing a gallant ship
+beating against a terrible storm off a lee coast of black rocks and
+snowy breakers.  But high above the flying scud and dark-rolling
+clouds, there floated a little isle of sunlight, from which beamed
+forth an angel's face; and this bright face shed a distinct spot of
+radiance upon the ship's tossed deck, something like that silver
+plate now inserted into the Victory's plank where Nelson fell.  "Ah,
+noble ship," the angel seemed to say, "beat on, beat on, thou noble
+ship, and bear a hardy helm; for lo! the sun is breaking through; the
+clouds are rolling off--serenest azure is at hand."
+</DOC>
+<DOC>
+<DOCNO>Chapter 8, Paragraph 7</DOCNO>
+Nor was the pulpit itself without a trace of the same sea-taste that
+had achieved the ladder and the picture.  Its panelled front was in
+the likeness of a ship's bluff bows, and the Holy Bible rested on a
+projecting piece of scroll work, fashioned after a ship's
+fiddle-headed beak.
+</DOC>
+<DOC>
+<DOCNO>Chapter 8, Paragraph 8</DOCNO>
+What could be more full of meaning?--for the pulpit is ever this
+earth's foremost part; all the rest comes in its rear; the pulpit
+leads the world.  From thence it is the storm of God's quick wrath is
+first descried, and the bow must bear the earliest brunt.  From
+thence it is the God of breezes fair or foul is first invoked for
+favourable winds.  Yes, the world's a ship on its passage out, and not
+a voyage complete; and the pulpit is its prow.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 1</DOCNO>
+The Sermon.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 2</DOCNO>
+Father Mapple rose, and in a mild voice of unassuming authority
+ordered the scattered people to condense.  "Starboard gangway,
+there! side away to larboard--larboard gangway to starboard!
+Midships! midships!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 3</DOCNO>
+There was a low rumbling of heavy sea-boots among the benches, and a
+still slighter shuffling of women's shoes, and all was quiet again,
+and every eye on the preacher.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 4</DOCNO>
+He paused a little; then kneeling in the pulpit's bows, folded his
+large brown hands across his chest, uplifted his closed eyes, and
+offered a prayer so deeply devout that he seemed kneeling and praying
+at the bottom of the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 5</DOCNO>
+This ended, in prolonged solemn tones, like the continual tolling of
+a bell in a ship that is foundering at sea in a fog--in such tones he
+commenced reading the following hymn; but changing his manner towards
+the concluding stanzas, burst forth with a pealing exultation and
+joy--
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 6</DOCNO>
+"The ribs and terrors in the whale,
+Arched over me a dismal gloom,
+While all God's sun-lit waves rolled by,
+And lift me deepening down to doom.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 7</DOCNO>
+"I saw the opening maw of hell,
+With endless pains and sorrows there;
+Which none but they that feel can tell--
+Oh, I was plunging to despair.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 8</DOCNO>
+"In black distress, I called my God,
+When I could scarce believe him mine,
+He bowed his ear to my complaints--
+No more the whale did me confine.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 9</DOCNO>
+"With speed he flew to my relief,
+As on a radiant dolphin borne;
+Awful, yet bright, as lightning shone
+The face of my Deliverer God.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 10</DOCNO>
+"My song for ever shall record
+That terrible, that joyful hour;
+I give the glory to my God,
+His all the mercy and the power.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 11</DOCNO>
+Nearly all joined in singing this hymn, which swelled high above the
+howling of the storm.  A brief pause ensued; the preacher slowly
+turned over the leaves of the Bible, and at last, folding his hand
+down upon the proper page, said: "Beloved shipmates, clinch the last
+verse of the first chapter of Jonah--'And God had prepared a great
+fish to swallow up Jonah.'"
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 12</DOCNO>
+"Shipmates, this book, containing only four chapters--four yarns--is
+one of the smallest strands in the mighty cable of the Scriptures.
+Yet what depths of the soul does Jonah's deep sealine sound! what a
+pregnant lesson to us is this prophet!  What a noble thing is that
+canticle in the fish's belly!  How billow-like and boisterously
+grand!  We feel the floods surging over us; we sound with him to the
+kelpy bottom of the waters; sea-weed and all the slime of the sea is
+about us!  But WHAT is this lesson that the book of Jonah teaches?
+Shipmates, it is a two-stranded lesson; a lesson to us all as sinful
+men, and a lesson to me as a pilot of the living God.  As sinful men,
+it is a lesson to us all, because it is a story of the sin,
+hard-heartedness, suddenly awakened fears, the swift punishment,
+repentance, prayers, and finally the deliverance and joy of Jonah.
+As with all sinners among men, the sin of this son of Amittai was in
+his wilful disobedience of the command of God--never mind now what
+that command was, or how conveyed--which he found a hard command.
+But all the things that God would have us do are hard for us to
+do--remember that--and hence, he oftener commands us than endeavors
+to persuade.  And if we obey God, we must disobey ourselves; and it
+is in this disobeying ourselves, wherein the hardness of obeying God
+consists.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 13</DOCNO>
+"With this sin of disobedience in him, Jonah still further flouts at
+God, by seeking to flee from Him.  He thinks that a ship made by men
+will carry him into countries where God does not reign, but only the
+Captains of this earth.  He skulks about the wharves of Joppa, and
+seeks a ship that's bound for Tarshish.  There lurks, perhaps, a
+hitherto unheeded meaning here.  By all accounts Tarshish could have
+been no other city than the modern Cadiz.  That's the opinion of
+learned men.  And where is Cadiz, shipmates?  Cadiz is in Spain; as
+far by water, from Joppa, as Jonah could possibly have sailed in
+those ancient days, when the Atlantic was an almost unknown sea.
+Because Joppa, the modern Jaffa, shipmates, is on the most easterly
+coast of the Mediterranean, the Syrian; and Tarshish or Cadiz more
+than two thousand miles to the westward from that, just outside the
+Straits of Gibraltar.  See ye not then, shipmates, that Jonah sought
+to flee world-wide from God?  Miserable man!  Oh! most contemptible
+and worthy of all scorn; with slouched hat and guilty eye, skulking
+from his God; prowling among the shipping like a vile burglar
+hastening to cross the seas.  So disordered, self-condemning is his
+look, that had there been policemen in those days, Jonah, on the mere
+suspicion of something wrong, had been arrested ere he touched a
+deck.  How plainly he's a fugitive! no baggage, not a hat-box,
+valise, or carpet-bag,--no friends accompany him to the wharf with
+their adieux.  At last, after much dodging search, he finds the
+Tarshish ship receiving the last items of her cargo; and as he steps
+on board to see its Captain in the cabin, all the sailors for the
+moment desist from hoisting in the goods, to mark the stranger's evil
+eye.  Jonah sees this; but in vain he tries to look all ease and
+confidence; in vain essays his wretched smile.  Strong intuitions of
+the man assure the mariners he can be no innocent.  In their gamesome
+but still serious way, one whispers to the other--"Jack, he's robbed
+a widow;" or, "Joe, do you mark him; he's a bigamist;" or, "Harry
+lad, I guess he's the adulterer that broke jail in old Gomorrah, or
+belike, one of the missing murderers from Sodom."  Another runs to
+read the bill that's stuck against the spile upon the wharf to which
+the ship is moored, offering five hundred gold coins for the
+apprehension of a parricide, and containing a description of his
+person.  He reads, and looks from Jonah to the bill; while all his
+sympathetic shipmates now crowd round Jonah, prepared to lay their
+hands upon him.  Frighted Jonah trembles, and summoning all his
+boldness to his face, only looks so much the more a coward.  He will
+not confess himself suspected; but that itself is strong suspicion.
+So he makes the best of it; and when the sailors find him not to be
+the man that is advertised, they let him pass, and he descends into
+the cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 14</DOCNO>
+"'Who's there?' cries the Captain at his busy desk, hurriedly making
+out his papers for the Customs--'Who's there?'  Oh! how that harmless
+question mangles Jonah!  For the instant he almost turns to flee
+again.  But he rallies.  'I seek a passage in this ship to Tarshish;
+how soon sail ye, sir?'  Thus far the busy Captain had not looked up
+to Jonah, though the man now stands before him; but no sooner does he
+hear that hollow voice, than he darts a scrutinizing glance.  'We
+sail with the next coming tide,' at last he slowly answered, still
+intently eyeing him.  'No sooner, sir?'--'Soon enough for any honest
+man that goes a passenger.'  Ha!  Jonah, that's another stab.  But he
+swiftly calls away the Captain from that scent.  'I'll sail with
+ye,'--he says,--'the passage money how much is that?--I'll pay now.'
+For it is particularly written, shipmates, as if it were a thing not
+to be overlooked in this history, 'that he paid the fare thereof' ere
+the craft did sail.  And taken with the context, this is full of
+meaning.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 15</DOCNO>
+"Now Jonah's Captain, shipmates, was one whose discernment detects
+crime in any, but whose cupidity exposes it only in the penniless.
+In this world, shipmates, sin that pays its way can travel freely,
+and without a passport; whereas Virtue, if a pauper, is stopped at
+all frontiers.  So Jonah's Captain prepares to test the length of
+Jonah's purse, ere he judge him openly.  He charges him thrice the
+usual sum; and it's assented to.  Then the Captain knows that Jonah
+is a fugitive; but at the same time resolves to help a flight that
+paves its rear with gold.  Yet when Jonah fairly takes out his purse,
+prudent suspicions still molest the Captain.  He rings every coin to
+find a counterfeit.  Not a forger, any way, he mutters; and Jonah is
+put down for his passage.  'Point out my state-room, Sir,' says Jonah
+now, 'I'm travel-weary; I need sleep.'  'Thou lookest like it,' says
+the Captain, 'there's thy room.'  Jonah enters, and would lock the
+door, but the lock contains no key.  Hearing him foolishly fumbling
+there, the Captain laughs lowly to himself, and mutters something
+about the doors of convicts' cells being never allowed to be locked
+within.  All dressed and dusty as he is, Jonah throws himself into
+his berth, and finds the little state-room ceiling almost resting on
+his forehead.  The air is close, and Jonah gasps.  Then, in that
+contracted hole, sunk, too, beneath the ship's water-line, Jonah
+feels the heralding presentiment of that stifling hour, when the
+whale shall hold him in the smallest of his bowels' wards.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 16</DOCNO>
+"Screwed at its axis against the side, a swinging lamp slightly
+oscillates in Jonah's room; and the ship, heeling over towards the
+wharf with the weight of the last bales received, the lamp, flame and
+all, though in slight motion, still maintains a permanent obliquity
+with reference to the room; though, in truth, infallibly straight
+itself, it but made obvious the false, lying levels among which it
+hung.  The lamp alarms and frightens Jonah; as lying in his berth his
+tormented eyes roll round the place, and this thus far successful
+fugitive finds no refuge for his restless glance.  But that
+contradiction in the lamp more and more appals him.  The floor, the
+ceiling, and the side, are all awry.  'Oh! so my conscience hangs in
+me!' he groans, 'straight upwards, so it burns; but the chambers of
+my soul are all in crookedness!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 17</DOCNO>
+"Like one who after a night of drunken revelry hies to his bed, still
+reeling, but with conscience yet pricking him, as the plungings of
+the Roman race-horse but so much the more strike his steel tags into
+him; as one who in that miserable plight still turns and turns in
+giddy anguish, praying God for annihilation until the fit be passed;
+and at last amid the whirl of woe he feels, a deep stupor steals over
+him, as over the man who bleeds to death, for conscience is the
+wound, and there's naught to staunch it; so, after sore wrestlings in
+his berth, Jonah's prodigy of ponderous misery drags him drowning
+down to sleep.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 18</DOCNO>
+"And now the time of tide has come; the ship casts off her cables;
+and from the deserted wharf the uncheered ship for Tarshish, all
+careening, glides to sea.  That ship, my friends, was the first of
+recorded smugglers! the contraband was Jonah.  But the sea rebels; he
+will not bear the wicked burden.  A dreadful storm comes on, the
+ship is like to break.  But now when the boatswain calls all hands to
+lighten her; when boxes, bales, and jars are clattering overboard;
+when the wind is shrieking, and the men are yelling, and every plank
+thunders with trampling feet right over Jonah's head; in all this
+raging tumult, Jonah sleeps his hideous sleep.  He sees no black sky
+and raging sea, feels not the reeling timbers, and little hears he or
+heeds he the far rush of the mighty whale, which even now with open
+mouth is cleaving the seas after him.  Aye, shipmates, Jonah was gone
+down into the sides of the ship--a berth in the cabin as I have taken
+it, and was fast asleep.  But the frightened master comes to him, and
+shrieks in his dead ear, 'What meanest thou, O, sleeper! arise!'
+Startled from his lethargy by that direful cry, Jonah staggers to his
+feet, and stumbling to the deck, grasps a shroud, to look out upon
+the sea.  But at that moment he is sprung upon by a panther billow
+leaping over the bulwarks.  Wave after wave thus leaps into the ship,
+and finding no speedy vent runs roaring fore and aft, till the
+mariners come nigh to drowning while yet afloat.  And ever, as the
+white moon shows her affrighted face from the steep gullies in the
+blackness overhead, aghast Jonah sees the rearing bowsprit pointing
+high upward, but soon beat downward again towards the tormented deep.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 19</DOCNO>
+"Terrors upon terrors run shouting through his soul.  In all his
+cringing attitudes, the God-fugitive is now too plainly known.  The
+sailors mark him; more and more certain grow their suspicions of him,
+and at last, fully to test the truth, by referring the whole matter
+to high Heaven, they fall to casting lots, to see for whose
+cause this great tempest was upon them.  The lot is Jonah's; that
+discovered, then how furiously they mob him with their questions.
+'What is thine occupation?  Whence comest thou?  Thy country?  What
+people?  But mark now, my shipmates, the behavior of poor Jonah.  The
+eager mariners but ask him who he is, and where from; whereas, they
+not only receive an answer to those questions, but likewise another
+answer to a question not put by them, but the unsolicited answer is
+forced from Jonah by the hard hand of God that is upon him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 20</DOCNO>
+"'I am a Hebrew,' he cries--and then--'I fear the Lord the God of
+Heaven who hath made the sea and the dry land!'  Fear him, O Jonah?
+Aye, well mightest thou fear the Lord God THEN!  Straightway, he now
+goes on to make a full confession; whereupon the mariners became more
+and more appalled, but still are pitiful.  For when Jonah, not yet
+supplicating God for mercy, since he but too well knew the darkness
+of his deserts,--when wretched Jonah cries out to them to take him
+and cast him forth into the sea, for he knew that for HIS sake this
+great tempest was upon them; they mercifully turn from him, and seek
+by other means to save the ship.  But all in vain; the indignant gale
+howls louder; then, with one hand raised invokingly to God, with the
+other they not unreluctantly lay hold of Jonah.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 21</DOCNO>
+"And now behold Jonah taken up as an anchor and dropped into the sea;
+when instantly an oily calmness floats out from the east, and the sea
+is still, as Jonah carries down the gale with him, leaving smooth
+water behind.  He goes down in the whirling heart of such a
+masterless commotion that he scarce heeds the moment when he drops
+seething into the yawning jaws awaiting him; and the whale shoots-to
+all his ivory teeth, like so many white bolts, upon his prison.  Then
+Jonah prayed unto the Lord out of the fish's belly.  But observe his
+prayer, and learn a weighty lesson.  For sinful as he is, Jonah does
+not weep and wail for direct deliverance.  He feels that his dreadful
+punishment is just.  He leaves all his deliverance to God, contenting
+himself with this, that spite of all his pains and pangs, he will
+still look towards His holy temple.  And here, shipmates, is true and
+faithful repentance; not clamorous for pardon, but grateful for
+punishment.  And how pleasing to God was this conduct in Jonah, is
+shown in the eventual deliverance of him from the sea and the whale.
+Shipmates, I do not place Jonah before you to be copied for his sin
+but I do place him before you as a model for repentance.  Sin not;
+but if you do, take heed to repent of it like Jonah."
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 22</DOCNO>
+While he was speaking these words, the howling of the shrieking,
+slanting storm without seemed to add new power to the preacher, who,
+when describing Jonah's sea-storm, seemed tossed by a storm himself.
+His deep chest heaved as with a ground-swell; his tossed arms seemed
+the warring elements at work; and the thunders that rolled away from
+off his swarthy brow, and the light leaping from his eye, made all
+his simple hearers look on him with a quick fear that was strange to
+them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 23</DOCNO>
+There now came a lull in his look, as he silently turned over the
+leaves of the Book once more; and, at last, standing motionless, with
+closed eyes, for the moment, seemed communing with God and himself.
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 24</DOCNO>
+But again he leaned over towards the people, and bowing his head
+lowly, with an aspect of the deepest yet manliest humility, he spake
+these words:
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 25</DOCNO>
+"Shipmates, God has laid but one hand upon you; both his hands press
+upon me.  I have read ye by what murky light may be mine the lesson
+that Jonah teaches to all sinners; and therefore to ye, and still
+more to me, for I am a greater sinner than ye.  And now how gladly
+would I come down from this mast-head and sit on the hatches there
+where you sit, and listen as you listen, while some one of you reads
+ME that other and more awful lesson which Jonah teaches to ME, as a
+pilot of the living God.  How being an anointed pilot-prophet, or
+speaker of true things, and bidden by the Lord to sound those
+unwelcome truths in the ears of a wicked Nineveh, Jonah, appalled at
+the hostility he should raise, fled from his mission, and sought to
+escape his duty and his God by taking ship at Joppa.  But God is
+everywhere; Tarshish he never reached.  As we have seen, God came
+upon him in the whale, and swallowed him down to living gulfs of
+doom, and with swift slantings tore him along 'into the midst of the
+seas,' where the eddying depths sucked him ten thousand fathoms down,
+and 'the weeds were wrapped about his head,' and all the watery world
+of woe bowled over him.  Yet even then beyond the reach of any
+plummet--'out of the belly of hell'--when the whale grounded upon the
+ocean's utmost bones, even then, God heard the engulphed, repenting
+prophet when he cried.  Then God spake unto the fish; and from the
+shuddering cold and blackness of the sea, the whale came breeching up
+towards the warm and pleasant sun, and all the delights of air and
+earth; and 'vomited out Jonah upon the dry land;' when the word of
+the Lord came a second time; and Jonah, bruised and beaten--his ears,
+like two sea-shells, still multitudinously murmuring of the
+ocean--Jonah did the Almighty's bidding.  And what was that,
+shipmates?  To preach the Truth to the face of Falsehood!  That was
+it!
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 26</DOCNO>
+"This, shipmates, this is that other lesson; and woe to that pilot of
+the living God who slights it.  Woe to him whom this world charms
+from Gospel duty!  Woe to him who seeks to pour oil upon the waters
+when God has brewed them into a gale!  Woe to him who seeks to please
+rather than to appal!  Woe to him whose good name is more to him than
+goodness!  Woe to him who, in this world, courts not dishonour!  Woe
+to him who would not be true, even though to be false were salvation!
+Yea, woe to him who, as the great Pilot Paul has it, while preaching
+to others is himself a castaway!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 27</DOCNO>
+He dropped and fell away from himself for a moment; then lifting his
+face to them again, showed a deep joy in his eyes, as he cried out
+with a heavenly enthusiasm,--"But oh! shipmates! on the starboard
+hand of every woe, there is a sure delight; and higher the top of
+that delight, than the bottom of the woe is deep.  Is not the
+main-truck higher than the kelson is low?  Delight is to him--a far,
+far upward, and inward delight--who against the proud gods and
+commodores of this earth, ever stands forth his own inexorable self.
+Delight is to him whose strong arms yet support him, when the ship of
+this base treacherous world has gone down beneath him.  Delight is to
+him, who gives no quarter in the truth, and kills, burns, and
+destroys all sin though he pluck it out from under the robes of
+Senators and Judges.  Delight,--top-gallant delight is to him, who
+acknowledges no law or lord, but the Lord his God, and is only a
+patriot to heaven.  Delight is to him, whom all the waves of the
+billows of the seas of the boisterous mob can never shake from this
+sure Keel of the Ages.  And eternal delight and deliciousness will be
+his, who coming to lay him down, can say with his final breath--O
+Father!--chiefly known to me by Thy rod--mortal or immortal, here I
+die.  I have striven to be Thine, more than to be this world's, or
+mine own.  Yet this is nothing: I leave eternity to Thee; for what
+is man that he should live out the lifetime of his God?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 9, Paragraph 28</DOCNO>
+He said no more, but slowly waving a benediction, covered his face
+with his hands, and so remained kneeling, till all the people had
+departed, and he was left alone in the place.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 1</DOCNO>
+A Bosom Friend.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 2</DOCNO>
+Returning to the Spouter-Inn from the Chapel, I found Queequeg there
+quite alone; he having left the Chapel before the benediction some
+time.  He was sitting on a bench before the fire, with his feet on
+the stove hearth, and in one hand was holding close up to his face
+that little negro idol of his; peering hard into its face, and with a
+jack-knife gently whittling away at its nose, meanwhile humming to
+himself in his heathenish way.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 3</DOCNO>
+But being now interrupted, he put up the image; and pretty soon,
+going to the table, took up a large book there, and placing it on his
+lap began counting the pages with deliberate regularity; at every
+fiftieth page--as I fancied--stopping a moment, looking vacantly
+around him, and giving utterance to a long-drawn gurgling whistle of
+astonishment.  He would then begin again at the next fifty; seeming
+to commence at number one each time, as though he could not count
+more than fifty, and it was only by such a large number of fifties
+being found together, that his astonishment at the multitude of pages
+was excited.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 4</DOCNO>
+With much interest I sat watching him.  Savage though he was, and
+hideously marred about the face--at least to my taste--his
+countenance yet had a something in it which was by no means
+disagreeable.  You cannot hide the soul.  Through all his unearthly
+tattooings, I thought I saw the traces of a simple honest heart; and
+in his large, deep eyes, fiery black and bold, there seemed tokens of
+a spirit that would dare a thousand devils.  And besides all this,
+there was a certain lofty bearing about the Pagan, which even his
+uncouthness could not altogether maim.  He looked like a man who had
+never cringed and never had had a creditor.  Whether it was, too,
+that his head being shaved, his forehead was drawn out in freer and
+brighter relief, and looked more expansive than it otherwise would,
+this I will not venture to decide; but certain it was his head was
+phrenologically an excellent one.  It may seem ridiculous, but it
+reminded me of General Washington's head, as seen in the popular
+busts of him.  It had the same long regularly graded retreating slope
+from above the brows, which were likewise very projecting, like two
+long promontories thickly wooded on top.  Queequeg was George
+Washington cannibalistically developed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 5</DOCNO>
+Whilst I was thus closely scanning him, half-pretending meanwhile to
+be looking out at the storm from the casement, he never heeded my
+presence, never troubled himself with so much as a single glance; but
+appeared wholly occupied with counting the pages of the marvellous
+book.  Considering how sociably we had been sleeping together the
+night previous, and especially considering the affectionate arm I had
+found thrown over me upon waking in the morning, I thought this
+indifference of his very strange.  But savages are strange beings; at
+times you do not know exactly how to take them.  At first they are
+overawing; their calm self-collectedness of simplicity seems a
+Socratic wisdom.  I had noticed also that Queequeg never consorted at
+all, or but very little, with the other seamen in the inn.  He made
+no advances whatever; appeared to have no desire to enlarge the
+circle of his acquaintances.  All this struck me as mighty singular;
+yet, upon second thoughts, there was something almost sublime in it.
+Here was a man some twenty thousand miles from home, by the way of
+Cape Horn, that is--which was the only way he could get there--thrown
+among people as strange to him as though he were in the planet
+Jupiter; and yet he seemed entirely at his ease; preserving the
+utmost serenity; content with his own companionship; always equal to
+himself.  Surely this was a touch of fine philosophy; though no doubt
+he had never heard there was such a thing as that.  But, perhaps, to
+be true philosophers, we mortals should not be conscious of so living
+or so striving.  So soon as I hear that such or such a man gives
+himself out for a philosopher, I conclude that, like the dyspeptic
+old woman, he must have "broken his digester."
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 6</DOCNO>
+As I sat there in that now lonely room; the fire burning low, in that
+mild stage when, after its first intensity has warmed the air, it
+then only glows to be looked at; the evening shades and phantoms
+gathering round the casements, and peering in upon us silent,
+solitary twain; the storm booming without in solemn swells; I began
+to be sensible of strange feelings.  I felt a melting in me.  No more
+my splintered heart and maddened hand were turned against the wolfish
+world.  This soothing savage had redeemed it.  There he sat, his very
+indifference speaking a nature in which there lurked no civilized
+hypocrisies and bland deceits.  Wild he was; a very sight of sights
+to see; yet I began to feel myself mysteriously drawn towards him.
+And those same things that would have repelled most others, they were
+the very magnets that thus drew me.  I'll try a pagan friend, thought
+I, since Christian kindness has proved but hollow courtesy.  I drew
+my bench near him, and made some friendly signs and hints, doing my
+best to talk with him meanwhile.  At first he little noticed these
+advances; but presently, upon my referring to his last night's
+hospitalities, he made out to ask me whether we were again to be
+bedfellows.  I told him yes; whereat I thought he looked pleased,
+perhaps a little complimented.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 7</DOCNO>
+We then turned over the book together, and I endeavored to explain to
+him the purpose of the printing, and the meaning of the few pictures
+that were in it.  Thus I soon engaged his interest; and from that we
+went to jabbering the best we could about the various outer sights to
+be seen in this famous town.  Soon I proposed a social smoke; and,
+producing his pouch and tomahawk, he quietly offered me a puff.  And
+then we sat exchanging puffs from that wild pipe of his, and keeping
+it regularly passing between us.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 8</DOCNO>
+If there yet lurked any ice of indifference towards me in the Pagan's
+breast, this pleasant, genial smoke we had, soon thawed it out, and
+left us cronies.  He seemed to take to me quite as naturally and
+unbiddenly as I to him; and when our smoke was over, he pressed his
+forehead against mine, clasped me round the waist, and said that
+henceforth we were married; meaning, in his country's phrase, that we
+were bosom friends; he would gladly die for me, if need should be.
+In a countryman, this sudden flame of friendship would have seemed
+far too premature, a thing to be much distrusted; but in this simple
+savage those old rules would not apply.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 9</DOCNO>
+After supper, and another social chat and smoke, we went to our room
+together.  He made me a present of his embalmed head; took out his
+enormous tobacco wallet, and groping under the tobacco, drew out some
+thirty dollars in silver; then spreading them on the table, and
+mechanically dividing them into two equal portions, pushed one of
+them towards me, and said it was mine.  I was going to remonstrate;
+but he silenced me by pouring them into my trowsers' pockets.  I let
+them stay.  He then went about his evening prayers, took out his
+idol, and removed the paper fireboard.  By certain signs and
+symptoms, I thought he seemed anxious for me to join him; but well
+knowing what was to follow, I deliberated a moment whether, in case
+he invited me, I would comply or otherwise.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 10</DOCNO>
+I was a good Christian; born and bred in the bosom of the infallible
+Presbyterian Church.  How then could I unite with this wild idolator
+in worshipping his piece of wood?  But what is worship? thought I.
+Do you suppose now, Ishmael, that the magnanimous God of heaven and
+earth--pagans and all included--can possibly be jealous of an
+insignificant bit of black wood?  Impossible!  But what is
+worship?--to do the will of God--THAT is worship.  And what is the
+will of God?--to do to my fellow man what I would have my fellow man
+to do to me--THAT is the will of God.  Now, Queequeg is my fellow
+man.  And what do I wish that this Queequeg would do to me?  Why,
+unite with me in my particular Presbyterian form of worship.
+Consequently, I must then unite with him in his; ergo, I must turn
+idolator.  So I kindled the shavings; helped prop up the innocent
+little idol; offered him burnt biscuit with Queequeg; salamed before
+him twice or thrice; kissed his nose; and that done, we undressed and
+went to bed, at peace with our own consciences and all the world.
+But we did not go to sleep without some little chat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 10, Paragraph 11</DOCNO>
+How it is I know not; but there is no place like a bed for
+confidential disclosures between friends.  Man and wife, they say,
+there open the very bottom of their souls to each other; and some old
+couples often lie and chat over old times till nearly morning.  Thus,
+then, in our hearts' honeymoon, lay I and Queequeg--a cosy, loving
+pair.
+</DOC>
+<DOC>
+<DOCNO>Chapter 11, Paragraph 1</DOCNO>
+Nightgown.
+</DOC>
+<DOC>
+<DOCNO>Chapter 11, Paragraph 2</DOCNO>
+We had lain thus in bed, chatting and napping at short intervals, and
+Queequeg now and then affectionately throwing his brown tattooed legs
+over mine, and then drawing them back; so entirely sociable and free
+and easy were we; when, at last, by reason of our confabulations,
+what little nappishness remained in us altogether departed, and we
+felt like getting up again, though day-break was yet some way down
+the future.
+</DOC>
+<DOC>
+<DOCNO>Chapter 11, Paragraph 3</DOCNO>
+Yes, we became very wakeful; so much so that our recumbent position
+began to grow wearisome, and by little and little we found ourselves
+sitting up; the clothes well tucked around us, leaning against the
+head-board with our four knees drawn up close together, and our two
+noses bending over them, as if our kneepans were warming-pans.  We
+felt very nice and snug, the more so since it was so chilly out of
+doors; indeed out of bed-clothes too, seeing that there was no fire
+in the room.  The more so, I say, because truly to enjoy bodily
+warmth, some small part of you must be cold, for there is no quality
+in this world that is not what it is merely by contrast.  Nothing
+exists in itself.  If you flatter yourself that you are all over
+comfortable, and have been so a long time, then you cannot be said to
+be comfortable any more.  But if, like Queequeg and me in the bed,
+the tip of your nose or the crown of your head be slightly chilled,
+why then, indeed, in the general consciousness you feel most
+delightfully and unmistakably warm.  For this reason a sleeping
+apartment should never be furnished with a fire, which is one of the
+luxurious discomforts of the rich.  For the height of this sort of
+deliciousness is to have nothing but the blanket between you and
+your snugness and the cold of the outer air.  Then there you lie like
+the one warm spark in the heart of an arctic crystal.
+</DOC>
+<DOC>
+<DOCNO>Chapter 11, Paragraph 4</DOCNO>
+We had been sitting in this crouching manner for some time, when all
+at once I thought I would open my eyes; for when between sheets,
+whether by day or by night, and whether asleep or awake, I have a way
+of always keeping my eyes shut, in order the more to concentrate the
+snugness of being in bed.  Because no man can ever feel his own
+identity aright except his eyes be closed; as if darkness were
+indeed the proper element of our essences, though light be more
+congenial to our clayey part.  Upon opening my eyes then, and coming
+out of my own pleasant and self-created darkness into the imposed and
+coarse outer gloom of the unilluminated twelve-o'clock-at-night, I
+experienced a disagreeable revulsion.  Nor did I at all object to the
+hint from Queequeg that perhaps it were best to strike a light,
+seeing that we were so wide awake; and besides he felt a strong
+desire to have a few quiet puffs from his Tomahawk.  Be it said, that
+though I had felt such a strong repugnance to his smoking in the bed
+the night before, yet see how elastic our stiff prejudices grow when
+love once comes to bend them.  For now I liked nothing better than
+to have Queequeg smoking by me, even in bed, because he seemed to be
+full of such serene household joy then.  I no more felt unduly
+concerned for the landlord's policy of insurance.  I was only alive
+to the condensed confidential comfortableness of sharing a pipe and a
+blanket with a real friend.  With our shaggy jackets drawn about our
+shoulders, we now passed the Tomahawk from one to the other, till
+slowly there grew over us a blue hanging tester of smoke, illuminated
+by the flame of the new-lit lamp.
+</DOC>
+<DOC>
+<DOCNO>Chapter 11, Paragraph 5</DOCNO>
+Whether it was that this undulating tester rolled the savage away to
+far distant scenes, I know not, but he now spoke of his native
+island; and, eager to hear his history, I begged him to go on and
+tell it.  He gladly complied.  Though at the time I but ill
+comprehended not a few of his words, yet subsequent disclosures, when
+I had become more familiar with his broken phraseology, now enable me
+to present the whole story such as it may prove in the mere skeleton
+I give.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 1</DOCNO>
+Biographical.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 2</DOCNO>
+Queequeg was a native of Rokovoko, an island far away to the West
+and South.  It is not down in any map; true places never are.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 3</DOCNO>
+When a new-hatched savage running wild about his native woodlands in
+a grass clout, followed by the nibbling goats, as if he were a green
+sapling; even then, in Queequeg's ambitious soul, lurked a strong
+desire to see something more of Christendom than a specimen whaler or
+two.  His father was a High Chief, a King; his uncle a High Priest;
+and on the maternal side he boasted aunts who were the wives of
+unconquerable warriors.  There was excellent blood in his
+veins--royal stuff; though sadly vitiated, I fear, by the cannibal
+propensity he nourished in his untutored youth.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 4</DOCNO>
+A Sag Harbor ship visited his father's bay, and Queequeg sought a
+passage to Christian lands.  But the ship, having her full complement
+of seamen, spurned his suit; and not all the King his father's
+influence could prevail.  But Queequeg vowed a vow.  Alone in his
+canoe, he paddled off to a distant strait, which he knew the ship
+must pass through when she quitted the island.  On one side was a
+coral reef; on the other a low tongue of land, covered with mangrove
+thickets that grew out into the water.  Hiding his canoe, still
+afloat, among these thickets, with its prow seaward, he sat down in
+the stern, paddle low in hand; and when the ship was gliding by, like
+a flash he darted out; gained her side; with one backward dash of his
+foot capsized and sank his canoe; climbed up the chains; and throwing
+himself at full length upon the deck, grappled a ring-bolt there, and
+swore not to let it go, though hacked in pieces.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 5</DOCNO>
+In vain the captain threatened to throw him overboard; suspended a
+cutlass over his naked wrists; Queequeg was the son of a King, and
+Queequeg budged not.  Struck by his desperate dauntlessness, and his
+wild desire to visit Christendom, the captain at last relented, and
+told him he might make himself at home.  But this fine young
+savage--this sea Prince of Wales, never saw the Captain's cabin.
+They put him down among the sailors, and made a whaleman of him.  But
+like Czar Peter content to toil in the shipyards of foreign cities,
+Queequeg disdained no seeming ignominy, if thereby he might happily
+gain the power of enlightening his untutored countrymen.  For at
+bottom--so he told me--he was actuated by a profound desire to learn
+among the Christians, the arts whereby to make his people still
+happier than they were; and more than that, still better than they
+were.  But, alas! the practices of whalemen soon convinced him that
+even Christians could be both miserable and wicked; infinitely more
+so, than all his father's heathens.  Arrived at last in old Sag
+Harbor; and seeing what the sailors did there; and then going on to
+Nantucket, and seeing how they spent their wages in that place also,
+poor Queequeg gave it up for lost.  Thought he, it's a wicked world
+in all meridians; I'll die a pagan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 6</DOCNO>
+And thus an old idolator at heart, he yet lived among these
+Christians, wore their clothes, and tried to talk their gibberish.
+Hence the queer ways about him, though now some time from home.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 7</DOCNO>
+By hints, I asked him whether he did not propose going back, and
+having a coronation; since he might now consider his father dead and
+gone, he being very old and feeble at the last accounts.  He answered
+no, not yet; and added that he was fearful Christianity, or rather
+Christians, had unfitted him for ascending the pure and undefiled
+throne of thirty pagan Kings before him.  But by and by, he said, he
+would return,--as soon as he felt himself baptized again.  For the
+nonce, however, he proposed to sail about, and sow his wild oats in
+all four oceans.  They had made a harpooneer of him, and that barbed
+iron was in lieu of a sceptre now.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 8</DOCNO>
+I asked him what might be his immediate purpose, touching his future
+movements.  He answered, to go to sea again, in his old vocation.
+Upon this, I told him that whaling was my own design, and informed
+him of my intention to sail out of Nantucket, as being the most
+promising port for an adventurous whaleman to embark from.  He at
+once resolved to accompany me to that island, ship aboard the same
+vessel, get into the same watch, the same boat, the same mess with
+me, in short to share my every hap; with both my hands in his, boldly
+dip into the Potluck of both worlds.  To all this I joyously
+assented; for besides the affection I now felt for Queequeg, he was
+an experienced harpooneer, and as such, could not fail to be of great
+usefulness to one, who, like me, was wholly ignorant of the mysteries
+of whaling, though well acquainted with the sea, as known to merchant
+seamen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 12, Paragraph 9</DOCNO>
+His story being ended with his pipe's last dying puff, Queequeg
+embraced me, pressed his forehead against mine, and blowing out the
+light, we rolled over from each other, this way and that, and very
+soon were sleeping.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 1</DOCNO>
+Wheelbarrow.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 2</DOCNO>
+Next morning, Monday, after disposing of the embalmed head to a
+barber, for a block, I settled my own and comrade's bill; using,
+however, my comrade's money.  The grinning landlord, as well as the
+boarders, seemed amazingly tickled at the sudden friendship which had
+sprung up between me and Queequeg--especially as Peter Coffin's cock
+and bull stories about him had previously so much alarmed me
+concerning the very person whom I now companied with.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 3</DOCNO>
+We borrowed a wheelbarrow, and embarking our things, including my own
+poor carpet-bag, and Queequeg's canvas sack and hammock, away we went
+down to "the Moss," the little Nantucket packet schooner moored at
+the wharf.  As we were going along the people stared; not at Queequeg
+so much--for they were used to seeing cannibals like him in their
+streets,--but at seeing him and me upon such confidential terms.  But
+we heeded them not, going along wheeling the barrow by turns, and
+Queequeg now and then stopping to adjust the sheath on his harpoon
+barbs.  I asked him why he carried such a troublesome thing with him
+ashore, and whether all whaling ships did not find their own
+harpoons.  To this, in substance, he replied, that though what I
+hinted was true enough, yet he had a particular affection for his own
+harpoon, because it was of assured stuff, well tried in many a mortal
+combat, and deeply intimate with the hearts of whales.  In short,
+like many inland reapers and mowers, who go into the farmers' meadows
+armed with their own scythes--though in no wise obliged to furnish
+them--even so, Queequeg, for his own private reasons, preferred his
+own harpoon.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 4</DOCNO>
+Shifting the barrow from my hand to his, he told me a funny story
+about the first wheelbarrow he had ever seen.  It was in Sag Harbor.
+The owners of his ship, it seems, had lent him one, in which to carry
+his heavy chest to his boarding house.  Not to seem ignorant about
+the thing--though in truth he was entirely so, concerning the precise
+way in which to manage the barrow--Queequeg puts his chest upon it;
+lashes it fast; and then shoulders the barrow and marches up the
+wharf.  "Why," said I, "Queequeg, you might have known better than
+that, one would think.  Didn't the people laugh?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 5</DOCNO>
+Upon this, he told me another story.  The people of his island of
+Rokovoko, it seems, at their wedding feasts express the fragrant
+water of young cocoanuts into a large stained calabash like a
+punchbowl; and this punchbowl always forms the great central ornament
+on the braided mat where the feast is held.  Now a certain grand
+merchant ship once touched at Rokovoko, and its commander--from all
+accounts, a very stately punctilious gentleman, at least for a sea
+captain--this commander was invited to the wedding feast of
+Queequeg's sister, a pretty young princess just turned of ten.  Well;
+when all the wedding guests were assembled at the bride's bamboo
+cottage, this Captain marches in, and being assigned the post of
+honour, placed himself over against the punchbowl, and between the
+High Priest and his majesty the King, Queequeg's father.  Grace being
+said,--for those people have their grace as well as we--though
+Queequeg told me that unlike us, who at such times look downwards to
+our platters, they, on the contrary, copying the ducks, glance
+upwards to the great Giver of all feasts--Grace, I say, being said,
+the High Priest opens the banquet by the immemorial ceremony of the
+island; that is, dipping his consecrated and consecrating fingers
+into the bowl before the blessed beverage circulates.  Seeing himself
+placed next the Priest, and noting the ceremony, and thinking
+himself--being Captain of a ship--as having plain precedence over a
+mere island King, especially in the King's own house--the Captain
+coolly proceeds to wash his hands in the punchbowl;--taking it I
+suppose for a huge finger-glass.  "Now," said Queequeg, "what you
+tink now?--Didn't our people laugh?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 6</DOCNO>
+At last, passage paid, and luggage safe, we stood on board the
+schooner.  Hoisting sail, it glided down the Acushnet river.  On one
+side, New Bedford rose in terraces of streets, their ice-covered
+trees all glittering in the clear, cold air.  Huge hills and
+mountains of casks on casks were piled upon her wharves, and side by
+side the world-wandering whale ships lay silent and safely moored at
+last; while from others came a sound of carpenters and coopers, with
+blended noises of fires and forges to melt the pitch, all betokening
+that new cruises were on the start; that one most perilous and long
+voyage ended, only begins a second; and a second ended, only begins a
+third, and so on, for ever and for aye.  Such is the endlessness,
+yea, the intolerableness of all earthly effort.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 7</DOCNO>
+Gaining the more open water, the bracing breeze waxed fresh; the
+little Moss tossed the quick foam from her bows, as a young colt his
+snortings.  How I snuffed that Tartar air!--how I spurned that
+turnpike earth!--that common highway all over dented with the marks
+of slavish heels and hoofs; and turned me to admire the magnanimity
+of the sea which will permit no records.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 8</DOCNO>
+At the same foam-fountain, Queequeg seemed to drink and reel with me.
+His dusky nostrils swelled apart; he showed his filed and pointed
+teeth.  On, on we flew; and our offing gained, the Moss did homage to
+the blast; ducked and dived her bows as a slave before the Sultan.
+Sideways leaning, we sideways darted; every ropeyarn tingling like a
+wire; the two tall masts buckling like Indian canes in land
+tornadoes.  So full of this reeling scene were we, as we stood by the
+plunging bowsprit, that for some time we did not notice the jeering
+glances of the passengers, a lubber-like assembly, who marvelled that
+two fellow beings should be so companionable; as though a white man
+were anything more dignified than a whitewashed negro.  But there
+were some boobies and bumpkins there, who, by their intense
+greenness, must have come from the heart and centre of all verdure.
+Queequeg caught one of these young saplings mimicking him behind his
+back.  I thought the bumpkin's hour of doom was come.  Dropping his
+harpoon, the brawny savage caught him in his arms, and by an almost
+miraculous dexterity and strength, sent him high up bodily into the
+air; then slightly tapping his stern in mid-somerset, the fellow
+landed with bursting lungs upon his feet, while Queequeg, turning his
+back upon him, lighted his tomahawk pipe and passed it to me for a
+puff.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 9</DOCNO>
+"Capting!  Capting! yelled the bumpkin, running towards that officer;
+"Capting, Capting, here's the devil."
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 10</DOCNO>
+"Hallo, YOU sir," cried the Captain, a gaunt rib of the sea, stalking
+up to Queequeg, "what in thunder do you mean by that?  Don't you know
+you might have killed that chap?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 11</DOCNO>
+"What him say?" said Queequeg, as he mildly turned to me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 12</DOCNO>
+"He say," said I, "that you came near kill-e that man there,"
+pointing to the still shivering greenhorn.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 13</DOCNO>
+"Kill-e," cried Queequeg, twisting his tattooed face into an
+unearthly expression of disdain, "ah! him bevy small-e fish-e;
+Queequeg no kill-e so small-e fish-e; Queequeg kill-e big whale!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 14</DOCNO>
+"Look you," roared the Captain, "I'll kill-e YOU, you cannibal, if
+you try any more of your tricks aboard here; so mind your eye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 15</DOCNO>
+But it so happened just then, that it was high time for the Captain
+to mind his own eye.  The prodigious strain upon the main-sail had
+parted the weather-sheet, and the tremendous boom was now flying from
+side to side, completely sweeping the entire after part of the deck.
+The poor fellow whom Queequeg had handled so roughly, was swept
+overboard; all hands were in a panic; and to attempt snatching at the
+boom to stay it, seemed madness.  It flew from right to left, and
+back again, almost in one ticking of a watch, and every instant
+seemed on the point of snapping into splinters.  Nothing was done,
+and nothing seemed capable of being done; those on deck rushed
+towards the bows, and stood eyeing the boom as if it were the lower
+jaw of an exasperated whale.  In the midst of this consternation,
+Queequeg dropped deftly to his knees, and crawling under the path of
+the boom, whipped hold of a rope, secured one end to the bulwarks,
+and then flinging the other like a lasso, caught it round the boom as
+it swept over his head, and at the next jerk, the spar was that way
+trapped, and all was safe.  The schooner was run into the wind, and
+while the hands were clearing away the stern boat, Queequeg, stripped
+to the waist, darted from the side with a long living arc of a leap.
+For three minutes or more he was seen swimming like a dog, throwing
+his long arms straight out before him, and by turns revealing his
+brawny shoulders through the freezing foam.  I looked at the grand
+and glorious fellow, but saw no one to be saved.  The greenhorn had
+gone down.  Shooting himself perpendicularly from the water,
+Queequeg, now took an instant's glance around him, and seeming to see
+just how matters were, dived down and disappeared.  A few minutes
+more, and he rose again, one arm still striking out, and with the
+other dragging a lifeless form.  The boat soon picked them up.  The
+poor bumpkin was restored.  All hands voted Queequeg a noble trump;
+the captain begged his pardon.  From that hour I clove to Queequeg
+like a barnacle; yea, till poor Queequeg took his last long dive.
+</DOC>
+<DOC>
+<DOCNO>Chapter 13, Paragraph 16</DOCNO>
+Was there ever such unconsciousness?  He did not seem to think that
+he at all deserved a medal from the Humane and Magnanimous Societies.
+He only asked for water--fresh water--something to wipe the brine
+off; that done, he put on dry clothes, lighted his pipe, and leaning
+against the bulwarks, and mildly eyeing those around him, seemed to
+be saying to himself--"It's a mutual, joint-stock world, in all
+meridians.  We cannibals must help these Christians."
+</DOC>
+<DOC>
+<DOCNO>Chapter 14, Paragraph 1</DOCNO>
+Nantucket.
+</DOC>
+<DOC>
+<DOCNO>Chapter 14, Paragraph 2</DOCNO>
+Nothing more happened on the passage worthy the mentioning; so, after
+a fine run, we safely arrived in Nantucket.
+</DOC>
+<DOC>
+<DOCNO>Chapter 14, Paragraph 3</DOCNO>
+Nantucket!  Take out your map and look at it.  See what a real corner
+of the world it occupies; how it stands there, away off shore, more
+lonely than the Eddystone lighthouse.  Look at it--a mere hillock,
+and elbow of sand; all beach, without a background.  There is more
+sand there than you would use in twenty years as a substitute for
+blotting paper.  Some gamesome wights will tell you that they have to
+plant weeds there, they don't grow naturally; that they import Canada
+thistles; that they have to send beyond seas for a spile to stop a
+leak in an oil cask; that pieces of wood in Nantucket are carried
+about like bits of the true cross in Rome; that people there plant
+toadstools before their houses, to get under the shade in summer
+time; that one blade of grass makes an oasis, three blades in a day's
+walk a prairie; that they wear quicksand shoes, something like
+Laplander snow-shoes; that they are so shut up, belted about, every
+way inclosed, surrounded, and made an utter island of by the ocean,
+that to their very chairs and tables small clams will sometimes be
+found adhering, as to the backs of sea turtles.  But these
+extravaganzas only show that Nantucket is no Illinois.
+</DOC>
+<DOC>
+<DOCNO>Chapter 14, Paragraph 4</DOCNO>
+Look now at the wondrous traditional story of how this island was
+settled by the red-men.  Thus goes the legend.  In olden times an
+eagle swooped down upon the New England coast, and carried off an
+infant Indian in his talons.  With loud lament the parents saw their
+child borne out of sight over the wide waters.  They resolved to
+follow in the same direction.  Setting out in their canoes, after a
+perilous passage they discovered the island, and there they found an
+empty ivory casket,--the poor little Indian's skeleton.
+</DOC>
+<DOC>
+<DOCNO>Chapter 14, Paragraph 5</DOCNO>
+What wonder, then, that these Nantucketers, born on a beach, should
+take to the sea for a livelihood!  They first caught crabs and
+quohogs in the sand; grown bolder, they waded out with nets for
+mackerel; more experienced, they pushed off in boats and captured
+cod; and at last, launching a navy of great ships on the sea,
+explored this watery world; put an incessant belt of
+circumnavigations round it; peeped in at Behring's Straits; and in
+all seasons and all oceans declared everlasting war with the
+mightiest animated mass that has survived the flood; most monstrous
+and most mountainous!  That Himmalehan, salt-sea Mastodon, clothed
+with such portentousness of unconscious power, that his very panics
+are more to be dreaded than his most fearless and malicious assaults!
+</DOC>
+<DOC>
+<DOCNO>Chapter 14, Paragraph 6</DOCNO>
+And thus have these naked Nantucketers, these sea hermits, issuing
+from their ant-hill in the sea, overrun and conquered the watery
+world like so many Alexanders; parcelling out among them the
+Atlantic, Pacific, and Indian oceans, as the three pirate powers did
+Poland.  Let America add Mexico to Texas, and pile Cuba upon Canada;
+let the English overswarm all India, and hang out their blazing
+banner from the sun; two thirds of this terraqueous globe are the
+Nantucketer's.  For the sea is his; he owns it, as Emperors own
+empires; other seamen having but a right of way through it.  Merchant
+ships are but extension bridges; armed ones but floating forts; even
+pirates and privateers, though following the sea as highwaymen the
+road, they but plunder other ships, other fragments of the land like
+themselves, without seeking to draw their living from the bottomless
+deep itself.  The Nantucketer, he alone resides and riots on the sea;
+he alone, in Bible language, goes down to it in ships; to and fro
+ploughing it as his own special plantation.  THERE is his home; THERE
+lies his business, which a Noah's flood would not interrupt, though
+it overwhelmed all the millions in China.  He lives on the sea, as
+prairie cocks in the prairie; he hides among the waves, he climbs
+them as chamois hunters climb the Alps.  For years he knows not the
+land; so that when he comes to it at last, it smells like another
+world, more strangely than the moon would to an Earthsman.  With the
+landless gull, that at sunset folds her wings and is rocked to sleep
+between billows; so at nightfall, the Nantucketer, out of sight of
+land, furls his sails, and lays him to his rest, while under his very
+pillow rush herds of walruses and whales.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 1</DOCNO>
+Chowder.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 2</DOCNO>
+It was quite late in the evening when the little Moss came snugly to
+anchor, and Queequeg and I went ashore; so we could attend to no
+business that day, at least none but a supper and a bed.  The
+landlord of the Spouter-Inn had recommended us to his cousin Hosea
+Hussey of the Try Pots, whom he asserted to be the proprietor of one
+of the best kept hotels in all Nantucket, and moreover he had assured
+us that Cousin Hosea, as he called him, was famous for his chowders.
+In short, he plainly hinted that we could not possibly do better than
+try pot-luck at the Try Pots.  But the directions he had given us
+about keeping a yellow warehouse on our starboard hand till we opened
+a white church to the larboard, and then keeping that on the larboard
+hand till we made a corner three points to the starboard, and that
+done, then ask the first man we met where the place was: these
+crooked directions of his very much puzzled us at first, especially
+as, at the outset, Queequeg insisted that the yellow warehouse--our
+first point of departure--must be left on the larboard hand, whereas
+I had understood Peter Coffin to say it was on the starboard.
+However, by dint of beating about a little in the dark, and now and
+then knocking up a peaceable inhabitant to inquire the way, we at
+last came to something which there was no mistaking.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 3</DOCNO>
+Two enormous wooden pots painted black, and suspended by asses' ears,
+swung from the cross-trees of an old top-mast, planted in front of an
+old doorway.  The horns of the cross-trees were sawed off on the
+other side, so that this old top-mast looked not a little like a
+gallows.  Perhaps I was over sensitive to such impressions at the
+time, but I could not help staring at this gallows with a vague
+misgiving.  A sort of crick was in my neck as I gazed up to the two
+remaining horns; yes, TWO of them, one for Queequeg, and one for me.
+It's ominous, thinks I.  A Coffin my Innkeeper upon landing in my
+first whaling port; tombstones staring at me in the whalemen's
+chapel; and here a gallows! and a pair of prodigious black pots too!
+Are these last throwing out oblique hints touching Tophet?
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 4</DOCNO>
+I was called from these reflections by the sight of a freckled woman
+with yellow hair and a yellow gown, standing in the porch of the inn,
+under a dull red lamp swinging there, that looked much like an
+injured eye, and carrying on a brisk scolding with a man in a purple
+woollen shirt.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 5</DOCNO>
+"Get along with ye," said she to the man, "or I'll be combing ye!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 6</DOCNO>
+"Come on, Queequeg," said I, "all right.  There's Mrs. Hussey."
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 7</DOCNO>
+And so it turned out; Mr. Hosea Hussey being from home, but leaving
+Mrs. Hussey entirely competent to attend to all his affairs.  Upon
+making known our desires for a supper and a bed, Mrs. Hussey,
+postponing further scolding for the present, ushered us into a little
+room, and seating us at a table spread with the relics of a recently
+concluded repast, turned round to us and said--"Clam or Cod?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 8</DOCNO>
+"What's that about Cods, ma'am?" said I, with much politeness.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 9</DOCNO>
+"Clam or Cod?" she repeated.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 10</DOCNO>
+"A clam for supper? a cold clam; is THAT what you mean, Mrs. Hussey?"
+says I, "but that's a rather cold and clammy reception in the winter
+time, ain't it, Mrs. Hussey?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 11</DOCNO>
+But being in a great hurry to resume scolding the man in the purple
+Shirt, who was waiting for it in the entry, and seeming to hear
+nothing but the word "clam," Mrs. Hussey hurried towards an open door
+leading to the kitchen, and bawling out "clam for two," disappeared.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 12</DOCNO>
+"Queequeg," said I, "do you think that we can make out a supper for
+us both on one clam?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 13</DOCNO>
+However, a warm savory steam from the kitchen served to belie the
+apparently cheerless prospect before us.  But when that smoking
+chowder came in, the mystery was delightfully explained.  Oh, sweet
+friends! hearken to me.  It was made of small juicy clams, scarcely
+bigger than hazel nuts, mixed with pounded ship biscuit, and salted
+pork cut up into little flakes; the whole enriched with butter, and
+plentifully seasoned with pepper and salt.  Our appetites being
+sharpened by the frosty voyage, and in particular, Queequeg seeing
+his favourite fishing food before him, and the chowder being
+surpassingly excellent, we despatched it with great expedition: when
+leaning back a moment and bethinking me of Mrs. Hussey's clam and cod
+announcement, I thought I would try a little experiment.  Stepping to
+the kitchen door, I uttered the word "cod" with great emphasis, and
+resumed my seat.  In a few moments the savoury steam came forth
+again, but with a different flavor, and in good time a fine
+cod-chowder was placed before us.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 14</DOCNO>
+We resumed business; and while plying our spoons in the bowl, thinks
+I to myself, I wonder now if this here has any effect on the head?
+What's that stultifying saying about chowder-headed people?  "But
+look, Queequeg, ain't that a live eel in your bowl?  Where's your
+harpoon?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 15</DOCNO>
+Fishiest of all fishy places was the Try Pots, which well deserved
+its name; for the pots there were always boiling chowders.  Chowder
+for breakfast, and chowder for dinner, and chowder for supper, till
+you began to look for fish-bones coming through your clothes.  The
+area before the house was paved with clam-shells.  Mrs. Hussey wore a
+polished necklace of codfish vertebra; and Hosea Hussey had his
+account books bound in superior old shark-skin.  There was a fishy
+flavor to the milk, too, which I could not at all account for, till
+one morning happening to take a stroll along the beach among some
+fishermen's boats, I saw Hosea's brindled cow feeding on fish
+remnants, and marching along the sand with each foot in a cod's
+decapitated head, looking very slip-shod, I assure ye.
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 16</DOCNO>
+Supper concluded, we received a lamp, and directions from Mrs. Hussey
+concerning the nearest way to bed; but, as Queequeg was about to
+precede me up the stairs, the lady reached forth her arm, and
+demanded his harpoon; she allowed no harpoon in her chambers.  "Why
+not? said I; "every true whaleman sleeps with his harpoon--but why
+not?"  "Because it's dangerous," says she.  "Ever since young Stiggs
+coming from that unfort'nt v'y'ge of his, when he was gone four years
+and a half, with only three barrels of ILE, was found dead in my
+first floor back, with his harpoon in his side; ever since then I
+allow no boarders to take sich dangerous weepons in their rooms at
+night.  So, Mr. Queequeg" (for she had learned his name), "I will
+just take this here iron, and keep it for you till morning.  But the
+chowder; clam or cod to-morrow for breakfast, men?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 15, Paragraph 17</DOCNO>
+"Both," says I; "and let's have a couple of smoked herring by way of
+variety."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 1</DOCNO>
+The Ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 2</DOCNO>
+In bed we concocted our plans for the morrow.  But to my surprise and
+no small concern, Queequeg now gave me to understand, that he had
+been diligently consulting Yojo--the name of his black little
+god--and Yojo had told him two or three times over, and strongly
+insisted upon it everyway, that instead of our going together among
+the whaling-fleet in harbor, and in concert selecting our craft;
+instead of this, I say, Yojo earnestly enjoined that the selection of
+the ship should rest wholly with me, inasmuch as Yojo purposed
+befriending us; and, in order to do so, had already pitched upon a
+vessel, which, if left to myself, I, Ishmael, should infallibly light
+upon, for all the world as though it had turned out by chance; and in
+that vessel I must immediately ship myself, for the present
+irrespective of Queequeg.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 3</DOCNO>
+I have forgotten to mention that, in many things, Queequeg placed
+great confidence in the excellence of Yojo's judgment and surprising
+forecast of things; and cherished Yojo with considerable esteem, as a
+rather good sort of god, who perhaps meant well enough upon the
+whole, but in all cases did not succeed in his benevolent designs.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 4</DOCNO>
+Now, this plan of Queequeg's, or rather Yojo's, touching the
+selection of our craft; I did not like that plan at all.  I had not a
+little relied upon Queequeg's sagacity to point out the whaler best
+fitted to carry us and our fortunes securely.  But as all my
+remonstrances produced no effect upon Queequeg, I was obliged to
+acquiesce; and accordingly prepared to set about this business with a
+determined rushing sort of energy and vigor, that should quickly
+settle that trifling little affair.  Next morning early, leaving
+Queequeg shut up with Yojo in our little bedroom--for it seemed that
+it was some sort of Lent or Ramadan, or day of fasting, humiliation,
+and prayer with Queequeg and Yojo that day; HOW it was I never could
+find out, for, though I applied myself to it several times, I never
+could master his liturgies and XXXIX Articles--leaving Queequeg,
+then, fasting on his tomahawk pipe, and Yojo warming himself at his
+sacrificial fire of shavings, I sallied out among the shipping.
+After much prolonged sauntering and many random inquiries, I learnt
+that there were three ships up for three-years' voyages--The
+Devil-dam, the Tit-bit, and the Pequod.  DEVIL-DAM, I do not know
+the origin of; TIT-BIT is obvious; PEQUOD, you will no doubt
+remember, was the name of a celebrated tribe of Massachusetts
+Indians; now extinct as the ancient Medes.  I peered and pryed about
+the Devil-dam; from her, hopped over to the Tit-bit; and finally,
+going on board the Pequod, looked around her for a moment, and then
+decided that this was the very ship for us.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 5</DOCNO>
+You may have seen many a quaint craft in your day, for aught I
+know;--square-toed luggers; mountainous Japanese junks; butter-box
+galliots, and what not; but take my word for it, you never saw such a
+rare old craft as this same rare old Pequod.  She was a ship of the
+old school, rather small if anything; with an old-fashioned
+claw-footed look about her.  Long seasoned and weather-stained in the
+typhoons and calms of all four oceans, her old hull's complexion was
+darkened like a French grenadier's, who has alike fought in Egypt and
+Siberia.  Her venerable bows looked bearded.  Her masts--cut
+somewhere on the coast of Japan, where her original ones were lost
+overboard in a gale--her masts stood stiffly up like the spines of
+the three old kings of Cologne.  Her ancient decks were worn and
+wrinkled, like the pilgrim-worshipped flag-stone in Canterbury
+Cathedral where Becket bled.  But to all these her old antiquities,
+were added new and marvellous features, pertaining to the wild
+business that for more than half a century she had followed.  Old
+Captain Peleg, many years her chief-mate, before he commanded another
+vessel of his own, and now a retired seaman, and one of the principal
+owners of the Pequod,--this old Peleg, during the term of his
+chief-mateship, had built upon her original grotesqueness, and inlaid
+it, all over, with a quaintness both of material and device,
+unmatched by anything except it be Thorkill-Hake's carved buckler or
+bedstead.  She was apparelled like any barbaric Ethiopian emperor,
+his neck heavy with pendants of polished ivory.  She was a thing of
+trophies.  A cannibal of a craft, tricking herself forth in the
+chased bones of her enemies.  All round, her unpanelled, open
+bulwarks were garnished like one continuous jaw, with the long sharp
+teeth of the sperm whale, inserted there for pins, to fasten her old
+hempen thews and tendons to.  Those thews ran not through base blocks
+of land wood, but deftly travelled over sheaves of sea-ivory.
+Scorning a turnstile wheel at her reverend helm, she sported there a
+tiller; and that tiller was in one mass, curiously carved from the
+long narrow lower jaw of her hereditary foe.  The helmsman who
+steered by that tiller in a tempest, felt like the Tartar, when he
+holds back his fiery steed by clutching its jaw.  A noble craft, but
+somehow a most melancholy!  All noble things are touched with that.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 6</DOCNO>
+Now when I looked about the quarter-deck, for some one having
+authority, in order to propose myself as a candidate for the voyage,
+at first I saw nobody; but I could not well overlook a strange sort
+of tent, or rather wigwam, pitched a little behind the main-mast.  It
+seemed only a temporary erection used in port.  It was of a conical
+shape, some ten feet high; consisting of the long, huge slabs of
+limber black bone taken from the middle and highest part of the jaws
+of the right-whale.  Planted with their broad ends on the deck, a
+circle of these slabs laced together, mutually sloped towards each
+other, and at the apex united in a tufted point, where the loose
+hairy fibres waved to and fro like the top-knot on some old
+Pottowottamie Sachem's head.  A triangular opening faced towards the
+bows of the ship, so that the insider commanded a complete view
+forward.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 7</DOCNO>
+And half concealed in this queer tenement, I at length found one who
+by his aspect seemed to have authority; and who, it being noon, and
+the ship's work suspended, was now enjoying respite from the burden
+of command.  He was seated on an old-fashioned oaken chair, wriggling
+all over with curious carving; and the bottom of which was formed of
+a stout interlacing of the same elastic stuff of which the wigwam was
+constructed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 8</DOCNO>
+There was nothing so very particular, perhaps, about the appearance
+of the elderly man I saw; he was brown and brawny, like most old
+seamen, and heavily rolled up in blue pilot-cloth, cut in the Quaker
+style; only there was a fine and almost microscopic net-work of the
+minutest wrinkles interlacing round his eyes, which must have arisen
+from his continual sailings in many hard gales, and always looking to
+windward;--for this causes the muscles about the eyes to become
+pursed together.  Such eye-wrinkles are very effectual in a scowl.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 9</DOCNO>
+"Is this the Captain of the Pequod?" said I, advancing to the door of
+the tent.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 10</DOCNO>
+"Supposing it be the captain of the Pequod, what dost thou want of
+him?" he demanded.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 11</DOCNO>
+"I was thinking of shipping."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 12</DOCNO>
+"Thou wast, wast thou?  I see thou art no Nantucketer--ever been in
+a stove boat?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 13</DOCNO>
+"No, Sir, I never have."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 14</DOCNO>
+"Dost know nothing at all about whaling, I dare say--eh?
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 15</DOCNO>
+"Nothing, Sir; but I have no doubt I shall soon learn.  I've been
+several voyages in the merchant service, and I think that--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 16</DOCNO>
+"Merchant service be damned.  Talk not that lingo to me.  Dost see
+that leg?--I'll take that leg away from thy stern, if ever thou
+talkest of the marchant service to me again.  Marchant service
+indeed!  I suppose now ye feel considerable proud of having served in
+those marchant ships.  But flukes! man, what makes thee want to go a
+whaling, eh?--it looks a little suspicious, don't it, eh?--Hast not
+been a pirate, hast thou?--Didst not rob thy last Captain, didst
+thou?--Dost not think of murdering the officers when thou gettest to
+sea?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 17</DOCNO>
+I protested my innocence of these things.  I saw that under the mask
+of these half humorous innuendoes, this old seaman, as an insulated
+Quakerish Nantucketer, was full of his insular prejudices, and rather
+distrustful of all aliens, unless they hailed from Cape Cod or the
+Vineyard.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 18</DOCNO>
+"But what takes thee a-whaling?  I want to know that before I think
+of shipping ye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 19</DOCNO>
+"Well, sir, I want to see what whaling is.  I want to see the world."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 20</DOCNO>
+"Want to see what whaling is, eh?  Have ye clapped eye on Captain
+Ahab?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 21</DOCNO>
+"Who is Captain Ahab, sir?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 22</DOCNO>
+"Aye, aye, I thought so.  Captain Ahab is the Captain of this ship."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 23</DOCNO>
+"I am mistaken then.  I thought I was speaking to the Captain
+himself."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 24</DOCNO>
+"Thou art speaking to Captain Peleg--that's who ye are speaking to,
+young man.  It belongs to me and Captain Bildad to see the Pequod
+fitted out for the voyage, and supplied with all her needs, including
+crew.  We are part owners and agents.  But as I was going to say, if
+thou wantest to know what whaling is, as thou tellest ye do, I can
+put ye in a way of finding it out before ye bind yourself to it, past
+backing out.  Clap eye on Captain Ahab, young man, and thou wilt find
+that he has only one leg."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 25</DOCNO>
+"What do you mean, sir?  Was the other one lost by a whale?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 26</DOCNO>
+"Lost by a whale!  Young man, come nearer to me: it was devoured,
+chewed up, crunched by the monstrousest parmacetty that ever chipped
+a boat!--ah, ah!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 27</DOCNO>
+I was a little alarmed by his energy, perhaps also a little touched
+at the hearty grief in his concluding exclamation, but said as calmly
+as I could, "What you say is no doubt true enough, sir; but how could
+I know there was any peculiar ferocity in that particular whale,
+though indeed I might have inferred as much from the simple fact of
+the accident."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 28</DOCNO>
+"Look ye now, young man, thy lungs are a sort of soft, d'ye see; thou
+dost not talk shark a bit.  SURE, ye've been to sea before now; sure
+of that?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 29</DOCNO>
+"Sir," said I, "I thought I told you that I had been four voyages in
+the merchant--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 30</DOCNO>
+"Hard down out of that!  Mind what I said about the marchant
+service--don't aggravate me--I won't have it.  But let us understand
+each other.  I have given thee a hint about what whaling is; do ye
+yet feel inclined for it?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 31</DOCNO>
+"I do, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 32</DOCNO>
+"Very good.  Now, art thou the man to pitch a harpoon down a live
+whale's throat, and then jump after it?  Answer, quick!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 33</DOCNO>
+"I am, sir, if it should be positively indispensable to do so; not to
+be got rid of, that is; which I don't take to be the fact."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 34</DOCNO>
+"Good again.  Now then, thou not only wantest to go a-whaling, to
+find out by experience what whaling is, but ye also want to go in
+order to see the world?  Was not that what ye said?  I thought so.
+Well then, just step forward there, and take a peep over the
+weather-bow, and then back to me and tell me what ye see there."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 35</DOCNO>
+For a moment I stood a little puzzled by this curious request, not
+knowing exactly how to take it, whether humorously or in earnest.
+But concentrating all his crow's feet into one scowl, Captain Peleg
+started me on the errand.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 36</DOCNO>
+Going forward and glancing over the weather bow, I perceived that the
+ship swinging to her anchor with the flood-tide, was now obliquely
+pointing towards the open ocean.  The prospect was unlimited, but
+exceedingly monotonous and forbidding; not the slightest variety that
+I could see.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 37</DOCNO>
+"Well, what's the report?" said Peleg when I came back; "what did ye
+see?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 38</DOCNO>
+"Not much," I replied--"nothing but water; considerable horizon
+though, and there's a squall coming up, I think."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 39</DOCNO>
+"Well, what does thou think then of seeing the world?  Do ye wish to
+go round Cape Horn to see any more of it, eh?  Can't ye see the world
+where you stand?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 40</DOCNO>
+I was a little staggered, but go a-whaling I must, and I would; and
+the Pequod was as good a ship as any--I thought the best--and all
+this I now repeated to Peleg.  Seeing me so determined, he expressed
+his willingness to ship me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 41</DOCNO>
+"And thou mayest as well sign the papers right off," he added--"come
+along with ye."  And so saying, he led the way below deck into the
+cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 42</DOCNO>
+Seated on the transom was what seemed to me a most uncommon and
+surprising figure.  It turned out to be Captain Bildad, who along
+with Captain Peleg was one of the largest owners of the vessel; the
+other shares, as is sometimes the case in these ports, being held by
+a crowd of old annuitants; widows, fatherless children, and chancery
+wards; each owning about the value of a timber head, or a foot of
+plank, or a nail or two in the ship.  People in Nantucket invest
+their money in whaling vessels, the same way that you do yours in
+approved state stocks bringing in good interest.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 43</DOCNO>
+Now, Bildad, like Peleg, and indeed many other Nantucketers, was a
+Quaker, the island having been originally settled by that sect; and
+to this day its inhabitants in general retain in an uncommon measure
+the peculiarities of the Quaker, only variously and anomalously
+modified by things altogether alien and heterogeneous.  For some of
+these same Quakers are the most sanguinary of all sailors and
+whale-hunters.  They are fighting Quakers; they are Quakers with a
+vengeance.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 44</DOCNO>
+So that there are instances among them of men, who, named with
+Scripture names--a singularly common fashion on the island--and in
+childhood naturally imbibing the stately dramatic thee and thou of
+the Quaker idiom; still, from the audacious, daring, and boundless
+adventure of their subsequent lives, strangely blend with these
+unoutgrown peculiarities, a thousand bold dashes of character, not
+unworthy a Scandinavian sea-king, or a poetical Pagan Roman.  And
+when these things unite in a man of greatly superior natural force,
+with a globular brain and a ponderous heart; who has also by the
+stillness and seclusion of many long night-watches in the remotest
+waters, and beneath constellations never seen here at the north, been
+led to think untraditionally and independently; receiving all
+nature's sweet or savage impressions fresh from her own virgin
+voluntary and confiding breast, and thereby chiefly, but with some
+help from accidental advantages, to learn a bold and nervous lofty
+language--that man makes one in a whole nation's census--a mighty
+pageant creature, formed for noble tragedies.  Nor will it at all
+detract from him, dramatically regarded, if either by birth or other
+circumstances, he have what seems a half wilful overruling morbidness
+at the bottom of his nature.  For all men tragically great are made
+so through a certain morbidness.  Be sure of this, O young ambition,
+all mortal greatness is but disease.  But, as yet we have not to do
+with such an one, but with quite another; and still a man, who, if
+indeed peculiar, it only results again from another phase of the
+Quaker, modified by individual circumstances.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 45</DOCNO>
+Like Captain Peleg, Captain Bildad was a well-to-do, retired
+whaleman.  But unlike Captain Peleg--who cared not a rush for what
+are called serious things, and indeed deemed those self-same serious
+things the veriest of all trifles--Captain Bildad had not only been
+originally educated according to the strictest sect of Nantucket
+Quakerism, but all his subsequent ocean life, and the sight of many
+unclad, lovely island creatures, round the Horn--all that had not
+moved this native born Quaker one single jot, had not so much as
+altered one angle of his vest.  Still, for all this immutableness,
+was there some lack of common consistency about worthy Captain
+Peleg.  Though refusing, from conscientious scruples, to bear arms
+against land invaders, yet himself had illimitably invaded the
+Atlantic and Pacific; and though a sworn foe to human bloodshed, yet
+had he in his straight-bodied coat, spilled tuns upon tuns of
+leviathan gore.  How now in the contemplative evening of his days,
+the pious Bildad reconciled these things in the reminiscence, I do
+not know; but it did not seem to concern him much, and very probably
+he had long since come to the sage and sensible conclusion that a
+man's religion is one thing, and this practical world quite another.
+This world pays dividends.  Rising from a little cabin-boy in short
+clothes of the drabbest drab, to a harpooneer in a broad shad-bellied
+waistcoat; from that becoming boat-header, chief-mate, and captain,
+and finally a ship owner; Bildad, as I hinted before, had concluded
+his adventurous career by wholly retiring from active life at the
+goodly age of sixty, and dedicating his remaining days to the quiet
+receiving of his well-earned income.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 46</DOCNO>
+Now, Bildad, I am sorry to say, had the reputation of being an
+incorrigible old hunks, and in his sea-going days, a bitter, hard
+task-master.  They told me in Nantucket, though it certainly seems a
+curious story, that when he sailed the old Categut whaleman, his
+crew, upon arriving home, were mostly all carried ashore to the
+hospital, sore exhausted and worn out.  For a pious man, especially
+for a Quaker, he was certainly rather hard-hearted, to say the
+least.  He never used to swear, though, at his men, they said; but
+somehow he got an inordinate quantity of cruel, unmitigated hard work
+out of them.  When Bildad was a chief-mate, to have his drab-coloured
+eye intently looking at you, made you feel completely nervous, till
+you could clutch something--a hammer or a marling-spike, and go to
+work like mad, at something or other, never mind what.  Indolence and
+idleness perished before him.  His own person was the exact
+embodiment of his utilitarian character.  On his long, gaunt body, he
+carried no spare flesh, no superfluous beard, his chin having a soft,
+economical nap to it, like the worn nap of his broad-brimmed hat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 47</DOCNO>
+Such, then, was the person that I saw seated on the transom when I
+followed Captain Peleg down into the cabin.  The space between the
+decks was small; and there, bolt-upright, sat old Bildad, who always
+sat so, and never leaned, and this to save his coat tails.  His
+broad-brim was placed beside him; his legs were stiffly crossed; his
+drab vesture was buttoned up to his chin; and spectacles on nose, he
+seemed absorbed in reading from a ponderous volume.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 48</DOCNO>
+"Bildad," cried Captain Peleg, "at it again, Bildad, eh?  Ye have
+been studying those Scriptures, now, for the last thirty years, to my
+certain knowledge.  How far ye got, Bildad?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 49</DOCNO>
+As if long habituated to such profane talk from his old shipmate,
+Bildad, without noticing his present irreverence, quietly looked up,
+and seeing me, glanced again inquiringly towards Peleg.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 50</DOCNO>
+"He says he's our man, Bildad," said Peleg, "he wants to ship."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 51</DOCNO>
+"Dost thee?" said Bildad, in a hollow tone, and turning round to me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 52</DOCNO>
+"I dost," said I unconsciously, he was so intense a Quaker.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 53</DOCNO>
+"What do ye think of him, Bildad?" said Peleg.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 54</DOCNO>
+"He'll do," said Bildad, eyeing me, and then went on spelling away at
+his book in a mumbling tone quite audible.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 55</DOCNO>
+I thought him the queerest old Quaker I ever saw, especially as
+Peleg, his friend and old shipmate, seemed such a blusterer.  But I
+said nothing, only looking round me sharply.  Peleg now threw open a
+chest, and drawing forth the ship's articles, placed pen and ink
+before him, and seated himself at a little table.  I began to think
+it was high time to settle with myself at what terms I would be
+willing to engage for the voyage.  I was already aware that in the
+whaling business they paid no wages; but all hands, including the
+captain, received certain shares of the profits called lays, and that
+these lays were proportioned to the degree of importance pertaining
+to the respective duties of the ship's company.  I was also aware
+that being a green hand at whaling, my own lay would not be very
+large; but considering that I was used to the sea, could steer a
+ship, splice a rope, and all that, I made no doubt that from all I
+had heard I should be offered at least the 275th lay--that is, the
+275th part of the clear net proceeds of the voyage, whatever that
+might eventually amount to.  And though the 275th lay was what they
+call a rather LONG LAY, yet it was better than nothing; and if we had
+a lucky voyage, might pretty nearly pay for the clothing I would wear
+out on it, not to speak of my three years' beef and board, for which
+I would not have to pay one stiver.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 56</DOCNO>
+It might be thought that this was a poor way to accumulate a princely
+fortune--and so it was, a very poor way indeed.  But I am one of
+those that never take on about princely fortunes, and am quite
+content if the world is ready to board and lodge me, while I am
+putting up at this grim sign of the Thunder Cloud.  Upon the whole, I
+thought that the 275th lay would be about the fair thing, but would not
+have been surprised had I been offered the 200th, considering I was
+of a broad-shouldered make.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 57</DOCNO>
+But one thing, nevertheless, that made me a little distrustful about
+receiving a generous share of the profits was this: Ashore, I had
+heard something of both Captain Peleg and his unaccountable old crony
+Bildad; how that they being the principal proprietors of the Pequod,
+therefore the other and more inconsiderable and scattered owners,
+left nearly the whole management of the ship's affairs to these two.
+And I did not know but what the stingy old Bildad might have a mighty
+deal to say about shipping hands, especially as I now found him on
+board the Pequod, quite at home there in the cabin, and reading his
+Bible as if at his own fireside.  Now while Peleg was vainly trying
+to mend a pen with his jack-knife, old Bildad, to my no small
+surprise, considering that he was such an interested party in these
+proceedings; Bildad never heeded us, but went on mumbling to himself
+out of his book, "LAY not up for yourselves treasures upon earth,
+where moth--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 58</DOCNO>
+"Well, Captain Bildad," interrupted Peleg, "what d'ye say, what lay
+shall we give this young man?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 59</DOCNO>
+"Thou knowest best," was the sepulchral reply, "the seven hundred and
+seventy-seventh wouldn't be too much, would it?--'where moth and rust
+do corrupt, but LAY--'"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 60</DOCNO>
+LAY, indeed, thought I, and such a lay! the seven hundred and
+seventy-seventh!  Well, old Bildad, you are determined that I, for
+one, shall not LAY up many LAYS here below, where moth and rust do
+corrupt.  It was an exceedingly LONG LAY that, indeed; and though
+from the magnitude of the figure it might at first deceive a
+landsman, yet the slightest consideration will show that though seven
+hundred and seventy-seven is a pretty large number, yet, when you
+come to make a TEENTH of it, you will then see, I say, that the seven
+hundred and seventy-seventh part of a farthing is a good deal less
+than seven hundred and seventy-seven gold doubloons; and so I thought
+at the time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 61</DOCNO>
+"Why, blast your eyes, Bildad," cried Peleg, "thou dost not want to
+swindle this young man! he must have more than that."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 62</DOCNO>
+"Seven hundred and seventy-seventh," again said Bildad, without
+lifting his eyes; and then went on mumbling--"for where your treasure
+is, there will your heart be also."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 63</DOCNO>
+"I am going to put him down for the three hundredth," said Peleg, "do
+ye hear that, Bildad!  The three hundredth lay, I say."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 64</DOCNO>
+Bildad laid down his book, and turning solemnly towards him said,
+"Captain Peleg, thou hast a generous heart; but thou must consider
+the duty thou owest to the other owners of this ship--widows and
+orphans, many of them--and that if we too abundantly reward the
+labors of this young man, we may be taking the bread from those
+widows and those orphans.  The seven hundred and seventy-seventh lay,
+Captain Peleg."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 65</DOCNO>
+"Thou Bildad!" roared Peleg, starting up and clattering about the
+cabin.  "Blast ye, Captain Bildad, if I had followed thy advice in
+these matters, I would afore now had a conscience to lug about that
+would be heavy enough to founder the largest ship that ever sailed
+round Cape Horn."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 66</DOCNO>
+"Captain Peleg," said Bildad steadily, "thy conscience may be drawing
+ten inches of water, or ten fathoms, I can't tell; but as thou art
+still an impenitent man, Captain Peleg, I greatly fear lest thy
+conscience be but a leaky one; and will in the end sink thee
+foundering down to the fiery pit, Captain Peleg."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 67</DOCNO>
+"Fiery pit! fiery pit! ye insult me, man; past all natural bearing,
+ye insult me.  It's an all-fired outrage to tell any human creature
+that he's bound to hell.  Flukes and flames!  Bildad, say that again
+to me, and start my soul-bolts, but I'll--I'll--yes, I'll swallow a
+live goat with all his hair and horns on.  Out of the cabin, ye
+canting, drab-coloured son of a wooden gun--a straight wake with ye!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 68</DOCNO>
+As he thundered out this he made a rush at Bildad, but with a
+marvellous oblique, sliding celerity, Bildad for that time eluded
+him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 69</DOCNO>
+Alarmed at this terrible outburst between the two principal and
+responsible owners of the ship, and feeling half a mind to give up
+all idea of sailing in a vessel so questionably owned and temporarily
+commanded, I stepped aside from the door to give egress to Bildad,
+who, I made no doubt, was all eagerness to vanish from before the
+awakened wrath of Peleg.  But to my astonishment, he sat down again
+on the transom very quietly, and seemed to have not the slightest
+intention of withdrawing.  He seemed quite used to impenitent Peleg
+and his ways.  As for Peleg, after letting off his rage as he had,
+there seemed no more left in him, and he, too, sat down like a lamb,
+though he twitched a little as if still nervously agitated.  "Whew!"
+he whistled at last--"the squall's gone off to leeward, I think.
+Bildad, thou used to be good at sharpening a lance, mend that pen,
+will ye.  My jack-knife here needs the grindstone.  That's he; thank
+ye, Bildad.  Now then, my young man, Ishmael's thy name, didn't ye
+say?  Well then, down ye go here, Ishmael, for the three hundredth
+lay."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 70</DOCNO>
+"Captain Peleg," said I, "I have a friend with me who wants to ship
+too--shall I bring him down to-morrow?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 71</DOCNO>
+"To be sure," said Peleg.  "Fetch him along, and we'll look at him."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 72</DOCNO>
+"What lay does he want?" groaned Bildad, glancing up from the book
+in which he had again been burying himself.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 73</DOCNO>
+"Oh! never thee mind about that, Bildad," said Peleg.  "Has he ever
+whaled it any?" turning to me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 74</DOCNO>
+"Killed more whales than I can count, Captain Peleg."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 75</DOCNO>
+"Well, bring him along then."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 76</DOCNO>
+And, after signing the papers, off I went; nothing doubting but that
+I had done a good morning's work, and that the Pequod was the
+identical ship that Yojo had provided to carry Queequeg and me round
+the Cape.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 77</DOCNO>
+But I had not proceeded far, when I began to bethink me that the
+Captain with whom I was to sail yet remained unseen by me; though,
+indeed, in many cases, a whale-ship will be completely fitted out,
+and receive all her crew on board, ere the captain makes himself
+visible by arriving to take command; for sometimes these voyages are
+so prolonged, and the shore intervals at home so exceedingly brief,
+that if the captain have a family, or any absorbing concernment of
+that sort, he does not trouble himself much about his ship in port,
+but leaves her to the owners till all is ready for sea.  However, it
+is always as well to have a look at him before irrevocably committing
+yourself into his hands.  Turning back I accosted Captain Peleg,
+inquiring where Captain Ahab was to be found.
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 78</DOCNO>
+"And what dost thou want of Captain Ahab?  It's all right enough;
+thou art shipped."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 79</DOCNO>
+"Yes, but I should like to see him."
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 80</DOCNO>
+"But I don't think thou wilt be able to at present.  I don't know
+exactly what's the matter with him; but he keeps close inside the
+house; a sort of sick, and yet he don't look so.  In fact, he ain't
+sick; but no, he isn't well either.  Any how, young man, he won't
+always see me, so I don't suppose he will thee.  He's a queer man,
+Captain Ahab--so some think--but a good one.  Oh, thou'lt like him
+well enough; no fear, no fear.  He's a grand, ungodly, god-like man,
+Captain Ahab; doesn't speak much; but, when he does speak, then you
+may well listen.  Mark ye, be forewarned; Ahab's above the common;
+Ahab's been in colleges, as well as 'mong the cannibals; been used to
+deeper wonders than the waves; fixed his fiery lance in mightier,
+stranger foes than whales.  His lance! aye, the keenest and the surest
+that out of all our isle!  Oh! he ain't Captain Bildad; no, and he
+ain't Captain Peleg; HE'S AHAB, boy; and Ahab of old, thou knowest,
+was a crowned king!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 81</DOCNO>
+"And a very vile one.  When that wicked king was slain, the dogs, did
+they not lick his blood?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 82</DOCNO>
+"Come hither to me--hither, hither," said Peleg, with a significance
+in his eye that almost startled me.  "Look ye, lad; never say that on
+board the Pequod.  Never say it anywhere.  Captain Ahab did not name
+himself.  'Twas a foolish, ignorant whim of his crazy, widowed
+mother, who died when he was only a twelvemonth old.  And yet the old
+squaw Tistig, at Gayhead, said that the name would somehow prove
+prophetic.  And, perhaps, other fools like her may tell thee the
+same.  I wish to warn thee.  It's a lie.  I know Captain Ahab well;
+I've sailed with him as mate years ago; I know what he is--a good
+man--not a pious, good man, like Bildad, but a swearing good
+man--something like me--only there's a good deal more of him.  Aye,
+aye, I know that he was never very jolly; and I know that on the
+passage home, he was a little out of his mind for a spell; but it was
+the sharp shooting pains in his bleeding stump that brought that
+about, as any one might see.  I know, too, that ever since he lost
+his leg last voyage by that accursed whale, he's been a kind of
+moody--desperate moody, and savage sometimes; but that will all pass
+off.  And once for all, let me tell thee and assure thee, young man,
+it's better to sail with a moody good captain than a laughing bad
+one.  So good-bye to thee--and wrong not Captain Ahab, because he
+happens to have a wicked name.  Besides, my boy, he has a wife--not
+three voyages wedded--a sweet, resigned girl.  Think of that; by that
+sweet girl that old man has a child: hold ye then there can be any
+utter, hopeless harm in Ahab?  No, no, my lad; stricken, blasted, if
+he be, Ahab has his humanities!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 16, Paragraph 83</DOCNO>
+As I walked away, I was full of thoughtfulness; what had been
+incidentally revealed to me of Captain Ahab, filled me with a certain
+wild vagueness of painfulness concerning him.  And somehow, at the
+time, I felt a sympathy and a sorrow for him, but for I don't know
+what, unless it was the cruel loss of his leg.  And yet I also felt a
+strange awe of him; but that sort of awe, which I cannot at all
+describe, was not exactly awe; I do not know what it was.  But I felt
+it; and it did not disincline me towards him; though I felt
+impatience at what seemed like mystery in him, so imperfectly as he
+was known to me then.  However, my thoughts were at length carried in
+other directions, so that for the present dark Ahab slipped my mind.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 1</DOCNO>
+The Ramadan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 2</DOCNO>
+As Queequeg's Ramadan, or Fasting and Humiliation, was to continue
+all day, I did not choose to disturb him till towards night-fall; for
+I cherish the greatest respect towards everybody's religious
+obligations, never mind how comical, and could not find it in my
+heart to undervalue even a congregation of ants worshipping a
+toad-stool; or those other creatures in certain parts of our earth,
+who with a degree of footmanism quite unprecedented in other planets,
+bow down before the torso of a deceased landed proprietor merely on
+account of the inordinate possessions yet owned and rented in his
+name.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 3</DOCNO>
+I say, we good Presbyterian Christians should be charitable in these
+things, and not fancy ourselves so vastly superior to other mortals,
+pagans and what not, because of their half-crazy conceits on these
+subjects.  There was Queequeg, now, certainly entertaining the most
+absurd notions about Yojo and his Ramadan;--but what of that?
+Queequeg thought he knew what he was about, I suppose; he seemed to
+be content; and there let him rest.  All our arguing with him would
+not avail; let him be, I say: and Heaven have mercy on us
+all--Presbyterians and Pagans alike--for we are all somehow
+dreadfully cracked about the head, and sadly need mending.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 4</DOCNO>
+Towards evening, when I felt assured that all his performances and
+rituals must be over, I went up to his room and knocked at the door;
+but no answer.  I tried to open it, but it was fastened inside.
+"Queequeg," said I softly through the key-hole:--all silent.  "I say,
+Queequeg! why don't you speak?  It's I--Ishmael."  But all remained
+still as before.  I began to grow alarmed.  I had allowed him such
+abundant time; I thought he might have had an apoplectic fit.  I
+looked through the key-hole; but the door opening into an odd corner
+of the room, the key-hole prospect was but a crooked and sinister
+one.  I could only see part of the foot-board of the bed and a line
+of the wall, but nothing more.  I was surprised to behold resting
+against the wall the wooden shaft of Queequeg's harpoon, which the
+landlady the evening previous had taken from him, before our mounting
+to the chamber.  That's strange, thought I; but at any rate, since
+the harpoon stands yonder, and he seldom or never goes abroad without
+it, therefore he must be inside here, and no possible mistake.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 5</DOCNO>
+"Queequeg!--Queequeg!"--all still.  Something must have happened.
+Apoplexy!  I tried to burst open the door; but it stubbornly
+resisted.  Running down stairs, I quickly stated my suspicions to the
+first person I met--the chamber-maid.  "La! la!" she cried, "I
+thought something must be the matter.  I went to make the bed after
+breakfast, and the door was locked; and not a mouse to be heard; and
+it's been just so silent ever since.  But I thought, may be, you had
+both gone off and locked your baggage in for safe keeping.  La! la,
+ma'am!--Mistress! murder!  Mrs. Hussey! apoplexy!"--and with these
+cries, she ran towards the kitchen, I following.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 6</DOCNO>
+Mrs. Hussey soon appeared, with a mustard-pot in one hand and a
+vinegar-cruet in the other, having just broken away from the
+occupation of attending to the castors, and scolding her little black
+boy meantime.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 7</DOCNO>
+"Wood-house!" cried I, "which way to it?  Run for God's sake, and
+fetch something to pry open the door--the axe!--the axe! he's had a
+stroke; depend upon it!"--and so saying I was unmethodically rushing
+up stairs again empty-handed, when Mrs. Hussey interposed the
+mustard-pot and vinegar-cruet, and the entire castor of her
+countenance.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 8</DOCNO>
+"What's the matter with you, young man?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 9</DOCNO>
+"Get the axe!  For God's sake, run for the doctor, some one, while I
+pry it open!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 10</DOCNO>
+"Look here," said the landlady, quickly putting down the
+vinegar-cruet, so as to have one hand free; "look here; are you
+talking about prying open any of my doors?"--and with that she seized
+my arm.  "What's the matter with you?  What's the matter with you,
+shipmate?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 11</DOCNO>
+In as calm, but rapid a manner as possible, I gave her to understand
+the whole case.  Unconsciously clapping the vinegar-cruet to one side
+of her nose, she ruminated for an instant; then exclaimed--"No!  I
+haven't seen it since I put it there."  Running to a little closet
+under the landing of the stairs, she glanced in, and returning, told
+me that Queequeg's harpoon was missing.  "He's killed himself," she
+cried.  "It's unfort'nate Stiggs done over again there goes another
+counterpane--God pity his poor mother!--it will be the ruin of my
+house.  Has the poor lad a sister?  Where's that girl?--there, Betty,
+go to Snarles the Painter, and tell him to paint me a sign, with--"no
+suicides permitted here, and no smoking in the parlor;"--might as
+well kill both birds at once.  Kill?  The Lord be merciful to his
+ghost!  What's that noise there?  You, young man, avast there!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 12</DOCNO>
+And running up after me, she caught me as I was again trying to force
+open the door.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 13</DOCNO>
+"I don't allow it; I won't have my premises spoiled.  Go for the
+locksmith, there's one about a mile from here.  But avast!" putting
+her hand in her side-pocket, "here's a key that'll fit, I guess;
+let's see."  And with that, she turned it in the lock; but, alas!
+Queequeg's supplemental bolt remained unwithdrawn within.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 14</DOCNO>
+"Have to burst it open," said I, and was running down the entry a
+little, for a good start, when the landlady caught at me, again
+vowing I should not break down her premises; but I tore from her, and
+with a sudden bodily rush dashed myself full against the mark.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 15</DOCNO>
+With a prodigious noise the door flew open, and the knob slamming
+against the wall, sent the plaster to the ceiling; and there, good
+heavens! there sat Queequeg, altogether cool and self-collected;
+right in the middle of the room; squatting on his hams, and holding
+Yojo on top of his head.  He looked neither one way nor the other
+way, but sat like a carved image with scarce a sign of active life.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 16</DOCNO>
+"Queequeg," said I, going up to him, "Queequeg, what's the matter
+with you?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 17</DOCNO>
+"He hain't been a sittin' so all day, has he?" said the landlady.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 18</DOCNO>
+But all we said, not a word could we drag out of him; I almost felt
+like pushing him over, so as to change his position, for it was
+almost intolerable, it seemed so painfully and unnaturally
+constrained; especially, as in all probability he had been sitting so
+for upwards of eight or ten hours, going too without his regular
+meals.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 19</DOCNO>
+"Mrs. Hussey," said I, "he's ALIVE at all events; so leave us, if you
+please, and I will see to this strange affair myself."
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 20</DOCNO>
+Closing the door upon the landlady, I endeavored to prevail upon
+Queequeg to take a chair; but in vain.  There he sat; and all he
+could do--for all my polite arts and blandishments--he would not move
+a peg, nor say a single word, nor even look at me, nor notice my
+presence in the slightest way.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 21</DOCNO>
+I wonder, thought I, if this can possibly be a part of his Ramadan;
+do they fast on their hams that way in his native island.  It must be
+so; yes, it's part of his creed, I suppose; well, then, let him
+rest; he'll get up sooner or later, no doubt.  It can't last for
+ever, thank God, and his Ramadan only comes once a year; and I don't
+believe it's very punctual then.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 22</DOCNO>
+I went down to supper.  After sitting a long time listening to the
+long stories of some sailors who had just come from a plum-pudding
+voyage, as they called it (that is, a short whaling-voyage in a
+schooner or brig, confined to the north of the line, in the Atlantic
+Ocean only); after listening to these plum-puddingers till nearly
+eleven o'clock, I went up stairs to go to bed, feeling quite sure by
+this time Queequeg must certainly have brought his Ramadan to a
+termination.  But no; there he was just where I had left him; he had
+not stirred an inch.  I began to grow vexed with him; it seemed so
+downright senseless and insane to be sitting there all day and half
+the night on his hams in a cold room, holding a piece of wood on his
+head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 23</DOCNO>
+"For heaven's sake, Queequeg, get up and shake yourself; get up and
+have some supper.  You'll starve; you'll kill yourself, Queequeg."
+But not a word did he reply.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 24</DOCNO>
+Despairing of him, therefore, I determined to go to bed and to sleep;
+and no doubt, before a great while, he would follow me.  But previous
+to turning in, I took my heavy bearskin jacket, and threw it over
+him, as it promised to be a very cold night; and he had nothing but
+his ordinary round jacket on.  For some time, do all I would, I could
+not get into the faintest doze.  I had blown out the candle; and the
+mere thought of Queequeg--not four feet off--sitting there in that
+uneasy position, stark alone in the cold and dark; this made me
+really wretched.  Think of it; sleeping all night in the same room
+with a wide awake pagan on his hams in this dreary, unaccountable
+Ramadan!
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 25</DOCNO>
+But somehow I dropped off at last, and knew nothing more till break
+of day; when, looking over the bedside, there squatted Queequeg, as
+if he had been screwed down to the floor.  But as soon as the first
+glimpse of sun entered the window, up he got, with stiff and grating
+joints, but with a cheerful look; limped towards me where I lay;
+pressed his forehead again against mine; and said his Ramadan was
+over.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 26</DOCNO>
+Now, as I before hinted, I have no objection to any person's
+religion, be it what it may, so long as that person does not kill or
+insult any other person, because that other person don't believe it
+also.  But when a man's religion becomes really frantic; when it is a
+positive torment to him; and, in fine, makes this earth of ours an
+uncomfortable inn to lodge in; then I think it high time to take that
+individual aside and argue the point with him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 27</DOCNO>
+And just so I now did with Queequeg.  "Queequeg," said I, "get into
+bed now, and lie and listen to me."  I then went on, beginning with
+the rise and progress of the primitive religions, and coming down to
+the various religions of the present time, during which time I
+labored to show Queequeg that all these Lents, Ramadans, and
+prolonged ham-squattings in cold, cheerless rooms were stark
+nonsense; bad for the health; useless for the soul; opposed, in
+short, to the obvious laws of Hygiene and common sense.  I told him,
+too, that he being in other things such an extremely sensible and
+sagacious savage, it pained me, very badly pained me, to see him now
+so deplorably foolish about this ridiculous Ramadan of his.  Besides,
+argued I, fasting makes the body cave in; hence the spirit caves in;
+and all thoughts born of a fast must necessarily be half-starved.
+This is the reason why most dyspeptic religionists cherish such
+melancholy notions about their hereafters.  In one word, Queequeg,
+said I, rather digressively; hell is an idea first born on an
+undigested apple-dumpling; and since then perpetuated through the
+hereditary dyspepsias nurtured by Ramadans.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 28</DOCNO>
+I then asked Queequeg whether he himself was ever troubled with
+dyspepsia; expressing the idea very plainly, so that he could take it
+in.  He said no; only upon one memorable occasion.  It was after a
+great feast given by his father the king, on the gaining of a great
+battle wherein fifty of the enemy had been killed by about two
+o'clock in the afternoon, and all cooked and eaten that very evening.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 29</DOCNO>
+"No more, Queequeg," said I, shuddering; "that will do;" for I knew
+the inferences without his further hinting them.  I had seen a sailor
+who had visited that very island, and he told me that it was the
+custom, when a great battle had been gained there, to barbecue all
+the slain in the yard or garden of the victor; and then, one by one,
+they were placed in great wooden trenchers, and garnished round like
+a pilau, with breadfruit and cocoanuts; and with some parsley in
+their mouths, were sent round with the victor's compliments to all
+his friends, just as though these presents were so many Christmas
+turkeys.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 30</DOCNO>
+After all, I do not think that my remarks about religion made much
+impression upon Queequeg.  Because, in the first place, he somehow
+seemed dull of hearing on that important subject, unless considered
+from his own point of view; and, in the second place, he did not more
+than one third understand me, couch my ideas simply as I would; and,
+finally, he no doubt thought he knew a good deal more about the true
+religion than I did.  He looked at me with a sort of condescending
+concern and compassion, as though he thought it a great pity that
+such a sensible young man should be so hopelessly lost to evangelical
+pagan piety.
+</DOC>
+<DOC>
+<DOCNO>Chapter 17, Paragraph 31</DOCNO>
+At last we rose and dressed; and Queequeg, taking a prodigiously
+hearty breakfast of chowders of all sorts, so that the landlady
+should not make much profit by reason of his Ramadan, we sallied out
+to board the Pequod, sauntering along, and picking our teeth with
+halibut bones.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 1</DOCNO>
+His Mark.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 2</DOCNO>
+As we were walking down the end of the wharf towards the ship,
+Queequeg carrying his harpoon, Captain Peleg in his gruff voice
+loudly hailed us from his wigwam, saying he had not suspected my
+friend was a cannibal, and furthermore announcing that he let no
+cannibals on board that craft, unless they previously produced their
+papers.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 3</DOCNO>
+"What do you mean by that, Captain Peleg?" said I, now jumping on the
+bulwarks, and leaving my comrade standing on the wharf.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 4</DOCNO>
+"I mean," he replied, "he must show his papers."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 5</DOCNO>
+"Yes," said Captain Bildad in his hollow voice, sticking his head
+from behind Peleg's, out of the wigwam.  "He must show that he's
+converted.  Son of darkness," he added, turning to Queequeg, "art
+thou at present in communion with any Christian church?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 6</DOCNO>
+"Why," said I, "he's a member of the first Congregational Church."
+Here be it said, that many tattooed savages sailing in Nantucket
+ships at last come to be converted into the churches.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 7</DOCNO>
+"First Congregational Church," cried Bildad, "what! that worships in
+Deacon Deuteronomy Coleman's meeting-house?" and so saying, taking
+out his spectacles, he rubbed them with his great yellow bandana
+handkerchief, and putting them on very carefully, came out of the
+wigwam, and leaning stiffly over the bulwarks, took a good long look
+at Queequeg.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 8</DOCNO>
+"How long hath he been a member?" he then said, turning to me; "not
+very long, I rather guess, young man."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 9</DOCNO>
+"No," said Peleg, "and he hasn't been baptized right either, or it
+would have washed some of that devil's blue off his face."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 10</DOCNO>
+"Do tell, now," cried Bildad, "is this Philistine a regular member of
+Deacon Deuteronomy's meeting?  I never saw him going there, and I
+pass it every Lord's day."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 11</DOCNO>
+"I don't know anything about Deacon Deuteronomy or his meeting," said
+I; "all I know is, that Queequeg here is a born member of the First
+Congregational Church.  He is a deacon himself, Queequeg is."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 12</DOCNO>
+"Young man," said Bildad sternly, "thou art skylarking with
+me--explain thyself, thou young Hittite.  What church dost thee mean?
+answer me."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 13</DOCNO>
+Finding myself thus hard pushed, I replied.  "I mean, sir, the same
+ancient Catholic Church to which you and I, and Captain Peleg there,
+and Queequeg here, and all of us, and every mother's son and soul of
+us belong; the great and everlasting First Congregation of this whole
+worshipping world; we all belong to that; only some of us cherish
+some queer crotchets no ways touching the grand belief; in THAT we
+all join hands."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 14</DOCNO>
+"Splice, thou mean'st SPLICE hands," cried Peleg, drawing nearer.
+"Young man, you'd better ship for a missionary, instead of a
+fore-mast hand; I never heard a better sermon.  Deacon
+Deuteronomy--why Father Mapple himself couldn't beat it, and he's
+reckoned something.  Come aboard, come aboard; never mind about the
+papers.  I say, tell Quohog there--what's that you call him? tell
+Quohog to step along.  By the great anchor, what a harpoon he's got
+there! looks like good stuff that; and he handles it about right.  I
+say, Quohog, or whatever your name is, did you ever stand in the head
+of a whale-boat? did you ever strike a fish?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 15</DOCNO>
+Without saying a word, Queequeg, in his wild sort of way, jumped upon
+the bulwarks, from thence into the bows of one of the whale-boats
+hanging to the side; and then bracing his left knee, and poising his
+harpoon, cried out in some such way as this:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 16</DOCNO>
+"Cap'ain, you see him small drop tar on water dere?  You see him?
+well, spose him one whale eye, well, den!" and taking sharp aim at
+it, he darted the iron right over old Bildad's broad brim, clean
+across the ship's decks, and struck the glistening tar spot out of
+sight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 17</DOCNO>
+"Now," said Queequeg, quietly hauling in the line, "spos-ee him
+whale-e eye; why, dad whale dead."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 18</DOCNO>
+"Quick, Bildad," said Peleg, his partner, who, aghast at the close
+vicinity of the flying harpoon, had retreated towards the cabin
+gangway.  "Quick, I say, you Bildad, and get the ship's papers.  We
+must have Hedgehog there, I mean Quohog, in one of our boats.  Look
+ye, Quohog, we'll give ye the ninetieth lay, and that's more than
+ever was given a harpooneer yet out of Nantucket."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 19</DOCNO>
+So down we went into the cabin, and to my great joy Queequeg was soon
+enrolled among the same ship's company to which I myself belonged.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 20</DOCNO>
+When all preliminaries were over and Peleg had got everything ready
+for signing, he turned to me and said, "I guess, Quohog there don't
+know how to write, does he?  I say, Quohog, blast ye! dost thou sign
+thy name or make thy mark?
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 21</DOCNO>
+But at this question, Queequeg, who had twice or thrice before taken
+part in similar ceremonies, looked no ways abashed; but taking the
+offered pen, copied upon the paper, in the proper place, an exact
+counterpart of a queer round figure which was tattooed upon his arm;
+so that through Captain Peleg's obstinate mistake touching his
+appellative, it stood something like this:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 22</DOCNO>
+Quohog.
+his X mark.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 23</DOCNO>
+Meanwhile Captain Bildad sat earnestly and steadfastly eyeing
+Queequeg, and at last rising solemnly and fumbling in the huge
+pockets of his broad-skirted drab coat, took out a bundle of tracts,
+and selecting one entitled "The Latter Day Coming; or No Time to
+Lose," placed it in Queequeg's hands, and then grasping them and the
+book with both his, looked earnestly into his eyes, and said, "Son of
+darkness, I must do my duty by thee; I am part owner of this ship,
+and feel concerned for the souls of all its crew; if thou still
+clingest to thy Pagan ways, which I sadly fear, I beseech thee,
+remain not for aye a Belial bondsman.  Spurn the idol Bell, and the
+hideous dragon; turn from the wrath to come; mind thine eye, I say;
+oh! goodness gracious! steer clear of the fiery pit!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 24</DOCNO>
+Something of the salt sea yet lingered in old Bildad's language,
+heterogeneously mixed with Scriptural and domestic phrases.
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 25</DOCNO>
+"Avast there, avast there, Bildad, avast now spoiling our
+harpooneer," Peleg.  "Pious harpooneers never make good voyagers--it
+takes the shark out of 'em; no harpooneer is worth a straw who aint
+pretty sharkish.  There was young Nat Swaine, once the bravest
+boat-header out of all Nantucket and the Vineyard; he joined the
+meeting, and never came to good.  He got so frightened about his
+plaguy soul, that he shrinked and sheered away from whales, for fear
+of after-claps, in case he got stove and went to Davy Jones."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 26</DOCNO>
+"Peleg!  Peleg!" said Bildad, lifting his eyes and hands, "thou
+thyself, as I myself, hast seen many a perilous time; thou knowest,
+Peleg, what it is to have the fear of death; how, then, can'st thou
+prate in this ungodly guise.  Thou beliest thine own heart, Peleg.
+Tell me, when this same Pequod here had her three masts overboard in
+that typhoon on Japan, that same voyage when thou went mate with
+Captain Ahab, did'st thou not think of Death and the Judgment then?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 27</DOCNO>
+"Hear him, hear him now," cried Peleg, marching across the cabin, and
+thrusting his hands far down into his pockets,--"hear him, all of ye.
+Think of that!  When every moment we thought the ship would sink!
+Death and the Judgment then?  What?  With all three masts making such
+an everlasting thundering against the side; and every sea breaking
+over us, fore and aft.  Think of Death and the Judgment then?  No!
+no time to think about Death then.  Life was what Captain Ahab and I
+was thinking of; and how to save all hands--how to rig
+jury-masts--how to get into the nearest port; that was what I was
+thinking of."
+</DOC>
+<DOC>
+<DOCNO>Chapter 18, Paragraph 28</DOCNO>
+Bildad said no more, but buttoning up his coat, stalked on deck,
+where we followed him.  There he stood, very quietly overlooking some
+sailmakers who were mending a top-sail in the waist.  Now and then he
+stooped to pick up a patch, or save an end of tarred twine, which
+otherwise might have been wasted.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 1</DOCNO>
+The Prophet.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 2</DOCNO>
+"Shipmates, have ye shipped in that ship?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 3</DOCNO>
+Queequeg and I had just left the Pequod, and were sauntering away from
+the water, for the moment each occupied with his own thoughts, when
+the above words were put to us by a stranger, who, pausing before us,
+levelled his massive forefinger at the vessel in question.  He was
+but shabbily apparelled in faded jacket and patched trowsers; a rag
+of a black handkerchief investing his neck.  A confluent small-pox
+had in all directions flowed over his face, and left it like the
+complicated ribbed bed of a torrent, when the rushing waters have
+been dried up.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 4</DOCNO>
+"Have ye shipped in her?" he repeated.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 5</DOCNO>
+"You mean the ship Pequod, I suppose," said I, trying to gain a
+little more time for an uninterrupted look at him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 6</DOCNO>
+"Aye, the Pequod--that ship there," he said, drawing back his whole
+arm, and then rapidly shoving it straight out from him, with the
+fixed bayonet of his pointed finger darted full at the object.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 7</DOCNO>
+"Yes," said I, "we have just signed the articles."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 8</DOCNO>
+"Anything down there about your souls?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 9</DOCNO>
+"About what?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 10</DOCNO>
+"Oh, perhaps you hav'n't got any," he said quickly.  "No matter
+though, I know many chaps that hav'n't got any,--good luck to 'em;
+and they are all the better off for it.  A soul's a sort of a fifth
+wheel to a wagon."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 11</DOCNO>
+"What are you jabbering about, shipmate?" said I.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 12</DOCNO>
+"HE'S got enough, though, to make up for all deficiencies of that
+sort in other chaps," abruptly said the stranger, placing a nervous
+emphasis upon the word HE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 13</DOCNO>
+"Queequeg," said I, "let's go; this fellow has broken loose from
+somewhere; he's talking about something and somebody we don't know."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 14</DOCNO>
+"Stop!" cried the stranger.  "Ye said true--ye hav'n't seen Old
+Thunder yet, have ye?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 15</DOCNO>
+"Who's Old Thunder?" said I, again riveted with the insane
+earnestness of his manner.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 16</DOCNO>
+"Captain Ahab."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 17</DOCNO>
+"What! the captain of our ship, the Pequod?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 18</DOCNO>
+"Aye, among some of us old sailor chaps, he goes by that name.  Ye
+hav'n't seen him yet, have ye?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 19</DOCNO>
+"No, we hav'n't.  He's sick they say, but is getting better, and will
+be all right again before long."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 20</DOCNO>
+"All right again before long!" laughed the stranger, with a solemnly
+derisive sort of laugh.  "Look ye; when Captain Ahab is all right,
+then this left arm of mine will be all right; not before."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 21</DOCNO>
+"What do you know about him?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 22</DOCNO>
+"What did they TELL you about him?  Say that!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 23</DOCNO>
+"They didn't tell much of anything about him; only I've heard that
+he's a good whale-hunter, and a good captain to his crew."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 24</DOCNO>
+"That's true, that's true--yes, both true enough.  But you must jump
+when he gives an order.  Step and growl; growl and go--that's the
+word with Captain Ahab.  But nothing about that thing that happened
+to him off Cape Horn, long ago, when he lay like dead for three days
+and nights; nothing about that deadly skrimmage with the Spaniard
+afore the altar in Santa?--heard nothing about that, eh?  Nothing
+about the silver calabash he spat into?  And nothing about his losing
+his leg last voyage, according to the prophecy.  Didn't ye hear a
+word about them matters and something more, eh?  No, I don't think ye
+did; how could ye?  Who knows it?  Not all Nantucket, I guess.  But
+hows'ever, mayhap, ye've heard tell about the leg, and how he lost
+it; aye, ye have heard of that, I dare say.  Oh yes, THAT every one
+knows a'most--I mean they know he's only one leg; and that a
+parmacetti took the other off."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 25</DOCNO>
+"My friend," said I, "what all this gibberish of yours is about, I
+don't know, and I don't much care; for it seems to me that you must
+be a little damaged in the head.  But if you are speaking of Captain
+Ahab, of that ship there, the Pequod, then let me tell you, that I
+know all about the loss of his leg."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 26</DOCNO>
+"ALL about it, eh--sure you do?--all?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 27</DOCNO>
+"Pretty sure."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 28</DOCNO>
+With finger pointed and eye levelled at the Pequod, the beggar-like
+stranger stood a moment, as if in a troubled reverie; then starting a
+little, turned and said:--"Ye've shipped, have ye?  Names down on the
+papers?  Well, well, what's signed, is signed; and what's to be, will
+be; and then again, perhaps it won't be, after all.  Anyhow, it's
+all fixed and arranged a'ready; and some sailors or other must go
+with him, I suppose; as well these as any other men, God pity 'em!
+Morning to ye, shipmates, morning; the ineffable heavens bless ye;
+I'm sorry I stopped ye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 29</DOCNO>
+"Look here, friend," said I, "if you have anything important to tell
+us, out with it; but if you are only trying to bamboozle us, you are
+mistaken in your game; that's all I have to say."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 30</DOCNO>
+"And it's said very well, and I like to hear a chap talk up that way;
+you are just the man for him--the likes of ye.  Morning to ye,
+shipmates, morning!  Oh! when ye get there, tell 'em I've concluded
+not to make one of 'em."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 31</DOCNO>
+"Ah, my dear fellow, you can't fool us that way--you can't fool us.
+It is the easiest thing in the world for a man to look as if he had a
+great secret in him."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 32</DOCNO>
+"Morning to ye, shipmates, morning."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 33</DOCNO>
+"Morning it is," said I.  "Come along, Queequeg, let's leave this
+crazy man.  But stop, tell me your name, will you?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 34</DOCNO>
+"Elijah."
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 35</DOCNO>
+Elijah! thought I, and we walked away, both commenting, after each
+other's fashion, upon this ragged old sailor; and agreed that he was
+nothing but a humbug, trying to be a bugbear.  But we had not gone
+perhaps above a hundred yards, when chancing to turn a corner, and
+looking back as I did so, who should be seen but Elijah following us,
+though at a distance.  Somehow, the sight of him struck me so, that I
+said nothing to Queequeg of his being behind, but passed on with my
+comrade, anxious to see whether the stranger would turn the same
+corner that we did.  He did; and then it seemed to me that he was
+dogging us, but with what intent I could not for the life of me
+imagine.  This circumstance, coupled with his ambiguous,
+half-hinting, half-revealing, shrouded sort of talk, now begat in me
+all kinds of vague wonderments and half-apprehensions, and all
+connected with the Pequod; and Captain Ahab; and the leg he had lost;
+and the Cape Horn fit; and the silver calabash; and what Captain
+Peleg had said of him, when I left the ship the day previous; and the
+prediction of the squaw Tistig; and the voyage we had bound ourselves
+to sail; and a hundred other shadowy things.
+</DOC>
+<DOC>
+<DOCNO>Chapter 19, Paragraph 36</DOCNO>
+I was resolved to satisfy myself whether this ragged Elijah was
+really dogging us or not, and with that intent crossed the way with
+Queequeg, and on that side of it retraced our steps.  But Elijah
+passed on, without seeming to notice us.  This relieved me; and once
+more, and finally as it seemed to me, I pronounced him in my heart, a
+humbug.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 1</DOCNO>
+All Astir.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 2</DOCNO>
+A day or two passed, and there was great activity aboard the Pequod.
+Not only were the old sails being mended, but new sails were coming
+on board, and bolts of canvas, and coils of rigging; in short,
+everything betokened that the ship's preparations were hurrying to a
+close.  Captain Peleg seldom or never went ashore, but sat in his
+wigwam keeping a sharp look-out upon the hands: Bildad did all the
+purchasing and providing at the stores; and the men employed in the
+hold and on the rigging were working till long after night-fall.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 3</DOCNO>
+On the day following Queequeg's signing the articles, word was given
+at all the inns where the ship's company were stopping, that their
+chests must be on board before night, for there was no telling how
+soon the vessel might be sailing.  So Queequeg and I got down our
+traps, resolving, however, to sleep ashore till the last.  But it
+seems they always give very long notice in these cases, and the ship
+did not sail for several days.  But no wonder; there was a good deal
+to be done, and there is no telling how many things to be thought of,
+before the Pequod was fully equipped.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 4</DOCNO>
+Every one knows what a multitude of things--beds, sauce-pans, knives
+and forks, shovels and tongs, napkins, nut-crackers, and what not,
+are indispensable to the business of housekeeping.  Just so with
+whaling, which necessitates a three-years' housekeeping upon the wide
+ocean, far from all grocers, costermongers, doctors, bakers, and
+bankers.  And though this also holds true of merchant vessels, yet
+not by any means to the same extent as with whalemen.  For besides
+the great length of the whaling voyage, the numerous articles
+peculiar to the prosecution of the fishery, and the impossibility of
+replacing them at the remote harbors usually frequented, it must be
+remembered, that of all ships, whaling vessels are the most exposed
+to accidents of all kinds, and especially to the destruction and loss
+of the very things upon which the success of the voyage most depends.
+Hence, the spare boats, spare spars, and spare lines and harpoons,
+and spare everythings, almost, but a spare Captain and duplicate
+ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 5</DOCNO>
+At the period of our arrival at the Island, the heaviest storage of
+the Pequod had been almost completed; comprising her beef, bread,
+water, fuel, and iron hoops and staves.  But, as before hinted, for
+some time there was a continual fetching and carrying on board of
+divers odds and ends of things, both large and small.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 6</DOCNO>
+Chief among those who did this fetching and carrying was Captain
+Bildad's sister, a lean old lady of a most determined and
+indefatigable spirit, but withal very kindhearted, who seemed
+resolved that, if SHE could help it, nothing should be found wanting
+in the Pequod, after once fairly getting to sea.  At one time she
+would come on board with a jar of pickles for the steward's pantry;
+another time with a bunch of quills for the chief mate's desk, where
+he kept his log; a third time with a roll of flannel for the small of
+some one's rheumatic back.  Never did any woman better deserve her
+name, which was Charity--Aunt Charity, as everybody called her.  And
+like a sister of charity did this charitable Aunt Charity bustle
+about hither and thither, ready to turn her hand and heart to
+anything that promised to yield safety, comfort, and consolation to
+all on board a ship in which her beloved brother Bildad was
+concerned, and in which she herself owned a score or two of
+well-saved dollars.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 7</DOCNO>
+But it was startling to see this excellent hearted Quakeress coming
+on board, as she did the last day, with a long oil-ladle in one hand,
+and a still longer whaling lance in the other.  Nor was Bildad himself
+nor Captain Peleg at all backward.  As for Bildad, he carried about
+with him a long list of the articles needed, and at every fresh
+arrival, down went his mark opposite that article upon the paper.
+Every once in a while Peleg came hobbling out of his whalebone den,
+roaring at the men down the hatchways, roaring up to the riggers at
+the mast-head, and then concluded by roaring back into his wigwam.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 8</DOCNO>
+During these days of preparation, Queequeg and I often visited the
+craft, and as often I asked about Captain Ahab, and how he was, and
+when he was going to come on board his ship.  To these questions they
+would answer, that he was getting better and better, and was expected
+aboard every day; meantime, the two captains, Peleg and Bildad, could
+attend to everything necessary to fit the vessel for the voyage.  If
+I had been downright honest with myself, I would have seen very
+plainly in my heart that I did but half fancy being committed this
+way to so long a voyage, without once laying my eyes on the man who
+was to be the absolute dictator of it, so soon as the ship sailed out
+upon the open sea.  But when a man suspects any wrong, it sometimes
+happens that if he be already involved in the matter, he insensibly
+strives to cover up his suspicions even from himself.  And much this
+way it was with me.  I said nothing, and tried to think nothing.
+</DOC>
+<DOC>
+<DOCNO>Chapter 20, Paragraph 9</DOCNO>
+At last it was given out that some time next day the ship would
+certainly sail.  So next morning, Queequeg and I took a very early
+start.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 1</DOCNO>
+Going Aboard.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 2</DOCNO>
+It was nearly six o'clock, but only grey imperfect misty dawn, when
+we drew nigh the wharf.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 3</DOCNO>
+"There are some sailors running ahead there, if I see right," said I
+to Queequeg, "it can't be shadows; she's off by sunrise, I guess;
+come on!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 4</DOCNO>
+"Avast!" cried a voice, whose owner at the same time coming close
+behind us, laid a hand upon both our shoulders, and then insinuating
+himself between us, stood stooping forward a little, in the uncertain
+twilight, strangely peering from Queequeg to me.  It was Elijah.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 5</DOCNO>
+"Going aboard?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 6</DOCNO>
+"Hands off, will you," said I.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 7</DOCNO>
+"Lookee here," said Queequeg, shaking himself, "go 'way!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 8</DOCNO>
+"Ain't going aboard, then?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 9</DOCNO>
+"Yes, we are," said I, "but what business is that of yours?  Do you
+know, Mr. Elijah, that I consider you a little impertinent?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 10</DOCNO>
+"No, no, no; I wasn't aware of that," said Elijah, slowly and
+wonderingly looking from me to Queequeg, with the most unaccountable
+glances.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 11</DOCNO>
+"Elijah," said I, "you will oblige my friend and me by withdrawing.
+We are going to the Indian and Pacific Oceans, and would prefer not
+to be detained."
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 12</DOCNO>
+"Ye be, be ye?  Coming back afore breakfast?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 13</DOCNO>
+"He's cracked, Queequeg," said I, "come on."
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 14</DOCNO>
+"Holloa!" cried stationary Elijah, hailing us when we had removed a
+few paces.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 15</DOCNO>
+"Never mind him," said I, "Queequeg, come on."
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 16</DOCNO>
+But he stole up to us again, and suddenly clapping his hand on my
+shoulder, said--"Did ye see anything looking like men going towards
+that ship a while ago?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 17</DOCNO>
+Struck by this plain matter-of-fact question, I answered, saying,
+"Yes, I thought I did see four or five men; but it was too dim to be
+sure."
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 18</DOCNO>
+"Very dim, very dim," said Elijah.  "Morning to ye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 19</DOCNO>
+Once more we quitted him; but once more he came softly after us; and
+touching my shoulder again, said, "See if you can find 'em now, will
+ye?
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 20</DOCNO>
+"Find who?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 21</DOCNO>
+"Morning to ye! morning to ye!" he rejoined, again moving off.  "Oh!
+I was going to warn ye against--but never mind, never mind--it's all
+one, all in the family too;--sharp frost this morning, ain't it?
+Good-bye to ye.  Shan't see ye again very soon, I guess; unless it's
+before the Grand Jury."  And with these cracked words he finally
+departed, leaving me, for the moment, in no small wonderment at his
+frantic impudence.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 22</DOCNO>
+At last, stepping on board the Pequod, we found everything in
+profound quiet, not a soul moving.  The cabin entrance was locked
+within; the hatches were all on, and lumbered with coils of rigging.
+Going forward to the forecastle, we found the slide of the scuttle
+open.  Seeing a light, we went down, and found only an old rigger
+there, wrapped in a tattered pea-jacket.  He was thrown at whole
+length upon two chests, his face downwards and inclosed in his folded
+arms.  The profoundest slumber slept upon him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 23</DOCNO>
+"Those sailors we saw, Queequeg, where can they have gone to?" said
+I, looking dubiously at the sleeper.  But it seemed that, when on the
+wharf, Queequeg had not at all noticed what I now alluded to; hence I
+would have thought myself to have been optically deceived in that
+matter, were it not for Elijah's otherwise inexplicable question.
+But I beat the thing down; and again marking the sleeper, jocularly
+hinted to Queequeg that perhaps we had best sit up with the body;
+telling him to establish himself accordingly.  He put his hand upon
+the sleeper's rear, as though feeling if it was soft enough; and
+then, without more ado, sat quietly down there.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 24</DOCNO>
+"Gracious!  Queequeg, don't sit there," said I.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 25</DOCNO>
+"Oh! perry dood seat," said Queequeg, "my country way; won't hurt
+him face."
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 26</DOCNO>
+"Face!" said I, "call that his face? very benevolent countenance
+then; but how hard he breathes, he's heaving himself; get off,
+Queequeg, you are heavy, it's grinding the face of the poor.  Get
+off, Queequeg!  Look, he'll twitch you off soon.  I wonder he don't
+wake."
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 27</DOCNO>
+Queequeg removed himself to just beyond the head of the sleeper, and
+lighted his tomahawk pipe.  I sat at the feet.  We kept the pipe
+passing over the sleeper, from one to the other.  Meanwhile, upon
+questioning him in his broken fashion, Queequeg gave me to understand
+that, in his land, owing to the absence of settees and sofas of all
+sorts, the king, chiefs, and great people generally, were in the
+custom of fattening some of the lower orders for ottomans; and to
+furnish a house comfortably in that respect, you had only to buy up
+eight or ten lazy fellows, and lay them round in the piers and
+alcoves.  Besides, it was very convenient on an excursion; much
+better than those garden-chairs which are convertible into
+walking-sticks; upon occasion, a chief calling his attendant, and
+desiring him to make a settee of himself under a spreading tree,
+perhaps in some damp marshy place.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 28</DOCNO>
+While narrating these things, every time Queequeg received the
+tomahawk from me, he flourished the hatchet-side of it over the
+sleeper's head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 29</DOCNO>
+"What's that for, Queequeg?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 30</DOCNO>
+"Perry easy, kill-e; oh! perry easy!
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 31</DOCNO>
+He was going on with some wild reminiscences about his tomahawk-pipe,
+which, it seemed, had in its two uses both brained his foes and
+soothed his soul, when we were directly attracted to the sleeping
+rigger.  The strong vapour now completely filling the contracted hole,
+it began to tell upon him.  He breathed with a sort of muffledness;
+then seemed troubled in the nose; then revolved over once or twice;
+then sat up and rubbed his eyes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 32</DOCNO>
+"Holloa!" he breathed at last, "who be ye smokers?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 33</DOCNO>
+"Shipped men," answered I, "when does she sail?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 34</DOCNO>
+"Aye, aye, ye are going in her, be ye?  She sails to-day.  The
+Captain came aboard last night."
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 35</DOCNO>
+"What Captain?--Ahab?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 36</DOCNO>
+"Who but him indeed?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 37</DOCNO>
+I was going to ask him some further questions concerning Ahab, when
+we heard a noise on deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 38</DOCNO>
+"Holloa!  Starbuck's astir," said the rigger.  "He's a lively chief
+mate, that; good man, and a pious; but all alive now, I must turn
+to."  And so saying he went on deck, and we followed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 21, Paragraph 39</DOCNO>
+It was now clear sunrise.  Soon the crew came on board in twos and
+threes; the riggers bestirred themselves; the mates were actively
+engaged; and several of the shore people were busy in bringing
+various last things on board.  Meanwhile Captain Ahab remained
+invisibly enshrined within his cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 1</DOCNO>
+Merry Christmas.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 2</DOCNO>
+At length, towards noon, upon the final dismissal of the ship's
+riggers, and after the Pequod had been hauled out from the wharf, and
+after the ever-thoughtful Charity had come off in a whale-boat, with
+her last gift--a night-cap for Stubb, the second mate, her
+brother-in-law, and a spare Bible for the steward--after all this,
+the two Captains, Peleg and Bildad, issued from the cabin, and
+turning to the chief mate, Peleg said:
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 3</DOCNO>
+"Now, Mr. Starbuck, are you sure everything is right?  Captain Ahab
+is all ready--just spoke to him--nothing more to be got from shore,
+eh?  Well, call all hands, then.  Muster 'em aft here--blast 'em!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 4</DOCNO>
+"No need of profane words, however great the hurry, Peleg," said
+Bildad, "but away with thee, friend Starbuck, and do our bidding."
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 5</DOCNO>
+How now!  Here upon the very point of starting for the voyage,
+Captain Peleg and Captain Bildad were going it with a high hand on
+the quarter-deck, just as if they were to be joint-commanders at sea,
+as well as to all appearances in port.  And, as for Captain Ahab, no
+sign of him was yet to be seen; only, they said he was in the cabin.
+But then, the idea was, that his presence was by no means necessary
+in getting the ship under weigh, and steering her well out to sea.
+Indeed, as that was not at all his proper business, but the pilot's;
+and as he was not yet completely recovered--so they said--therefore,
+Captain Ahab stayed below.  And all this seemed natural enough;
+especially as in the merchant service many captains never show
+themselves on deck for a considerable time after heaving up the
+anchor, but remain over the cabin table, having a farewell
+merry-making with their shore friends, before they quit the ship for
+good with the pilot.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 6</DOCNO>
+But there was not much chance to think over the matter, for Captain
+Peleg was now all alive.  He seemed to do most of the talking and
+commanding, and not Bildad.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 7</DOCNO>
+"Aft here, ye sons of bachelors," he cried, as the sailors lingered
+at the main-mast.  "Mr. Starbuck, drive'em aft."
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 8</DOCNO>
+"Strike the tent there!"--was the next order.  As I hinted before,
+this whalebone marquee was never pitched except in port; and on board
+the Pequod, for thirty years, the order to strike the tent was well
+known to be the next thing to heaving up the anchor.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 9</DOCNO>
+"Man the capstan!  Blood and thunder!--jump!"--was the next command,
+and the crew sprang for the handspikes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 10</DOCNO>
+Now in getting under weigh, the station generally occupied by the
+pilot is the forward part of the ship.  And here Bildad, who, with
+Peleg, be it known, in addition to his other officers, was one of the
+licensed pilots of the port--he being suspected to have got himself
+made a pilot in order to save the Nantucket pilot-fee to all the
+ships he was concerned in, for he never piloted any other
+craft--Bildad, I say, might now be seen actively engaged in looking
+over the bows for the approaching anchor, and at intervals singing
+what seemed a dismal stave of psalmody, to cheer the hands at the
+windlass, who roared forth some sort of a chorus about the girls in
+Booble Alley, with hearty good will.  Nevertheless, not three days
+previous, Bildad had told them that no profane songs would be allowed
+on board the Pequod, particularly in getting under weigh; and
+Charity, his sister, had placed a small choice copy of Watts in each
+seaman's berth.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 11</DOCNO>
+Meantime, overseeing the other part of the ship, Captain Peleg ripped
+and swore astern in the most frightful manner.  I almost thought he
+would sink the ship before the anchor could be got up; involuntarily
+I paused on my handspike, and told Queequeg to do the same, thinking
+of the perils we both ran, in starting on the voyage with such a
+devil for a pilot.  I was comforting myself, however, with the
+thought that in pious Bildad might be found some salvation, spite of
+his seven hundred and seventy-seventh lay; when I felt a sudden sharp
+poke in my rear, and turning round, was horrified at the apparition
+of Captain Peleg in the act of withdrawing his leg from my immediate
+vicinity.  That was my first kick.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 12</DOCNO>
+"Is that the way they heave in the marchant service?" he roared.
+"Spring, thou sheep-head; spring, and break thy backbone!  Why don't
+ye spring, I say, all of ye--spring!  Quohog! spring, thou chap with
+the red whiskers; spring there, Scotch-cap; spring, thou green
+pants.  Spring, I say, all of ye, and spring your eyes out!"  And so
+saying, he moved along the windlass, here and there using his leg
+very freely, while imperturbable Bildad kept leading off with his
+psalmody.  Thinks I, Captain Peleg must have been drinking something
+to-day.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 13</DOCNO>
+At last the anchor was up, the sails were set, and off we glided.  It
+was a short, cold Christmas; and as the short northern day merged
+into night, we found ourselves almost broad upon the wintry ocean,
+whose freezing spray cased us in ice, as in polished armor.  The long
+rows of teeth on the bulwarks glistened in the moonlight; and like
+the white ivory tusks of some huge elephant, vast curving icicles
+depended from the bows.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 14</DOCNO>
+Lank Bildad, as pilot, headed the first watch, and ever and anon, as
+the old craft deep dived into the green seas, and sent the shivering
+frost all over her, and the winds howled, and the cordage rang, his
+steady notes were heard,--
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 15</DOCNO>
+"Sweet fields beyond the swelling flood,
+Stand dressed in living green.
+So to the Jews old Canaan stood,
+While Jordan rolled between."
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 16</DOCNO>
+Never did those sweet words sound more sweetly to me than then.  They
+were full of hope and fruition.  Spite of this frigid winter night in
+the boisterous Atlantic, spite of my wet feet and wetter jacket,
+there was yet, it then seemed to me, many a pleasant haven in store;
+and meads and glades so eternally vernal, that the grass shot up by
+the spring, untrodden, unwilted, remains at midsummer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 17</DOCNO>
+At last we gained such an offing, that the two pilots were needed no
+longer.  The stout sail-boat that had accompanied us began ranging
+alongside.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 18</DOCNO>
+It was curious and not unpleasing, how Peleg and Bildad were affected
+at this juncture, especially Captain Bildad.  For loath to depart,
+yet; very loath to leave, for good, a ship bound on so long and
+perilous a voyage--beyond both stormy Capes; a ship in which some
+thousands of his hard earned dollars were invested; a ship, in which
+an old shipmate sailed as captain; a man almost as old as he, once
+more starting to encounter all the terrors of the pitiless jaw; loath
+to say good-bye to a thing so every way brimful of every interest to
+him,--poor old Bildad lingered long; paced the deck with anxious
+strides; ran down into the cabin to speak another farewell word
+there; again came on deck, and looked to windward; looked towards the
+wide and endless waters, only bounded by the far-off unseen Eastern
+Continents; looked towards the land; looked aloft; looked right and
+left; looked everywhere and nowhere; and at last, mechanically
+coiling a rope upon its pin, convulsively grasped stout Peleg by the
+hand, and holding up a lantern, for a moment stood gazing heroically
+in his face, as much as to say, "Nevertheless, friend Peleg, I can
+stand it; yes, I can."
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 19</DOCNO>
+As for Peleg himself, he took it more like a philosopher; but for all
+his philosophy, there was a tear twinkling in his eye, when the
+lantern came too near.  And he, too, did not a little run from cabin
+to deck--now a word below, and now a word with Starbuck, the chief
+mate.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 20</DOCNO>
+But, at last, he turned to his comrade, with a final sort of look
+about him,--"Captain Bildad--come, old shipmate, we must go.  Back
+the main-yard there!  Boat ahoy!  Stand by to come close alongside,
+now!  Careful, careful!--come, Bildad, boy--say your last.  Luck to
+ye, Starbuck--luck to ye, Mr. Stubb--luck to ye, Mr. Flask--good-bye
+and good luck to ye all--and this day three years I'll have a hot
+supper smoking for ye in old Nantucket.  Hurrah and away!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 21</DOCNO>
+"God bless ye, and have ye in His holy keeping, men," murmured old
+Bildad, almost incoherently.  "I hope ye'll have fine weather now, so
+that Captain Ahab may soon be moving among ye--a pleasant sun is all
+he needs, and ye'll have plenty of them in the tropic voyage ye go.
+Be careful in the hunt, ye mates.  Don't stave the boats needlessly,
+ye harpooneers; good white cedar plank is raised full three per cent.
+within the year.  Don't forget your prayers, either.  Mr. Starbuck,
+mind that cooper don't waste the spare staves.  Oh! the sail-needles
+are in the green locker!  Don't whale it too much a' Lord's days,
+men; but don't miss a fair chance either, that's rejecting Heaven's
+good gifts.  Have an eye to the molasses tierce, Mr. Stubb; it was a
+little leaky, I thought.  If ye touch at the islands, Mr. Flask,
+beware of fornication.  Good-bye, good-bye!  Don't keep that cheese
+too long down in the hold, Mr. Starbuck; it'll spoil.  Be careful
+with the butter--twenty cents the pound it was, and mind ye, if--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 22</DOCNO>
+"Come, come, Captain Bildad; stop palavering,--away!" and with that,
+Peleg hurried him over the side, and both dropt into the boat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 22, Paragraph 23</DOCNO>
+Ship and boat diverged; the cold, damp night breeze blew between; a
+screaming gull flew overhead; the two hulls wildly rolled; we gave
+three heavy-hearted cheers, and blindly plunged like fate into the
+lone Atlantic.
+</DOC>
+<DOC>
+<DOCNO>Chapter 23, Paragraph 1</DOCNO>
+The Lee Shore.
+</DOC>
+<DOC>
+<DOCNO>Chapter 23, Paragraph 2</DOCNO>
+Some chapters back, one Bulkington was spoken of, a tall, newlanded
+mariner, encountered in New Bedford at the inn.
+</DOC>
+<DOC>
+<DOCNO>Chapter 23, Paragraph 3</DOCNO>
+When on that shivering winter's night, the Pequod thrust her
+vindictive bows into the cold malicious waves, who should I see
+standing at her helm but Bulkington!  I looked with sympathetic awe
+and fearfulness upon the man, who in mid-winter just landed from a
+four years' dangerous voyage, could so unrestingly push off again for
+still another tempestuous term.  The land seemed scorching to his
+feet.  Wonderfullest things are ever the unmentionable; deep memories
+yield no epitaphs; this six-inch chapter is the stoneless grave of
+Bulkington.  Let me only say that it fared with him as with the
+storm-tossed ship, that miserably drives along the leeward land.  The
+port would fain give succor; the port is pitiful; in the port is
+safety, comfort, hearthstone, supper, warm blankets, friends, all
+that's kind to our mortalities.  But in that gale, the port, the
+land, is that ship's direst jeopardy; she must fly all hospitality;
+one touch of land, though it but graze the keel, would make her
+shudder through and through.  With all her might she crowds all sail
+off shore; in so doing, fights 'gainst the very winds that fain would
+blow her homeward; seeks all the lashed sea's landlessness again; for
+refuge's sake forlornly rushing into peril; her only friend her
+bitterest foe!
+</DOC>
+<DOC>
+<DOCNO>Chapter 23, Paragraph 4</DOCNO>
+Know ye now, Bulkington?  Glimpses do ye seem to see of that mortally
+intolerable truth; that all deep, earnest thinking is but the
+intrepid effort of the soul to keep the open independence of her sea;
+while the wildest winds of heaven and earth conspire to cast her on
+the treacherous, slavish shore?
+</DOC>
+<DOC>
+<DOCNO>Chapter 23, Paragraph 5</DOCNO>
+But as in landlessness alone resides highest truth, shoreless,
+indefinite as God--so, better is it to perish in that howling
+infinite, than be ingloriously dashed upon the lee, even if that were
+safety!  For worm-like, then, oh! who would craven crawl to land!
+Terrors of the terrible! is all this agony so vain?  Take heart, take
+heart, O Bulkington!  Bear thee grimly, demigod!  Up from the spray
+of thy ocean-perishing--straight up, leaps thy apotheosis!
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 1</DOCNO>
+The Advocate.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 2</DOCNO>
+As Queequeg and I are now fairly embarked in this business of
+whaling; and as this business of whaling has somehow come to be
+regarded among landsmen as a rather unpoetical and disreputable
+pursuit; therefore, I am all anxiety to convince ye, ye landsmen, of
+the injustice hereby done to us hunters of whales.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 3</DOCNO>
+In the first place, it may be deemed almost superfluous to establish
+the fact, that among people at large, the business of whaling is not
+accounted on a level with what are called the liberal professions.
+If a stranger were introduced into any miscellaneous metropolitan
+society, it would but slightly advance the general opinion of his
+merits, were he presented to the company as a harpooneer, say; and if
+in emulation of the naval officers he should append the initials
+S.W.F. (Sperm Whale Fishery) to his visiting card, such a procedure
+would be deemed pre-eminently presuming and ridiculous.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 4</DOCNO>
+Doubtless one leading reason why the world declines honouring us
+whalemen, is this: they think that, at best, our vocation amounts to
+a butchering sort of business; and that when actively engaged
+therein, we are surrounded by all manner of defilements.  Butchers we
+are, that is true.  But butchers, also, and butchers of the bloodiest
+badge have been all Martial Commanders whom the world invariably
+delights to honour.  And as for the matter of the alleged
+uncleanliness of our business, ye shall soon be initiated into
+certain facts hitherto pretty generally unknown, and which, upon the
+whole, will triumphantly plant the sperm whale-ship at least among
+the cleanliest things of this tidy earth.  But even granting the
+charge in question to be true; what disordered slippery decks of a
+whale-ship are comparable to the unspeakable carrion of those
+battle-fields from which so many soldiers return to drink in all
+ladies' plaudits?  And if the idea of peril so much enhances the
+popular conceit of the soldier's profession; let me assure ye that
+many a veteran who has freely marched up to a battery, would quickly
+recoil at the apparition of the sperm whale's vast tail, fanning into
+eddies the air over his head.  For what are the comprehensible
+terrors of man compared with the interlinked terrors and wonders of
+God!
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 5</DOCNO>
+But, though the world scouts at us whale hunters, yet does it
+unwittingly pay us the profoundest homage; yea, an all-abounding
+adoration! for almost all the tapers, lamps, and candles that burn
+round the globe, burn, as before so many shrines, to our glory!
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 6</DOCNO>
+But look at this matter in other lights; weigh it in all sorts of
+scales; see what we whalemen are, and have been.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 7</DOCNO>
+Why did the Dutch in De Witt's time have admirals of their whaling
+fleets?  Why did Louis XVI. of France, at his own personal expense,
+fit out whaling ships from Dunkirk, and politely invite to that town
+some score or two of families from our own island of Nantucket?  Why
+did Britain between the years 1750 and 1788 pay to her whalemen in
+bounties upwards of L1,000,000?  And lastly, how comes it that we
+whalemen of America now outnumber all the rest of the banded whalemen
+in the world; sail a navy of upwards of seven hundred vessels; manned
+by eighteen thousand men; yearly consuming 4,000,000 of dollars; the
+ships worth, at the time of sailing, $20,000,000! and every year
+importing into our harbors a well reaped harvest of $7,000,000.  How
+comes all this, if there be not something puissant in whaling?
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 8</DOCNO>
+But this is not the half; look again.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 9</DOCNO>
+I freely assert, that the cosmopolite philosopher cannot, for his
+life, point out one single peaceful influence, which within the last
+sixty years has operated more potentially upon the whole broad world,
+taken in one aggregate, than the high and mighty business of whaling.
+One way and another, it has begotten events so remarkable in
+themselves, and so continuously momentous in their sequential issues,
+that whaling may well be regarded as that Egyptian mother, who bore
+offspring themselves pregnant from her womb.  It would be a hopeless,
+endless task to catalogue all these things.  Let a handful suffice.
+For many years past the whale-ship has been the pioneer in ferreting
+out the remotest and least known parts of the earth.  She has
+explored seas and archipelagoes which had no chart, where no Cook or
+Vancouver had ever sailed.  If American and European men-of-war
+now peacefully ride in once savage harbors, let them fire salutes to
+the honour and glory of the whale-ship, which originally showed them
+the way, and first interpreted between them and the savages.  They
+may celebrate as they will the heroes of Exploring Expeditions, your
+Cooks, your Krusensterns; but I say that scores of anonymous
+Captains have sailed out of Nantucket, that were as great, and
+greater than your Cook and your Krusenstern.  For in their
+succourless empty-handedness, they, in the heathenish sharked waters,
+and by the beaches of unrecorded, javelin islands, battled with
+virgin wonders and terrors that Cook with all his marines and
+muskets would not willingly have dared.  All that is made such a
+flourish of in the old South Sea Voyages, those things were but the
+life-time commonplaces of our heroic Nantucketers.  Often,
+adventures which Vancouver dedicates three chapters to, these men
+accounted unworthy of being set down in the ship's common log.  Ah,
+the world!  Oh, the world!
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 10</DOCNO>
+Until the whale fishery rounded Cape Horn, no commerce but colonial,
+scarcely any intercourse but colonial, was carried on between Europe
+and the long line of the opulent Spanish provinces on the Pacific
+coast.  It was the whaleman who first broke through the jealous
+policy of the Spanish crown, touching those colonies; and, if space
+permitted, it might be distinctly shown how from those whalemen at
+last eventuated the liberation of Peru, Chili, and Bolivia from the
+yoke of Old Spain, and the establishment of the eternal democracy in
+those parts.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 11</DOCNO>
+That great America on the other side of the sphere, Australia, was
+given to the enlightened world by the whaleman.  After its first
+blunder-born discovery by a Dutchman, all other ships long shunned
+those shores as pestiferously barbarous; but the whale-ship touched
+there.  The whale-ship is the true mother of that now mighty colony.
+Moreover, in the infancy of the first Australian settlement, the
+emigrants were several times saved from starvation by the benevolent
+biscuit of the whale-ship luckily dropping an anchor in their waters.
+The uncounted isles of all Polynesia confess the same truth, and do
+commercial homage to the whale-ship, that cleared the way for the
+missionary and the merchant, and in many cases carried the primitive
+missionaries to their first destinations.  If that double-bolted
+land, Japan, is ever to become hospitable, it is the whale-ship alone
+to whom the credit will be due; for already she is on the threshold.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 12</DOCNO>
+But if, in the face of all this, you still declare that whaling has
+no aesthetically noble associations connected with it, then am I
+ready to shiver fifty lances with you there, and unhorse you with a
+split helmet every time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 13</DOCNO>
+The whale has no famous author, and whaling no famous chronicler, you
+will say.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 14</DOCNO>
+THE WHALE NO FAMOUS AUTHOR, AND WHALING NO FAMOUS CHRONICLER?  Who
+wrote the first account of our Leviathan?  Who but mighty Job!  And
+who composed the first narrative of a whaling-voyage?  Who, but no
+less a prince than Alfred the Great, who, with his own royal pen,
+took down the words from Other, the Norwegian whale-hunter of those
+times!  And who pronounced our glowing eulogy in Parliament?  Who,
+but Edmund Burke!
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 15</DOCNO>
+True enough, but then whalemen themselves are poor devils; they have
+no good blood in their veins.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 16</DOCNO>
+NO GOOD BLOOD IN THEIR VEINS?  They have something better than royal
+blood there.  The grandmother of Benjamin Franklin was Mary Morrel;
+afterwards, by marriage, Mary Folger, one of the old settlers of
+Nantucket, and the ancestress to a long line of Folgers and
+harpooneers--all kith and kin to noble Benjamin--this day darting the
+barbed iron from one side of the world to the other.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 17</DOCNO>
+Good again; but then all confess that somehow whaling is not
+respectable.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 18</DOCNO>
+WHALING NOT RESPECTABLE?  Whaling is imperial!  By old English
+statutory law, the whale is declared "a royal fish."*
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 19</DOCNO>
+Oh, that's only nominal!  The whale himself has never figured in any
+grand imposing way.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 20</DOCNO>
+THE WHALE NEVER FIGURED IN ANY GRAND IMPOSING WAY?  In one of the
+mighty triumphs given to a Roman general upon his entering the
+world's capital, the bones of a whale, brought all the way from the
+Syrian coast, were the most conspicuous object in the cymballed
+procession.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 21</DOCNO>
+*See subsequent chapters for something more on this head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 22</DOCNO>
+Grant it, since you cite it; but, say what you will, there is no real
+dignity in whaling.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 23</DOCNO>
+NO DIGNITY IN WHALING?  The dignity of our calling the very heavens
+attest.  Cetus is a constellation in the South!  No more!  Drive
+down your hat in presence of the Czar, and take it off to Queequeg!
+No more!  I know a man that, in his lifetime, has taken three hundred
+and fifty whales.  I account that man more honourable than that great
+captain of antiquity who boasted of taking as many walled towns.
+</DOC>
+<DOC>
+<DOCNO>Chapter 24, Paragraph 24</DOCNO>
+And, as for me, if, by any possibility, there be any as yet
+undiscovered prime thing in me; if I shall ever deserve any real
+repute in that small but high hushed world which I might not be
+unreasonably ambitious of; if hereafter I shall do anything that, upon
+the whole, a man might rather have done than to have left undone; if,
+at my death, my executors, or more properly my creditors, find any
+precious MSS. in my desk, then here I prospectively ascribe all the
+honour and the glory to whaling; for a whale-ship was my Yale College
+and my Harvard.
+</DOC>
+<DOC>
+<DOCNO>Chapter 25, Paragraph 1</DOCNO>
+Postscript.
+</DOC>
+<DOC>
+<DOCNO>Chapter 25, Paragraph 2</DOCNO>
+In behalf of the dignity of whaling, I would fain advance naught but
+substantiated facts.  But after embattling his facts, an advocate who
+should wholly suppress a not unreasonable surmise, which might tell
+eloquently upon his cause--such an advocate, would he not be
+blameworthy?
+</DOC>
+<DOC>
+<DOCNO>Chapter 25, Paragraph 3</DOCNO>
+It is well known that at the coronation of kings and queens, even
+modern ones, a certain curious process of seasoning them for their
+functions is gone through.  There is a saltcellar of state, so
+called, and there may be a castor of state.  How they use the salt,
+precisely--who knows?  Certain I am, however, that a king's head is
+solemnly oiled at his coronation, even as a head of salad.  Can it
+be, though, that they anoint it with a view of making its interior
+run well, as they anoint machinery?  Much might be ruminated here,
+concerning the essential dignity of this regal process, because in
+common life we esteem but meanly and contemptibly a fellow who
+anoints his hair, and palpably smells of that anointing.  In truth, a
+mature man who uses hair-oil, unless medicinally, that man has
+probably got a quoggy spot in him somewhere.  As a general rule, he
+can't amount to much in his totality.
+</DOC>
+<DOC>
+<DOCNO>Chapter 25, Paragraph 4</DOCNO>
+But the only thing to be considered here, is this--what kind of oil
+is used at coronations?  Certainly it cannot be olive oil, nor
+macassar oil, nor castor oil, nor bear's oil, nor train oil, nor
+cod-liver oil.  What then can it possibly be, but sperm oil in
+its unmanufactured, unpolluted state, the sweetest of all oils?
+</DOC>
+<DOC>
+<DOCNO>Chapter 25, Paragraph 5</DOCNO>
+Think of that, ye loyal Britons! we whalemen supply your kings and
+queens with coronation stuff!
+</DOC>
+<DOC>
+<DOCNO>Chapter 26, Paragraph 1</DOCNO>
+Knights and Squires.
+</DOC>
+<DOC>
+<DOCNO>Chapter 26, Paragraph 2</DOCNO>
+The chief mate of the Pequod was Starbuck, a native of Nantucket, and
+a Quaker by descent.  He was a long, earnest man, and though born on
+an icy coast, seemed well adapted to endure hot latitudes, his flesh
+being hard as twice-baked biscuit.  Transported to the Indies, his
+live blood would not spoil like bottled ale.  He must have been born
+in some time of general drought and famine, or upon one of those fast
+days for which his state is famous.  Only some thirty arid summers
+had he seen; those summers had dried up all his physical
+superfluousness.  But this, his thinness, so to speak, seemed no more
+the token of wasting anxieties and cares, than it seemed the
+indication of any bodily blight.  It was merely the condensation of
+the man.  He was by no means ill-looking; quite the contrary.  His
+pure tight skin was an excellent fit; and closely wrapped up in it,
+and embalmed with inner health and strength, like a revivified
+Egyptian, this Starbuck seemed prepared to endure for long ages to
+come, and to endure always, as now; for be it Polar snow or torrid
+sun, like a patent chronometer, his interior vitality was warranted
+to do well in all climates.  Looking into his eyes, you seemed to
+see there the yet lingering images of those thousand-fold perils he
+had calmly confronted through life.  A staid, steadfast man, whose
+life for the most part was a telling pantomime of action, and not a
+tame chapter of sounds.  Yet, for all his hardy sobriety and
+fortitude, there were certain qualities in him which at times
+affected, and in some cases seemed well nigh to overbalance all the
+rest.  Uncommonly conscientious for a seaman, and endued with a deep
+natural reverence, the wild watery loneliness of his life did
+therefore strongly incline him to superstition; but to that sort of
+superstition, which in some organizations seems rather to spring,
+somehow, from intelligence than from ignorance.  Outward portents and
+inward presentiments were his.  And if at times these things bent the
+welded iron of his soul, much more did his far-away domestic memories
+of his young Cape wife and child, tend to bend him still more from
+the original ruggedness of his nature, and open him still further to
+those latent influences which, in some honest-hearted men, restrain
+the gush of dare-devil daring, so often evinced by others in the more
+perilous vicissitudes of the fishery.  "I will have no man in my
+boat," said Starbuck, "who is not afraid of a whale."  By this, he
+seemed to mean, not only that the most reliable and useful courage
+was that which arises from the fair estimation of the encountered
+peril, but that an utterly fearless man is a far more dangerous
+comrade than a coward.
+</DOC>
+<DOC>
+<DOCNO>Chapter 26, Paragraph 3</DOCNO>
+"Aye, aye," said Stubb, the second mate, "Starbuck, there, is as
+careful a man as you'll find anywhere in this fishery."  But we shall
+ere long see what that word "careful" precisely means when used by a
+man like Stubb, or almost any other whale hunter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 26, Paragraph 4</DOCNO>
+Starbuck was no crusader after perils; in him courage was not a
+sentiment; but a thing simply useful to him, and always at hand upon
+all mortally practical occasions.  Besides, he thought, perhaps, that
+in this business of whaling, courage was one of the great staple
+outfits of the ship, like her beef and her bread, and not to be
+foolishly wasted.  Wherefore he had no fancy for lowering for whales
+after sun-down; nor for persisting in fighting a fish that too much
+persisted in fighting him.  For, thought Starbuck, I am here in this
+critical ocean to kill whales for my living, and not to be killed by
+them for theirs; and that hundreds of men had been so killed Starbuck
+well knew.  What doom was his own father's?  Where, in the bottomless
+deeps, could he find the torn limbs of his brother?
+</DOC>
+<DOC>
+<DOCNO>Chapter 26, Paragraph 5</DOCNO>
+With memories like these in him, and, moreover, given to a certain
+superstitiousness, as has been said; the courage of this Starbuck
+which could, nevertheless, still flourish, must indeed have been
+extreme.  But it was not in reasonable nature that a man so
+organized, and with such terrible experiences and remembrances as he
+had; it was not in nature that these things should fail in latently
+engendering an element in him, which, under suitable circumstances,
+would break out from its confinement, and burn all his courage up.
+And brave as he might be, it was that sort of bravery chiefly,
+visible in some intrepid men, which, while generally abiding firm in
+the conflict with seas, or winds, or whales, or any of the ordinary
+irrational horrors of the world, yet cannot withstand those more
+terrific, because more spiritual terrors, which sometimes menace you
+from the concentrating brow of an enraged and mighty man.
+</DOC>
+<DOC>
+<DOCNO>Chapter 26, Paragraph 6</DOCNO>
+But were the coming narrative to reveal in any instance, the complete
+abasement of poor Starbuck's fortitude, scarce might I have the heart
+to write it; for it is a thing most sorrowful, nay shocking, to
+expose the fall of valour in the soul.  Men may seem detestable as
+joint stock-companies and nations; knaves, fools, and murderers there
+may be; men may have mean and meagre faces; but man, in the ideal,
+is so noble and so sparkling, such a grand and glowing creature, that
+over any ignominious blemish in him all his fellows should run to
+throw their costliest robes.  That immaculate manliness we feel
+within ourselves, so far within us, that it remains intact though all
+the outer character seem gone; bleeds with keenest anguish at the
+undraped spectacle of a valor-ruined man.  Nor can piety itself, at
+such a shameful sight, completely stifle her upbraidings against the
+permitting stars.  But this august dignity I treat of, is not the
+dignity of kings and robes, but that abounding dignity which has no
+robed investiture.  Thou shalt see it shining in the arm that wields
+a pick or drives a spike; that democratic dignity which, on all
+hands, radiates without end from God; Himself!  The great God
+absolute!  The centre and circumference of all democracy!  His
+omnipresence, our divine equality!
+</DOC>
+<DOC>
+<DOCNO>Chapter 26, Paragraph 7</DOCNO>
+If, then, to meanest mariners, and renegades and castaways, I shall
+hereafter ascribe high qualities, though dark; weave round them
+tragic graces; if even the most mournful, perchance the most abased,
+among them all, shall at times lift himself to the exalted mounts; if
+I shall touch that workman's arm with some ethereal light; if I shall
+spread a rainbow over his disastrous set of sun; then against all
+mortal critics bear me out in it, thou Just Spirit of Equality,
+which hast spread one royal mantle of humanity over all my kind!
+Bear me out in it, thou great democratic God! who didst not refuse to
+the swart convict, Bunyan, the pale, poetic pearl; Thou who didst
+clothe with doubly hammered leaves of finest gold, the stumped and
+paupered arm of old Cervantes; Thou who didst pick up Andrew Jackson
+from the pebbles; who didst hurl him upon a war-horse; who didst
+thunder him higher than a throne!  Thou who, in all Thy mighty,
+earthly marchings, ever cullest Thy selectest champions from the
+kingly commons; bear me out in it, O God!
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 1</DOCNO>
+Knights and Squires.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 2</DOCNO>
+Stubb was the second mate.  He was a native of Cape Cod; and hence,
+according to local usage, was called a Cape-Cod-man.  A
+happy-go-lucky; neither craven nor valiant; taking perils as they
+came with an indifferent air; and while engaged in the most imminent
+crisis of the chase, toiling away, calm and collected as a journeyman
+joiner engaged for the year.  Good-humored, easy, and careless, he
+presided over his whale-boat as if the most deadly encounter were but
+a dinner, and his crew all invited guests.  He was as particular
+about the comfortable arrangement of his part of the boat, as an
+old stage-driver is about the snugness of his box.  When close to the
+whale, in the very death-lock of the fight, he handled his unpitying
+lance coolly and off-handedly, as a whistling tinker his hammer.  He
+would hum over his old rigadig tunes while flank and flank with the
+most exasperated monster.  Long usage had, for this Stubb, converted
+the jaws of death into an easy chair.  What he thought of death
+itself, there is no telling.  Whether he ever thought of it at all,
+might be a question; but, if he ever did chance to cast his mind that
+way after a comfortable dinner, no doubt, like a good sailor, he took
+it to be a sort of call of the watch to tumble aloft, and bestir
+themselves there, about something which he would find out when he
+obeyed the order, and not sooner.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 3</DOCNO>
+What, perhaps, with other things, made Stubb such an easy-going,
+unfearing man, so cheerily trudging off with the burden of life in a
+world full of grave pedlars, all bowed to the ground with their
+packs; what helped to bring about that almost impious good-humor of
+his; that thing must have been his pipe.  For, like his nose, his
+short, black little pipe was one of the regular features of his face.
+You would almost as soon have expected him to turn out of his bunk
+without his nose as without his pipe.  He kept a whole row of pipes
+there ready loaded, stuck in a rack, within easy reach of his hand;
+and, whenever he turned in, he smoked them all out in succession,
+lighting one from the other to the end of the chapter; then loading
+them again to be in readiness anew.  For, when Stubb dressed, instead
+of first putting his legs into his trowsers, he put his pipe into his
+mouth.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 4</DOCNO>
+I say this continual smoking must have been one cause, at least, of
+his peculiar disposition; for every one knows that this earthly air,
+whether ashore or afloat, is terribly infected with the nameless
+miseries of the numberless mortals who have died exhaling it; and as
+in time of the cholera, some people go about with a camphorated
+handkerchief to their mouths; so, likewise, against all mortal
+tribulations, Stubb's tobacco smoke might have operated as a sort of
+disinfecting agent.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 5</DOCNO>
+The third mate was Flask, a native of Tisbury, in Martha's Vineyard.
+A short, stout, ruddy young fellow, very pugnacious concerning
+whales, who somehow seemed to think that the great leviathans had
+personally and hereditarily affronted him; and therefore it was a
+sort of point of honour with him, to destroy them whenever
+encountered.  So utterly lost was he to all sense of reverence for
+the many marvels of their majestic bulk and mystic ways; and so dead
+to anything like an apprehension of any possible danger from
+encountering them; that in his poor opinion, the wondrous whale was
+but a species of magnified mouse, or at least water-rat, requiring
+only a little circumvention and some small application of time and
+trouble in order to kill and boil.  This ignorant, unconscious
+fearlessness of his made him a little waggish in the matter of
+whales; he followed these fish for the fun of it; and a three years'
+voyage round Cape Horn was only a jolly joke that lasted that length
+of time.  As a carpenter's nails are divided into wrought nails and
+cut nails; so mankind may be similarly divided.  Little Flask was one
+of the wrought ones; made to clinch tight and last long.  They called
+him King-Post on board of the Pequod; because, in form, he could be
+well likened to the short, square timber known by that name in Arctic
+whalers; and which by the means of many radiating side timbers
+inserted into it, serves to brace the ship against the icy
+concussions of those battering seas.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 6</DOCNO>
+Now these three mates--Starbuck, Stubb, and Flask, were momentous
+men.  They it was who by universal prescription commanded three of the
+Pequod's boats as headsmen.  In that grand order of battle in which
+Captain Ahab would probably marshal his forces to descend on the
+whales, these three headsmen were as captains of companies.  Or,
+being armed with their long keen whaling spears, they were as a
+picked trio of lancers; even as the harpooneers were flingers of
+javelins.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 7</DOCNO>
+And since in this famous fishery, each mate or headsman, like a
+Gothic Knight of old, is always accompanied by his boat-steerer or
+harpooneer, who in certain conjunctures provides him with a fresh
+lance, when the former one has been badly twisted, or elbowed in the
+assault; and moreover, as there generally subsists between the two, a
+close intimacy and friendliness; it is therefore but meet, that in
+this place we set down who the Pequod's harpooneers were, and to what
+headsman each of them belonged.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 8</DOCNO>
+First of all was Queequeg, whom Starbuck, the chief mate, had
+selected for his squire.  But Queequeg is already known.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 9</DOCNO>
+Next was Tashtego, an unmixed Indian from Gay Head, the most westerly
+promontory of Martha's Vineyard, where there still exists the last
+remnant of a village of red men, which has long supplied the
+neighboring island of Nantucket with many of her most daring
+harpooneers.  In the fishery, they usually go by the generic name of
+Gay-Headers.  Tashtego's long, lean, sable hair, his high cheek
+bones, and black rounding eyes--for an Indian, Oriental in their
+largeness, but Antarctic in their glittering expression--all this
+sufficiently proclaimed him an inheritor of the unvitiated blood of
+those proud warrior hunters, who, in quest of the great New England
+moose, had scoured, bow in hand, the aboriginal forests of the main.
+But no longer snuffing in the trail of the wild beasts of the
+woodland, Tashtego now hunted in the wake of the great whales of the
+sea; the unerring harpoon of the son fitly replacing the infallible
+arrow of the sires.  To look at the tawny brawn of his lithe snaky
+limbs, you would almost have credited the superstitions of some of
+the earlier Puritans, and half-believed this wild Indian to be a son
+of the Prince of the Powers of the Air.  Tashtego was Stubb the
+second mate's squire.
+</DOC>
+<DOC>
+<DOCNO>Chapter 27, Paragraph 10</DOCNO>
+Third among the harpooneers was Daggoo, a gigantic, coal-black
+negro-savage, with a lion-like tread--an Ahasuerus to behold.
+Suspended from his ears were two golden hoops, so large that the
+sailors called them ring-bolts, and would talk of securing the
+top-sail halyards to them.  In his youth Daggoo had voluntarily
+shipped on board of a whaler, lying in a lonely bay on his native
+coast.  And never having been anywhere in the world but in Africa,
+Nantucket, and the pagan harbors most frequented by whalemen; and
+having now led for many years the bold life of the fishery in the
+ships of owners uncommonly heedful of what manner of men they
+shipped; Daggoo retained all his barbaric virtues, and erect as a
+giraffe, moved about the decks in all the pomp of six feet five in
+his socks.  There was a corporeal humility in looking up at him; and
+a white man standing before him seemed a white flag come to beg truce
+of a fortress.  Curious to tell, this imperial negro, Ahasuerus
+Daggoo, was the Squire of little Flask, who looked like a chess-man
+beside him.  As for the residue of the Pequod's company, be it said,
+that at the present day not one in two of the many thousand men
+before the mast employed in the American whale fishery, are Americans
+born, though pretty nearly all the officers are.  Herein it is the
+same with the American whale fishery as with the American army and
+military and merchant navies, and the engineering forces employed in
+the construction of the American Canals and Railroads.  The same, I
+say, because in all these cases the native American liberally
+provides the brains, the rest of the world as generously supplying
+the muscles.  No small number of these whaling seamen belong to the
+Azores, where the outward bound Nantucket whalers frequently touch to
+augment their crews from the hardy peasants of those rocky shores.
+In like manner, the Greenland whalers sailing out of Hull or London,
+put in at the Shetland Islands, to receive the full complement of
+their crew.  Upon the passage homewards, they drop them there again.
+How it is, there is no telling, but Islanders seem to make the best
+whalemen.  They were nearly all Islanders in the Pequod, ISOLATOES
+too, I call such, not acknowledging the common continent of men, but
+each ISOLATO living on a separate continent of his own.  Yet now,
+federated along one keel, what a set these Isolatoes were!  An
+Anacharsis Clootz deputation from all the isles of the sea, and all
+the ends of the earth, accompanying Old Ahab in the Pequod to lay the
+world's grievances before that bar from which not very many of them
+ever come back.  Black Little Pip--he never did--oh, no! he went
+before.  Poor Alabama boy!  On the grim Pequod's forecastle, ye shall
+ere long see him, beating his tambourine; prelusive of the eternal
+time, when sent for, to the great quarter-deck on high, he was bid
+strike in with angels, and beat his tambourine in glory; called a
+coward here, hailed a hero there!
+</DOC>
+<DOC>
+<DOCNO>Chapter 28, Paragraph 1</DOCNO>
+Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 28, Paragraph 2</DOCNO>
+For several days after leaving Nantucket, nothing above hatches was
+seen of Captain Ahab.  The mates regularly relieved each other at the
+watches, and for aught that could be seen to the contrary, they
+seemed to be the only commanders of the ship; only they sometimes
+issued from the cabin with orders so sudden and peremptory, that
+after all it was plain they but commanded vicariously.  Yes, their
+supreme lord and dictator was there, though hitherto unseen by any
+eyes not permitted to penetrate into the now sacred retreat of the
+cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 28, Paragraph 3</DOCNO>
+Every time I ascended to the deck from my watches below, I instantly
+gazed aft to mark if any strange face were visible; for my first
+vague disquietude touching the unknown captain, now in the seclusion
+of the sea, became almost a perturbation.  This was strangely
+heightened at times by the ragged Elijah's diabolical incoherences
+uninvitedly recurring to me, with a subtle energy I could not have
+before conceived of.  But poorly could I withstand them, much as in
+other moods I was almost ready to smile at the solemn whimsicalities
+of that outlandish prophet of the wharves.  But whatever it was of
+apprehensiveness or uneasiness--to call it so--which I felt, yet
+whenever I came to look about me in the ship, it seemed against all
+warrantry to cherish such emotions.  For though the harpooneers, with
+the great body of the crew, were a far more barbaric, heathenish, and
+motley set than any of the tame merchant-ship companies which my
+previous experiences had made me acquainted with, still I ascribed
+this--and rightly ascribed it--to the fierce uniqueness of the very
+nature of that wild Scandinavian vocation in which I had so
+abandonedly embarked.  But it was especially the aspect of the three
+chief officers of the ship, the mates, which was most forcibly
+calculated to allay these colourless misgivings, and induce confidence
+and cheerfulness in every presentment of the voyage.  Three better,
+more likely sea-officers and men, each in his own different way,
+could not readily be found, and they were every one of them
+Americans; a Nantucketer, a Vineyarder, a Cape man.  Now, it being
+Christmas when the ship shot from out her harbor, for a space we had
+biting Polar weather, though all the time running away from it to the
+southward; and by every degree and minute of latitude which we
+sailed, gradually leaving that merciless winter, and all its
+intolerable weather behind us.  It was one of those less lowering,
+but still grey and gloomy enough mornings of the transition, when
+with a fair wind the ship was rushing through the water with a
+vindictive sort of leaping and melancholy rapidity, that as I mounted
+to the deck at the call of the forenoon watch, so soon as I levelled
+my glance towards the taffrail, foreboding shivers ran over me.
+Reality outran apprehension; Captain Ahab stood upon his
+quarter-deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 28, Paragraph 4</DOCNO>
+There seemed no sign of common bodily illness about him, nor of the
+recovery from any.  He looked like a man cut away from the stake,
+when the fire has overrunningly wasted all the limbs without
+consuming them, or taking away one particle from their compacted aged
+robustness.  His whole high, broad form, seemed made of solid bronze,
+and shaped in an unalterable mould, like Cellini's cast Perseus.
+Threading its way out from among his grey hairs, and continuing right
+down one side of his tawny scorched face and neck, till it
+disappeared in his clothing, you saw a slender rod-like mark, lividly
+whitish.  It resembled that perpendicular seam sometimes made in the
+straight, lofty trunk of a great tree, when the upper lightning
+tearingly darts down it, and without wrenching a single twig, peels
+and grooves out the bark from top to bottom, ere running off into the
+soil, leaving the tree still greenly alive, but branded.  Whether
+that mark was born with him, or whether it was the scar left by some
+desperate wound, no one could certainly say.  By some tacit consent,
+throughout the voyage little or no allusion was made to it,
+especially by the mates.  But once Tashtego's senior, an old Gay-Head
+Indian among the crew, superstitiously asserted that not till he was
+full forty years old did Ahab become that way branded, and then it
+came upon him, not in the fury of any mortal fray, but in an
+elemental strife at sea.  Yet, this wild hint seemed inferentially
+negatived, by what a grey Manxman insinuated, an old sepulchral man,
+who, having never before sailed out of Nantucket, had never ere this
+laid eye upon wild Ahab.  Nevertheless, the old sea-traditions, the
+immemorial credulities, popularly invested this old Manxman with
+preternatural powers of discernment.  So that no white sailor
+seriously contradicted him when he said that if ever Captain Ahab
+should be tranquilly laid out--which might hardly come to pass, so he
+muttered--then, whoever should do that last office for the dead,
+would find a birth-mark on him from crown to sole.
+</DOC>
+<DOC>
+<DOCNO>Chapter 28, Paragraph 5</DOCNO>
+So powerfully did the whole grim aspect of Ahab affect me, and the
+livid brand which streaked it, that for the first few moments I
+hardly noted that not a little of this overbearing grimness was owing
+to the barbaric white leg upon which he partly stood.  It had
+previously come to me that this ivory leg had at sea been fashioned
+from the polished bone of the sperm whale's jaw.  "Aye, he was
+dismasted off Japan," said the old Gay-Head Indian once; "but like
+his dismasted craft, he shipped another mast without coming home for
+it.  He has a quiver of 'em."
+</DOC>
+<DOC>
+<DOCNO>Chapter 28, Paragraph 6</DOCNO>
+I was struck with the singular posture he maintained.  Upon each side
+of the Pequod's quarter deck, and pretty close to the mizzen shrouds,
+there was an auger hole, bored about half an inch or so, into the
+plank.  His bone leg steadied in that hole; one arm elevated, and
+holding by a shroud; Captain Ahab stood erect, looking straight out
+beyond the ship's ever-pitching prow.  There was an infinity of
+firmest fortitude, a determinate, unsurrenderable wilfulness, in the
+fixed and fearless, forward dedication of that glance.  Not a word he
+spoke; nor did his officers say aught to him; though by all their
+minutest gestures and expressions, they plainly showed the uneasy, if
+not painful, consciousness of being under a troubled master-eye.  And
+not only that, but moody stricken Ahab stood before them with a
+crucifixion in his face; in all the nameless regal overbearing
+dignity of some mighty woe.
+</DOC>
+<DOC>
+<DOCNO>Chapter 28, Paragraph 7</DOCNO>
+Ere long, from his first visit in the air, he withdrew into his
+cabin.  But after that morning, he was every day visible to the crew;
+either standing in his pivot-hole, or seated upon an ivory stool he
+had; or heavily walking the deck.  As the sky grew less gloomy;
+indeed, began to grow a little genial, he became still less and less
+a recluse; as if, when the ship had sailed from home, nothing but the
+dead wintry bleakness of the sea had then kept him so secluded.  And,
+by and by, it came to pass, that he was almost continually in the
+air; but, as yet, for all that he said, or perceptibly did, on the at
+last sunny deck, he seemed as unnecessary there as another mast.  But
+the Pequod was only making a passage now; not regularly cruising;
+nearly all whaling preparatives needing supervision the mates were
+fully competent to, so that there was little or nothing, out of
+himself, to employ or excite Ahab, now; and thus chase away, for that
+one interval, the clouds that layer upon layer were piled upon his
+brow, as ever all clouds choose the loftiest peaks to pile themselves
+upon.
+</DOC>
+<DOC>
+<DOCNO>Chapter 28, Paragraph 8</DOCNO>
+Nevertheless, ere long, the warm, warbling persuasiveness of the
+pleasant, holiday weather we came to, seemed gradually to charm him
+from his mood.  For, as when the red-cheeked, dancing girls, April
+and May, trip home to the wintry, misanthropic woods; even the
+barest, ruggedest, most thunder-cloven old oak will at least send
+forth some few green sprouts, to welcome such glad-hearted visitants;
+so Ahab did, in the end, a little respond to the playful allurings of
+that girlish air.  More than once did he put forth the faint blossom
+of a look, which, in any other man, would have soon flowered out in a
+smile.
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 1</DOCNO>
+Enter Ahab; to Him, Stubb.
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 2</DOCNO>
+Some days elapsed, and ice and icebergs all astern, the Pequod now
+went rolling through the bright Quito spring, which, at sea, almost
+perpetually reigns on the threshold of the eternal August of the
+Tropic.  The warmly cool, clear, ringing, perfumed, overflowing,
+redundant days, were as crystal goblets of Persian sherbet, heaped
+up--flaked up, with rose-water snow.  The starred and stately nights
+seemed haughty dames in jewelled velvets, nursing at home in lonely
+pride, the memory of their absent conquering Earls, the golden
+helmeted suns!  For sleeping man, 'twas hard to choose between such
+winsome days and such seducing nights.  But all the witcheries of
+that unwaning weather did not merely lend new spells and potencies to
+the outward world.  Inward they turned upon the soul, especially when
+the still mild hours of eve came on; then, memory shot her crystals
+as the clear ice most forms of noiseless twilights.  And all these
+subtle agencies, more and more they wrought on Ahab's texture.
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 3</DOCNO>
+Old age is always wakeful; as if, the longer linked with life, the
+less man has to do with aught that looks like death.  Among
+sea-commanders, the old greybeards will oftenest leave their berths
+to visit the night-cloaked deck.  It was so with Ahab; only that now,
+of late, he seemed so much to live in the open air, that truly
+speaking, his visits were more to the cabin, than from the cabin to
+the planks.  "It feels like going down into one's tomb,"--he would
+mutter to himself--"for an old captain like me to be descending this
+narrow scuttle, to go to my grave-dug berth."
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 4</DOCNO>
+So, almost every twenty-four hours, when the watches of the night
+were set, and the band on deck sentinelled the slumbers of the band
+below; and when if a rope was to be hauled upon the forecastle, the
+sailors flung it not rudely down, as by day, but with some
+cautiousness dropt it to its place for fear of disturbing their
+slumbering shipmates; when this sort of steady quietude would begin
+to prevail, habitually, the silent steersman would watch the
+cabin-scuttle; and ere long the old man would emerge, gripping at the
+iron banister, to help his crippled way.  Some considering touch of
+humanity was in him; for at times like these, he usually abstained
+from patrolling the quarter-deck; because to his wearied mates,
+seeking repose within six inches of his ivory heel, such would have
+been the reverberating crack and din of that bony step, that their
+dreams would have been on the crunching teeth of sharks.  But once,
+the mood was on him too deep for common regardings; and as with
+heavy, lumber-like pace he was measuring the ship from taffrail to
+mainmast, Stubb, the old second mate, came up from below, with a
+certain unassured, deprecating humorousness, hinted that if Captain
+Ahab was pleased to walk the planks, then, no one could say nay; but
+there might be some way of muffling the noise; hinting something
+indistinctly and hesitatingly about a globe of tow, and the insertion
+into it, of the ivory heel.  Ah!  Stubb, thou didst not know Ahab
+then.
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 5</DOCNO>
+"Am I a cannon-ball, Stubb," said Ahab, "that thou wouldst wad me
+that fashion?  But go thy ways; I had forgot.  Below to thy nightly
+grave; where such as ye sleep between shrouds, to use ye to the
+filling one at last.--Down, dog, and kennel!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 6</DOCNO>
+Starting at the unforseen concluding exclamation of the so suddenly
+scornful old man, Stubb was speechless a moment; then said excitedly,
+"I am not used to be spoken to that way, sir; I do but less than half
+like it, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 7</DOCNO>
+"Avast! gritted Ahab between his set teeth, and violently moving
+away, as if to avoid some passionate temptation.
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 8</DOCNO>
+"No, sir; not yet," said Stubb, emboldened, "I will not tamely be
+called a dog, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 9</DOCNO>
+"Then be called ten times a donkey, and a mule, and an ass, and
+begone, or I'll clear the world of thee!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 10</DOCNO>
+As he said this, Ahab advanced upon him with such overbearing terrors
+in his aspect, that Stubb involuntarily retreated.
+</DOC>
+<DOC>
+<DOCNO>Chapter 29, Paragraph 11</DOCNO>
+"I was never served so before without giving a hard blow for it,"
+muttered Stubb, as he found himself descending the cabin-scuttle.
+"It's very queer.  Stop, Stubb; somehow, now, I don't well know
+whether to go back and strike him, or--what's that?--down here on my
+knees and pray for him?  Yes, that was the thought coming up in me;
+but it would be the first time I ever DID pray.  It's queer; very
+queer; and he's queer too; aye, take him fore and aft, he's about the
+queerest old man Stubb ever sailed with.  How he flashed at me!--his
+eyes like powder-pans! is he mad?  Anyway there's something on his
+mind, as sure as there must be something on a deck when it cracks.
+He aint in his bed now, either, more than three hours out of the
+twenty-four; and he don't sleep then.  Didn't that Dough-Boy, the
+steward, tell me that of a morning he always finds the old man's
+hammock clothes all rumpled and tumbled, and the sheets down at the
+foot, and the coverlid almost tied into knots, and the pillow a sort
+of frightful hot, as though a baked brick had been on it?  A hot old
+man!  I guess he's got what some folks ashore call a conscience; it's
+a kind of Tic-Dolly-row they say--worse nor a toothache.  Well, well;
+I don't know what it is, but the Lord keep me from catching it.  He's
+full of riddles; I wonder what he goes into the after hold for, every
+night, as Dough-Boy tells me he suspects; what's that for, I should
+like to know?  Who's made appointments with him in the hold?  Ain't
+that queer, now?  But there's no telling, it's the old game--Here
+goes for a snooze.  Damn me, it's worth a fellow's while to be born
+into the world, if only to fall right asleep.  And now that I think
+of it, that's about the first thing babies do, and that's a sort of
+queer, too.  Damn me, but all things are queer, come to think of 'em.
+But that's against my principles.  Think not, is my eleventh
+commandment; and sleep when you can, is my twelfth--So here goes
+again.  But how's that? didn't he call me a dog? blazes! he called me
+ten times a donkey, and piled a lot of jackasses on top of THAT!  He
+might as well have kicked me, and done with it.  Maybe he DID kick
+me, and I didn't observe it, I was so taken all aback with his brow,
+somehow.  It flashed like a bleached bone.  What the devil's the
+matter with me?  I don't stand right on my legs.  Coming afoul of
+that old man has a sort of turned me wrong side out.  By the Lord, I
+must have been dreaming, though--How? how? how?--but the only way's
+to stash it; so here goes to hammock again; and in the morning, I'll
+see how this plaguey juggling thinks over by daylight."
+</DOC>
+<DOC>
+<DOCNO>Chapter 30, Paragraph 1</DOCNO>
+The Pipe.
+</DOC>
+<DOC>
+<DOCNO>Chapter 30, Paragraph 2</DOCNO>
+When Stubb had departed, Ahab stood for a while leaning over the
+bulwarks; and then, as had been usual with him of late, calling a
+sailor of the watch, he sent him below for his ivory stool, and also
+his pipe.  Lighting the pipe at the binnacle lamp and planting the
+stool on the weather side of the deck, he sat and smoked.
+</DOC>
+<DOC>
+<DOCNO>Chapter 30, Paragraph 3</DOCNO>
+In old Norse times, the thrones of the sea-loving Danish kings were
+fabricated, saith tradition, of the tusks of the narwhale.  How could
+one look at Ahab then, seated on that tripod of bones, without
+bethinking him of the royalty it symbolized?  For a Khan of the
+plank, and a king of the sea, and a great lord of Leviathans was
+Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 30, Paragraph 4</DOCNO>
+Some moments passed, during which the thick vapour came from his mouth
+in quick and constant puffs, which blew back again into his face.
+"How now," he soliloquized at last, withdrawing the tube, "this
+smoking no longer soothes.  Oh, my pipe! hard must it go with me if
+thy charm be gone!  Here have I been unconsciously toiling, not
+pleasuring--aye, and ignorantly smoking to windward all the while; to
+windward, and with such nervous whiffs, as if, like the dying whale,
+my final jets were the strongest and fullest of trouble.  What
+business have I with this pipe?  This thing that is meant for
+sereneness, to send up mild white vapours among mild white hairs, not
+among torn iron-grey locks like mine.  I'll smoke no more--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 30, Paragraph 5</DOCNO>
+He tossed the still lighted pipe into the sea.  The fire hissed in
+the waves; the same instant the ship shot by the bubble the sinking
+pipe made.  With slouched hat, Ahab lurchingly paced the planks.
+</DOC>
+<DOC>
+<DOCNO>Chapter 31, Paragraph 1</DOCNO>
+Queen Mab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 31, Paragraph 2</DOCNO>
+Next morning Stubb accosted Flask.
+</DOC>
+<DOC>
+<DOCNO>Chapter 31, Paragraph 3</DOCNO>
+"Such a queer dream, King-Post, I never had.  You know the old man's
+ivory leg, well I dreamed he kicked me with it; and when I tried to
+kick back, upon my soul, my little man, I kicked my leg right off!
+And then, presto!  Ahab seemed a pyramid, and I, like a blazing fool,
+kept kicking at it.  But what was still more curious, Flask--you know
+how curious all dreams are--through all this rage that I was in, I
+somehow seemed to be thinking to myself, that after all, it was not
+much of an insult, that kick from Ahab.  'Why,' thinks I, 'what's the
+row?  It's not a real leg, only a false leg.'  And there's a mighty
+difference between a living thump and a dead thump.  That's what
+makes a blow from the hand, Flask, fifty times more savage to bear
+than a blow from a cane.  The living member--that makes the living
+insult, my little man.  And thinks I to myself all the while, mind,
+while I was stubbing my silly toes against that cursed pyramid--so
+confoundedly contradictory was it all, all the while, I say, I was
+thinking to myself, 'what's his leg now, but a cane--a whalebone
+cane.  Yes,' thinks I, 'it was only a playful cudgelling--in fact,
+only a whaleboning that he gave me--not a base kick.  Besides,'
+thinks I, 'look at it once; why, the end of it--the foot part--what a
+small sort of end it is; whereas, if a broad footed farmer kicked me,
+THERE'S a devilish broad insult.  But this insult is whittled down to
+a point only.'  But now comes the greatest joke of the dream, Flask.
+While I was battering away at the pyramid, a sort of badger-haired
+old merman, with a hump on his back, takes me by the shoulders, and
+slews me round.  'What are you 'bout?' says he.  Slid! man, but I was
+frightened.  Such a phiz!  But, somehow, next moment I was over the
+fright.  'What am I about?' says I at last.  'And what business is
+that of yours, I should like to know, Mr. Humpback?  Do YOU want a
+kick?'  By the lord, Flask, I had no sooner said that, than he turned
+round his stern to me, bent over, and dragging up a lot of seaweed he
+had for a clout--what do you think, I saw?--why thunder alive, man,
+his stern was stuck full of marlinspikes, with the points out.  Says
+I, on second thoughts, 'I guess I won't kick you, old fellow.'  'Wise
+Stubb,' said he, 'wise Stubb;' and kept muttering it all the time, a
+sort of eating of his own gums like a chimney hag.  Seeing he wasn't
+going to stop saying over his 'wise Stubb, wise Stubb,' I thought I
+might as well fall to kicking the pyramid again.  But I had only just
+lifted my foot for it, when he roared out, 'Stop that kicking!'
+'Halloa,' says I, 'what's the matter now, old fellow?'  'Look ye
+here,' says he; 'let's argue the insult.  Captain Ahab kicked ye,
+didn't he?'  'Yes, he did,' says I--'right HERE it was.'  'Very
+good,' says he--'he used his ivory leg, didn't he?'  'Yes, he did,'
+says I.  'Well then,' says he, 'wise Stubb, what have you to complain
+of?  Didn't he kick with right good will? it wasn't a common pitch
+pine leg he kicked with, was it?  No, you were kicked by a great man,
+and with a beautiful ivory leg, Stubb.  It's an honour; I consider it
+an honour.  Listen, wise Stubb.  In old England the greatest lords
+think it great glory to be slapped by a queen, and made
+garter-knights of; but, be YOUR boast, Stubb, that ye were kicked by
+old Ahab, and made a wise man of.  Remember what I say; BE kicked by
+him; account his kicks honours; and on no account kick back; for you
+can't help yourself, wise Stubb.  Don't you see that pyramid?'  With
+that, he all of a sudden seemed somehow, in some queer fashion, to
+swim off into the air.  I snored; rolled over; and there I was in my
+hammock!  Now, what do you think of that dream, Flask?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 31, Paragraph 4</DOCNO>
+"I don't know; it seems a sort of foolish to me, tho.'"
+</DOC>
+<DOC>
+<DOCNO>Chapter 31, Paragraph 5</DOCNO>
+"May be; may be.  But it's made a wise man of me, Flask.  D'ye see
+Ahab standing there, sideways looking over the stern?  Well, the best
+thing you can do, Flask, is to let the old man alone; never speak to
+him, whatever he says.  Halloa!  What's that he shouts?  Hark!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 31, Paragraph 6</DOCNO>
+"Mast-head, there!  Look sharp, all of ye!  There are whales
+hereabouts!
+</DOC>
+<DOC>
+<DOCNO>Chapter 31, Paragraph 7</DOCNO>
+If ye see a white one, split your lungs for him!
+</DOC>
+<DOC>
+<DOCNO>Chapter 31, Paragraph 8</DOCNO>
+"What do you think of that now, Flask? ain't there a small drop of
+something queer about that, eh?  A white whale--did ye mark that,
+man?  Look ye--there's something special in the wind.  Stand by for
+it, Flask.  Ahab has that that's bloody on his mind.  But, mum; he
+comes this way."
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 1</DOCNO>
+Cetology.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 2</DOCNO>
+Already we are boldly launched upon the deep; but soon we shall be
+lost in its unshored, harbourless immensities.  Ere that come to pass;
+ere the Pequod's weedy hull rolls side by side with the barnacled
+hulls of the leviathan; at the outset it is but well to attend to a
+matter almost indispensable to a thorough appreciative understanding
+of the more special leviathanic revelations and allusions of all
+sorts which are to follow.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 3</DOCNO>
+It is some systematized exhibition of the whale in his broad genera,
+that I would now fain put before you.  Yet is it no easy task.  The
+classification of the constituents of a chaos, nothing less is here
+essayed.  Listen to what the best and latest authorities have laid
+down.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 4</DOCNO>
+"No branch of Zoology is so much involved as that which is entitled
+Cetology," says Captain Scoresby, A.D. 1820.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 5</DOCNO>
+"It is not my intention, were it in my power, to enter into the
+inquiry as to the true method of dividing the cetacea into groups and
+families....  Utter confusion exists among the historians of this
+animal" (sperm whale), says Surgeon Beale, A.D. 1839.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 6</DOCNO>
+"Unfitness to pursue our research in the unfathomable waters."
+"Impenetrable veil covering our knowledge of the cetacea."  "A field
+strewn with thorns."  "All these incomplete indications but serve to
+torture us naturalists."
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 7</DOCNO>
+Thus speak of the whale, the great Cuvier, and John Hunter, and
+Lesson, those lights of zoology and anatomy.  Nevertheless, though of
+real knowledge there be little, yet of books there are a plenty; and
+so in some small degree, with cetology, or the science of whales.
+Many are the men, small and great, old and new, landsmen and seamen,
+who have at large or in little, written of the whale.  Run over a
+few:--The Authors of the Bible; Aristotle; Pliny; Aldrovandi; Sir
+Thomas Browne; Gesner; Ray; Linnaeus; Rondeletius; Willoughby; Green;
+Artedi; Sibbald; Brisson; Marten; Lacepede; Bonneterre; Desmarest;
+Baron Cuvier; Frederick Cuvier; John Hunter; Owen; Scoresby; Beale;
+Bennett; J.  Ross Browne; the Author of Miriam Coffin; Olmstead; and
+the Rev.  T.  Cheever.  But to what ultimate generalizing purpose all
+these have written, the above cited extracts will show.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 8</DOCNO>
+Of the names in this list of whale authors, only those following Owen
+ever saw living whales; and but one of them was a real professional
+harpooneer and whaleman.  I mean Captain Scoresby.  On the separate
+subject of the Greenland or right-whale, he is the best existing
+authority.  But Scoresby knew nothing and says nothing of the great
+sperm whale, compared with which the Greenland whale is almost
+unworthy mentioning.  And here be it said, that the Greenland whale
+is an usurper upon the throne of the seas.  He is not even by any
+means the largest of the whales.  Yet, owing to the long priority of
+his claims, and the profound ignorance which, till some seventy years
+back, invested the then fabulous or utterly unknown sperm-whale, and
+which ignorance to this present day still reigns in all but some few
+scientific retreats and whale-ports; this usurpation has been every
+way complete.  Reference to nearly all the leviathanic allusions in
+the great poets of past days, will satisfy you that the Greenland
+whale, without one rival, was to them the monarch of the seas.  But
+the time has at last come for a new proclamation.  This is Charing
+Cross; hear ye! good people all,--the Greenland whale is
+deposed,--the great sperm whale now reigneth!
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 9</DOCNO>
+There are only two books in being which at all pretend to put the
+living sperm whale before you, and at the same time, in the remotest
+degree succeed in the attempt.  Those books are Beale's and
+Bennett's; both in their time surgeons to English South-Sea
+whale-ships, and both exact and reliable men.  The original matter
+touching the sperm whale to be found in their volumes is necessarily
+small; but so far as it goes, it is of excellent quality, though
+mostly confined to scientific description.  As yet, however, the
+sperm whale, scientific or poetic, lives not complete in any
+literature.  Far above all other hunted whales, his is an unwritten
+life.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 10</DOCNO>
+Now the various species of whales need some sort of popular
+comprehensive classification, if only an easy outline one for the
+present, hereafter to be filled in all its departments by subsequent
+laborers.  As no better man advances to take this matter in hand, I
+hereupon offer my own poor endeavors.  I promise nothing complete;
+because any human thing supposed to be complete, must for that very
+reason infallibly be faulty.  I shall not pretend to a minute
+anatomical description of the various species, or--in this place at
+least--to much of any description.  My object here is simply to
+project the draught of a systematization of cetology.  I am the
+architect, not the builder.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 11</DOCNO>
+But it is a ponderous task; no ordinary letter-sorter in the
+Post-Office is equal to it.  To grope down into the bottom of the sea
+after them; to have one's hands among the unspeakable foundations,
+ribs, and very pelvis of the world; this is a fearful thing.  What am
+I that I should essay to hook the nose of this leviathan!  The awful
+tauntings in Job might well appal me.  "Will he the (leviathan) make
+a covenant with thee?  Behold the hope of him is vain!  But I have
+swam through libraries and sailed through oceans; I have had to do
+with whales with these visible hands; I am in earnest; and I will
+try.  There are some preliminaries to settle.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 12</DOCNO>
+First: The uncertain, unsettled condition of this science of Cetology
+is in the very vestibule attested by the fact, that in some quarters
+it still remains a moot point whether a whale be a fish.  In his
+System of Nature, A.D. 1776, Linnaeus declares, "I hereby separate
+the whales from the fish."  But of my own knowledge, I know that down
+to the year 1850, sharks and shad, alewives and herring, against
+Linnaeus's express edict, were still found dividing the possession of
+the same seas with the Leviathan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 13</DOCNO>
+The grounds upon which Linnaeus would fain have banished the whales
+from the waters, he states as follows: "On account of their warm
+bilocular heart, their lungs, their movable eyelids, their hollow
+ears, penem intrantem feminam mammis lactantem," and finally, "ex
+lege naturae jure meritoque."  I submitted all this to my friends
+Simeon Macey and Charley Coffin, of Nantucket, both messmates of mine
+in a certain voyage, and they united in the opinion that the reasons
+set forth were altogether insufficient.  Charley profanely hinted
+they were humbug.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 14</DOCNO>
+Be it known that, waiving all argument, I take the good old fashioned
+ground that the whale is a fish, and call upon holy Jonah to back me.
+This fundamental thing settled, the next point is, in what internal
+respect does the whale differ from other fish.  Above, Linnaeus has
+given you those items.  But in brief, they are these: lungs and warm
+blood; whereas, all other fish are lungless and cold blooded.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 15</DOCNO>
+Next: how shall we define the whale, by his obvious externals, so as
+conspicuously to label him for all time to come?  To be short, then,
+a whale is A SPOUTING FISH WITH A HORIZONTAL TAIL.  There you have
+him.  However contracted, that definition is the result of expanded
+meditation.  A walrus spouts much like a whale, but the walrus is not
+a fish, because he is amphibious.  But the last term of the
+definition is still more cogent, as coupled with the first.  Almost
+any one must have noticed that all the fish familiar to landsmen have
+not a flat, but a vertical, or up-and-down tail.  Whereas, among
+spouting fish the tail, though it may be similarly shaped, invariably
+assumes a horizontal position.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 16</DOCNO>
+By the above definition of what a whale is, I do by no means exclude
+from the leviathanic brotherhood any sea creature hitherto identified
+with the whale by the best informed Nantucketers; nor, on the other
+hand, link with it any fish hitherto authoritatively regarded as
+alien.*  Hence, all the smaller, spouting, and horizontal tailed fish
+must be included in this ground-plan of Cetology.  Now, then, come
+the grand divisions of the entire whale host.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 17</DOCNO>
+*I am aware that down to the present time, the fish styled Lamatins
+and Dugongs (Pig-fish and Sow-fish of the Coffins of Nantucket) are
+included by many naturalists among the whales.  But as these pig-fish
+are a noisy, contemptible set, mostly lurking in the mouths of
+rivers, and feeding on wet hay, and especially as they do not spout,
+I deny their credentials as whales; and have presented them with
+their passports to quit the Kingdom of Cetology.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 18</DOCNO>
+First: According to magnitude I divide the whales into three primary
+BOOKS (subdivisible into CHAPTERS), and these shall comprehend them
+all, both small and large.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 19</DOCNO>
+I. THE FOLIO WHALE; II. the OCTAVO WHALE; III. the DUODECIMO WHALE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 20</DOCNO>
+As the type of the FOLIO I present the SPERM WHALE; of the OCTAVO,
+the GRAMPUS; of the DUODECIMO, the PORPOISE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 21</DOCNO>
+FOLIOS.  Among these I here include the following chapters:--I. The
+SPERM WHALE; II. the RIGHT WHALE; III. the FIN-BACK WHALE; IV. the
+HUMP-BACKED WHALE; V. the RAZOR-BACK WHALE; VI. the SULPHUR-BOTTOM
+WHALE.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 22</DOCNO>
+BOOK I. (FOLIO), CHAPTER I. (SPERM WHALE).--This whale, among the
+English of old vaguely known as the Trumpa whale, and the Physeter
+whale, and the Anvil Headed whale, is the present Cachalot of the
+French, and the Pottsfich of the Germans, and the Macrocephalus of
+the Long Words.  He is, without doubt, the largest inhabitant of the
+globe; the most formidable of all whales to encounter; the most
+majestic in aspect; and lastly, by far the most valuable in commerce;
+he being the only creature from which that valuable substance,
+spermaceti, is obtained.  All his peculiarities will, in many other
+places, be enlarged upon.  It is chiefly with his name that I now
+have to do.  Philologically considered, it is absurd.  Some centuries
+ago, when the Sperm whale was almost wholly unknown in his own
+proper individuality, and when his oil was only accidentally obtained
+from the stranded fish; in those days spermaceti, it would seem, was
+popularly supposed to be derived from a creature identical with the
+one then known in England as the Greenland or Right Whale.  It was
+the idea also, that this same spermaceti was that quickening humor of
+the Greenland Whale which the first syllable of the word literally
+expresses.  In those times, also, spermaceti was exceedingly scarce,
+not being used for light, but only as an ointment and medicament.  It
+was only to be had from the druggists as you nowadays buy an ounce of
+rhubarb.  When, as I opine, in the course of time, the true nature of
+spermaceti became known, its original name was still retained by the
+dealers; no doubt to enhance its value by a notion so strangely
+significant of its scarcity.  And so the appellation must at last
+have come to be bestowed upon the whale from which this spermaceti
+was really derived.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 23</DOCNO>
+BOOK I. (FOLIO), CHAPTER II. (RIGHT WHALE).--In one respect this is
+the most venerable of the leviathans, being the one first regularly
+hunted by man.  It yields the article commonly known as whalebone or
+baleen; and the oil specially known as "whale oil," an inferior
+article in commerce.  Among the fishermen, he is indiscriminately
+designated by all the following titles: The Whale; the Greenland
+Whale; the Black Whale; the Great Whale; the True Whale; the Right
+Whale.  There is a deal of obscurity concerning the identity of the
+species thus multitudinously baptised.  What then is the whale, which
+I include in the second species of my Folios?  It is the Great
+Mysticetus of the English naturalists; the Greenland Whale of the
+English whalemen; the Baliene Ordinaire of the French whalemen; the
+Growlands Walfish of the Swedes.  It is the whale which for more than
+two centuries past has been hunted by the Dutch and English in the
+Arctic seas; it is the whale which the American fishermen have long
+pursued in the Indian ocean, on the Brazil Banks, on the Nor' West
+Coast, and various other parts of the world, designated by them Right
+Whale Cruising Grounds.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 24</DOCNO>
+Some pretend to see a difference between the Greenland whale of the
+English and the right whale of the Americans.  But they precisely
+agree in all their grand features; nor has there yet been presented a
+single determinate fact upon which to ground a radical distinction.
+It is by endless subdivisions based upon the most inconclusive
+differences, that some departments of natural history become so
+repellingly intricate.  The right whale will be elsewhere treated of
+at some length, with reference to elucidating the sperm whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 25</DOCNO>
+BOOK I. (FOLIO), CHAPTER III. (FIN-BACK).--Under this head I reckon a
+monster which, by the various names of Fin-Back, Tall-Spout, and
+Long-John, has been seen almost in every sea and is commonly the
+whale whose distant jet is so often descried by passengers crossing
+the Atlantic, in the New York packet-tracks.  In the length he
+attains, and in his baleen, the Fin-back resembles the right whale,
+but is of a less portly girth, and a lighter colour, approaching to
+olive.  His great lips present a cable-like aspect, formed by the
+intertwisting, slanting folds of large wrinkles.  His grand
+distinguishing feature, the fin, from which he derives his name, is
+often a conspicuous object.  This fin is some three or four feet
+long, growing vertically from the hinder part of the back, of an
+angular shape, and with a very sharp pointed end.  Even if not the
+slightest other part of the creature be visible, this isolated fin
+will, at times, be seen plainly projecting from the surface.  When
+the sea is moderately calm, and slightly marked with spherical
+ripples, and this gnomon-like fin stands up and casts shadows upon
+the wrinkled surface, it may well be supposed that the watery circle
+surrounding it somewhat resembles a dial, with its style and wavy
+hour-lines graved on it.  On that Ahaz-dial the shadow often goes
+back.  The Fin-Back is not gregarious.  He seems a whale-hater, as
+some men are man-haters.  Very shy; always going solitary;
+unexpectedly rising to the surface in the remotest and most sullen
+waters; his straight and single lofty jet rising like a tall
+misanthropic spear upon a barren plain; gifted with such wondrous
+power and velocity in swimming, as to defy all present pursuit from
+man; this leviathan seems the banished and unconquerable Cain of his
+race, bearing for his mark that style upon his back.  From having the
+baleen in his mouth, the Fin-Back is sometimes included with the
+right whale, among a theoretic species denominated WHALEBONE WHALES,
+that is, whales with baleen.  Of these so called Whalebone whales,
+there would seem to be several varieties, most of which, however, are
+little known.  Broad-nosed whales and beaked whales; pike-headed
+whales; bunched whales; under-jawed whales and rostrated whales, are
+the fishermen's names for a few sorts.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 26</DOCNO>
+In connection with this appellative of "Whalebone whales," it is of
+great importance to mention, that however such a nomenclature may be
+convenient in facilitating allusions to some kind of whales, yet it
+is in vain to attempt a clear classification of the Leviathan,
+founded upon either his baleen, or hump, or fin, or teeth;
+notwithstanding that those marked parts or features very obviously
+seem better adapted to afford the basis for a regular system of
+Cetology than any other detached bodily distinctions, which the
+whale, in his kinds, presents.  How then?  The baleen, hump,
+back-fin, and teeth; these are things whose peculiarities are
+indiscriminately dispersed among all sorts of whales, without any
+regard to what may be the nature of their structure in other and
+more essential particulars.  Thus, the sperm whale and the humpbacked
+whale, each has a hump; but there the similitude ceases.  Then, this
+same humpbacked whale and the Greenland whale, each of these has
+baleen; but there again the similitude ceases.  And it is just the
+same with the other parts above mentioned.  In various sorts of
+whales, they form such irregular combinations; or, in the case of any
+one of them detached, such an irregular isolation; as utterly to defy
+all general methodization formed upon such a basis.  On this rock
+every one of the whale-naturalists has split.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 27</DOCNO>
+But it may possibly be conceived that, in the internal parts of the
+whale, in his anatomy--there, at least, we shall be able to hit the
+right classification.  Nay; what thing, for example, is there in the
+Greenland whale's anatomy more striking than his baleen?  Yet we have
+seen that by his baleen it is impossible correctly to classify the
+Greenland whale.  And if you descend into the bowels of the various
+leviathans, why there you will not find distinctions a fiftieth part
+as available to the systematizer as those external ones already
+enumerated.  What then remains? nothing but to take hold of the
+whales bodily, in their entire liberal volume, and boldly sort them
+that way.  And this is the Bibliographical system here adopted; and
+it is the only one that can possibly succeed, for it alone is
+practicable.  To proceed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 28</DOCNO>
+BOOK I. (FOLIO) CHAPTER IV. (HUMP-BACK).--This whale is often seen on
+the northern American coast.  He has been frequently captured there,
+and towed into harbor.  He has a great pack on him like a peddler; or
+you might call him the Elephant and Castle whale.  At any rate, the
+popular name for him does not sufficiently distinguish him, since the
+sperm whale also has a hump though a smaller one.  His oil is not
+very valuable.  He has baleen.  He is the most gamesome and
+light-hearted of all the whales, making more gay foam and white water
+generally than any other of them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 29</DOCNO>
+BOOK I. (FOLIO), CHAPTER V. (RAZOR-BACK).--Of this whale little is
+known but his name.  I have seen him at a distance off Cape Horn.  Of
+a retiring nature, he eludes both hunters and philosophers.  Though
+no coward, he has never yet shown any part of him but his back, which
+rises in a long sharp ridge.  Let him go.  I know little more of him,
+nor does anybody else.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 30</DOCNO>
+BOOK I. (FOLIO), CHAPTER VI. (SULPHUR-BOTTOM).--Another retiring
+gentleman, with a brimstone belly, doubtless got by scraping along
+the Tartarian tiles in some of his profounder divings.  He is seldom
+seen; at least I have never seen him except in the remoter southern
+seas, and then always at too great a distance to study his
+countenance.  He is never chased; he would run away with rope-walks
+of line.  Prodigies are told of him.  Adieu, Sulphur Bottom!  I can
+say nothing more that is true of ye, nor can the oldest Nantucketer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 31</DOCNO>
+Thus ends BOOK I. (FOLIO), and now begins BOOK II. (OCTAVO).
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 32</DOCNO>
+OCTAVOES.*--These embrace the whales of middling magnitude, among
+which present may be numbered:--I., the GRAMPUS; II., the BLACK FISH;
+III., the NARWHALE; IV., the THRASHER; V., the KILLER.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 33</DOCNO>
+*Why this book of whales is not denominated the Quarto is very plain.
+Because, while the whales of this order, though smaller than those
+of the former order, nevertheless retain a proportionate likeness to
+them in figure, yet the bookbinder's Quarto volume in its dimensioned
+form does not preserve the shape of the Folio volume, but the Octavo
+volume does.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 34</DOCNO>
+BOOK II. (OCTAVO), CHAPTER I. (GRAMPUS).--Though this fish, whose
+loud sonorous breathing, or rather blowing, has furnished a proverb
+to landsmen, is so well known a denizen of the deep, yet is he not
+popularly classed among whales.  But possessing all the grand
+distinctive features of the leviathan, most naturalists have
+recognised him for one.  He is of moderate octavo size, varying from
+fifteen to twenty-five feet in length, and of corresponding
+dimensions round the waist.  He swims in herds; he is never regularly
+hunted, though his oil is considerable in quantity, and pretty good
+for light.  By some fishermen his approach is regarded as premonitory
+of the advance of the great sperm whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 35</DOCNO>
+BOOK II. (OCTAVO), CHAPTER II. (BLACK FISH).--I give the popular
+fishermen's names for all these fish, for generally they are the
+best.  Where any name happens to be vague or inexpressive, I shall
+say so, and suggest another.  I do so now, touching the Black Fish,
+so-called, because blackness is the rule among almost all whales.
+So, call him the Hyena Whale, if you please.  His voracity is well
+known, and from the circumstance that the inner angles of his lips
+are curved upwards, he carries an everlasting Mephistophelean grin on
+his face.  This whale averages some sixteen or eighteen feet in
+length.  He is found in almost all latitudes.  He has a peculiar way
+of showing his dorsal hooked fin in swimming, which looks something
+like a Roman nose.  When not more profitably employed, the sperm
+whale hunters sometimes capture the Hyena whale, to keep up the
+supply of cheap oil for domestic employment--as some frugal
+housekeepers, in the absence of company, and quite alone by
+themselves, burn unsavory tallow instead of odorous wax.  Though
+their blubber is very thin, some of these whales will yield you
+upwards of thirty gallons of oil.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 36</DOCNO>
+BOOK II. (OCTAVO), CHAPTER III. (NARWHALE), that is, NOSTRIL
+WHALE.--Another instance of a curiously named whale, so named I
+suppose from his peculiar horn being originally mistaken for a peaked
+nose.  The creature is some sixteen feet in length, while its horn
+averages five feet, though some exceed ten, and even attain to
+fifteen feet.  Strictly speaking, this horn is but a lengthened tusk,
+growing out from the jaw in a line a little depressed from the
+horizontal.  But it is only found on the sinister side, which has an
+ill effect, giving its owner something analogous to the aspect of a
+clumsy left-handed man.  What precise purpose this ivory horn or
+lance answers, it would be hard to say.  It does not seem to be used
+like the blade of the sword-fish and bill-fish; though some sailors
+tell me that the Narwhale employs it for a rake in turning over the
+bottom of the sea for food.  Charley Coffin said it was used for an
+ice-piercer; for the Narwhale, rising to the surface of the Polar
+Sea, and finding it sheeted with ice, thrusts his horn up, and so
+breaks through.  But you cannot prove either of these surmises to be
+correct.  My own opinion is, that however this one-sided horn may
+really be used by the Narwhale--however that may be--it would
+certainly be very convenient to him for a folder in reading
+pamphlets.  The Narwhale I have heard called the Tusked whale, the
+Horned whale, and the Unicorn whale.  He is certainly a curious
+example of the Unicornism to be found in almost every kingdom of
+animated nature.  From certain cloistered old authors I have gathered
+that this same sea-unicorn's horn was in ancient days regarded as the
+great antidote against poison, and as such, preparations of it
+brought immense prices.  It was also distilled to a volatile salts
+for fainting ladies, the same way that the horns of the male deer are
+manufactured into hartshorn.  Originally it was in itself accounted
+an object of great curiosity.  Black Letter tells me that Sir Martin
+Frobisher on his return from that voyage, when Queen Bess did
+gallantly wave her jewelled hand to him from a window of Greenwich
+Palace, as his bold ship sailed down the Thames; "when Sir Martin
+returned from that voyage," saith Black Letter, "on bended knees he
+presented to her highness a prodigious long horn of the Narwhale,
+which for a long period after hung in the castle at Windsor."  An
+Irish author avers that the Earl of Leicester, on bended knees, did
+likewise present to her highness another horn, pertaining to a land
+beast of the unicorn nature.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 37</DOCNO>
+The Narwhale has a very picturesque, leopard-like look, being of a
+milk-white ground colour, dotted with round and oblong spots of black.
+His oil is very superior, clear and fine; but there is little of it,
+and he is seldom hunted.  He is mostly found in the circumpolar seas.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 38</DOCNO>
+BOOK II. (OCTAVO), CHAPTER IV. (KILLER).--Of this whale little is
+precisely known to the Nantucketer, and nothing at all to the
+professed naturalist.  From what I have seen of him at a distance,
+I should say that he was about the bigness of a grampus.  He is very
+savage--a sort of Feegee fish.  He sometimes takes the great Folio
+whales by the lip, and hangs there like a leech, till the mighty
+brute is worried to death.  The Killer is never hunted.  I never
+heard what sort of oil he has.  Exception might be taken to the name
+bestowed upon this whale, on the ground of its indistinctness.  For
+we are all killers, on land and on sea; Bonapartes and Sharks
+included.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 39</DOCNO>
+BOOK II. (OCTAVO), CHAPTER V. (THRASHER).--This gentleman is famous
+for his tail, which he uses for a ferule in thrashing his foes.  He
+mounts the Folio whale's back, and as he swims, he works his passage
+by flogging him; as some schoolmasters get along in the world by a
+similar process.  Still less is known of the Thrasher than of the
+Killer.  Both are outlaws, even in the lawless seas.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 40</DOCNO>
+Thus ends BOOK II. (OCTAVO), and begins BOOK III. (DUODECIMO).
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 41</DOCNO>
+DUODECIMOES.--These include the smaller whales.  I. The Huzza
+Porpoise.  II. The Algerine Porpoise.  III. The Mealy-mouthed
+Porpoise.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 42</DOCNO>
+To those who have not chanced specially to study the subject, it may
+possibly seem strange, that fishes not commonly exceeding four or
+five feet should be marshalled among WHALES--a word, which, in the
+popular sense, always conveys an idea of hugeness.  But the creatures
+set down above as Duodecimoes are infallibly whales, by the terms of
+my definition of what a whale is--i.e. a spouting fish, with a
+horizontal tail.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 43</DOCNO>
+BOOK III. (DUODECIMO), CHAPTER 1. (HUZZA PORPOISE).--This is the
+common porpoise found almost all over the globe.  The name is of my
+own bestowal; for there are more than one sort of porpoises, and
+something must be done to distinguish them.  I call him thus, because
+he always swims in hilarious shoals, which upon the broad sea keep
+tossing themselves to heaven like caps in a Fourth-of-July crowd.
+Their appearance is generally hailed with delight by the mariner.
+Full of fine spirits, they invariably come from the breezy billows to
+windward.  They are the lads that always live before the wind.  They
+are accounted a lucky omen.  If you yourself can withstand three
+cheers at beholding these vivacious fish, then heaven help ye; the
+spirit of godly gamesomeness is not in ye.  A well-fed, plump Huzza
+Porpoise will yield you one good gallon of good oil.  But the fine
+and delicate fluid extracted from his jaws is exceedingly valuable.
+It is in request among jewellers and watchmakers.  Sailors put it on
+their hones.  Porpoise meat is good eating, you know.  It may never
+have occurred to you that a porpoise spouts.  Indeed, his spout is so
+small that it is not very readily discernible.  But the next time you
+have a chance, watch him; and you will then see the great Sperm whale
+himself in miniature.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 44</DOCNO>
+BOOK III. (DUODECIMO), CHAPTER II. (ALGERINE PORPOISE).--A pirate.
+Very savage.  He is only found, I think, in the Pacific.  He is
+somewhat larger than the Huzza Porpoise, but much of the same general
+make.  Provoke him, and he will buckle to a shark.  I have lowered
+for him many times, but never yet saw him captured.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 45</DOCNO>
+BOOK III. (DUODECIMO), CHAPTER III. (MEALY-MOUTHED PORPOISE).--The
+largest kind of Porpoise; and only found in the Pacific, so far as it
+is known.  The only English name, by which he has hitherto been
+designated, is that of the fishers--Right-Whale Porpoise, from the
+circumstance that he is chiefly found in the vicinity of that Folio.
+In shape, he differs in some degree from the Huzza Porpoise, being of
+a less rotund and jolly girth; indeed, he is of quite a neat and
+gentleman-like figure.  He has no fins on his back (most other
+porpoises have), he has a lovely tail, and sentimental Indian eyes of
+a hazel hue.  But his mealy-mouth spoils all.  Though his entire
+back down to his side fins is of a deep sable, yet a boundary line,
+distinct as the mark in a ship's hull, called the "bright waist,"
+that line streaks him from stem to stern, with two separate colours,
+black above and white below.  The white comprises part of his head,
+and the whole of his mouth, which makes him look as if he had just
+escaped from a felonious visit to a meal-bag.  A most mean and mealy
+aspect!  His oil is much like that of the common porpoise.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 46</DOCNO>
+Beyond the DUODECIMO, this system does not proceed, inasmuch as the
+Porpoise is the smallest of the whales.  Above, you have all the
+Leviathans of note.  But there are a rabble of uncertain, fugitive,
+half-fabulous whales, which, as an American whaleman, I know by
+reputation, but not personally.  I shall enumerate them by their
+fore-castle appellations; for possibly such a list may be valuable to
+future investigators, who may complete what I have here but begun.
+If any of the following whales, shall hereafter be caught and marked,
+then he can readily be incorporated into this System, according to
+his Folio, Octavo, or Duodecimo magnitude:--The Bottle-Nose Whale;
+the Junk Whale; the Pudding-Headed Whale; the Cape Whale; the Leading
+Whale; the Cannon Whale; the Scragg Whale; the Coppered Whale; the
+Elephant Whale; the Iceberg Whale; the Quog Whale; the Blue Whale; etc.
+>From Icelandic, Dutch, and old English authorities, there might
+be quoted other lists of uncertain whales, blessed with all manner of
+uncouth names.  But I omit them as altogether obsolete; and can
+hardly help suspecting them for mere sounds, full of Leviathanism,
+but signifying nothing.
+</DOC>
+<DOC>
+<DOCNO>Chapter 32, Paragraph 47</DOCNO>
+Finally: It was stated at the outset, that this system would not be
+here, and at once, perfected.  You cannot but plainly see that I have
+kept my word.  But I now leave my cetological System standing thus
+unfinished, even as the great Cathedral of Cologne was left, with the
+crane still standing upon the top of the uncompleted tower.  For
+small erections may be finished by their first architects; grand
+ones, true ones, ever leave the copestone to posterity.  God keep me
+from ever completing anything.  This whole book is but a
+draught--nay, but the draught of a draught.  Oh, Time, Strength,
+Cash, and Patience!
+</DOC>
+<DOC>
+<DOCNO>Chapter 33, Paragraph 1</DOCNO>
+The Specksynder.
+</DOC>
+<DOC>
+<DOCNO>Chapter 33, Paragraph 2</DOCNO>
+Concerning the officers of the whale-craft, this seems as good a
+place as any to set down a little domestic peculiarity on ship-board,
+arising from the existence of the harpooneer class of officers, a
+class unknown of course in any other marine than the whale-fleet.
+</DOC>
+<DOC>
+<DOCNO>Chapter 33, Paragraph 3</DOCNO>
+The large importance attached to the harpooneer's vocation is evinced
+by the fact, that originally in the old Dutch Fishery, two centuries
+and more ago, the command of a whale ship was not wholly lodged in
+the person now called the captain, but was divided between him and an
+officer called the Specksynder.  Literally this word means
+Fat-Cutter; usage, however, in time made it equivalent to Chief
+Harpooneer.  In those days, the captain's authority was restricted to
+the navigation and general management of the vessel; while over the
+whale-hunting department and all its concerns, the Specksynder or
+Chief Harpooneer reigned supreme.  In the British Greenland Fishery,
+under the corrupted title of Specksioneer, this old Dutch official is
+still retained, but his former dignity is sadly abridged.  At present
+he ranks simply as senior Harpooneer; and as such, is but one of the
+captain's more inferior subalterns.  Nevertheless, as upon the good
+conduct of the harpooneers the success of a whaling voyage largely
+depends, and since in the American Fishery he is not only an
+important officer in the boat, but under certain circumstances (night
+watches on a whaling ground) the command of the ship's deck is also
+his; therefore the grand political maxim of the sea demands, that he
+should nominally live apart from the men before the mast, and be in
+some way distinguished as their professional superior; though always,
+by them, familiarly regarded as their social equal.
+</DOC>
+<DOC>
+<DOCNO>Chapter 33, Paragraph 4</DOCNO>
+Now, the grand distinction drawn between officer and man at sea, is
+this--the first lives aft, the last forward.  Hence, in whale-ships
+and merchantmen alike, the mates have their quarters with the
+captain; and so, too, in most of the American whalers the harpooneers
+are lodged in the after part of the ship.  That is to say, they take
+their meals in the captain's cabin, and sleep in a place indirectly
+communicating with it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 33, Paragraph 5</DOCNO>
+Though the long period of a Southern whaling voyage (by far the
+longest of all voyages now or ever made by man), the peculiar perils
+of it, and the community of interest prevailing among a company, all
+of whom, high or low, depend for their profits, not upon fixed wages,
+but upon their common luck, together with their common vigilance,
+intrepidity, and hard work; though all these things do in some cases
+tend to beget a less rigorous discipline than in merchantmen
+generally; yet, never mind how much like an old Mesopotamian family
+these whalemen may, in some primitive instances, live together; for
+all that, the punctilious externals, at least, of the quarter-deck
+are seldom materially relaxed, and in no instance done away.  Indeed,
+many are the Nantucket ships in which you will see the skipper
+parading his quarter-deck with an elated grandeur not surpassed in
+any military navy; nay, extorting almost as much outward homage as if
+he wore the imperial purple, and not the shabbiest of pilot-cloth.
+</DOC>
+<DOC>
+<DOCNO>Chapter 33, Paragraph 6</DOCNO>
+And though of all men the moody captain of the Pequod was the least
+given to that sort of shallowest assumption; and though the only
+homage he ever exacted, was implicit, instantaneous obedience; though
+he required no man to remove the shoes from his feet ere stepping
+upon the quarter-deck; and though there were times when, owing to
+peculiar circumstances connected with events hereafter to be
+detailed, he addressed them in unusual terms, whether of
+condescension or IN TERROREM, or otherwise; yet even Captain Ahab was
+by no means unobservant of the paramount forms and usages of the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 33, Paragraph 7</DOCNO>
+Nor, perhaps, will it fail to be eventually perceived, that behind
+those forms and usages, as it were, he sometimes masked himself;
+incidentally making use of them for other and more private ends than
+they were legitimately intended to subserve.  That certain sultanism
+of his brain, which had otherwise in a good degree remained
+unmanifested; through those forms that same sultanism became
+incarnate in an irresistible dictatorship.  For be a man's
+intellectual superiority what it will, it can never assume the
+practical, available supremacy over other men, without the aid of
+some sort of external arts and entrenchments, always, in themselves,
+more or less paltry and base.  This it is, that for ever keeps God's
+true princes of the Empire from the world's hustings; and leaves the
+highest honours that this air can give, to those men who become famous
+more through their infinite inferiority to the choice hidden handful
+of the Divine Inert, than through their undoubted superiority over
+the dead level of the mass.  Such large virtue lurks in these small
+things when extreme political superstitions invest them, that in some
+royal instances even to idiot imbecility they have imparted potency.
+But when, as in the case of Nicholas the Czar, the ringed crown of
+geographical empire encircles an imperial brain; then, the plebeian
+herds crouch abased before the tremendous centralization.  Nor, will
+the tragic dramatist who would depict mortal indomitableness in its
+fullest sweep and direct swing, ever forget a hint, incidentally so
+important in his art, as the one now alluded to.
+</DOC>
+<DOC>
+<DOCNO>Chapter 33, Paragraph 8</DOCNO>
+But Ahab, my Captain, still moves before me in all his Nantucket
+grimness and shagginess; and in this episode touching Emperors and
+Kings, I must not conceal that I have only to do with a poor old
+whale-hunter like him; and, therefore, all outward majestical
+trappings and housings are denied me.  Oh, Ahab! what shall be grand
+in thee, it must needs be plucked at from the skies, and dived for in
+the deep, and featured in the unbodied air!
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 1</DOCNO>
+The Cabin-Table.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 2</DOCNO>
+It is noon; and Dough-Boy, the steward, thrusting his pale
+loaf-of-bread face from the cabin-scuttle, announces dinner to his
+lord and master; who, sitting in the lee quarter-boat, has just been
+taking an observation of the sun; and is now mutely reckoning the
+latitude on the smooth, medallion-shaped tablet, reserved for that
+daily purpose on the upper part of his ivory leg.  From his complete
+inattention to the tidings, you would think that moody Ahab had not
+heard his menial.  But presently, catching hold of the mizen shrouds,
+he swings himself to the deck, and in an even, unexhilarated voice,
+saying, "Dinner, Mr. Starbuck," disappears into the cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 3</DOCNO>
+When the last echo of his sultan's step has died away, and Starbuck,
+the first Emir, has every reason to suppose that he is seated, then
+Starbuck rouses from his quietude, takes a few turns along the
+planks, and, after a grave peep into the binnacle, says, with some
+touch of pleasantness, "Dinner, Mr. Stubb," and descends the scuttle.
+The second Emir lounges about the rigging awhile, and then slightly
+shaking the main brace, to see whether it will be all right with
+that important rope, he likewise takes up the old burden, and with a
+rapid "Dinner, Mr. Flask," follows after his predecessors.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 4</DOCNO>
+But the third Emir, now seeing himself all alone on the quarter-deck,
+seems to feel relieved from some curious restraint; for, tipping all
+sorts of knowing winks in all sorts of directions, and kicking off
+his shoes, he strikes into a sharp but noiseless squall of a hornpipe
+right over the Grand Turk's head; and then, by a dexterous sleight,
+pitching his cap up into the mizentop for a shelf, he goes down
+rollicking so far at least as he remains visible from the deck,
+reversing all other processions, by bringing up the rear with music.
+But ere stepping into the cabin doorway below, he pauses, ships a new
+face altogether, and, then, independent, hilarious little Flask
+enters King Ahab's presence, in the character of Abjectus, or the
+Slave.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 5</DOCNO>
+It is not the least among the strange things bred by the intense
+artificialness of sea-usages, that while in the open air of the deck
+some officers will, upon provocation, bear themselves boldly and
+defyingly enough towards their commander; yet, ten to one, let those
+very officers the next moment go down to their customary dinner in
+that same commander's cabin, and straightway their inoffensive, not
+to say deprecatory and humble air towards him, as he sits at the head
+of the table; this is marvellous, sometimes most comical.  Wherefore
+this difference?  A problem?  Perhaps not.  To have been Belshazzar,
+King of Babylon; and to have been Belshazzar, not haughtily but
+courteously, therein certainly must have been some touch of mundane
+grandeur.  But he who in the rightly regal and intelligent spirit
+presides over his own private dinner-table of invited guests, that
+man's unchallenged power and dominion of individual influence for the
+time; that man's royalty of state transcends Belshazzar's, for
+Belshazzar was not the greatest.  Who has but once dined his friends,
+has tasted what it is to be Caesar.  It is a witchery of social
+czarship which there is no withstanding.  Now, if to this
+consideration you superadd the official supremacy of a ship-master,
+then, by inference, you will derive the cause of that peculiarity of
+sea-life just mentioned.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 6</DOCNO>
+Over his ivory-inlaid table, Ahab presided like a mute, maned
+sea-lion on the white coral beach, surrounded by his warlike but
+still deferential cubs.  In his own proper turn, each officer waited
+to be served.  They were as little children before Ahab; and yet, in
+Ahab, there seemed not to lurk the smallest social arrogance.  With
+one mind, their intent eyes all fastened upon the old man's knife, as
+he carved the chief dish before him.  I do not suppose that for the
+world they would have profaned that moment with the slightest
+observation, even upon so neutral a topic as the weather.  No!  And
+when reaching out his knife and fork, between which the slice of beef
+was locked, Ahab thereby motioned Starbuck's plate towards him, the
+mate received his meat as though receiving alms; and cut it tenderly;
+and a little started if, perchance, the knife grazed against the
+plate; and chewed it noiselessly; and swallowed it, not without
+circumspection.  For, like the Coronation banquet at Frankfort, where
+the German Emperor profoundly dines with the seven Imperial
+Electors, so these cabin meals were somehow solemn meals, eaten in
+awful silence; and yet at table old Ahab forbade not conversation;
+only he himself was dumb.  What a relief it was to choking Stubb,
+when a rat made a sudden racket in the hold below.  And poor little
+Flask, he was the youngest son, and little boy of this weary family
+party.  His were the shinbones of the saline beef; his would have
+been the drumsticks.  For Flask to have presumed to help himself,
+this must have seemed to him tantamount to larceny in the first
+degree.  Had he helped himself at that table, doubtless, never more
+would he have been able to hold his head up in this honest world;
+nevertheless, strange to say, Ahab never forbade him.  And had Flask
+helped himself, the chances were Ahab had never so much as noticed
+it.  Least of all, did Flask presume to help himself to butter.
+Whether he thought the owners of the ship denied it to him, on
+account of its clotting his clear, sunny complexion; or whether he
+deemed that, on so long a voyage in such marketless waters, butter
+was at a premium, and therefore was not for him, a subaltern; however
+it was, Flask, alas! was a butterless man!
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 7</DOCNO>
+Another thing.  Flask was the last person down at the dinner, and
+Flask is the first man up.  Consider!  For hereby Flask's dinner was
+badly jammed in point of time.  Starbuck and Stubb both had the start
+of him; and yet they also have the privilege of lounging in the rear.
+If Stubb even, who is but a peg higher than Flask, happens to have
+but a small appetite, and soon shows symptoms of concluding his
+repast, then Flask must bestir himself, he will not get more than
+three mouthfuls that day; for it is against holy usage for Stubb to
+precede Flask to the deck.  Therefore it was that Flask once admitted
+in private, that ever since he had arisen to the dignity of an
+officer, from that moment he had never known what it was to be
+otherwise than hungry, more or less.  For what he ate did not so much
+relieve his hunger, as keep it immortal in him.  Peace and
+satisfaction, thought Flask, have for ever departed from my stomach.
+I am an officer; but, how I wish I could fish a bit of old-fashioned
+beef in the forecastle, as I used to when I was before the mast.
+There's the fruits of promotion now; there's the vanity of glory:
+there's the insanity of life!  Besides, if it were so that any mere
+sailor of the Pequod had a grudge against Flask in Flask's official
+capacity, all that sailor had to do, in order to obtain ample
+vengeance, was to go aft at dinner-time, and get a peep at Flask
+through the cabin sky-light, sitting silly and dumfoundered before
+awful Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 8</DOCNO>
+Now, Ahab and his three mates formed what may be called the first
+table in the Pequod's cabin.  After their departure, taking place in
+inverted order to their arrival, the canvas cloth was cleared, or
+rather was restored to some hurried order by the pallid steward.  And
+then the three harpooneers were bidden to the feast, they being its
+residuary legatees.  They made a sort of temporary servants' hall of
+the high and mighty cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 9</DOCNO>
+In strange contrast to the hardly tolerable constraint and nameless
+invisible domineerings of the captain's table, was the entire
+care-free license and ease, the almost frantic democracy of those
+inferior fellows the harpooneers.  While their masters, the mates,
+seemed afraid of the sound of the hinges of their own jaws, the
+harpooneers chewed their food with such a relish that there was a
+report to it.  They dined like lords; they filled their bellies like
+Indian ships all day loading with spices.  Such portentous appetites
+had Queequeg and Tashtego, that to fill out the vacancies made by the
+previous repast, often the pale Dough-Boy was fain to bring on a
+great baron of salt-junk, seemingly quarried out of the solid ox.
+And if he were not lively about it, if he did not go with a nimble
+hop-skip-and-jump, then Tashtego had an ungentlemanly way of
+accelerating him by darting a fork at his back, harpoon-wise.  And
+once Daggoo, seized with a sudden humor, assisted Dough-Boy's memory
+by snatching him up bodily, and thrusting his head into a great empty
+wooden trencher, while Tashtego, knife in hand, began laying out the
+circle preliminary to scalping him.  He was naturally a very nervous,
+shuddering sort of little fellow, this bread-faced steward; the
+progeny of a bankrupt baker and a hospital nurse.  And what with the
+standing spectacle of the black terrific Ahab, and the periodical
+tumultuous visitations of these three savages, Dough-Boy's whole life
+was one continual lip-quiver.  Commonly, after seeing the harpooneers
+furnished with all things they demanded, he would escape from their
+clutches into his little pantry adjoining, and fearfully peep out at
+them through the blinds of its door, till all was over.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 10</DOCNO>
+It was a sight to see Queequeg seated over against Tashtego, opposing
+his filed teeth to the Indian's: crosswise to them, Daggoo seated on
+the floor, for a bench would have brought his hearse-plumed head to
+the low carlines; at every motion of his colossal limbs, making the
+low cabin framework to shake, as when an African elephant goes
+passenger in a ship.  But for all this, the great negro was
+wonderfully abstemious, not to say dainty.  It seemed hardly possible
+that by such comparatively small mouthfuls he could keep up the
+vitality diffused through so broad, baronial, and superb a person.
+But, doubtless, this noble savage fed strong and drank deep of the
+abounding element of air; and through his dilated nostrils snuffed in
+the sublime life of the worlds.  Not by beef or by bread, are giants
+made or nourished.  But Queequeg, he had a mortal, barbaric smack of
+the lip in eating--an ugly sound enough--so much so, that the
+trembling Dough-Boy almost looked to see whether any marks of teeth
+lurked in his own lean arms.  And when he would hear Tashtego singing
+out for him to produce himself, that his bones might be picked, the
+simple-witted steward all but shattered the crockery hanging round
+him in the pantry, by his sudden fits of the palsy.  Nor did the
+whetstone which the harpooneers carried in their pockets, for their
+lances and other weapons; and with which whetstones, at dinner, they
+would ostentatiously sharpen their knives; that grating sound did not
+at all tend to tranquillize poor Dough-Boy.  How could he forget that
+in his Island days, Queequeg, for one, must certainly have been
+guilty of some murderous, convivial indiscretions.  Alas!  Dough-Boy!
+hard fares the white waiter who waits upon cannibals.  Not a napkin
+should he carry on his arm, but a buckler.  In good time, though, to
+his great delight, the three salt-sea warriors would rise and depart;
+to his credulous, fable-mongering ears, all their martial bones
+jingling in them at every step, like Moorish scimetars in scabbards.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 11</DOCNO>
+But, though these barbarians dined in the cabin, and nominally lived
+there; still, being anything but sedentary in their habits, they were
+scarcely ever in it except at mealtimes, and just before
+sleeping-time, when they passed through it to their own peculiar
+quarters.
+</DOC>
+<DOC>
+<DOCNO>Chapter 34, Paragraph 12</DOCNO>
+In this one matter, Ahab seemed no exception to most American whale
+captains, who, as a set, rather incline to the opinion that by rights
+the ship's cabin belongs to them; and that it is by courtesy alone
+that anybody else is, at any time, permitted there.  So that, in real
+truth, the mates and harpooneers of the Pequod might more properly be
+said to have lived out of the cabin than in it.  For when they did
+enter it, it was something as a street-door enters a house; turning
+inwards for a moment, only to be turned out the next; and, as a
+permanent thing, residing in the open air.  Nor did they lose much
+hereby; in the cabin was no companionship; socially, Ahab was
+inaccessible.  Though nominally included in the census of
+Christendom, he was still an alien to it.  He lived in the world, as
+the last of the Grisly Bears lived in settled Missouri.  And as when
+Spring and Summer had departed, that wild Logan of the woods, burying
+himself in the hollow of a tree, lived out the winter there, sucking
+his own paws; so, in his inclement, howling old age, Ahab's soul,
+shut up in the caved trunk of his body, there fed upon the sullen
+paws of its gloom!
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 1</DOCNO>
+The Mast-Head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 2</DOCNO>
+It was during the more pleasant weather, that in due rotation with
+the other seamen my first mast-head came round.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 3</DOCNO>
+In most American whalemen the mast-heads are manned almost
+simultaneously with the vessel's leaving her port; even though she
+may have fifteen thousand miles, and more, to sail ere reaching her
+proper cruising ground.  And if, after a three, four, or five years'
+voyage she is drawing nigh home with anything empty in her--say, an
+empty vial even--then, her mast-heads are kept manned to the last;
+and not till her skysail-poles sail in among the spires of the port,
+does she altogether relinquish the hope of capturing one whale more.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 4</DOCNO>
+Now, as the business of standing mast-heads, ashore or afloat, is a
+very ancient and interesting one, let us in some measure expatiate
+here.  I take it, that the earliest standers of mast-heads were the
+old Egyptians; because, in all my researches, I find none prior to
+them.  For though their progenitors, the builders of Babel, must
+doubtless, by their tower, have intended to rear the loftiest
+mast-head in all Asia, or Africa either; yet (ere the final truck was
+put to it) as that great stone mast of theirs may be said to have
+gone by the board, in the dread gale of God's wrath; therefore, we
+cannot give these Babel builders priority over the Egyptians.  And
+that the Egyptians were a nation of mast-head standers, is an
+assertion based upon the general belief among archaeologists, that
+the first pyramids were founded for astronomical purposes: a theory
+singularly supported by the peculiar stair-like formation of all four
+sides of those edifices; whereby, with prodigious long upliftings of
+their legs, those old astronomers were wont to mount to the apex, and
+sing out for new stars; even as the look-outs of a modern ship sing
+out for a sail, or a whale just bearing in sight.  In Saint Stylites,
+the famous Christian hermit of old times, who built him a lofty stone
+pillar in the desert and spent the whole latter portion of his life
+on its summit, hoisting his food from the ground with a tackle; in
+him we have a remarkable instance of a dauntless
+stander-of-mast-heads; who was not to be driven from his place by
+fogs or frosts, rain, hail, or sleet; but valiantly facing everything
+out to the last, literally died at his post.  Of modern
+standers-of-mast-heads we have but a lifeless set; mere stone, iron,
+and bronze men; who, though well capable of facing out a stiff gale,
+are still entirely incompetent to the business of singing out upon
+discovering any strange sight.  There is Napoleon; who, upon the top
+of the column of Vendome, stands with arms folded, some one hundred
+and fifty feet in the air; careless, now, who rules the decks below;
+whether Louis Philippe, Louis Blanc, or Louis the Devil.  Great
+Washington, too, stands high aloft on his towering main-mast in
+Baltimore, and like one of Hercules' pillars, his column marks that
+point of human grandeur beyond which few mortals will go.  Admiral
+Nelson, also, on a capstan of gun-metal, stands his mast-head in
+Trafalgar Square; and ever when most obscured by that London smoke,
+token is yet given that a hidden hero is there; for where there is
+smoke, must be fire.  But neither great Washington, nor Napoleon, nor
+Nelson, will answer a single hail from below, however madly invoked
+to befriend by their counsels the distracted decks upon which they
+gaze; however it may be surmised, that their spirits penetrate
+through the thick haze of the future, and descry what shoals and what
+rocks must be shunned.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 5</DOCNO>
+It may seem unwarrantable to couple in any respect the mast-head
+standers of the land with those of the sea; but that in truth it is
+not so, is plainly evinced by an item for which Obed Macy, the sole
+historian of Nantucket, stands accountable.  The worthy Obed tells
+us, that in the early times of the whale fishery, ere ships were
+regularly launched in pursuit of the game, the people of that island
+erected lofty spars along the sea-coast, to which the look-outs
+ascended by means of nailed cleats, something as fowls go upstairs in
+a hen-house.  A few years ago this same plan was adopted by the Bay
+whalemen of New Zealand, who, upon descrying the game, gave notice to
+the ready-manned boats nigh the beach.  But this custom has now
+become obsolete; turn we then to the one proper mast-head, that of a
+whale-ship at sea.  The three mast-heads are kept manned from
+sun-rise to sun-set; the seamen taking their regular turns (as at the
+helm), and relieving each other every two hours.  In the serene
+weather of the tropics it is exceedingly pleasant the mast-head; nay,
+to a dreamy meditative man it is delightful.  There you stand, a
+hundred feet above the silent decks, striding along the deep, as if
+the masts were gigantic stilts, while beneath you and between your
+legs, as it were, swim the hugest monsters of the sea, even as ships
+once sailed between the boots of the famous Colossus at old Rhodes.
+There you stand, lost in the infinite series of the sea, with nothing
+ruffled but the waves.  The tranced ship indolently rolls; the drowsy
+trade winds blow; everything resolves you into languor.  For the most
+part, in this tropic whaling life, a sublime uneventfulness invests
+you; you hear no news; read no gazettes; extras with startling
+accounts of commonplaces never delude you into unnecessary
+excitements; you hear of no domestic afflictions; bankrupt
+securities; fall of stocks; are never troubled with the thought of
+what you shall have for dinner--for all your meals for three years
+and more are snugly stowed in casks, and your bill of fare is
+immutable.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 6</DOCNO>
+In one of those southern whalesmen, on a long three or four years'
+voyage, as often happens, the sum of the various hours you spend at
+the mast-head would amount to several entire months.  And it is much
+to be deplored that the place to which you devote so considerable a
+portion of the whole term of your natural life, should be so sadly
+destitute of anything approaching to a cosy inhabitiveness, or
+adapted to breed a comfortable localness of feeling, such as pertains
+to a bed, a hammock, a hearse, a sentry box, a pulpit, a coach, or
+any other of those small and snug contrivances in which men
+temporarily isolate themselves.  Your most usual point of perch is
+the head of the t' gallant-mast, where you stand upon two thin
+parallel sticks (almost peculiar to whalemen) called the t' gallant
+cross-trees.  Here, tossed about by the sea, the beginner feels about
+as cosy as he would standing on a bull's horns.  To be sure, in cold
+weather you may carry your house aloft with you, in the shape of a
+watch-coat; but properly speaking the thickest watch-coat is no more
+of a house than the unclad body; for as the soul is glued inside of
+its fleshy tabernacle, and cannot freely move about in it, nor even
+move out of it, without running great risk of perishing (like an
+ignorant pilgrim crossing the snowy Alps in winter); so a watch-coat
+is not so much of a house as it is a mere envelope, or additional
+skin encasing you.  You cannot put a shelf or chest of drawers in
+your body, and no more can you make a convenient closet of your
+watch-coat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 7</DOCNO>
+Concerning all this, it is much to be deplored that the mast-heads of
+a southern whale ship are unprovided with those enviable little tents
+or pulpits, called CROW'S-NESTS, in which the look-outs of a
+Greenland whaler are protected from the inclement weather of the
+frozen seas.  In the fireside narrative of Captain Sleet, entitled
+"A Voyage among the Icebergs, in quest of the Greenland Whale, and
+incidentally for the re-discovery of the Lost Icelandic Colonies of
+Old Greenland;" in this admirable volume, all standers of mast-heads
+are furnished with a charmingly circumstantial account of the then
+recently invented CROW'S-NEST of the Glacier, which was the name of
+Captain Sleet's good craft.  He called it the SLEET'S CROW'S-NEST, in
+honour of himself; he being the original inventor and patentee, and
+free from all ridiculous false delicacy, and holding that if we call
+our own children after our own names (we fathers being the original
+inventors and patentees), so likewise should we denominate after
+ourselves any other apparatus we may beget.  In shape, the Sleet's
+crow's-nest is something like a large tierce or pipe; it is open
+above, however, where it is furnished with a movable side-screen to
+keep to windward of your head in a hard gale.  Being fixed on the
+summit of the mast, you ascend into it through a little trap-hatch in
+the bottom.  On the after side, or side next the stern of the ship,
+is a comfortable seat, with a locker underneath for umbrellas,
+comforters, and coats.  In front is a leather rack, in which to keep
+your speaking trumpet, pipe, telescope, and other nautical
+conveniences.  When Captain Sleet in person stood his mast-head in
+this crow's-nest of his, he tells us that he always had a rifle with
+him (also fixed in the rack), together with a powder flask and shot,
+for the purpose of popping off the stray narwhales, or vagrant sea
+unicorns infesting those waters; for you cannot successfully shoot at
+them from the deck owing to the resistance of the water, but to shoot
+down upon them is a very different thing.  Now, it was plainly a
+labor of love for Captain Sleet to describe, as he does, all the
+little detailed conveniences of his crow's-nest; but though he so
+enlarges upon many of these, and though he treats us to a very
+scientific account of his experiments in this crow's-nest, with a
+small compass he kept there for the purpose of counteracting the
+errors resulting from what is called the "local attraction" of all
+binnacle magnets; an error ascribable to the horizontal vicinity of
+the iron in the ship's planks, and in the Glacier's case, perhaps, to
+there having been so many broken-down blacksmiths among her crew; I
+say, that though the Captain is very discreet and scientific here,
+yet, for all his learned "binnacle deviations," "azimuth compass
+observations," and "approximate errors," he knows very well, Captain
+Sleet, that he was not so much immersed in those profound magnetic
+meditations, as to fail being attracted occasionally towards that
+well replenished little case-bottle, so nicely tucked in on one side
+of his crow's nest, within easy reach of his hand.  Though, upon the
+whole, I greatly admire and even love the brave, the honest, and
+learned Captain; yet I take it very ill of him that he should so
+utterly ignore that case-bottle, seeing what a faithful friend and
+comforter it must have been, while with mittened fingers and hooded
+head he was studying the mathematics aloft there in that bird's nest
+within three or four perches of the pole.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 8</DOCNO>
+But if we Southern whale-fishers are not so snugly housed aloft as
+Captain Sleet and his Greenlandmen were; yet that disadvantage is
+greatly counter-balanced by the widely contrasting serenity of those
+seductive seas in which we South fishers mostly float.  For one, I
+used to lounge up the rigging very leisurely, resting in the top to
+have a chat with Queequeg, or any one else off duty whom I might find
+there; then ascending a little way further, and throwing a lazy leg
+over the top-sail yard, take a preliminary view of the watery
+pastures, and so at last mount to my ultimate destination.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 9</DOCNO>
+Let me make a clean breast of it here, and frankly admit that I kept
+but sorry guard.  With the problem of the universe revolving in me,
+how could I--being left completely to myself at such a
+thought-engendering altitude--how could I but lightly hold my
+obligations to observe all whale-ships' standing orders, "Keep your
+weather eye open, and sing out every time."
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 10</DOCNO>
+And let me in this place movingly admonish you, ye ship-owners of
+Nantucket!  Beware of enlisting in your vigilant fisheries any lad
+with lean brow and hollow eye; given to unseasonable meditativeness;
+and who offers to ship with the Phaedon instead of Bowditch in his
+head.  Beware of such an one, I say; your whales must be seen before
+they can be killed; and this sunken-eyed young Platonist will tow you
+ten wakes round the world, and never make you one pint of sperm the
+richer.  Nor are these monitions at all unneeded.  For nowadays, the
+whale-fishery furnishes an asylum for many romantic, melancholy, and
+absent-minded young men, disgusted with the carking cares of earth,
+and seeking sentiment in tar and blubber.  Childe Harold not
+unfrequently perches himself upon the mast-head of some luckless
+disappointed whale-ship, and in moody phrase ejaculates:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 11</DOCNO>
+"Roll on, thou deep and dark blue ocean, roll!  Ten thousand
+blubber-hunters sweep over thee in vain."
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 12</DOCNO>
+Very often do the captains of such ships take those absent-minded
+young philosophers to task, upbraiding them with not feeling
+sufficient "interest" in the voyage; half-hinting that they are so
+hopelessly lost to all honourable ambition, as that in their secret
+souls they would rather not see whales than otherwise.  But all in
+vain; those young Platonists have a notion that their vision is
+imperfect; they are short-sighted; what use, then, to strain the
+visual nerve?  They have left their opera-glasses at home.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 13</DOCNO>
+"Why, thou monkey," said a harpooneer to one of these lads, "we've
+been cruising now hard upon three years, and thou hast not raised a
+whale yet.  Whales are scarce as hen's teeth whenever thou art up
+here."  Perhaps they were; or perhaps there might have been shoals of
+them in the far horizon; but lulled into such an opium-like
+listlessness of vacant, unconscious reverie is this absent-minded
+youth by the blending cadence of waves with thoughts, that at last he
+loses his identity; takes the mystic ocean at his feet for the
+visible image of that deep, blue, bottomless soul, pervading mankind
+and nature; and every strange, half-seen, gliding, beautiful thing
+that eludes him; every dimly-discovered, uprising fin of some
+undiscernible form, seems to him the embodiment of those elusive
+thoughts that only people the soul by continually flitting through
+it.  In this enchanted mood, thy spirit ebbs away to whence it came;
+becomes diffused through time and space; like Crammer's sprinkled
+Pantheistic ashes, forming at last a part of every shore the round
+globe over.
+</DOC>
+<DOC>
+<DOCNO>Chapter 35, Paragraph 14</DOCNO>
+There is no life in thee, now, except that rocking life imparted by a
+gently rolling ship; by her, borrowed from the sea; by the sea, from
+the inscrutable tides of God.  But while this sleep, this dream is on
+ye, move your foot or hand an inch; slip your hold at all; and your
+identity comes back in horror.  Over Descartian vortices you hover.
+And perhaps, at mid-day, in the fairest weather, with one
+half-throttled shriek you drop through that transparent air into the
+summer sea, no more to rise for ever.  Heed it well, ye Pantheists!
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 1</DOCNO>
+The Quarter-Deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 2</DOCNO>
+(ENTER AHAB: THEN, ALL)
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 3</DOCNO>
+It was not a great while after the affair of the pipe, that one
+morning shortly after breakfast, Ahab, as was his wont, ascended the
+cabin-gangway to the deck.  There most sea-captains usually walk at
+that hour, as country gentlemen, after the same meal, take a few
+turns in the garden.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 4</DOCNO>
+Soon his steady, ivory stride was heard, as to and fro he paced his
+old rounds, upon planks so familiar to his tread, that they were all
+over dented, like geological stones, with the peculiar mark of his
+walk.  Did you fixedly gaze, too, upon that ribbed and dented brow;
+there also, you would see still stranger foot-prints--the foot-prints
+of his one unsleeping, ever-pacing thought.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 5</DOCNO>
+But on the occasion in question, those dents looked deeper, even as
+his nervous step that morning left a deeper mark.  And, so full of
+his thought was Ahab, that at every uniform turn that he made, now at
+the main-mast and now at the binnacle, you could almost see that
+thought turn in him as he turned, and pace in him as he paced; so
+completely possessing him, indeed, that it all but seemed the inward
+mould of every outer movement.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 6</DOCNO>
+"D'ye mark him, Flask?" whispered Stubb; "the chick that's in him
+pecks the shell.  'Twill soon be out."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 7</DOCNO>
+The hours wore on;--Ahab now shut up within his cabin; anon, pacing
+the deck, with the same intense bigotry of purpose in his aspect.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 8</DOCNO>
+It drew near the close of day.  Suddenly he came to a halt by the
+bulwarks, and inserting his bone leg into the auger-hole there, and
+with one hand grasping a shroud, he ordered Starbuck to send
+everybody aft.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 9</DOCNO>
+"Sir!" said the mate, astonished at an order seldom or never given on
+ship-board except in some extraordinary case.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 10</DOCNO>
+"Send everybody aft," repeated Ahab.  "Mast-heads, there! come down!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 11</DOCNO>
+When the entire ship's company were assembled, and with curious and
+not wholly unapprehensive faces, were eyeing him, for he looked not
+unlike the weather horizon when a storm is coming up, Ahab, after
+rapidly glancing over the bulwarks, and then darting his eyes among
+the crew, started from his standpoint; and as though not a soul were
+nigh him resumed his heavy turns upon the deck.  With bent head and
+half-slouched hat he continued to pace, unmindful of the wondering
+whispering among the men; till Stubb cautiously whispered to Flask,
+that Ahab must have summoned them there for the purpose of witnessing
+a pedestrian feat.  But this did not last long.  Vehemently pausing,
+he cried:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 12</DOCNO>
+"What do ye do when ye see a whale, men?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 13</DOCNO>
+"Sing out for him!" was the impulsive rejoinder from a score of
+clubbed voices.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 14</DOCNO>
+"Good!" cried Ahab, with a wild approval in his tones; observing the
+hearty animation into which his unexpected question had so
+magnetically thrown them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 15</DOCNO>
+"And what do ye next, men?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 16</DOCNO>
+"Lower away, and after him!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 17</DOCNO>
+"And what tune is it ye pull to, men?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 18</DOCNO>
+"A dead whale or a stove boat!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 19</DOCNO>
+More and more strangely and fiercely glad and approving, grew the
+countenance of the old man at every shout; while the mariners began
+to gaze curiously at each other, as if marvelling how it was that
+they themselves became so excited at such seemingly purposeless
+questions.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 20</DOCNO>
+But, they were all eagerness again, as Ahab, now half-revolving in
+his pivot-hole, with one hand reaching high up a shroud, and tightly,
+almost convulsively grasping it, addressed them thus:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 21</DOCNO>
+"All ye mast-headers have before now heard me give orders about a
+white whale.  Look ye! d'ye see this Spanish ounce of gold?"--holding
+up a broad bright coin to the sun--"it is a sixteen dollar piece,
+men.  D'ye see it?  Mr. Starbuck, hand me yon top-maul."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 22</DOCNO>
+While the mate was getting the hammer, Ahab, without speaking, was
+slowly rubbing the gold piece against the skirts of his jacket, as if
+to heighten its lustre, and without using any words was meanwhile
+lowly humming to himself, producing a sound so strangely muffled and
+inarticulate that it seemed the mechanical humming of the wheels of
+his vitality in him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 23</DOCNO>
+Receiving the top-maul from Starbuck, he advanced towards the
+main-mast with the hammer uplifted in one hand, exhibiting the gold
+with the other, and with a high raised voice exclaiming: "Whosoever
+of ye raises me a white-headed whale with a wrinkled brow and a
+crooked jaw; whosoever of ye raises me that white-headed whale, with
+three holes punctured in his starboard fluke--look ye, whosoever of
+ye raises me that same white whale, he shall have this gold ounce, my
+boys!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 24</DOCNO>
+"Huzza! huzza!" cried the seamen, as with swinging tarpaulins they
+hailed the act of nailing the gold to the mast.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 25</DOCNO>
+"It's a white whale, I say," resumed Ahab, as he threw down the
+topmaul: "a white whale.  Skin your eyes for him, men; look sharp for
+white water; if ye see but a bubble, sing out."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 26</DOCNO>
+All this while Tashtego, Daggoo, and Queequeg had looked on with even
+more intense interest and surprise than the rest, and at the mention
+of the wrinkled brow and crooked jaw they had started as if each was
+separately touched by some specific recollection.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 27</DOCNO>
+"Captain Ahab," said Tashtego, "that white whale must be the same
+that some call Moby Dick."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 28</DOCNO>
+"Moby Dick?" shouted Ahab.  "Do ye know the white whale then, Tash?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 29</DOCNO>
+"Does he fan-tail a little curious, sir, before he goes down?" said
+the Gay-Header deliberately.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 30</DOCNO>
+"And has he a curious spout, too," said Daggoo, "very bushy, even for
+a parmacetty, and mighty quick, Captain Ahab?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 31</DOCNO>
+"And he have one, two, three--oh! good many iron in him hide, too,
+Captain," cried Queequeg disjointedly, "all twiske-tee be-twisk, like
+him--him--" faltering hard for a word, and screwing his hand round
+and round as though uncorking a bottle--"like him--him--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 32</DOCNO>
+"Corkscrew!" cried Ahab, "aye, Queequeg, the harpoons lie all twisted
+and wrenched in him; aye, Daggoo, his spout is a big one, like a
+whole shock of wheat, and white as a pile of our Nantucket wool after
+the great annual sheep-shearing; aye, Tashtego, and he fan-tails like
+a split jib in a squall.  Death and devils! men, it is Moby Dick ye
+have seen--Moby Dick--Moby Dick!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 33</DOCNO>
+"Captain Ahab," said Starbuck, who, with Stubb and Flask, had thus
+far been eyeing his superior with increasing surprise, but at last
+seemed struck with a thought which somewhat explained all the wonder.
+"Captain Ahab, I have heard of Moby Dick--but it was not Moby Dick
+that took off thy leg?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 34</DOCNO>
+"Who told thee that?" cried Ahab; then pausing, "Aye, Starbuck; aye,
+my hearties all round; it was Moby Dick that dismasted me; Moby Dick
+that brought me to this dead stump I stand on now.  Aye, aye," he
+shouted with a terrific, loud, animal sob, like that of a
+heart-stricken moose; "Aye, aye! it was that accursed white whale
+that razeed me; made a poor pegging lubber of me for ever and a day!"
+Then tossing both arms, with measureless imprecations he shouted
+out: "Aye, aye! and I'll chase him round Good Hope, and round the
+Horn, and round the Norway Maelstrom, and round perdition's flames
+before I give him up.  And this is what ye have shipped for, men! to
+chase that white whale on both sides of land, and over all sides of
+earth, till he spouts black blood and rolls fin out.  What say ye,
+men, will ye splice hands on it, now?  I think ye do look brave."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 35</DOCNO>
+"Aye, aye!" shouted the harpooneers and seamen, running closer to the
+excited old man: "A sharp eye for the white whale; a sharp lance for
+Moby Dick!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 36</DOCNO>
+"God bless ye," he seemed to half sob and half shout.  "God bless ye,
+men.  Steward! go draw the great measure of grog.  But what's this
+long face about, Mr. Starbuck; wilt thou not chase the white whale?
+art not game for Moby Dick?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 37</DOCNO>
+"I am game for his crooked jaw, and for the jaws of Death too,
+Captain Ahab, if it fairly comes in the way of the business we
+follow; but I came here to hunt whales, not my commander's vengeance.
+How many barrels will thy vengeance yield thee even if thou gettest
+it, Captain Ahab? it will not fetch thee much in our Nantucket
+market."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 38</DOCNO>
+"Nantucket market!  Hoot!  But come closer, Starbuck; thou requirest
+a little lower layer.  If money's to be the measurer, man, and the
+accountants have computed their great counting-house the globe, by
+girdling it with guineas, one to every three parts of an inch; then,
+let me tell thee, that my vengeance will fetch a great premium HERE!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 39</DOCNO>
+"He smites his chest," whispered Stubb, "what's that for? methinks it
+rings most vast, but hollow."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 40</DOCNO>
+"Vengeance on a dumb brute!" cried Starbuck, "that simply smote thee
+from blindest instinct!  Madness!  To be enraged with a dumb thing,
+Captain Ahab, seems blasphemous."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 41</DOCNO>
+"Hark ye yet again--the little lower layer.  All visible objects,
+man, are but as pasteboard masks.  But in each event--in the living
+act, the undoubted deed--there, some unknown but still reasoning
+thing puts forth the mouldings of its features from behind the
+unreasoning mask.  If man will strike, strike through the mask!  How
+can the prisoner reach outside except by thrusting through the wall?
+To me, the white whale is that wall, shoved near to me.  Sometimes I
+think there's naught beyond.  But 'tis enough.  He tasks me; he heaps
+me; I see in him outrageous strength, with an inscrutable malice
+sinewing it.  That inscrutable thing is chiefly what I hate; and be
+the white whale agent, or be the white whale principal, I will wreak
+that hate upon him.  Talk not to me of blasphemy, man; I'd strike the
+sun if it insulted me.  For could the sun do that, then could I do
+the other; since there is ever a sort of fair play herein, jealousy
+presiding over all creations.  But not my master, man, is even that
+fair play.  Who's over me?  Truth hath no confines.  Take off thine
+eye! more intolerable than fiends' glarings is a doltish stare!  So,
+so; thou reddenest and palest; my heat has melted thee to anger-glow.
+But look ye, Starbuck, what is said in heat, that thing unsays
+itself.  There are men from whom warm words are small indignity.  I
+meant not to incense thee.  Let it go.  Look! see yonder Turkish
+cheeks of spotted tawn--living, breathing pictures painted by the
+sun.  The Pagan leopards--the unrecking and unworshipping things,
+that live; and seek, and give no reasons for the torrid life they
+feel!  The crew, man, the crew!  Are they not one and all with Ahab,
+in this matter of the whale?  See Stubb! he laughs!  See yonder
+Chilian! he snorts to think of it.  Stand up amid the general
+hurricane, thy one tost sapling cannot, Starbuck!  And what is it?
+Reckon it.  'Tis but to help strike a fin; no wondrous feat for
+Starbuck.  What is it more?  From this one poor hunt, then, the best
+lance out of all Nantucket, surely he will not hang back, when every
+foremast-hand has clutched a whetstone?  Ah! constrainings seize
+thee; I see! the billow lifts thee!  Speak, but speak!--Aye, aye! thy
+silence, then, THAT voices thee.  (ASIDE) Something shot from my
+dilated nostrils, he has inhaled it in his lungs.  Starbuck now is
+mine; cannot oppose me now, without rebellion."
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 42</DOCNO>
+"God keep me!--keep us all!" murmured Starbuck, lowly.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 43</DOCNO>
+But in his joy at the enchanted, tacit acquiescence of the mate, Ahab
+did not hear his foreboding invocation; nor yet the low laugh from
+the hold; nor yet the presaging vibrations of the winds in the
+cordage; nor yet the hollow flap of the sails against the masts, as
+for a moment their hearts sank in.  For again Starbuck's downcast
+eyes lighted up with the stubbornness of life; the subterranean laugh
+died away; the winds blew on; the sails filled out; the ship heaved
+and rolled as before.  Ah, ye admonitions and warnings! why stay ye
+not when ye come?  But rather are ye predictions than warnings, ye
+shadows!  Yet not so much predictions from without, as verifications
+of the foregoing things within.  For with little external to
+constrain us, the innermost necessities in our being, these still
+drive us on.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 44</DOCNO>
+"The measure! the measure!" cried Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 45</DOCNO>
+Receiving the brimming pewter, and turning to the harpooneers, he
+ordered them to produce their weapons.  Then ranging them before him
+near the capstan, with their harpoons in their hands, while his three
+mates stood at his side with their lances, and the rest of the ship's
+company formed a circle round the group; he stood for an instant
+searchingly eyeing every man of his crew.  But those wild eyes met
+his, as the bloodshot eyes of the prairie wolves meet the eye of
+their leader, ere he rushes on at their head in the trail of the
+bison; but, alas! only to fall into the hidden snare of the Indian.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 46</DOCNO>
+"Drink and pass!" he cried, handing the heavy charged flagon to the
+nearest seaman.  "The crew alone now drink.  Round with it, round!
+Short draughts--long swallows, men; 'tis hot as Satan's hoof.  So,
+so; it goes round excellently.  It spiralizes in ye; forks out at the
+serpent-snapping eye.  Well done; almost drained.  That way it went,
+this way it comes.  Hand it me--here's a hollow!  Men, ye seem the
+years; so brimming life is gulped and gone.  Steward, refill!
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 47</DOCNO>
+"Attend now, my braves.  I have mustered ye all round this capstan;
+and ye mates, flank me with your lances; and ye harpooneers, stand
+there with your irons; and ye, stout mariners, ring me in, that I may
+in some sort revive a noble custom of my fisherman fathers before
+me.  O men, you will yet see that--Ha! boy, come back? bad pennies
+come not sooner.  Hand it me.  Why, now, this pewter had run brimming
+again, were't not thou St. Vitus' imp--away, thou ague!
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 48</DOCNO>
+"Advance, ye mates!  Cross your lances full before me.  Well done!
+Let me touch the axis."  So saying, with extended arm, he grasped the
+three level, radiating lances at their crossed centre; while so
+doing, suddenly and nervously twitched them; meanwhile, glancing
+intently from Starbuck to Stubb; from Stubb to Flask.  It seemed as
+though, by some nameless, interior volition, he would fain have
+shocked into them the same fiery emotion accumulated within the
+Leyden jar of his own magnetic life.  The three mates quailed before
+his strong, sustained, and mystic aspect.  Stubb and Flask looked
+sideways from him; the honest eye of Starbuck fell downright.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 49</DOCNO>
+"In vain!" cried Ahab; "but, maybe, 'tis well.  For did ye three but
+once take the full-forced shock, then mine own electric thing, THAT
+had perhaps expired from out me.  Perchance, too, it would have
+dropped ye dead.  Perchance ye need it not.  Down lances!  And now,
+ye mates, I do appoint ye three cupbearers to my three pagan kinsmen
+there--yon three most honourable gentlemen and noblemen, my valiant
+harpooneers.  Disdain the task?  What, when the great Pope washes the
+feet of beggars, using his tiara for ewer?  Oh, my sweet cardinals!
+your own condescension, THAT shall bend ye to it.  I do not order ye;
+ye will it.  Cut your seizings and draw the poles, ye harpooneers!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 50</DOCNO>
+Silently obeying the order, the three harpooneers now stood with the
+detached iron part of their harpoons, some three feet long, held,
+barbs up, before him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 51</DOCNO>
+"Stab me not with that keen steel!  Cant them; cant them over! know
+ye not the goblet end?  Turn up the socket!  So, so; now, ye
+cup-bearers, advance.  The irons! take them; hold them while I fill!"
+Forthwith, slowly going from one officer to the other, he brimmed
+the harpoon sockets with the fiery waters from the pewter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 36, Paragraph 52</DOCNO>
+"Now, three to three, ye stand.  Commend the murderous chalices!
+Bestow them, ye who are now made parties to this indissoluble league.
+Ha!  Starbuck! but the deed is done!  Yon ratifying sun now waits to
+sit upon it.  Drink, ye harpooneers! drink and swear, ye men that man
+the deathful whaleboat's bow--Death to Moby Dick!  God hunt us all,
+if we do not hunt Moby Dick to his death!"  The long, barbed steel
+goblets were lifted; and to cries and maledictions against the white
+whale, the spirits were simultaneously quaffed down with a hiss.
+Starbuck paled, and turned, and shivered.  Once more, and finally,
+the replenished pewter went the rounds among the frantic crew; when,
+waving his free hand to them, they all dispersed; and Ahab retired
+within his cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 37, Paragraph 1</DOCNO>
+Sunset.
+</DOC>
+<DOC>
+<DOCNO>Chapter 37, Paragraph 2</DOCNO>
+THE CABIN; BY THE STERN WINDOWS; AHAB SITTING ALONE, AND GAZING OUT.
+</DOC>
+<DOC>
+<DOCNO>Chapter 37, Paragraph 3</DOCNO>
+I leave a white and turbid wake; pale waters, paler cheeks, where'er
+I sail.  The envious billows sidelong swell to whelm my track; let
+them; but first I pass.
+</DOC>
+<DOC>
+<DOCNO>Chapter 37, Paragraph 4</DOCNO>
+Yonder, by ever-brimming goblet's rim, the warm waves blush like
+wine.  The gold brow plumbs the blue.  The diver sun--slow dived from
+noon--goes down; my soul mounts up! she wearies with her endless
+hill.  Is, then, the crown too heavy that I wear? this Iron Crown of
+Lombardy.  Yet is it bright with many a gem; I the wearer, see not
+its far flashings; but darkly feel that I wear that, that dazzlingly
+confounds.  'Tis iron--that I know--not gold.  'Tis split, too--that
+I feel; the jagged edge galls me so, my brain seems to beat against
+the solid metal; aye, steel skull, mine; the sort that needs no
+helmet in the most brain-battering fight!
+</DOC>
+<DOC>
+<DOCNO>Chapter 37, Paragraph 5</DOCNO>
+Dry heat upon my brow?  Oh! time was, when as the sunrise nobly
+spurred me, so the sunset soothed.  No more.  This lovely light, it
+lights not me; all loveliness is anguish to me, since I can ne'er
+enjoy.  Gifted with the high perception, I lack the low, enjoying
+power; damned, most subtly and most malignantly! damned in the midst
+of Paradise!  Good night--good night! (WAVING HIS HAND, HE MOVES FROM
+THE WINDOW.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 37, Paragraph 6</DOCNO>
+'Twas not so hard a task.  I thought to find one stubborn, at the
+least; but my one cogged circle fits into all their various wheels,
+and they revolve.  Or, if you will, like so many ant-hills of powder,
+they all stand before me; and I their match.  Oh, hard! that to fire
+others, the match itself must needs be wasting!  What I've dared,
+I've willed; and what I've willed, I'll do!  They think me
+mad--Starbuck does; but I'm demoniac, I am madness maddened!  That
+wild madness that's only calm to comprehend itself!  The prophecy was
+that I should be dismembered; and--Aye!  I lost this leg.  I now
+prophesy that I will dismember my dismemberer.  Now, then, be the
+prophet and the fulfiller one.  That's more than ye, ye great gods,
+ever were.  I laugh and hoot at ye, ye cricket-players, ye pugilists,
+ye deaf Burkes and blinded Bendigoes!  I will not say as schoolboys
+do to bullies--Take some one of your own size; don't pommel ME!  No,
+ye've knocked me down, and I am up again; but YE have run and hidden.
+Come forth from behind your cotton bags!  I have no long gun to
+reach ye.  Come, Ahab's compliments to ye; come and see if ye can
+swerve me.  Swerve me? ye cannot swerve me, else ye swerve
+yourselves! man has ye there.  Swerve me?  The path to my fixed
+purpose is laid with iron rails, whereon my soul is grooved to run.
+Over unsounded gorges, through the rifled hearts of mountains, under
+torrents' beds, unerringly I rush!  Naught's an obstacle, naught's an
+angle to the iron way!
+</DOC>
+<DOC>
+<DOCNO>Chapter 38, Paragraph 1</DOCNO>
+Dusk.
+</DOC>
+<DOC>
+<DOCNO>Chapter 38, Paragraph 2</DOCNO>
+BY THE MAINMAST; STARBUCK LEANING AGAINST IT.
+</DOC>
+<DOC>
+<DOCNO>Chapter 38, Paragraph 3</DOCNO>
+My soul is more than matched; she's overmanned; and by a madman!
+Insufferable sting, that sanity should ground arms on such a field!
+But he drilled deep down, and blasted all my reason out of me!  I
+think I see his impious end; but feel that I must help him to it.
+Will I, nill I, the ineffable thing has tied me to him; tows me with
+a cable I have no knife to cut.  Horrible old man!  Who's over him,
+he cries;--aye, he would be a democrat to all above; look, how he
+lords it over all below!  Oh!  I plainly see my miserable office,--to
+obey, rebelling; and worse yet, to hate with touch of pity!  For in
+his eyes I read some lurid woe would shrivel me up, had I it.  Yet is
+there hope.  Time and tide flow wide.  The hated whale has the round
+watery world to swim in, as the small gold-fish has its glassy globe.
+His heaven-insulting purpose, God may wedge aside.  I would up
+heart, were it not like lead.  But my whole clock's run down; my
+heart the all-controlling weight, I have no key to lift again.
+</DOC>
+<DOC>
+<DOCNO>Chapter 38, Paragraph 4</DOCNO>
+[A BURST OF REVELRY FROM THE FORECASTLE.]
+</DOC>
+<DOC>
+<DOCNO>Chapter 38, Paragraph 5</DOCNO>
+Oh, God! to sail with such a heathen crew that have small touch of
+human mothers in them!  Whelped somewhere by the sharkish sea.  The
+white whale is their demigorgon.  Hark! the infernal orgies! that
+revelry is forward! mark the unfaltering silence aft!  Methinks it
+pictures life.  Foremost through the sparkling sea shoots on the gay,
+embattled, bantering bow, but only to drag dark Ahab after it, where
+he broods within his sternward cabin, builded over the dead water of
+the wake, and further on, hunted by its wolfish gurglings.  The long
+howl thrills me through!  Peace! ye revellers, and set the watch!
+Oh, life!  'tis in an hour like this, with soul beat down and held to
+knowledge,--as wild, untutored things are forced to feed--Oh, life!
+'tis now that I do feel the latent horror in thee! but 'tis not me!
+that horror's out of me! and with the soft feeling of the human in
+me, yet will I try to fight ye, ye grim, phantom futures!  Stand by
+me, hold me, bind me, O ye blessed influences!
+</DOC>
+<DOC>
+<DOCNO>Chapter 39, Paragraph 1</DOCNO>
+First Night Watch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 39, Paragraph 2</DOCNO>
+Fore-Top.
+</DOC>
+<DOC>
+<DOCNO>Chapter 39, Paragraph 3</DOCNO>
+(STUBB SOLUS, AND MENDING A BRACE.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 39, Paragraph 4</DOCNO>
+Ha! ha! ha! ha! hem! clear my throat!--I've been thinking over it
+ever since, and that ha, ha's the final consequence.  Why so?
+Because a laugh's the wisest, easiest answer to all that's queer; and
+come what will, one comfort's always left--that unfailing comfort is,
+it's all predestinated.  I heard not all his talk with Starbuck; but
+to my poor eye Starbuck then looked something as I the other evening
+felt.  Be sure the old Mogul has fixed him, too.  I twigged it, knew
+it; had had the gift, might readily have prophesied it--for when I
+clapped my eye upon his skull I saw it.  Well, Stubb, WISE
+Stubb--that's my title--well, Stubb, what of it, Stubb?  Here's a
+carcase.  I know not all that may be coming, but be it what it will,
+I'll go to it laughing.  Such a waggish leering as lurks in all your
+horribles!  I feel funny.  Fa, la! lirra, skirra!  What's my juicy
+little pear at home doing now?  Crying its eyes out?--Giving a party
+to the last arrived harpooneers, I dare say, gay as a frigate's
+pennant, and so am I--fa, la! lirra, skirra!  Oh--
+</DOC>
+<DOC>
+<DOCNO>Chapter 39, Paragraph 5</DOCNO>
+We'll drink to-night with hearts as light,
+To love, as gay and fleeting
+As bubbles that swim, on the beaker's brim,
+And break on the lips while meeting.
+</DOC>
+<DOC>
+<DOCNO>Chapter 39, Paragraph 6</DOCNO>
+A brave stave that--who calls?  Mr. Starbuck?  Aye, aye, sir--(ASIDE)
+he's my superior, he has his too, if I'm not mistaken.--Aye, aye,
+sir, just through with this job--coming.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 1</DOCNO>
+Midnight, Forecastle.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 2</DOCNO>
+HARPOONEERS AND SAILORS.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 3</DOCNO>
+(FORESAIL RISES AND DISCOVERS THE WATCH STANDING, LOUNGING, LEANING,
+AND LYING IN VARIOUS ATTITUDES, ALL SINGING IN CHORUS.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 4</DOCNO>
+Farewell and adieu to you, Spanish ladies!
+Farewell and adieu to you, ladies of Spain!
+Our captain's commanded.--
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 5</DOCNO>
+1ST NANTUCKET SAILOR.
+Oh, boys, don't be sentimental; it's bad for the digestion!  Take a
+tonic, follow me!
+(SINGS, AND ALL FOLLOW)
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 6</DOCNO>
+Our captain stood upon the deck,
+A spy-glass in his hand,
+A viewing of those gallant whales
+That blew at every strand.
+Oh, your tubs in your boats, my boys,
+And by your braces stand,
+And we'll have one of those fine whales,
+Hand, boys, over hand!
+So, be cheery, my lads! may your hearts never fail!
+While the bold harpooner is striking the whale!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 7</DOCNO>
+MATE'S VOICE FROM THE QUARTER-DECK.
+Eight bells there, forward!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 8</DOCNO>
+2ND NANTUCKET SAILOR.
+Avast the chorus!  Eight bells there! d'ye hear, bell-boy?  Strike
+the bell eight, thou Pip! thou blackling! and let me call the watch.
+I've the sort of mouth for that--the hogshead mouth.  So, so,
+(THRUSTS HIS HEAD DOWN THE SCUTTLE,) Star-bo-l-e-e-n-s, a-h-o-y!
+Eight bells there below!  Tumble up!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 9</DOCNO>
+DUTCH SAILOR.
+Grand snoozing to-night, maty; fat night for that.  I mark this in
+our old Mogul's wine; it's quite as deadening to some as filliping to
+others.  We sing; they sleep--aye, lie down there, like ground-tier
+butts.  At 'em again!  There, take this copper-pump, and hail 'em
+through it.  Tell 'em to avast dreaming of their lasses.  Tell 'em
+it's the resurrection; they must kiss their last, and come to
+judgment.  That's the way--THAT'S it; thy throat ain't spoiled with
+eating Amsterdam butter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 10</DOCNO>
+FRENCH SAILOR.
+Hist, boys! let's have a jig or two before we ride to anchor in
+Blanket Bay.  What say ye?  There comes the other watch.  Stand by
+all legs!  Pip! little Pip! hurrah with your tambourine!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 11</DOCNO>
+PIP.
+(SULKY AND SLEEPY)
+Don't know where it is.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 12</DOCNO>
+FRENCH SAILOR.
+Beat thy belly, then, and wag thy ears.  Jig it, men, I say; merry's
+the word; hurrah!  Damn me, won't you dance?  Form, now, Indian-file,
+and gallop into the double-shuffle?  Throw yourselves!  Legs! legs!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 13</DOCNO>
+ICELAND SAILOR.
+I don't like your floor, maty; it's too springy to my taste.  I'm
+used to ice-floors.  I'm sorry to throw cold water on the subject;
+but excuse me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 14</DOCNO>
+MALTESE SAILOR.
+Me too; where's your girls?  Who but a fool would take his left hand
+by his right, and say to himself, how d'ye do?  Partners!  I must
+have partners!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 15</DOCNO>
+SICILIAN SAILOR.
+Aye; girls and a green!--then I'll hop with ye; yea, turn
+grasshopper!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 16</DOCNO>
+LONG-ISLAND SAILOR.
+Well, well, ye sulkies, there's plenty more of us.  Hoe corn when you
+may, say I.  All legs go to harvest soon.  Ah! here comes the music;
+now for it!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 17</DOCNO>
+AZORE SAILOR.
+(ASCENDING, AND PITCHING THE TAMBOURINE UP THE SCUTTLE.)
+Here you are, Pip; and there's the windlass-bitts; up you mount!
+Now, boys!
+(THE HALF OF THEM DANCE TO THE TAMBOURINE; SOME GO BELOW; SOME SLEEP
+OR LIE AMONG THE COILS OF RIGGING.  OATHS A-PLENTY.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 18</DOCNO>
+AZORE SAILOR.
+(DANCING)
+Go it, Pip!  Bang it, bell-boy!  Rig it, dig it, stig it, quig it,
+bell-boy!  Make fire-flies; break the jinglers!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 19</DOCNO>
+PIP.
+Jinglers, you say?--there goes another, dropped off; I pound it so.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 20</DOCNO>
+CHINA SAILOR.
+Rattle thy teeth, then, and pound away; make a pagoda of thyself.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 21</DOCNO>
+FRENCH SAILOR.
+Merry-mad!  Hold up thy hoop, Pip, till I jump through it!  Split
+jibs! tear yourselves!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 22</DOCNO>
+TASHTEGO.
+(QUIETLY SMOKING)
+That's a white man; he calls that fun: humph!  I save my sweat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 23</DOCNO>
+OLD MANX SAILOR.
+I wonder whether those jolly lads bethink them of what they are
+dancing over.  I'll dance over your grave, I will--that's the
+bitterest threat of your night-women, that beat head-winds round
+corners.  O Christ! to think of the green navies and the
+green-skulled crews!  Well, well; belike the whole world's a ball, as
+you scholars have it; and so 'tis right to make one ballroom of it.
+Dance on, lads, you're young; I was once.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 24</DOCNO>
+3D NANTUCKET SAILOR.
+Spell oh!--whew! this is worse than pulling after whales in a
+calm--give us a whiff, Tash.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 25</DOCNO>
+(THEY CEASE DANCING, AND GATHER IN CLUSTERS.  MEANTIME THE SKY
+DARKENS--THE WIND RISES.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 26</DOCNO>
+LASCAR SAILOR.
+By Brahma! boys, it'll be douse sail soon.  The sky-born, high-tide
+Ganges turned to wind!  Thou showest thy black brow, Seeva!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 27</DOCNO>
+MALTESE SAILOR.
+(RECLINING AND SHAKING HIS CAP.)
+It's the waves--the snow's caps turn to jig it now.  They'll shake
+their tassels soon.  Now would all the waves were women, then I'd go
+drown, and chassee with them evermore!  There's naught so sweet on
+earth--heaven may not match it!--as those swift glances of warm, wild
+bosoms in the dance, when the over-arboring arms hide such ripe,
+bursting grapes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 28</DOCNO>
+SICILIAN SAILOR.
+(RECLINING.)
+Tell me not of it!  Hark ye, lad--fleet interlacings of the
+limbs--lithe swayings--coyings--flutterings! lip! heart! hip! all
+graze: unceasing touch and go! not taste, observe ye, else come
+satiety.  Eh, Pagan? (NUDGING.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 29</DOCNO>
+TAHITAN SAILOR.
+(RECLINING ON A MAT.)
+Hail, holy nakedness of our dancing girls!--the Heeva-Heeva!  Ah! low
+veiled, high palmed Tahiti!  I still rest me on thy mat, but the soft
+soil has slid!  I saw thee woven in the wood, my mat! green the first
+day I brought ye thence; now worn and wilted quite.  Ah me!--not thou
+nor I can bear the change!  How then, if so be transplanted to yon
+sky?  Hear I the roaring streams from Pirohitee's peak of spears,
+when they leap down the crags and drown the villages?--The blast! the
+blast!  Up, spine, and meet it! (LEAPS TO HIS FEET.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 30</DOCNO>
+PORTUGUESE SAILOR.
+How the sea rolls swashing 'gainst the side!  Stand by for reefing,
+hearties! the winds are just crossing swords, pell-mell they'll go
+lunging presently.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 31</DOCNO>
+DANISH SAILOR.
+Crack, crack, old ship! so long as thou crackest, thou holdest!  Well
+done!  The mate there holds ye to it stiffly.  He's no more afraid
+than the isle fort at Cattegat, put there to fight the Baltic with
+storm-lashed guns, on which the sea-salt cakes!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 32</DOCNO>
+4TH NANTUCKET SAILOR.
+He has his orders, mind ye that.  I heard old Ahab tell him he must
+always kill a squall, something as they burst a waterspout with a
+pistol--fire your ship right into it!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 33</DOCNO>
+ENGLISH SAILOR.
+Blood! but that old man's a grand old cove!  We are the lads to hunt
+him up his whale!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 34</DOCNO>
+ALL.
+Aye! aye!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 35</DOCNO>
+OLD MANX SAILOR.
+How the three pines shake!  Pines are the hardest sort of tree to
+live when shifted to any other soil, and here there's none but the
+crew's cursed clay.  Steady, helmsman! steady.  This is the sort of
+weather when brave hearts snap ashore, and keeled hulls split at sea.
+Our captain has his birthmark; look yonder, boys, there's another in
+the sky--lurid-like, ye see, all else pitch black.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 36</DOCNO>
+DAGGOO.
+What of that?  Who's afraid of black's afraid of me!  I'm quarried
+out of it!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 37</DOCNO>
+SPANISH SAILOR.
+(ASIDE.) He wants to bully, ah!--the old grudge makes me touchy
+(ADVANCING.) Aye, harpooneer, thy race is the undeniable dark side of
+mankind--devilish dark at that.  No offence.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 38</DOCNO>
+DAGGOO (GRIMLY).
+None.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 39</DOCNO>
+ST. JAGO'S SAILOR.
+That Spaniard's mad or drunk.  But that can't be, or else in his one
+case our old Mogul's fire-waters are somewhat long in working.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 40</DOCNO>
+5TH NANTUCKET SAILOR.
+What's that I saw--lightning?  Yes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 41</DOCNO>
+SPANISH SAILOR.
+No; Daggoo showing his teeth.
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 42</DOCNO>
+DAGGOO (SPRINGING).
+Swallow thine, mannikin!  White skin, white liver!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 43</DOCNO>
+SPANISH SAILOR (MEETING HIM).
+Knife thee heartily! big frame, small spirit!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 44</DOCNO>
+ALL.
+A row! a row! a row!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 45</DOCNO>
+TASHTEGO (WITH A WHIFF).
+A row a'low, and a row aloft--Gods and men--both brawlers!  Humph!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 46</DOCNO>
+BELFAST SAILOR.
+A row! arrah a row!  The Virgin be blessed, a row!  Plunge in with
+ye!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 47</DOCNO>
+ENGLISH SAILOR.
+Fair play!  Snatch the Spaniard's knife!  A ring, a ring!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 48</DOCNO>
+OLD MANX SAILOR.
+Ready formed.  There! the ringed horizon.  In that ring Cain struck
+Abel.  Sweet work, right work!  No?  Why then, God, mad'st thou the
+ring?
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 49</DOCNO>
+MATE'S VOICE FROM THE QUARTER-DECK.
+Hands by the halyards! in top-gallant sails!  Stand by to reef
+topsails!
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 50</DOCNO>
+ALL.
+The squall! the squall! jump, my jollies! (THEY SCATTER.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 40, Paragraph 51</DOCNO>
+PIP (SHRINKING UNDER THE WINDLASS).
+Jollies?  Lord help such jollies!  Crish, crash! there goes the
+jib-stay!  Blang-whang!  God!  Duck lower, Pip, here comes the royal
+yard!  It's worse than being in the whirled woods, the last day of
+the year!  Who'd go climbing after chestnuts now?  But there they
+go, all cursing, and here I don't.  Fine prospects to 'em; they're on
+the road to heaven.  Hold on hard!  Jimmini, what a squall!  But
+those chaps there are worse yet--they are your white squalls, they.
+White squalls? white whale, shirr! shirr!  Here have I heard all
+their chat just now, and the white whale--shirr! shirr!--but spoken
+of once! and only this evening--it makes me jingle all over like my
+tambourine--that anaconda of an old man swore 'em in to hunt him!
+Oh, thou big white God aloft there somewhere in yon darkness, have
+mercy on this small black boy down here; preserve him from all men
+that have no bowels to feel fear!
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 1</DOCNO>
+Moby Dick.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 2</DOCNO>
+I, Ishmael, was one of that crew; my shouts had gone up with the
+rest; my oath had been welded with theirs; and stronger I shouted,
+and more did I hammer and clinch my oath, because of the dread in my
+soul.  A wild, mystical, sympathetical feeling was in me; Ahab's
+quenchless feud seemed mine.  With greedy ears I learned the history
+of that murderous monster against whom I and all the others had taken
+our oaths of violence and revenge.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 3</DOCNO>
+For some time past, though at intervals only, the unaccompanied,
+secluded White Whale had haunted those uncivilized seas mostly
+frequented by the Sperm Whale fishermen.  But not all of them knew of
+his existence; only a few of them, comparatively, had knowingly seen
+him; while the number who as yet had actually and knowingly given
+battle to him, was small indeed.  For, owing to the large number of
+whale-cruisers; the disorderly way they were sprinkled over the
+entire watery circumference, many of them adventurously pushing their
+quest along solitary latitudes, so as seldom or never for a whole
+twelvemonth or more on a stretch, to encounter a single news-telling
+sail of any sort; the inordinate length of each separate voyage; the
+irregularity of the times of sailing from home; all these, with other
+circumstances, direct and indirect, long obstructed the spread
+through the whole world-wide whaling-fleet of the special
+individualizing tidings concerning Moby Dick.  It was hardly to be
+doubted, that several vessels reported to have encountered, at such
+or such a time, or on such or such a meridian, a Sperm Whale of
+uncommon magnitude and malignity, which whale, after doing great
+mischief to his assailants, had completely escaped them; to some
+minds it was not an unfair presumption, I say, that the whale in
+question must have been no other than Moby Dick.  Yet as of late the
+Sperm Whale fishery had been marked by various and not unfrequent
+instances of great ferocity, cunning, and malice in the monster
+attacked; therefore it was, that those who by accident ignorantly
+gave battle to Moby Dick; such hunters, perhaps, for the most part,
+were content to ascribe the peculiar terror he bred, more, as it
+were, to the perils of the Sperm Whale fishery at large, than to the
+individual cause.  In that way, mostly, the disastrous encounter
+between Ahab and the whale had hitherto been popularly regarded.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 4</DOCNO>
+And as for those who, previously hearing of the White Whale, by
+chance caught sight of him; in the beginning of the thing they had
+every one of them, almost, as boldly and fearlessly lowered for him,
+as for any other whale of that species.  But at length, such
+calamities did ensue in these assaults--not restricted to sprained
+wrists and ankles, broken limbs, or devouring amputations--but fatal
+to the last degree of fatality; those repeated disastrous repulses,
+all accumulating and piling their terrors upon Moby Dick; those
+things had gone far to shake the fortitude of many brave hunters, to
+whom the story of the White Whale had eventually come.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 5</DOCNO>
+Nor did wild rumors of all sorts fail to exaggerate, and still the
+more horrify the true histories of these deadly encounters.  For not
+only do fabulous rumors naturally grow out of the very body of all
+surprising terrible events,--as the smitten tree gives birth to its
+fungi; but, in maritime life, far more than in that of terra firma,
+wild rumors abound, wherever there is any adequate reality for them
+to cling to.  And as the sea surpasses the land in this matter, so
+the whale fishery surpasses every other sort of maritime life, in the
+wonderfulness and fearfulness of the rumors which sometimes circulate
+there.  For not only are whalemen as a body unexempt from that
+ignorance and superstitiousness hereditary to all sailors; but of all
+sailors, they are by all odds the most directly brought into contact
+with whatever is appallingly astonishing in the sea; face to face
+they not only eye its greatest marvels, but, hand to jaw, give battle
+to them.  Alone, in such remotest waters, that though you sailed a
+thousand miles, and passed a thousand shores, you would not come to
+any chiseled hearth-stone, or aught hospitable beneath that part of
+the sun; in such latitudes and longitudes, pursuing too such a
+calling as he does, the whaleman is wrapped by influences all tending
+to make his fancy pregnant with many a mighty birth.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 6</DOCNO>
+No wonder, then, that ever gathering volume from the mere transit
+over the widest watery spaces, the outblown rumors of the White Whale
+did in the end incorporate with themselves all manner of morbid
+hints, and half-formed foetal suggestions of supernatural agencies,
+which eventually invested Moby Dick with new terrors unborrowed from
+anything that visibly appears.  So that in many cases such a panic
+did he finally strike, that few who by those rumors, at least, had
+heard of the White Whale, few of those hunters were willing to
+encounter the perils of his jaw.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 7</DOCNO>
+But there were still other and more vital practical influences at
+work.  Not even at the present day has the original prestige of the
+Sperm Whale, as fearfully distinguished from all other species of the
+leviathan, died out of the minds of the whalemen as a body.  There
+are those this day among them, who, though intelligent and courageous
+enough in offering battle to the Greenland or Right whale, would
+perhaps--either from professional inexperience, or incompetency, or
+timidity, decline a contest with the Sperm Whale; at any rate, there
+are plenty of whalemen, especially among those whaling nations not
+sailing under the American flag, who have never hostilely encountered
+the Sperm Whale, but whose sole knowledge of the leviathan is
+restricted to the ignoble monster primitively pursued in the North;
+seated on their hatches, these men will hearken with a childish
+fireside interest and awe, to the wild, strange tales of Southern
+whaling.  Nor is the pre-eminent tremendousness of the great Sperm
+Whale anywhere more feelingly comprehended, than on board of those
+prows which stem him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 8</DOCNO>
+And as if the now tested reality of his might had in former legendary
+times thrown its shadow before it; we find some book
+naturalists--Olassen and Povelson--declaring the Sperm Whale not only
+to be a consternation to every other creature in the sea, but also to
+be so incredibly ferocious as continually to be athirst for human
+blood.  Nor even down to so late a time as Cuvier's, were these or
+almost similar impressions effaced.  For in his Natural History, the
+Baron himself affirms that at sight of the Sperm Whale, all fish
+(sharks included) are "struck with the most lively terrors," and
+"often in the precipitancy of their flight dash themselves against
+the rocks with such violence as to cause instantaneous death."  And
+however the general experiences in the fishery may amend such reports
+as these; yet in their full terribleness, even to the bloodthirsty
+item of Povelson, the superstitious belief in them is, in some
+vicissitudes of their vocation, revived in the minds of the hunters.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 9</DOCNO>
+So that overawed by the rumors and portents concerning him, not a few
+of the fishermen recalled, in reference to Moby Dick, the earlier
+days of the Sperm Whale fishery, when it was oftentimes hard to
+induce long practised Right whalemen to embark in the perils of this
+new and daring warfare; such men protesting that although other
+leviathans might be hopefully pursued, yet to chase and point lance
+at such an apparition as the Sperm Whale was not for mortal man.
+That to attempt it, would be inevitably to be torn into a quick
+eternity.  On this head, there are some remarkable documents that may
+be consulted.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 10</DOCNO>
+Nevertheless, some there were, who even in the face of these things
+were ready to give chase to Moby Dick; and a still greater number
+who, chancing only to hear of him distantly and vaguely, without the
+specific details of any certain calamity, and without superstitious
+accompaniments, were sufficiently hardy not to flee from the battle
+if offered.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 11</DOCNO>
+One of the wild suggestions referred to, as at last coming to be
+linked with the White Whale in the minds of the superstitiously
+inclined, was the unearthly conceit that Moby Dick was ubiquitous;
+that he had actually been encountered in opposite latitudes at one
+and the same instant of time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 12</DOCNO>
+Nor, credulous as such minds must have been, was this conceit
+altogether without some faint show of superstitious probability.  For
+as the secrets of the currents in the seas have never yet been
+divulged, even to the most erudite research; so the hidden ways of
+the Sperm Whale when beneath the surface remain, in great part,
+unaccountable to his pursuers; and from time to time have originated
+the most curious and contradictory speculations regarding them,
+especially concerning the mystic modes whereby, after sounding to a
+great depth, he transports himself with such vast swiftness to the
+most widely distant points.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 13</DOCNO>
+It is a thing well known to both American and English whale-ships,
+and as well a thing placed upon authoritative record years ago by
+Scoresby, that some whales have been captured far north in the
+Pacific, in whose bodies have been found the barbs of harpoons darted
+in the Greenland seas.  Nor is it to be gainsaid, that in some of
+these instances it has been declared that the interval of time
+between the two assaults could not have exceeded very many days.
+Hence, by inference, it has been believed by some whalemen, that the
+Nor' West Passage, so long a problem to man, was never a problem to
+the whale.  So that here, in the real living experience of living
+men, the prodigies related in old times of the inland Strello
+mountain in Portugal (near whose top there was said to be a lake in
+which the wrecks of ships floated up to the surface); and that still
+more wonderful story of the Arethusa fountain near Syracuse (whose
+waters were believed to have come from the Holy Land by an
+underground passage); these fabulous narrations are almost fully
+equalled by the realities of the whalemen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 14</DOCNO>
+Forced into familiarity, then, with such prodigies as these; and
+knowing that after repeated, intrepid assaults, the White Whale had
+escaped alive; it cannot be much matter of surprise that some
+whalemen should go still further in their superstitions; declaring
+Moby Dick not only ubiquitous, but immortal (for immortality is but
+ubiquity in time); that though groves of spears should be planted in
+his flanks, he would still swim away unharmed; or if indeed he should
+ever be made to spout thick blood, such a sight would be but a
+ghastly deception; for again in unensanguined billows hundreds of
+leagues away, his unsullied jet would once more be seen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 15</DOCNO>
+But even stripped of these supernatural surmisings, there was enough
+in the earthly make and incontestable character of the monster to
+strike the imagination with unwonted power.  For, it was not so much
+his uncommon bulk that so much distinguished him from other sperm
+whales, but, as was elsewhere thrown out--a peculiar snow-white
+wrinkled forehead, and a high, pyramidical white hump.  These were
+his prominent features; the tokens whereby, even in the limitless,
+uncharted seas, he revealed his identity, at a long distance, to
+those who knew him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 16</DOCNO>
+The rest of his body was so streaked, and spotted, and marbled with
+the same shrouded hue, that, in the end, he had gained his
+distinctive appellation of the White Whale; a name, indeed, literally
+justified by his vivid aspect, when seen gliding at high noon through
+a dark blue sea, leaving a milky-way wake of creamy foam, all
+spangled with golden gleamings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 17</DOCNO>
+Nor was it his unwonted magnitude, nor his remarkable hue, nor yet
+his deformed lower jaw, that so much invested the whale with natural
+terror, as that unexampled, intelligent malignity which, according to
+specific accounts, he had over and over again evinced in his
+assaults.  More than all, his treacherous retreats struck more of
+dismay than perhaps aught else.  For, when swimming before his
+exulting pursuers, with every apparent symptom of alarm, he had
+several times been known to turn round suddenly, and, bearing down
+upon them, either stave their boats to splinters, or drive them back
+in consternation to their ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 18</DOCNO>
+Already several fatalities had attended his chase.  But though
+similar disasters, however little bruited ashore, were by no means
+unusual in the fishery; yet, in most instances, such seemed the White
+Whale's infernal aforethought of ferocity, that every dismembering or
+death that he caused, was not wholly regarded as having been
+inflicted by an unintelligent agent.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 19</DOCNO>
+Judge, then, to what pitches of inflamed, distracted fury the minds
+of his more desperate hunters were impelled, when amid the chips of
+chewed boats, and the sinking limbs of torn comrades, they swam out
+of the white curds of the whale's direful wrath into the serene,
+exasperating sunlight, that smiled on, as if at a birth or a bridal.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 20</DOCNO>
+His three boats stove around him, and oars and men both whirling in
+the eddies; one captain, seizing the line-knife from his broken prow,
+had dashed at the whale, as an Arkansas duellist at his foe, blindly
+seeking with a six inch blade to reach the fathom-deep life of the
+whale.  That captain was Ahab.  And then it was, that suddenly
+sweeping his sickle-shaped lower jaw beneath him, Moby Dick had
+reaped away Ahab's leg, as a mower a blade of grass in the field.  No
+turbaned Turk, no hired Venetian or Malay, could have smote him with
+more seeming malice.  Small reason was there to doubt, then, that
+ever since that almost fatal encounter, Ahab had cherished a wild
+vindictiveness against the whale, all the more fell for that in his
+frantic morbidness he at last came to identify with him, not only all
+his bodily woes, but all his intellectual and spiritual
+exasperations.  The White Whale swam before him as the monomaniac
+incarnation of all those malicious agencies which some deep men feel
+eating in them, till they are left living on with half a heart and
+half a lung.  That intangible malignity which has been from the
+beginning; to whose dominion even the modern Christians ascribe
+one-half of the worlds; which the ancient Ophites of the east
+reverenced in their statue devil;--Ahab did not fall down and worship
+it like them; but deliriously transferring its idea to the abhorred
+white whale, he pitted himself, all mutilated, against it.  All that
+most maddens and torments; all that stirs up the lees of things; all
+truth with malice in it; all that cracks the sinews and cakes the
+brain; all the subtle demonisms of life and thought; all evil, to
+crazy Ahab, were visibly personified, and made practically assailable
+in Moby Dick.  He piled upon the whale's white hump the sum of all
+the general rage and hate felt by his whole race from Adam down; and
+then, as if his chest had been a mortar, he burst his hot heart's
+shell upon it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 21</DOCNO>
+It is not probable that this monomania in him took its instant rise
+at the precise time of his bodily dismemberment.  Then, in darting at
+the monster, knife in hand, he had but given loose to a sudden,
+passionate, corporal animosity; and when he received the stroke that
+tore him, he probably but felt the agonizing bodily laceration, but
+nothing more.  Yet, when by this collision forced to turn towards
+home, and for long months of days and weeks, Ahab and anguish lay
+stretched together in one hammock, rounding in mid winter that
+dreary, howling Patagonian Cape; then it was, that his torn body and
+gashed soul bled into one another; and so interfusing, made him mad.
+That it was only then, on the homeward voyage, after the encounter,
+that the final monomania seized him, seems all but certain from the
+fact that, at intervals during the passage, he was a raving lunatic;
+and, though unlimbed of a leg, yet such vital strength yet lurked in
+his Egyptian chest, and was moreover intensified by his delirium,
+that his mates were forced to lace him fast, even there, as he
+sailed, raving in his hammock.  In a strait-jacket, he swung to the
+mad rockings of the gales.  And, when running into more sufferable
+latitudes, the ship, with mild stun'sails spread, floated across the
+tranquil tropics, and, to all appearances, the old man's delirium
+seemed left behind him with the Cape Horn swells, and he came forth
+from his dark den into the blessed light and air; even then, when he
+bore that firm, collected front, however pale, and issued his calm
+orders once again; and his mates thanked God the direful madness was
+now gone; even then, Ahab, in his hidden self, raved on.  Human
+madness is oftentimes a cunning and most feline thing.  When you
+think it fled, it may have but become transfigured into some still
+subtler form.  Ahab's full lunacy subsided not, but deepeningly
+contracted; like the unabated Hudson, when that noble Northman flows
+narrowly, but unfathomably through the Highland gorge.  But, as in
+his narrow-flowing monomania, not one jot of Ahab's broad madness had
+been left behind; so in that broad madness, not one jot of his great
+natural intellect had perished.  That before living agent, now became
+the living instrument.  If such a furious trope may stand, his
+special lunacy stormed his general sanity, and carried it, and turned
+all its concentred cannon upon its own mad mark; so that far from
+having lost his strength, Ahab, to that one end, did now possess a
+thousand fold more potency than ever he had sanely brought to bear
+upon any one reasonable object.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 22</DOCNO>
+This is much; yet Ahab's larger, darker, deeper part remains
+unhinted.  But vain to popularize profundities, and all truth is
+profound.  Winding far down from within the very heart of this spiked
+Hotel de Cluny where we here stand--however grand and wonderful, now
+quit it;--and take your way, ye nobler, sadder souls, to those vast
+Roman halls of Thermes; where far beneath the fantastic towers of
+man's upper earth, his root of grandeur, his whole awful essence sits
+in bearded state; an antique buried beneath antiquities, and throned
+on torsoes!  So with a broken throne, the great gods mock that
+captive king; so like a Caryatid, he patient sits, upholding on his
+frozen brow the piled entablatures of ages.  Wind ye down there, ye
+prouder, sadder souls! question that proud, sad king!  A family
+likeness! aye, he did beget ye, ye young exiled royalties; and from
+your grim sire only will the old State-secret come.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 23</DOCNO>
+Now, in his heart, Ahab had some glimpse of this, namely: all my
+means are sane, my motive and my object mad.  Yet without power to
+kill, or change, or shun the fact; he likewise knew that to mankind
+he did long dissemble; in some sort, did still.  But that thing of
+his dissembling was only subject to his perceptibility, not to his
+will determinate.  Nevertheless, so well did he succeed in that
+dissembling, that when with ivory leg he stepped ashore at last, no
+Nantucketer thought him otherwise than but naturally grieved, and
+that to the quick, with the terrible casualty which had overtaken
+him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 24</DOCNO>
+The report of his undeniable delirium at sea was likewise popularly
+ascribed to a kindred cause.  And so too, all the added moodiness
+which always afterwards, to the very day of sailing in the Pequod on
+the present voyage, sat brooding on his brow.  Nor is it so very
+unlikely, that far from distrusting his fitness for another whaling
+voyage, on account of such dark symptoms, the calculating people of
+that prudent isle were inclined to harbor the conceit, that for those
+very reasons he was all the better qualified and set on edge, for a
+pursuit so full of rage and wildness as the bloody hunt of whales.
+Gnawed within and scorched without, with the infixed, unrelenting
+fangs of some incurable idea; such an one, could he be found, would
+seem the very man to dart his iron and lift his lance against the
+most appalling of all brutes.  Or, if for any reason thought to be
+corporeally incapacitated for that, yet such an one would seem
+superlatively competent to cheer and howl on his underlings to the
+attack.  But be all this as it may, certain it is, that with the mad
+secret of his unabated rage bolted up and keyed in him, Ahab had
+purposely sailed upon the present voyage with the one only and
+all-engrossing object of hunting the White Whale.  Had any one of his
+old acquaintances on shore but half dreamed of what was lurking in
+him then, how soon would their aghast and righteous souls have
+wrenched the ship from such a fiendish man!  They were bent on
+profitable cruises, the profit to be counted down in dollars from the
+mint.  He was intent on an audacious, immitigable, and supernatural
+revenge.
+</DOC>
+<DOC>
+<DOCNO>Chapter 41, Paragraph 25</DOCNO>
+Here, then, was this grey-headed, ungodly old man, chasing with
+curses a Job's whale round the world, at the head of a crew, too,
+chiefly made up of mongrel renegades, and castaways, and
+cannibals--morally enfeebled also, by the incompetence of mere
+unaided virtue or right-mindedness in Starbuck, the invunerable
+jollity of indifference and recklessness in Stubb, and the pervading
+mediocrity in Flask.  Such a crew, so officered, seemed specially
+picked and packed by some infernal fatality to help him to his
+monomaniac revenge.  How it was that they so aboundingly responded to
+the old man's ire--by what evil magic their souls were possessed,
+that at times his hate seemed almost theirs; the White Whale as much
+their insufferable foe as his; how all this came to be--what the
+White Whale was to them, or how to their unconscious understandings,
+also, in some dim, unsuspected way, he might have seemed the gliding
+great demon of the seas of life,--all this to explain, would be to
+dive deeper than Ishmael can go.  The subterranean miner that works
+in us all, how can one tell whither leads his shaft by the ever
+shifting, muffled sound of his pick?  Who does not feel the
+irresistible arm drag?  What skiff in tow of a seventy-four can stand
+still?  For one, I gave myself up to the abandonment of the time and
+the place; but while yet all a-rush to encounter the whale, could see
+naught in that brute but the deadliest ill.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 1</DOCNO>
+The Whiteness of The Whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 2</DOCNO>
+What the white whale was to Ahab, has been hinted; what, at times, he
+was to me, as yet remains unsaid.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 3</DOCNO>
+Aside from those more obvious considerations touching Moby Dick,
+which could not but occasionally awaken in any man's soul some alarm,
+there was another thought, or rather vague, nameless horror
+concerning him, which at times by its intensity completely
+overpowered all the rest; and yet so mystical and well nigh ineffable
+was it, that I almost despair of putting it in a comprehensible form.
+It was the whiteness of the whale that above all things appalled me.
+But how can I hope to explain myself here; and yet, in some dim,
+random way, explain myself I must, else all these chapters might be
+naught.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 4</DOCNO>
+Though in many natural objects, whiteness refiningly enhances beauty,
+as if imparting some special virtue of its own, as in marbles,
+japonicas, and pearls; and though various nations have in some way
+recognised a certain royal preeminence in this hue; even the
+barbaric, grand old kings of Pegu placing the title "Lord of the
+White Elephants" above all their other magniloquent ascriptions of
+dominion; and the modern kings of Siam unfurling the same snow-white
+quadruped in the royal standard; and the Hanoverian flag bearing the
+one figure of a snow-white charger; and the great Austrian Empire,
+Caesarian, heir to overlording Rome, having for the imperial colour
+the same imperial hue; and though this pre-eminence in it applies to
+the human race itself, giving the white man ideal mastership over
+every dusky tribe; and though, besides, all this, whiteness has been
+even made significant of gladness, for among the Romans a white stone
+marked a joyful day; and though in other mortal sympathies and
+symbolizings, this same hue is made the emblem of many touching,
+noble things--the innocence of brides, the benignity of age; though
+among the Red Men of America the giving of the white belt of wampum
+was the deepest pledge of honour; though in many climes, whiteness
+typifies the majesty of Justice in the ermine of the Judge, and
+contributes to the daily state of kings and queens drawn by
+milk-white steeds; though even in the higher mysteries of the most
+august religions it has been made the symbol of the divine
+spotlessness and power; by the Persian fire worshippers, the white
+forked flame being held the holiest on the altar; and in the Greek
+mythologies, Great Jove himself being made incarnate in a snow-white
+bull; and though to the noble Iroquois, the midwinter sacrifice of
+the sacred White Dog was by far the holiest festival of their
+theology, that spotless, faithful creature being held the purest
+envoy they could send to the Great Spirit with the annual tidings of
+their own fidelity; and though directly from the Latin word for
+white, all Christian priests derive the name of one part of their
+sacred vesture, the alb or tunic, worn beneath the cassock; and
+though among the holy pomps of the Romish faith, white is specially
+employed in the celebration of the Passion of our Lord; though in the
+Vision of St. John, white robes are given to the redeemed, and the
+four-and-twenty elders stand clothed in white before the great-white
+throne, and the Holy One that sitteth there white like wool; yet for
+all these accumulated associations, with whatever is sweet, and
+honourable, and sublime, there yet lurks an elusive something in the
+innermost idea of this hue, which strikes more of panic to the soul
+than that redness which affrights in blood.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 5</DOCNO>
+This elusive quality it is, which causes the thought of whiteness,
+when divorced from more kindly associations, and coupled with any
+object terrible in itself, to heighten that terror to the furthest
+bounds.  Witness the white bear of the poles, and the white shark of
+the tropics; what but their smooth, flaky whiteness makes them the
+transcendent horrors they are?  That ghastly whiteness it is which
+imparts such an abhorrent mildness, even more loathsome than
+terrific, to the dumb gloating of their aspect.  So that not the
+fierce-fanged tiger in his heraldic coat can so stagger courage as
+the white-shrouded bear or shark.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 6</DOCNO>
+*With reference to the Polar bear, it may possibly be urged by him
+who would fain go still deeper into this matter, that it is not the
+whiteness, separately regarded, which heightens the intolerable
+hideousness of that brute; for, analysed, that heightened
+hideousness, it might be said, only rises from the circumstance, that
+the irresponsible ferociousness of the creature stands invested in
+the fleece of celestial innocence and love; and hence, by bringing
+together two such opposite emotions in our minds, the Polar bear
+frightens us with so unnatural a contrast.  But even assuming all
+this to be true; yet, were it not for the whiteness, you would not
+have that intensified terror.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 7</DOCNO>
+As for the white shark, the white gliding ghostliness of repose in
+that creature, when beheld in his ordinary moods, strangely tallies
+with the same quality in the Polar quadruped.  This peculiarity is
+most vividly hit by the French in the name they bestow upon that
+fish.  The Romish mass for the dead begins with "Requiem eternam"
+(eternal rest), whence REQUIEM denominating the mass itself, and any
+other funeral music.  Now, in allusion to the white, silent stillness
+of death in this shark, and the mild deadliness of his habits, the
+French call him REQUIN.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 8</DOCNO>
+Bethink thee of the albatross, whence come those clouds of spiritual
+wonderment and pale dread, in which that white phantom sails in all
+imaginations?  Not Coleridge first threw that spell; but God's great,
+unflattering laureate, Nature.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 9</DOCNO>
+*I remember the first albatross I ever saw.  It was during a
+prolonged gale, in waters hard upon the Antarctic seas.  From my
+forenoon watch below, I ascended to the overclouded deck; and there,
+dashed upon the main hatches, I saw a regal, feathery thing of
+unspotted whiteness, and with a hooked, Roman bill sublime.  At
+intervals, it arched forth its vast archangel wings, as if to embrace
+some holy ark.  Wondrous flutterings and throbbings shook it.  Though
+bodily unharmed, it uttered cries, as some king's ghost in
+supernatural distress.  Through its inexpressible, strange eyes,
+methought I peeped to secrets which took hold of God.  As Abraham
+before the angels, I bowed myself; the white thing was so white, its
+wings so wide, and in those for ever exiled waters, I had lost the
+miserable warping memories of traditions and of towns.  Long I gazed
+at that prodigy of plumage.  I cannot tell, can only hint, the things
+that darted through me then.  But at last I awoke; and turning, asked
+a sailor what bird was this.  A goney, he replied.  Goney! never had
+heard that name before; is it conceivable that this glorious thing is
+utterly unknown to men ashore! never!  But some time after, I learned
+that goney was some seaman's name for albatross.  So that by no
+possibility could Coleridge's wild Rhyme have had aught to do with
+those mystical impressions which were mine, when I saw that bird upon
+our deck.  For neither had I then read the Rhyme, nor knew the bird
+to be an albatross.  Yet, in saying this, I do but indirectly burnish
+a little brighter the noble merit of the poem and the poet.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 10</DOCNO>
+I assert, then, that in the wondrous bodily whiteness of the bird
+chiefly lurks the secret of the spell; a truth the more evinced in
+this, that by a solecism of terms there are birds called grey
+albatrosses; and these I have frequently seen, but never with such
+emotions as when I beheld the Antarctic fowl.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 11</DOCNO>
+But how had the mystic thing been caught?  Whisper it not, and I will
+tell; with a treacherous hook and line, as the fowl floated on the
+sea.  At last the Captain made a postman of it; tying a lettered,
+leathern tally round its neck, with the ship's time and place; and
+then letting it escape.  But I doubt not, that leathern tally, meant
+for man, was taken off in Heaven, when the white fowl flew to join
+the wing-folding, the invoking, and adoring cherubim!
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 12</DOCNO>
+Most famous in our Western annals and Indian traditions is that of
+the White Steed of the Prairies; a magnificent milk-white charger,
+large-eyed, small-headed, bluff-chested, and with the dignity of a
+thousand monarchs in his lofty, overscorning carriage.  He was the
+elected Xerxes of vast herds of wild horses, whose pastures in those
+days were only fenced by the Rocky Mountains and the Alleghanies.  At
+their flaming head he westward trooped it like that chosen star which
+every evening leads on the hosts of light.  The flashing cascade of
+his mane, the curving comet of his tail, invested him with housings
+more resplendent than gold and silver-beaters could have furnished
+him.  A most imperial and archangelical apparition of that unfallen,
+western world, which to the eyes of the old trappers and hunters
+revived the glories of those primeval times when Adam walked majestic
+as a god, bluff-browed and fearless as this mighty steed.  Whether
+marching amid his aides and marshals in the van of countless cohorts
+that endlessly streamed it over the plains, like an Ohio; or whether
+with his circumambient subjects browsing all around at the horizon,
+the White Steed gallopingly reviewed them with warm nostrils
+reddening through his cool milkiness; in whatever aspect he presented
+himself, always to the bravest Indians he was the object of trembling
+reverence and awe.  Nor can it be questioned from what stands on
+legendary record of this noble horse, that it was his spiritual
+whiteness chiefly, which so clothed him with divineness; and that
+this divineness had that in it which, though commanding worship, at
+the same time enforced a certain nameless terror.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 13</DOCNO>
+But there are other instances where this whiteness loses all that
+accessory and strange glory which invests it in the White Steed and
+Albatross.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 14</DOCNO>
+What is it that in the Albino man so peculiarly repels and often
+shocks the eye, as that sometimes he is loathed by his own kith and
+kin!  It is that whiteness which invests him, a thing expressed by
+the name he bears.  The Albino is as well made as other men--has no
+substantive deformity--and yet this mere aspect of all-pervading
+whiteness makes him more strangely hideous than the ugliest abortion.
+Why should this be so?
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 15</DOCNO>
+Nor, in quite other aspects, does Nature in her least palpable but
+not the less malicious agencies, fail to enlist among her forces this
+crowning attribute of the terrible.  From its snowy aspect, the
+gauntleted ghost of the Southern Seas has been denominated the White
+Squall.  Nor, in some historic instances, has the art of human malice
+omitted so potent an auxiliary.  How wildly it heightens the effect
+of that passage in Froissart, when, masked in the snowy symbol of
+their faction, the desperate White Hoods of Ghent murder their
+bailiff in the market-place!
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 16</DOCNO>
+Nor, in some things, does the common, hereditary experience of all
+mankind fail to bear witness to the supernaturalism of this hue.  It
+cannot well be doubted, that the one visible quality in the aspect of
+the dead which most appals the gazer, is the marble pallor lingering
+there; as if indeed that pallor were as much like the badge of
+consternation in the other world, as of mortal trepidation here.  And
+from that pallor of the dead, we borrow the expressive hue of the
+shroud in which we wrap them.  Nor even in our superstitions do we
+fail to throw the same snowy mantle round our phantoms; all ghosts
+rising in a milk-white fog--Yea, while these terrors seize us, let us
+add, that even the king of terrors, when personified by the
+evangelist, rides on his pallid horse.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 17</DOCNO>
+Therefore, in his other moods, symbolize whatever grand or gracious
+thing he will by whiteness, no man can deny that in its profoundest
+idealized significance it calls up a peculiar apparition to the soul.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 18</DOCNO>
+But though without dissent this point be fixed, how is mortal man to
+account for it?  To analyse it, would seem impossible.  Can we,
+then, by the citation of some of those instances wherein this thing
+of whiteness--though for the time either wholly or in great part
+stripped of all direct associations calculated to impart to it aught
+fearful, but nevertheless, is found to exert over us the same
+sorcery, however modified;--can we thus hope to light upon some
+chance clue to conduct us to the hidden cause we seek?
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 19</DOCNO>
+Let us try.  But in a matter like this, subtlety appeals to subtlety,
+and without imagination no man can follow another into these halls.
+And though, doubtless, some at least of the imaginative impressions
+about to be presented may have been shared by most men, yet few
+perhaps were entirely conscious of them at the time, and therefore
+may not be able to recall them now.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 20</DOCNO>
+Why to the man of untutored ideality, who happens to be but loosely
+acquainted with the peculiar character of the day, does the bare
+mention of Whitsuntide marshal in the fancy such long, dreary,
+speechless processions of slow-pacing pilgrims, down-cast and hooded
+with new-fallen snow?  Or, to the unread, unsophisticated Protestant
+of the Middle American States, why does the passing mention of a
+White Friar or a White Nun, evoke such an eyeless statue in the soul?
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 21</DOCNO>
+Or what is there apart from the traditions of dungeoned warriors and
+kings (which will not wholly account for it) that makes the White
+Tower of London tell so much more strongly on the imagination of an
+untravelled American, than those other storied structures, its
+neighbors--the Byward Tower, or even the Bloody?  And those sublimer
+towers, the White Mountains of New Hampshire, whence, in peculiar
+moods, comes that gigantic ghostliness over the soul at the bare
+mention of that name, while the thought of Virginia's Blue Ridge is
+full of a soft, dewy, distant dreaminess?  Or why, irrespective of
+all latitudes and longitudes, does the name of the White Sea exert
+such a spectralness over the fancy, while that of the Yellow Sea
+lulls us with mortal thoughts of long lacquered mild afternoons on
+the waves, followed by the gaudiest and yet sleepiest of sunsets?
+Or, to choose a wholly unsubstantial instance, purely addressed to
+the fancy, why, in reading the old fairy tales of Central Europe,
+does "the tall pale man" of the Hartz forests, whose changeless
+pallor unrustlingly glides through the green of the groves--why is
+this phantom more terrible than all the whooping imps of the
+Blocksburg?
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 22</DOCNO>
+Nor is it, altogether, the remembrance of her cathedral-toppling
+earthquakes; nor the stampedoes of her frantic seas; nor the
+tearlessness of arid skies that never rain; nor the sight of her
+wide field of leaning spires, wrenched cope-stones, and crosses all
+adroop (like canted yards of anchored fleets); and her suburban
+avenues of house-walls lying over upon each other, as a tossed pack
+of cards;--it is not these things alone which make tearless Lima, the
+strangest, saddest city thou can'st see.  For Lima has taken the
+white veil; and there is a higher horror in this whiteness of her
+woe.  Old as Pizarro, this whiteness keeps her ruins for ever new;
+admits not the cheerful greenness of complete decay; spreads over her
+broken ramparts the rigid pallor of an apoplexy that fixes its own
+distortions.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 23</DOCNO>
+I know that, to the common apprehension, this phenomenon of whiteness
+is not confessed to be the prime agent in exaggerating the terror of
+objects otherwise terrible; nor to the unimaginative mind is there
+aught of terror in those appearances whose awfulness to another mind
+almost solely consists in this one phenomenon, especially when
+exhibited under any form at all approaching to muteness or
+universality.  What I mean by these two statements may perhaps be
+respectively elucidated by the following examples.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 24</DOCNO>
+First: The mariner, when drawing nigh the coasts of foreign lands, if
+by night he hear the roar of breakers, starts to vigilance, and feels
+just enough of trepidation to sharpen all his faculties; but under
+precisely similar circumstances, let him be called from his hammock
+to view his ship sailing through a midnight sea of milky
+whiteness--as if from encircling headlands shoals of combed white
+bears were swimming round him, then he feels a silent, superstitious
+dread; the shrouded phantom of the whitened waters is horrible to him
+as a real ghost; in vain the lead assures him he is still off
+soundings; heart and helm they both go down; he never rests till blue
+water is under him again.  Yet where is the mariner who will tell
+thee, "Sir, it was not so much the fear of striking hidden rocks, as
+the fear of that hideous whiteness that so stirred me?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 25</DOCNO>
+Second: To the native Indian of Peru, the continual sight of the
+snowhowdahed Andes conveys naught of dread, except, perhaps, in the
+mere fancying of the eternal frosted desolateness reigning at such
+vast altitudes, and the natural conceit of what a fearfulness it
+would be to lose oneself in such inhuman solitudes.  Much the same is
+it with the backwoodsman of the West, who with comparative
+indifference views an unbounded prairie sheeted with driven snow, no
+shadow of tree or twig to break the fixed trance of whiteness.  Not
+so the sailor, beholding the scenery of the Antarctic seas; where at
+times, by some infernal trick of legerdemain in the powers of frost
+and air, he, shivering and half shipwrecked, instead of rainbows
+speaking hope and solace to his misery, views what seems a boundless
+churchyard grinning upon him with its lean ice monuments and
+splintered crosses.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 26</DOCNO>
+But thou sayest, methinks that white-lead chapter about whiteness is
+but a white flag hung out from a craven soul; thou surrenderest to a
+hypo, Ishmael.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 27</DOCNO>
+Tell me, why this strong young colt, foaled in some peaceful valley
+of Vermont, far removed from all beasts of prey--why is it that upon
+the sunniest day, if you but shake a fresh buffalo robe behind him,
+so that he cannot even see it, but only smells its wild animal
+muskiness--why will he start, snort, and with bursting eyes paw the
+ground in phrensies of affright?  There is no remembrance in him of
+any gorings of wild creatures in his green northern home, so that the
+strange muskiness he smells cannot recall to him anything associated
+with the experience of former perils; for what knows he, this New
+England colt, of the black bisons of distant Oregon?
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 28</DOCNO>
+No; but here thou beholdest even in a dumb brute, the instinct of the
+knowledge of the demonism in the world.  Though thousands of miles
+from Oregon, still when he smells that savage musk, the rending,
+goring bison herds are as present as to the deserted wild foal of the
+prairies, which this instant they may be trampling into dust.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 29</DOCNO>
+Thus, then, the muffled rollings of a milky sea; the bleak rustlings
+of the festooned frosts of mountains; the desolate shiftings of the
+windrowed snows of prairies; all these, to Ishmael, are as the
+shaking of that buffalo robe to the frightened colt!
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 30</DOCNO>
+Though neither knows where lie the nameless things of which the
+mystic sign gives forth such hints; yet with me, as with the colt,
+somewhere those things must exist.  Though in many of its aspects
+this visible world seems formed in love, the invisible spheres were
+formed in fright.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 31</DOCNO>
+But not yet have we solved the incantation of this whiteness, and
+learned why it appeals with such power to the soul; and more strange
+and far more portentous--why, as we have seen, it is at once the most
+meaning symbol of spiritual things, nay, the very veil of the
+Christian's Deity; and yet should be as it is, the intensifying agent
+in things the most appalling to mankind.
+</DOC>
+<DOC>
+<DOCNO>Chapter 42, Paragraph 32</DOCNO>
+Is it that by its indefiniteness it shadows forth the heartless voids
+and immensities of the universe, and thus stabs us from behind with
+the thought of annihilation, when beholding the white depths of the
+milky way?  Or is it, that as in essence whiteness is not so much a
+colour as the visible absence of colour; and at the same time the
+concrete of all colours; is it for these reasons that there is such a
+dumb blankness, full of meaning, in a wide landscape of snows--a
+colourless, all-colour of atheism from which we shrink?  And when we
+consider that other theory of the natural philosophers, that all
+other earthly hues--every stately or lovely emblazoning--the sweet
+tinges of sunset skies and woods; yea, and the gilded velvets of
+butterflies, and the butterfly cheeks of young girls; all these are
+but subtile deceits, not actually inherent in substances, but only
+laid on from without; so that all deified Nature absolutely paints
+like the harlot, whose allurements cover nothing but the
+charnel-house within; and when we proceed further, and consider that
+the mystical cosmetic which produces every one of her hues, the great
+principle of light, for ever remains white or colourless in itself,
+and if operating without medium upon matter, would touch all objects,
+even tulips and roses, with its own blank tinge--pondering all this,
+the palsied universe lies before us a leper; and like wilful
+travellers in Lapland, who refuse to wear coloured and colouring
+glasses upon their eyes, so the wretched infidel gazes himself blind
+at the monumental white shroud that wraps all the prospect around
+him.  And of all these things the Albino whale was the symbol.
+Wonder ye then at the fiery hunt?
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 1</DOCNO>
+Hark!
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 2</DOCNO>
+"HIST!  Did you hear that noise, Cabaco?
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 3</DOCNO>
+It was the middle-watch; a fair moonlight; the seamen were standing
+in a cordon, extending from one of the fresh-water butts in the
+waist, to the scuttle-butt near the taffrail.  In this manner, they
+passed the buckets to fill the scuttle-butt.  Standing, for the most
+part, on the hallowed precincts of the quarter-deck, they were
+careful not to speak or rustle their feet.  From hand to hand, the
+buckets went in the deepest silence, only broken by the occasional
+flap of a sail, and the steady hum of the unceasingly advancing keel.
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 4</DOCNO>
+It was in the midst of this repose, that Archy, one of the cordon,
+whose post was near the after-hatches, whispered to his neighbor, a
+Cholo, the words above.
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 5</DOCNO>
+"Hist! did you hear that noise, Cabaco?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 6</DOCNO>
+"Take the bucket, will ye, Archy? what noise d'ye mean?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 7</DOCNO>
+"There it is again--under the hatches--don't you hear it--a cough--it
+sounded like a cough."
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 8</DOCNO>
+"Cough be damned!  Pass along that return bucket."
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 9</DOCNO>
+"There again--there it is!--it sounds like two or three sleepers
+turning over, now!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 10</DOCNO>
+"Caramba! have done, shipmate, will ye?  It's the three soaked
+biscuits ye eat for supper turning over inside of ye--nothing else.
+Look to the bucket!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 11</DOCNO>
+"Say what ye will, shipmate; I've sharp ears."
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 12</DOCNO>
+"Aye, you are the chap, ain't ye, that heard the hum of the old
+Quakeress's knitting-needles fifty miles at sea from Nantucket;
+you're the chap."
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 13</DOCNO>
+"Grin away; we'll see what turns up.  Hark ye, Cabaco, there is
+somebody down in the after-hold that has not yet been seen on deck;
+and I suspect our old Mogul knows something of it too.  I heard Stubb
+tell Flask, one morning watch, that there was something of that sort
+in the wind."
+</DOC>
+<DOC>
+<DOCNO>Chapter 43, Paragraph 14</DOCNO>
+"Tish! the bucket!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 1</DOCNO>
+The Chart.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 2</DOCNO>
+Had you followed Captain Ahab down into his cabin after the squall
+that took place on the night succeeding that wild ratification of his
+purpose with his crew, you would have seen him go to a locker in the
+transom, and bringing out a large wrinkled roll of yellowish sea
+charts, spread them before him on his screwed-down table.  Then
+seating himself before it, you would have seen him intently study the
+various lines and shadings which there met his eye; and with slow but
+steady pencil trace additional courses over spaces that before were
+blank.  At intervals, he would refer to piles of old log-books beside
+him, wherein were set down the seasons and places in which, on
+various former voyages of various ships, sperm whales had been
+captured or seen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 3</DOCNO>
+While thus employed, the heavy pewter lamp suspended in chains over
+his head, continually rocked with the motion of the ship, and for
+ever threw shifting gleams and shadows of lines upon his wrinkled
+brow, till it almost seemed that while he himself was marking out
+lines and courses on the wrinkled charts, some invisible pencil was
+also tracing lines and courses upon the deeply marked chart of his
+forehead.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 4</DOCNO>
+But it was not this night in particular that, in the solitude of his
+cabin, Ahab thus pondered over his charts.  Almost every night they
+were brought out; almost every night some pencil marks were effaced,
+and others were substituted.  For with the charts of all four oceans
+before him, Ahab was threading a maze of currents and eddies, with a
+view to the more certain accomplishment of that monomaniac thought of
+his soul.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 5</DOCNO>
+Now, to any one not fully acquainted with the ways of the leviathans,
+it might seem an absurdly hopeless task thus to seek out one solitary
+creature in the unhooped oceans of this planet.  But not so did it
+seem to Ahab, who knew the sets of all tides and currents; and
+thereby calculating the driftings of the sperm whale's food; and,
+also, calling to mind the regular, ascertained seasons for hunting
+him in particular latitudes; could arrive at reasonable surmises,
+almost approaching to certainties, concerning the timeliest day to be
+upon this or that ground in search of his prey.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 6</DOCNO>
+So assured, indeed, is the fact concerning the periodicalness of the
+sperm whale's resorting to given waters, that many hunters believe
+that, could he be closely observed and studied throughout the world;
+were the logs for one voyage of the entire whale fleet carefully
+collated, then the migrations of the sperm whale would be found to
+correspond in invariability to those of the herring-shoals or the
+flights of swallows.  On this hint, attempts have been made to
+construct elaborate migratory charts of the sperm whale.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 7</DOCNO>
+*Since the above was written, the statement is happily borne out by
+an official circular, issued by Lieutenant Maury, of the National
+Observatory, Washington, April 16th, 1851.  By that circular, it
+appears that precisely such a chart is in course of completion; and
+portions of it are presented in the circular.  "This chart divides
+the ocean into districts of five degrees of latitude by five degrees
+of longitude; perpendicularly through each of which districts are
+twelve columns for the twelve months; and horizontally through each
+of which districts are three lines; one to show the number of days
+that have been spent in each month in every district, and the two
+others to show the number of days in which whales, sperm or right,
+have been seen."
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 8</DOCNO>
+Besides, when making a passage from one feeding-ground to another,
+the sperm whales, guided by some infallible instinct--say, rather,
+secret intelligence from the Deity--mostly swim in VEINS, as they are
+called; continuing their way along a given ocean-line with such
+undeviating exactitude, that no ship ever sailed her course, by any
+chart, with one tithe of such marvellous precision.  Though, in these
+cases, the direction taken by any one whale be straight as a
+surveyor's parallel, and though the line of advance be strictly
+confined to its own unavoidable, straight wake, yet the arbitrary
+VEIN in which at these times he is said to swim, generally embraces
+some few miles in width (more or less, as the vein is presumed to
+expand or contract); but never exceeds the visual sweep from the
+whale-ship's mast-heads, when circumspectly gliding along this magic
+zone.  The sum is, that at particular seasons within that breadth and
+along that path, migrating whales may with great confidence be looked
+for.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 9</DOCNO>
+And hence not only at substantiated times, upon well known separate
+feeding-grounds, could Ahab hope to encounter his prey; but in
+crossing the widest expanses of water between those grounds he could,
+by his art, so place and time himself on his way, as even then not to
+be wholly without prospect of a meeting.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 10</DOCNO>
+There was a circumstance which at first sight seemed to entangle his
+delirious but still methodical scheme.  But not so in the reality,
+perhaps.  Though the gregarious sperm whales have their regular
+seasons for particular grounds, yet in general you cannot conclude
+that the herds which haunted such and such a latitude or longitude
+this year, say, will turn out to be identically the same with those
+that were found there the preceding season; though there are peculiar
+and unquestionable instances where the contrary of this has proved
+true.  In general, the same remark, only within a less wide limit,
+applies to the solitaries and hermits among the matured, aged sperm
+whales.  So that though Moby Dick had in a former year been seen, for
+example, on what is called the Seychelle ground in the Indian ocean,
+or Volcano Bay on the Japanese Coast; yet it did not follow, that
+were the Pequod to visit either of those spots at any subsequent
+corresponding season, she would infallibly encounter him there.  So,
+too, with some other feeding grounds, where he had at times revealed
+himself.  But all these seemed only his casual stopping-places and
+ocean-inns, so to speak, not his places of prolonged abode.  And
+where Ahab's chances of accomplishing his object have hitherto been
+spoken of, allusion has only been made to whatever way-side,
+antecedent, extra prospects were his, ere a particular set time or
+place were attained, when all possibilities would become
+probabilities, and, as Ahab fondly thought, every possibility the
+next thing to a certainty.  That particular set time and place were
+conjoined in the one technical phrase--the Season-on-the-Line.  For
+there and then, for several consecutive years, Moby Dick had been
+periodically descried, lingering in those waters for awhile, as the
+sun, in its annual round, loiters for a predicted interval in any one
+sign of the Zodiac.  There it was, too, that most of the deadly
+encounters with the white whale had taken place; there the waves were
+storied with his deeds; there also was that tragic spot where the
+monomaniac old man had found the awful motive to his vengeance.  But
+in the cautious comprehensiveness and unloitering vigilance with
+which Ahab threw his brooding soul into this unfaltering hunt, he
+would not permit himself to rest all his hopes upon the one crowning
+fact above mentioned, however flattering it might be to those hopes;
+nor in the sleeplessness of his vow could he so tranquillize his
+unquiet heart as to postpone all intervening quest.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 11</DOCNO>
+Now, the Pequod had sailed from Nantucket at the very beginning of
+the Season-on-the-Line.  No possible endeavor then could enable her
+commander to make the great passage southwards, double Cape Horn, and
+then running down sixty degrees of latitude arrive in the equatorial
+Pacific in time to cruise there.  Therefore, he must wait for the
+next ensuing season.  Yet the premature hour of the Pequod's sailing
+had, perhaps, been correctly selected by Ahab, with a view to this
+very complexion of things.  Because, an interval of three hundred and
+sixty-five days and nights was before him; an interval which, instead
+of impatiently enduring ashore, he would spend in a miscellaneous
+hunt; if by chance the White Whale, spending his vacation in seas far
+remote from his periodical feeding-grounds, should turn up his
+wrinkled brow off the Persian Gulf, or in the Bengal Bay, or China
+Seas, or in any other waters haunted by his race.  So that Monsoons,
+Pampas, Nor'-Westers, Harmattans, Trades; any wind but the Levanter
+and Simoon, might blow Moby Dick into the devious zig-zag
+world-circle of the Pequod's circumnavigating wake.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 12</DOCNO>
+But granting all this; yet, regarded discreetly and coolly, seems it
+not but a mad idea, this; that in the broad boundless ocean, one
+solitary whale, even if encountered, should be thought capable of
+individual recognition from his hunter, even as a white-bearded Mufti
+in the thronged thoroughfares of Constantinople?  Yes.  For the
+peculiar snow-white brow of Moby Dick, and his snow-white hump, could
+not but be unmistakable.  And have I not tallied the whale, Ahab
+would mutter to himself, as after poring over his charts till long
+after midnight he would throw himself back in reveries--tallied him,
+and shall he escape?  His broad fins are bored, and scalloped out
+like a lost sheep's ear!  And here, his mad mind would run on in a
+breathless race; till a weariness and faintness of pondering came
+over him; and in the open air of the deck he would seek to recover
+his strength.  Ah, God! what trances of torments does that man endure
+who is consumed with one unachieved revengeful desire.  He sleeps
+with clenched hands; and wakes with his own bloody nails in his
+palms.
+</DOC>
+<DOC>
+<DOCNO>Chapter 44, Paragraph 13</DOCNO>
+Often, when forced from his hammock by exhausting and intolerably
+vivid dreams of the night, which, resuming his own intense thoughts
+through the day, carried them on amid a clashing of phrensies, and
+whirled them round and round and round in his blazing brain, till
+the very throbbing of his life-spot became insufferable anguish; and
+when, as was sometimes the case, these spiritual throes in him heaved
+his being up from its base, and a chasm seemed opening in him, from
+which forked flames and lightnings shot up, and accursed fiends
+beckoned him to leap down among them; when this hell in himself
+yawned beneath him, a wild cry would be heard through the ship; and
+with glaring eyes Ahab would burst from his state room, as though
+escaping from a bed that was on fire.  Yet these, perhaps, instead of
+being the unsuppressable symptoms of some latent weakness, or fright
+at his own resolve, were but the plainest tokens of its intensity.
+For, at such times, crazy Ahab, the scheming, unappeasedly steadfast
+hunter of the white whale; this Ahab that had gone to his hammock,
+was not the agent that so caused him to burst from it in horror
+again.  The latter was the eternal, living principle or soul in him;
+and in sleep, being for the time dissociated from the characterizing
+mind, which at other times employed it for its outer vehicle or
+agent, it spontaneously sought escape from the scorching contiguity
+of the frantic thing, of which, for the time, it was no longer an
+integral.  But as the mind does not exist unless leagued with the
+soul, therefore it must have been that, in Ahab's case, yielding up
+all his thoughts and fancies to his one supreme purpose; that
+purpose, by its own sheer inveteracy of will, forced itself against
+gods and devils into a kind of self-assumed, independent being of its
+own.  Nay, could grimly live and burn, while the common vitality to
+which it was conjoined, fled horror-stricken from the unbidden and
+unfathered birth.  Therefore, the tormented spirit that glared out of
+bodily eyes, when what seemed Ahab rushed from his room, was for the
+time but a vacated thing, a formless somnambulistic being, a ray of
+living light, to be sure, but without an object to colour, and
+therefore a blankness in itself.  God help thee, old man, thy
+thoughts have created a creature in thee; and he whose intense
+thinking thus makes him a Prometheus; a vulture feeds upon that heart
+for ever; that vulture the very creature he creates.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 1</DOCNO>
+The Affidavit.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 2</DOCNO>
+So far as what there may be of a narrative in this book; and, indeed,
+as indirectly touching one or two very interesting and curious
+particulars in the habits of sperm whales, the foregoing chapter, in
+its earlier part, is as important a one as will be found in this
+volume; but the leading matter of it requires to be still further and
+more familiarly enlarged upon, in order to be adequately understood,
+and moreover to take away any incredulity which a profound ignorance
+of the entire subject may induce in some minds, as to the natural
+verity of the main points of this affair.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 3</DOCNO>
+I care not to perform this part of my task methodically; but shall be
+content to produce the desired impression by separate citations of
+items, practically or reliably known to me as a whaleman; and from
+these citations, I take it--the conclusion aimed at will naturally
+follow of itself.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 4</DOCNO>
+First: I have personally known three instances where a whale, after
+receiving a harpoon, has effected a complete escape; and, after an
+interval (in one instance of three years), has been again struck by
+the same hand, and slain; when the two irons, both marked by the same
+private cypher, have been taken from the body.  In the instance where
+three years intervened between the flinging of the two harpoons; and
+I think it may have been something more than that; the man who darted
+them happening, in the interval, to go in a trading ship on a voyage
+to Africa, went ashore there, joined a discovery party, and
+penetrated far into the interior, where he travelled for a period of
+nearly two years, often endangered by serpents, savages, tigers,
+poisonous miasmas, with all the other common perils incident to
+wandering in the heart of unknown regions.  Meanwhile, the whale he
+had struck must also have been on its travels; no doubt it had thrice
+circumnavigated the globe, brushing with its flanks all the coasts of
+Africa; but to no purpose.  This man and this whale again came
+together, and the one vanquished the other.  I say I, myself, have
+known three instances similar to this; that is in two of them I saw
+the whales struck; and, upon the second attack, saw the two irons
+with the respective marks cut in them, afterwards taken from the dead
+fish.  In the three-year instance, it so fell out that I was in the
+boat both times, first and last, and the last time distinctly
+recognised a peculiar sort of huge mole under the whale's eye, which
+I had observed there three years previous.  I say three years, but I
+am pretty sure it was more than that.  Here are three instances,
+then, which I personally know the truth of; but I have heard of many
+other instances from persons whose veracity in the matter there is no
+good ground to impeach.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 5</DOCNO>
+Secondly: It is well known in the Sperm Whale Fishery, however
+ignorant the world ashore may be of it, that there have been several
+memorable historical instances where a particular whale in the ocean
+has been at distant times and places popularly cognisable.  Why such
+a whale became thus marked was not altogether and originally owing to
+his bodily peculiarities as distinguished from other whales; for
+however peculiar in that respect any chance whale may be, they soon
+put an end to his peculiarities by killing him, and boiling him down
+into a peculiarly valuable oil.  No: the reason was this: that from
+the fatal experiences of the fishery there hung a terrible prestige
+of perilousness about such a whale as there did about Rinaldo
+Rinaldini, insomuch that most fishermen were content to recognise him
+by merely touching their tarpaulins when he would be discovered
+lounging by them on the sea, without seeking to cultivate a more
+intimate acquaintance.  Like some poor devils ashore that happen to
+know an irascible great man, they make distant unobtrusive
+salutations to him in the street, lest if they pursued the
+acquaintance further, they might receive a summary thump for their
+presumption.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 6</DOCNO>
+But not only did each of these famous whales enjoy great individual
+celebrity--Nay, you may call it an ocean-wide renown; not only was he
+famous in life and now is immortal in forecastle stories after death,
+but he was admitted into all the rights, privileges, and distinctions
+of a name; had as much a name indeed as Cambyses or Caesar.  Was it
+not so, O Timor Tom! thou famed leviathan, scarred like an iceberg,
+who so long did'st lurk in the Oriental straits of that name, whose
+spout was oft seen from the palmy beach of Ombay?  Was it not so, O
+New Zealand Jack! thou terror of all cruisers that crossed their
+wakes in the vicinity of the Tattoo Land?  Was it not so, O Morquan!
+King of Japan, whose lofty jet they say at times assumed the
+semblance of a snow-white cross against the sky?  Was it not so, O
+Don Miguel! thou Chilian whale, marked like an old tortoise with
+mystic hieroglyphics upon the back!  In plain prose, here are four
+whales as well known to the students of Cetacean History as Marius or
+Sylla to the classic scholar.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 7</DOCNO>
+But this is not all.  New Zealand Tom and Don Miguel, after at
+various times creating great havoc among the boats of different
+vessels, were finally gone in quest of, systematically hunted out,
+chased and killed by valiant whaling captains, who heaved up their
+anchors with that express object as much in view, as in setting out
+through the Narragansett Woods, Captain Butler of old had it in his
+mind to capture that notorious murderous savage Annawon, the headmost
+warrior of the Indian King Philip.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 8</DOCNO>
+I do not know where I can find a better place than just here, to make
+mention of one or two other things, which to me seem important, as in
+printed form establishing in all respects the reasonableness of the
+whole story of the White Whale, more especially the catastrophe.  For
+this is one of those disheartening instances where truth requires
+full as much bolstering as error.  So ignorant are most landsmen of
+some of the plainest and most palpable wonders of the world, that
+without some hints touching the plain facts, historical and
+otherwise, of the fishery, they might scout at Moby Dick as a
+monstrous fable, or still worse and more detestable, a hideous and
+intolerable allegory.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 9</DOCNO>
+First: Though most men have some vague flitting ideas of the general
+perils of the grand fishery, yet they have nothing like a fixed,
+vivid conception of those perils, and the frequency with which they
+recur.  One reason perhaps is, that not one in fifty of the actual
+disasters and deaths by casualties in the fishery, ever finds a
+public record at home, however transient and immediately forgotten
+that record.  Do you suppose that that poor fellow there, who this
+moment perhaps caught by the whale-line off the coast of New Guinea,
+is being carried down to the bottom of the sea by the sounding
+leviathan--do you suppose that that poor fellow's name will appear in
+the newspaper obituary you will read to-morrow at your breakfast?
+No: because the mails are very irregular between here and New Guinea.
+In fact, did you ever hear what might be called regular news direct
+or indirect from New Guinea?  Yet I tell you that upon one particular
+voyage which I made to the Pacific, among many others we spoke thirty
+different ships, every one of which had had a death by a whale, some
+of them more than one, and three that had each lost a boat's crew.
+For God's sake, be economical with your lamps and candles! not a
+gallon you burn, but at least one drop of man's blood was spilled for
+it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 10</DOCNO>
+Secondly: People ashore have indeed some indefinite idea that a whale
+is an enormous creature of enormous power; but I have ever found that
+when narrating to them some specific example of this two-fold
+enormousness, they have significantly complimented me upon my
+facetiousness; when, I declare upon my soul, I had no more idea of
+being facetious than Moses, when he wrote the history of the plagues
+of Egypt.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 11</DOCNO>
+But fortunately the special point I here seek can be established upon
+testimony entirely independent of my own.  That point is this: The
+Sperm Whale is in some cases sufficiently powerful, knowing, and
+judiciously malicious, as with direct aforethought to stave in,
+utterly destroy, and sink a large ship; and what is more, the Sperm
+Whale HAS done it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 12</DOCNO>
+First: In the year 1820 the ship Essex, Captain Pollard, of
+Nantucket, was cruising in the Pacific Ocean.  One day she saw
+spouts, lowered her boats, and gave chase to a shoal of sperm whales.
+Ere long, several of the whales were wounded; when, suddenly, a very
+large whale escaping from the boats, issued from the shoal, and bore
+directly down upon the ship.  Dashing his forehead against her hull,
+he so stove her in, that in less than "ten minutes" she settled down
+and fell over.  Not a surviving plank of her has been seen since.
+After the severest exposure, part of the crew reached the land in
+their boats.  Being returned home at last, Captain Pollard once more
+sailed for the Pacific in command of another ship, but the gods
+shipwrecked him again upon unknown rocks and breakers; for the second
+time his ship was utterly lost, and forthwith forswearing the sea, he
+has never tempted it since.  At this day Captain Pollard is a
+resident of Nantucket.  I have seen Owen Chace, who was chief mate of
+the Essex at the time of the tragedy; I have read his plain and
+faithful narrative; I have conversed with his son; and all this
+within a few miles of the scene of the catastrophe.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 13</DOCNO>
+*The following are extracts from Chace's narrative: "Every fact
+seemed to warrant me in concluding that it was anything but chance
+which directed his operations; he made two several attacks upon the
+ship, at a short interval between them, both of which, according to
+their direction, were calculated to do us the most injury, by being
+made ahead, and thereby combining the speed of the two objects for
+the shock; to effect which, the exact manoeuvres which he made were
+necessary.  His aspect was most horrible, and such as indicated
+resentment and fury.  He came directly from the shoal which we had
+just before entered, and in which we had struck three of his
+companions, as if fired with revenge for their sufferings."  Again:
+"At all events, the whole circumstances taken together, all happening
+before my own eyes, and producing, at the time, impressions in my
+mind of decided, calculating mischief, on the part of the whale (many
+of which impressions I cannot now recall), induce me to be satisfied
+that I am correct in my opinion."
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 14</DOCNO>
+Here are his reflections some time after quitting the ship, during a
+black night an open boat, when almost despairing of reaching any
+hospitable shore.  "The dark ocean and swelling waters were nothing;
+the fears of being swallowed up by some dreadful tempest, or dashed
+upon hidden rocks, with all the other ordinary subjects of fearful
+contemplation, seemed scarcely entitled to a moment's thought; the
+dismal looking wreck, and THE HORRID ASPECT AND REVENGE OF THE WHALE,
+wholly engrossed my reflections, until day again made its
+appearance."
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 15</DOCNO>
+In another place--p. 45,--he speaks of "THE MYSTERIOUS AND MORTAL
+ATTACK OF THE ANIMAL."
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 16</DOCNO>
+Secondly: The ship Union, also of Nantucket, was in the year 1807
+totally lost off the Azores by a similar onset, but the authentic
+particulars of this catastrophe I have never chanced to encounter,
+though from the whale hunters I have now and then heard casual
+allusions to it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 17</DOCNO>
+Thirdly: Some eighteen or twenty years ago Commodore J---, then
+commanding an American sloop-of-war of the first class, happened to
+be dining with a party of whaling captains, on board a Nantucket ship
+in the harbor of Oahu, Sandwich Islands.  Conversation turning upon
+whales, the Commodore was pleased to be sceptical touching the
+amazing strength ascribed to them by the professional gentlemen
+present.  He peremptorily denied for example, that any whale could so
+smite his stout sloop-of-war as to cause her to leak so much as a
+thimbleful.  Very good; but there is more coming.  Some weeks after,
+the Commodore set sail in this impregnable craft for Valparaiso.  But
+he was stopped on the way by a portly sperm whale, that begged a few
+moments' confidential business with him.  That business consisted in
+fetching the Commodore's craft such a thwack, that with all his pumps
+going he made straight for the nearest port to heave down and repair.
+I am not superstitious, but I consider the Commodore's interview
+with that whale as providential.  Was not Saul of Tarsus converted
+from unbelief by a similar fright?  I tell you, the sperm whale will
+stand no nonsense.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 18</DOCNO>
+I will now refer you to Langsdorff's Voyages for a little
+circumstance in point, peculiarly interesting to the writer hereof.
+Langsdorff, you must know by the way, was attached to the Russian
+Admiral Krusenstern's famous Discovery Expedition in the beginning of
+the present century.  Captain Langsdorff thus begins his seventeenth
+chapter:
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 19</DOCNO>
+"By the thirteenth of May our ship was ready to sail, and the next
+day we were out in the open sea, on our way to Ochotsh.  The weather
+was very clear and fine, but so intolerably cold that we were obliged
+to keep on our fur clothing.  For some days we had very little wind;
+it was not till the nineteenth that a brisk gale from the northwest
+sprang up.  An uncommon large whale, the body of which was larger
+than the ship itself, lay almost at the surface of the water, but was
+not perceived by any one on board till the moment when the ship,
+which was in full sail, was almost upon him, so that it was
+impossible to prevent its striking against him.  We were thus placed
+in the most imminent danger, as this gigantic creature, setting up
+its back, raised the ship three feet at least out of the water.  The
+masts reeled, and the sails fell altogether, while we who were below
+all sprang instantly upon the deck, concluding that we had struck
+upon some rock; instead of this we saw the monster sailing off with
+the utmost gravity and solemnity.  Captain D'Wolf applied immediately
+to the pumps to examine whether or not the vessel had received any
+damage from the shock, but we found that very happily it had escaped
+entirely uninjured."
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 20</DOCNO>
+Now, the Captain D'Wolf here alluded to as commanding the ship in
+question, is a New Englander, who, after a long life of unusual
+adventures as a sea-captain, this day resides in the village of
+Dorchester near Boston.  I have the honour of being a nephew of his.
+I have particularly questioned him concerning this passage in
+Langsdorff.  He substantiates every word.  The ship, however, was by
+no means a large one: a Russian craft built on the Siberian coast,
+and purchased by my uncle after bartering away the vessel in which he
+sailed from home.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 21</DOCNO>
+In that up and down manly book of old-fashioned adventure, so full,
+too, of honest wonders--the voyage of Lionel Wafer, one of ancient
+Dampier's old chums--I found a little matter set down so like that
+just quoted from Langsdorff, that I cannot forbear inserting it here
+for a corroborative example, if such be needed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 22</DOCNO>
+Lionel, it seems, was on his way to "John Ferdinando," as he calls
+the modern Juan Fernandes.  "In our way thither," he says, "about
+four o'clock in the morning, when we were about one hundred and fifty
+leagues from the Main of America, our ship felt a terrible shock,
+which put our men in such consternation that they could hardly tell
+where they were or what to think; but every one began to prepare for
+death.  And, indeed, the shock was so sudden and violent, that we
+took it for granted the ship had struck against a rock; but when the
+amazement was a little over, we cast the lead, and sounded, but found
+no ground.  ....  The suddenness of the shock made the guns leap in
+their carriages, and several of the men were shaken out of their
+hammocks.  Captain Davis, who lay with his head on a gun, was thrown
+out of his cabin!"  Lionel then goes on to impute the shock to an
+earthquake, and seems to substantiate the imputation by stating that
+a great earthquake, somewhere about that time, did actually do great
+mischief along the Spanish land.  But I should not much wonder if, in
+the darkness of that early hour of the morning, the shock was after
+all caused by an unseen whale vertically bumping the hull from
+beneath.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 23</DOCNO>
+I might proceed with several more examples, one way or another known
+to me, of the great power and malice at times of the sperm whale.  In
+more than one instance, he has been known, not only to chase the
+assailing boats back to their ships, but to pursue the ship itself,
+and long withstand all the lances hurled at him from its decks.  The
+English ship Pusie Hall can tell a story on that head; and, as for
+his strength, let me say, that there have been examples where the
+lines attached to a running sperm whale have, in a calm, been
+transferred to the ship, and secured there; the whale towing her
+great hull through the water, as a horse walks off with a cart.
+Again, it is very often observed that, if the sperm whale, once
+struck, is allowed time to rally, he then acts, not so often with
+blind rage, as with wilful, deliberate designs of destruction to his
+pursuers; nor is it without conveying some eloquent indication of his
+character, that upon being attacked he will frequently open his
+mouth, and retain it in that dread expansion for several consecutive
+minutes.  But I must be content with only one more and a concluding
+illustration; a remarkable and most significant one, by which you
+will not fail to see, that not only is the most marvellous event in
+this book corroborated by plain facts of the present day, but that
+these marvels (like all marvels) are mere repetitions of the ages; so
+that for the millionth time we say amen with Solomon--Verily there is
+nothing new under the sun.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 24</DOCNO>
+In the sixth Christian century lived Procopius, a Christian
+magistrate of Constantinople, in the days when Justinian was Emperor
+and Belisarius general.  As many know, he wrote the history of his
+own times, a work every way of uncommon value.  By the best
+authorities, he has always been considered a most trustworthy and
+unexaggerating historian, except in some one or two particulars, not
+at all affecting the matter presently to be mentioned.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 25</DOCNO>
+Now, in this history of his, Procopius mentions that, during the term
+of his prefecture at Constantinople, a great sea-monster was captured
+in the neighboring Propontis, or Sea of Marmora, after having
+destroyed vessels at intervals in those waters for a period of more
+than fifty years.  A fact thus set down in substantial history cannot
+easily be gainsaid.  Nor is there any reason it should be.  Of what
+precise species this sea-monster was, is not mentioned.  But as he
+destroyed ships, as well as for other reasons, he must have been a
+whale; and I am strongly inclined to think a sperm whale.  And I will
+tell you why.  For a long time I fancied that the sperm whale had
+been always unknown in the Mediterranean and the deep waters
+connecting with it.  Even now I am certain that those seas are not,
+and perhaps never can be, in the present constitution of things, a
+place for his habitual gregarious resort.  But further investigations
+have recently proved to me, that in modern times there have been
+isolated instances of the presence of the sperm whale in the
+Mediterranean.  I am told, on good authority, that on the Barbary
+coast, a Commodore Davis of the British navy found the skeleton of a
+sperm whale.  Now, as a vessel of war readily passes through the
+Dardanelles, hence a sperm whale could, by the same route, pass out
+of the Mediterranean into the Propontis.
+</DOC>
+<DOC>
+<DOCNO>Chapter 45, Paragraph 26</DOCNO>
+In the Propontis, as far as I can learn, none of that peculiar
+substance called BRIT is to be found, the aliment of the right whale.
+But I have every reason to believe that the food of the sperm
+whale--squid or cuttle-fish--lurks at the bottom of that sea, because
+large creatures, but by no means the largest of that sort, have been
+found at its surface.  If, then, you properly put these statements
+together, and reason upon them a bit, you will clearly perceive that,
+according to all human reasoning, Procopius's sea-monster, that for
+half a century stove the ships of a Roman Emperor, must in all
+probability have been a sperm whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 46, Paragraph 1</DOCNO>
+Surmises.
+</DOC>
+<DOC>
+<DOCNO>Chapter 46, Paragraph 2</DOCNO>
+Though, consumed with the hot fire of his purpose, Ahab in all his
+thoughts and actions ever had in view the ultimate capture of Moby
+Dick; though he seemed ready to sacrifice all mortal interests to
+that one passion; nevertheless it may have been that he was by nature
+and long habituation far too wedded to a fiery whaleman's ways,
+altogether to abandon the collateral prosecution of the voyage.  Or
+at least if this were otherwise, there were not wanting other motives
+much more influential with him.  It would be refining too much,
+perhaps, even considering his monomania, to hint that his
+vindictiveness towards the White Whale might have possibly extended
+itself in some degree to all sperm whales, and that the more monsters
+he slew by so much the more he multiplied the chances that each
+subsequently encountered whale would prove to be the hated one he
+hunted.  But if such an hypothesis be indeed exceptionable, there
+were still additional considerations which, though not so strictly
+according with the wildness of his ruling passion, yet were by no
+means incapable of swaying him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 46, Paragraph 3</DOCNO>
+To accomplish his object Ahab must use tools; and of all tools used
+in the shadow of the moon, men are most apt to get out of order.  He
+knew, for example, that however magnetic his ascendency in some
+respects was over Starbuck, yet that ascendency did not cover the
+complete spiritual man any more than mere corporeal superiority
+involves intellectual mastership; for to the purely spiritual, the
+intellectual but stand in a sort of corporeal relation.  Starbuck's
+body and Starbuck's coerced will were Ahab's, so long as Ahab kept
+his magnet at Starbuck's brain; still he knew that for all this the
+chief mate, in his soul, abhorred his captain's quest, and could he,
+would joyfully disintegrate himself from it, or even frustrate it.
+It might be that a long interval would elapse ere the White Whale was
+seen.  During that long interval Starbuck would ever be apt to fall
+into open relapses of rebellion against his captain's leadership,
+unless some ordinary, prudential, circumstantial influences were
+brought to bear upon him.  Not only that, but the subtle insanity of
+Ahab respecting Moby Dick was noways more significantly manifested
+than in his superlative sense and shrewdness in foreseeing that, for
+the present, the hunt should in some way be stripped of that strange
+imaginative impiousness which naturally invested it; that the full
+terror of the voyage must be kept withdrawn into the obscure
+background (for few men's courage is proof against protracted
+meditation unrelieved by action); that when they stood their long
+night watches, his officers and men must have some nearer things to
+think of than Moby Dick.  For however eagerly and impetuously the
+savage crew had hailed the announcement of his quest; yet all sailors
+of all sorts are more or less capricious and unreliable--they live in
+the varying outer weather, and they inhale its fickleness--and when
+retained for any object remote and blank in the pursuit, however
+promissory of life and passion in the end, it is above all things
+requisite that temporary interests and employments should intervene
+and hold them healthily suspended for the final dash.
+</DOC>
+<DOC>
+<DOCNO>Chapter 46, Paragraph 4</DOCNO>
+Nor was Ahab unmindful of another thing.  In times of strong emotion
+mankind disdain all base considerations; but such times are
+evanescent.  The permanent constitutional condition of the
+manufactured man, thought Ahab, is sordidness.  Granting that the
+White Whale fully incites the hearts of this my savage crew, and
+playing round their savageness even breeds a certain generous
+knight-errantism in them, still, while for the love of it they give
+chase to Moby Dick, they must also have food for their more common,
+daily appetites.  For even the high lifted and chivalric Crusaders of
+old times were not content to traverse two thousand miles of land to
+fight for their holy sepulchre, without committing burglaries,
+picking pockets, and gaining other pious perquisites by the way.  Had
+they been strictly held to their one final and romantic object--that
+final and romantic object, too many would have turned from in
+disgust.  I will not strip these men, thought Ahab, of all hopes of
+cash--aye, cash.  They may scorn cash now; but let some months go by,
+and no perspective promise of it to them, and then this same
+quiescent cash all at once mutinying in them, this same cash would
+soon cashier Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 46, Paragraph 5</DOCNO>
+Nor was there wanting still another precautionary motive more related
+to Ahab personally.  Having impulsively, it is probable, and perhaps
+somewhat prematurely revealed the prime but private purpose of the
+Pequod's voyage, Ahab was now entirely conscious that, in so doing,
+he had indirectly laid himself open to the unanswerable charge of
+usurpation; and with perfect impunity, both moral and legal, his crew
+if so disposed, and to that end competent, could refuse all further
+obedience to him, and even violently wrest from him the command.
+>From even the barely hinted imputation of usurpation, and the
+possible consequences of such a suppressed impression gaining ground,
+Ahab must of course have been most anxious to protect himself.  That
+protection could only consist in his own predominating brain and
+heart and hand, backed by a heedful, closely calculating attention to
+every minute atmospheric influence which it was possible for his crew
+to be subjected to.
+</DOC>
+<DOC>
+<DOCNO>Chapter 46, Paragraph 6</DOCNO>
+For all these reasons then, and others perhaps too analytic to be
+verbally developed here, Ahab plainly saw that he must still in a
+good degree continue true to the natural, nominal purpose of the
+Pequod's voyage; observe all customary usages; and not only that, but
+force himself to evince all his well known passionate interest in the
+general pursuit of his profession.
+</DOC>
+<DOC>
+<DOCNO>Chapter 46, Paragraph 7</DOCNO>
+Be all this as it may, his voice was now often heard hailing the
+three mast-heads and admonishing them to keep a bright look-out, and
+not omit reporting even a porpoise.  This vigilance was not long
+without reward.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 1</DOCNO>
+The Mat-Maker.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 2</DOCNO>
+It was a cloudy, sultry afternoon; the seamen were lazily lounging
+about the decks, or vacantly gazing over into the lead-coloured
+waters.  Queequeg and I were mildly employed weaving what is called a
+sword-mat, for an additional lashing to our boat.  So still and
+subdued and yet somehow preluding was all the scene, and such an
+incantation of reverie lurked in the air, that each silent sailor
+seemed resolved into his own invisible self.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 3</DOCNO>
+I was the attendant or page of Queequeg, while busy at the mat.  As I
+kept passing and repassing the filling or woof of marline between the
+long yarns of the warp, using my own hand for the shuttle, and as
+Queequeg, standing sideways, ever and anon slid his heavy oaken sword
+between the threads, and idly looking off upon the water, carelessly
+and unthinkingly drove home every yarn: I say so strange a
+dreaminess did there then reign all over the ship and all over the
+sea, only broken by the intermitting dull sound of the sword, that it
+seemed as if this were the Loom of Time, and I myself were a shuttle
+mechanically weaving and weaving away at the Fates.  There lay the
+fixed threads of the warp subject to but one single, ever returning,
+unchanging vibration, and that vibration merely enough to admit of
+the crosswise interblending of other threads with its own.  This warp
+seemed necessity; and here, thought I, with my own hand I ply my own
+shuttle and weave my own destiny into these unalterable threads.
+Meantime, Queequeg's impulsive, indifferent sword, sometimes hitting
+the woof slantingly, or crookedly, or strongly, or weakly, as the
+case might be; and by this difference in the concluding blow
+producing a corresponding contrast in the final aspect of the
+completed fabric; this savage's sword, thought I, which thus finally
+shapes and fashions both warp and woof; this easy, indifferent sword
+must be chance--aye, chance, free will, and necessity--nowise
+incompatible--all interweavingly working together.  The straight warp
+of necessity, not to be swerved from its ultimate course--its every
+alternating vibration, indeed, only tending to that; free will still
+free to ply her shuttle between given threads; and chance, though
+restrained in its play within the right lines of necessity, and
+sideways in its motions directed by free will, though thus prescribed
+to by both, chance by turns rules either, and has the last featuring
+blow at events.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 4</DOCNO>
+Thus we were weaving and weaving away when I started at a sound so
+strange, long drawn, and musically wild and unearthly, that the ball
+of free will dropped from my hand, and I stood gazing up at the
+clouds whence that voice dropped like a wing.  High aloft in the
+cross-trees was that mad Gay-Header, Tashtego.  His body was reaching
+eagerly forward, his hand stretched out like a wand, and at brief
+sudden intervals he continued his cries.  To be sure the same sound
+was that very moment perhaps being heard all over the seas, from
+hundreds of whalemen's look-outs perched as high in the air; but from
+few of those lungs could that accustomed old cry have derived such a
+marvellous cadence as from Tashtego the Indian's.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 5</DOCNO>
+As he stood hovering over you half suspended in air, so wildly and
+eagerly peering towards the horizon, you would have thought him some
+prophet or seer beholding the shadows of Fate, and by those wild
+cries announcing their coming.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 6</DOCNO>
+"There she blows! there! there! there! she blows! she blows!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 7</DOCNO>
+"Where-away?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 8</DOCNO>
+"On the lee-beam, about two miles off! a school of them!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 9</DOCNO>
+Instantly all was commotion.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 10</DOCNO>
+The Sperm Whale blows as a clock ticks, with the same undeviating and
+reliable uniformity.  And thereby whalemen distinguish this fish from
+other tribes of his genus.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 11</DOCNO>
+"There go flukes!" was now the cry from Tashtego; and the whales
+disappeared.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 12</DOCNO>
+"Quick, steward!" cried Ahab.  "Time! time!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 13</DOCNO>
+Dough-Boy hurried below, glanced at the watch, and reported the exact
+minute to Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 14</DOCNO>
+The ship was now kept away from the wind, and she went gently rolling
+before it.  Tashtego reporting that the whales had gone down heading
+to leeward, we confidently looked to see them again directly in
+advance of our bows.  For that singular craft at times evinced by the
+Sperm Whale when, sounding with his head in one direction, he
+nevertheless, while concealed beneath the surface, mills round, and
+swiftly swims off in the opposite quarter--this deceitfulness of his
+could not now be in action; for there was no reason to suppose that
+the fish seen by Tashtego had been in any way alarmed, or indeed knew
+at all of our vicinity.  One of the men selected for
+shipkeepers--that is, those not appointed to the boats, by this time
+relieved the Indian at the main-mast head.  The sailors at the fore
+and mizzen had come down; the line tubs were fixed in their places;
+the cranes were thrust out; the mainyard was backed, and the three
+boats swung over the sea like three samphire baskets over high
+cliffs.  Outside of the bulwarks their eager crews with one hand
+clung to the rail, while one foot was expectantly poised on the
+gunwale.  So look the long line of man-of-war's men about to throw
+themselves on board an enemy's ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 47, Paragraph 15</DOCNO>
+But at this critical instant a sudden exclamation was heard that took
+every eye from the whale.  With a start all glared at dark Ahab, who
+was surrounded by five dusky phantoms that seemed fresh formed out of
+air.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 1</DOCNO>
+The First Lowering.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 2</DOCNO>
+The phantoms, for so they then seemed, were flitting on the other
+side of the deck, and, with a noiseless celerity, were casting loose
+the tackles and bands of the boat which swung there.  This boat had
+always been deemed one of the spare boats, though technically called
+the captain's, on account of its hanging from the starboard quarter.
+The figure that now stood by its bows was tall and swart, with one
+white tooth evilly protruding from its steel-like lips.  A rumpled
+Chinese jacket of black cotton funereally invested him, with wide
+black trowsers of the same dark stuff.  But strangely crowning this
+ebonness was a glistening white plaited turban, the living hair
+braided and coiled round and round upon his head.  Less swart in
+aspect, the companions of this figure were of that vivid,
+tiger-yellow complexion peculiar to some of the aboriginal natives of
+the Manillas;--a race notorious for a certain diabolism of subtilty,
+and by some honest white mariners supposed to be the paid spies and
+secret confidential agents on the water of the devil, their lord,
+whose counting-room they suppose to be elsewhere.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 3</DOCNO>
+While yet the wondering ship's company were gazing upon these
+strangers, Ahab cried out to the white-turbaned old man at their
+head, "All ready there, Fedallah?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 4</DOCNO>
+"Ready," was the half-hissed reply.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 5</DOCNO>
+"Lower away then; d'ye hear?" shouting across the deck.  "Lower away
+there, I say."
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 6</DOCNO>
+Such was the thunder of his voice, that spite of their amazement the
+men sprang over the rail; the sheaves whirled round in the blocks;
+with a wallow, the three boats dropped into the sea; while, with a
+dexterous, off-handed daring, unknown in any other vocation, the
+sailors, goat-like, leaped down the rolling ship's side into the
+tossed boats below.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 7</DOCNO>
+Hardly had they pulled out from under the ship's lee, when a fourth
+keel, coming from the windward side, pulled round under the stern,
+and showed the five strangers rowing Ahab, who, standing erect in the
+stern, loudly hailed Starbuck, Stubb, and Flask, to spread themselves
+widely, so as to cover a large expanse of water.  But with all their
+eyes again riveted upon the swart Fedallah and his crew, the inmates
+of the other boats obeyed not the command.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 8</DOCNO>
+"Captain Ahab?--" said Starbuck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 9</DOCNO>
+"Spread yourselves," cried Ahab; "give way, all four boats.  Thou,
+Flask, pull out more to leeward!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 10</DOCNO>
+"Aye, aye, sir," cheerily cried little King-Post, sweeping round his
+great steering oar.  "Lay back!" addressing his crew.
+"There!--there!--there again!  There she blows right ahead,
+boys!--lay back!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 11</DOCNO>
+"Never heed yonder yellow boys, Archy."
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 12</DOCNO>
+"Oh, I don't mind'em, sir," said Archy; "I knew it all before now.
+Didn't I hear 'em in the hold?  And didn't I tell Cabaco here of it?
+What say ye, Cabaco?  They are stowaways, Mr. Flask."
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 13</DOCNO>
+"Pull, pull, my fine hearts-alive; pull, my children; pull, my little
+ones," drawlingly and soothingly sighed Stubb to his crew, some of
+whom still showed signs of uneasiness.  "Why don't you break your
+backbones, my boys?  What is it you stare at?  Those chaps in yonder
+boat?  Tut!  They are only five more hands come to help us--never
+mind from where--the more the merrier.  Pull, then, do pull; never
+mind the brimstone--devils are good fellows enough.  So, so; there
+you are now; that's the stroke for a thousand pounds; that's the
+stroke to sweep the stakes!  Hurrah for the gold cup of sperm oil, my
+heroes!  Three cheers, men--all hearts alive!  Easy, easy; don't be
+in a hurry--don't be in a hurry.  Why don't you snap your oars, you
+rascals?  Bite something, you dogs!  So, so, so, then:--softly,
+softly!  That's it--that's it! long and strong.  Give way there, give
+way!  The devil fetch ye, ye ragamuffin rapscallions; ye are all
+asleep.  Stop snoring, ye sleepers, and pull.  Pull, will ye? pull,
+can't ye? pull, won't ye?  Why in the name of gudgeons and
+ginger-cakes don't ye pull?--pull and break something! pull, and
+start your eyes out!  Here!" whipping out the sharp knife from his
+girdle; "every mother's son of ye draw his knife, and pull with the
+blade between his teeth.  That's it--that's it.  Now ye do something;
+that looks like it, my steel-bits.  Start her--start her, my
+silver-spoons!  Start her, marling-spikes!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 14</DOCNO>
+Stubb's exordium to his crew is given here at large, because he had
+rather a peculiar way of talking to them in general, and especially
+in inculcating the religion of rowing.  But you must not suppose from
+this specimen of his sermonizings that he ever flew into downright
+passions with his congregation.  Not at all; and therein consisted
+his chief peculiarity.  He would say the most terrific things to his
+crew, in a tone so strangely compounded of fun and fury, and the fury
+seemed so calculated merely as a spice to the fun, that no oarsman
+could hear such queer invocations without pulling for dear life, and
+yet pulling for the mere joke of the thing.  Besides he all the time
+looked so easy and indolent himself, so loungingly managed his
+steering-oar, and so broadly gaped--open-mouthed at times--that the
+mere sight of such a yawning commander, by sheer force of contrast,
+acted like a charm upon the crew.  Then again, Stubb was one of those
+odd sort of humorists, whose jollity is sometimes so curiously
+ambiguous, as to put all inferiors on their guard in the matter of
+obeying them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 15</DOCNO>
+In obedience to a sign from Ahab, Starbuck was now pulling obliquely
+across Stubb's bow; and when for a minute or so the two boats were
+pretty near to each other, Stubb hailed the mate.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 16</DOCNO>
+"Mr. Starbuck! larboard boat there, ahoy! a word with ye, sir, if ye
+please!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 17</DOCNO>
+"Halloa!" returned Starbuck, turning round not a single inch as he
+spoke; still earnestly but whisperingly urging his crew; his face set
+like a flint from Stubb's.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 18</DOCNO>
+"What think ye of those yellow boys, sir!
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 19</DOCNO>
+"Smuggled on board, somehow, before the ship sailed. (Strong, strong,
+boys!)" in a whisper to his crew, then speaking out loud again: "A
+sad business, Mr. Stubb! (seethe her, seethe her, my lads!) but never
+mind, Mr. Stubb, all for the best.  Let all your crew pull strong,
+come what will. (Spring, my men, spring!) There's hogsheads of sperm
+ahead, Mr. Stubb, and that's what ye came for. (Pull, my boys!)
+Sperm, sperm's the play!  This at least is duty; duty and profit hand
+in hand."
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 20</DOCNO>
+"Aye, aye, I thought as much," soliloquized Stubb, when the boats
+diverged, "as soon as I clapt eye on 'em, I thought so.  Aye, and
+that's what he went into the after hold for, so often, as Dough-Boy
+long suspected.  They were hidden down there.  The White Whale's at
+the bottom of it.  Well, well, so be it!  Can't be helped!  All
+right!  Give way, men!  It ain't the White Whale to-day!  Give way!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 21</DOCNO>
+Now the advent of these outlandish strangers at such a critical
+instant as the lowering of the boats from the deck, this had not
+unreasonably awakened a sort of superstitious amazement in some of
+the ship's company; but Archy's fancied discovery having some time
+previous got abroad among them, though indeed not credited then, this
+had in some small measure prepared them for the event.  It took off
+the extreme edge of their wonder; and so what with all this and
+Stubb's confident way of accounting for their appearance, they were
+for the time freed from superstitious surmisings; though the affair
+still left abundant room for all manner of wild conjectures as to
+dark Ahab's precise agency in the matter from the beginning.  For me,
+I silently recalled the mysterious shadows I had seen creeping on
+board the Pequod during the dim Nantucket dawn, as well as the
+enigmatical hintings of the unaccountable Elijah.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 22</DOCNO>
+Meantime, Ahab, out of hearing of his officers, having sided the
+furthest to windward, was still ranging ahead of the other boats; a
+circumstance bespeaking how potent a crew was pulling him.  Those
+tiger yellow creatures of his seemed all steel and whalebone; like
+five trip-hammers they rose and fell with regular strokes of
+strength, which periodically started the boat along the water like a
+horizontal burst boiler out of a Mississippi steamer.  As for
+Fedallah, who was seen pulling the harpooneer oar, he had thrown
+aside his black jacket, and displayed his naked chest with the whole
+part of his body above the gunwale, clearly cut against the
+alternating depressions of the watery horizon; while at the other end
+of the boat Ahab, with one arm, like a fencer's, thrown half backward
+into the air, as if to counterbalance any tendency to trip; Ahab was
+seen steadily managing his steering oar as in a thousand boat
+lowerings ere the White Whale had torn him.  All at once the
+outstretched arm gave a peculiar motion and then remained fixed,
+while the boat's five oars were seen simultaneously peaked.  Boat and
+crew sat motionless on the sea.  Instantly the three spread boats in
+the rear paused on their way.  The whales had irregularly settled
+bodily down into the blue, thus giving no distantly discernible token
+of the movement, though from his closer vicinity Ahab had observed
+it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 23</DOCNO>
+"Every man look out along his oars!" cried Starbuck.  "Thou,
+Queequeg, stand up!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 24</DOCNO>
+Nimbly springing up on the triangular raised box in the bow, the
+savage stood erect there, and with intensely eager eyes gazed off
+towards the spot where the chase had last been descried.  Likewise
+upon the extreme stern of the boat where it was also triangularly
+platformed level with the gunwale, Starbuck himself was seen coolly
+and adroitly balancing himself to the jerking tossings of his chip of
+a craft, and silently eyeing the vast blue eye of the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 25</DOCNO>
+Not very far distant Flask's boat was also lying breathlessly still;
+its commander recklessly standing upon the top of the loggerhead, a
+stout sort of post rooted in the keel, and rising some two feet above
+the level of the stern platform.  It is used for catching turns with
+the whale line.  Its top is not more spacious than the palm of a
+man's hand, and standing upon such a base as that, Flask seemed
+perched at the mast-head of some ship which had sunk to all but her
+trucks.  But little King-Post was small and short, and at the same
+time little King-Post was full of a large and tall ambition, so that
+this loggerhead stand-point of his did by no means satisfy King-Post.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 26</DOCNO>
+"I can't see three seas off; tip us up an oar there, and let me on to
+that."
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 27</DOCNO>
+Upon this, Daggoo, with either hand upon the gunwale to steady his
+way, swiftly slid aft, and then erecting himself volunteered his
+lofty shoulders for a pedestal.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 28</DOCNO>
+"Good a mast-head as any, sir.  Will you mount?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 29</DOCNO>
+"That I will, and thank ye very much, my fine fellow; only I wish you
+fifty feet taller."
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 30</DOCNO>
+Whereupon planting his feet firmly against two opposite planks of the
+boat, the gigantic negro, stooping a little, presented his flat palm
+to Flask's foot, and then putting Flask's hand on his hearse-plumed
+head and bidding him spring as he himself should toss, with one
+dexterous fling landed the little man high and dry on his shoulders.
+And here was Flask now standing, Daggoo with one lifted arm
+furnishing him with a breastband to lean against and steady himself
+by.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 31</DOCNO>
+At any time it is a strange sight to the tyro to see with what
+wondrous habitude of unconscious skill the whaleman will maintain an
+erect posture in his boat, even when pitched about by the most
+riotously perverse and cross-running seas.  Still more strange to see
+him giddily perched upon the loggerhead itself, under such
+circumstances.  But the sight of little Flask mounted upon gigantic
+Daggoo was yet more curious; for sustaining himself with a cool,
+indifferent, easy, unthought of, barbaric majesty, the noble negro to
+every roll of the sea harmoniously rolled his fine form.  On his
+broad back, flaxen-haired Flask seemed a snow-flake.  The bearer
+looked nobler than the rider.  Though truly vivacious, tumultuous,
+ostentatious little Flask would now and then stamp with impatience;
+but not one added heave did he thereby give to the negro's lordly
+chest.  So have I seen Passion and Vanity stamping the living
+magnanimous earth, but the earth did not alter her tides and her
+seasons for that.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 32</DOCNO>
+Meanwhile Stubb, the third mate, betrayed no such far-gazing
+solicitudes.  The whales might have made one of their regular
+soundings, not a temporary dive from mere fright; and if that were
+the case, Stubb, as his wont in such cases, it seems, was resolved to
+solace the languishing interval with his pipe.  He withdrew it from
+his hatband, where he always wore it aslant like a feather.  He
+loaded it, and rammed home the loading with his thumb-end; but hardly
+had he ignited his match across the rough sandpaper of his hand,
+when Tashtego, his harpooneer, whose eyes had been setting to
+windward like two fixed stars, suddenly dropped like light from his
+erect attitude to his seat, crying out in a quick phrensy of hurry,
+"Down, down all, and give way!--there they are!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 33</DOCNO>
+To a landsman, no whale, nor any sign of a herring, would have been
+visible at that moment; nothing but a troubled bit of greenish white
+water, and thin scattered puffs of vapour hovering over it, and
+suffusingly blowing off to leeward, like the confused scud from white
+rolling billows.  The air around suddenly vibrated and tingled, as it
+were, like the air over intensely heated plates of iron.  Beneath
+this atmospheric waving and curling, and partially beneath a thin
+layer of water, also, the whales were swimming.  Seen in advance of
+all the other indications, the puffs of vapour they spouted, seemed
+their forerunning couriers and detached flying outriders.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 34</DOCNO>
+All four boats were now in keen pursuit of that one spot of troubled
+water and air.  But it bade fair to outstrip them; it flew on and on,
+as a mass of interblending bubbles borne down a rapid stream from the
+hills.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 35</DOCNO>
+"Pull, pull, my good boys," said Starbuck, in the lowest possible but
+intensest concentrated whisper to his men; while the sharp fixed
+glance from his eyes darted straight ahead of the bow, almost seemed
+as two visible needles in two unerring binnacle compasses.  He did
+not say much to his crew, though, nor did his crew say anything to
+him.  Only the silence of the boat was at intervals startlingly
+pierced by one of his peculiar whispers, now harsh with command, now
+soft with entreaty.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 36</DOCNO>
+How different the loud little King-Post.  "Sing out and say
+something, my hearties.  Roar and pull, my thunderbolts!  Beach me,
+beach me on their black backs, boys; only do that for me, and I'll
+sign over to you my Martha's Vineyard plantation, boys; including
+wife and children, boys.  Lay me on--lay me on!  O Lord, Lord! but I
+shall go stark, staring mad!  See! see that white water!"  And so
+shouting, he pulled his hat from his head, and stamped up and down on
+it; then picking it up, flirted it far off upon the sea; and finally
+fell to rearing and plunging in the boat's stern like a crazed colt
+from the prairie.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 37</DOCNO>
+"Look at that chap now," philosophically drawled Stubb, who, with his
+unlighted short pipe, mechanically retained between his teeth, at a
+short distance, followed after--"He's got fits, that Flask has.
+Fits? yes, give him fits--that's the very word--pitch fits into 'em.
+Merrily, merrily, hearts-alive.  Pudding for supper, you
+know;--merry's the word.  Pull, babes--pull, sucklings--pull, all.
+But what the devil are you hurrying about?  Softly, softly, and
+steadily, my men.  Only pull, and keep pulling; nothing more.  Crack
+all your backbones, and bite your knives in two--that's all.  Take it
+easy--why don't ye take it easy, I say, and burst all your livers and
+lungs!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 38</DOCNO>
+But what it was that inscrutable Ahab said to that tiger-yellow crew
+of his--these were words best omitted here; for you live under the
+blessed light of the evangelical land.  Only the infidel sharks in
+the audacious seas may give ear to such words, when, with tornado
+brow, and eyes of red murder, and foam-glued lips, Ahab leaped after
+his prey.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 39</DOCNO>
+Meanwhile, all the boats tore on.  The repeated specific allusions of
+Flask to "that whale," as he called the fictitious monster which he
+declared to be incessantly tantalizing his boat's bow with its
+tail--these allusions of his were at times so vivid and life-like,
+that they would cause some one or two of his men to snatch a fearful
+look over the shoulder.  But this was against all rule; for the
+oarsmen must put out their eyes, and ram a skewer through their
+necks; usage pronouncing that they must have no organs but ears, and
+no limbs but arms, in these critical moments.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 40</DOCNO>
+It was a sight full of quick wonder and awe!  The vast swells of the
+omnipotent sea; the surging, hollow roar they made, as they rolled
+along the eight gunwales, like gigantic bowls in a boundless
+bowling-green; the brief suspended agony of the boat, as it would tip
+for an instant on the knife-like edge of the sharper waves, that
+almost seemed threatening to cut it in two; the sudden profound dip
+into the watery glens and hollows; the keen spurrings and goadings to
+gain the top of the opposite hill; the headlong, sled-like slide down
+its other side;--all these, with the cries of the headsmen and
+harpooneers, and the shuddering gasps of the oarsmen, with the
+wondrous sight of the ivory Pequod bearing down upon her boats with
+outstretched sails, like a wild hen after her screaming brood;--all
+this was thrilling.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 41</DOCNO>
+Not the raw recruit, marching from the bosom of his wife into the
+fever heat of his first battle; not the dead man's ghost encountering
+the first unknown phantom in the other world;--neither of these can
+feel stranger and stronger emotions than that man does, who for the
+first time finds himself pulling into the charmed, churned circle of
+the hunted sperm whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 42</DOCNO>
+The dancing white water made by the chase was now becoming more and
+more visible, owing to the increasing darkness of the dun
+cloud-shadows flung upon the sea.  The jets of vapour no longer
+blended, but tilted everywhere to right and left; the whales seemed
+separating their wakes.  The boats were pulled more apart; Starbuck
+giving chase to three whales running dead to leeward.  Our sail was
+now set, and, with the still rising wind, we rushed along; the boat
+going with such madness through the water, that the lee oars could
+scarcely be worked rapidly enough to escape being torn from the
+row-locks.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 43</DOCNO>
+Soon we were running through a suffusing wide veil of mist; neither
+ship nor boat to be seen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 44</DOCNO>
+"Give way, men," whispered Starbuck, drawing still further aft the
+sheet of his sail; "there is time to kill a fish yet before the
+squall comes.  There's white water again!--close to!  Spring!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 45</DOCNO>
+Soon after, two cries in quick succession on each side of us denoted
+that the other boats had got fast; but hardly were they overheard,
+when with a lightning-like hurtling whisper Starbuck said: "Stand
+up!" and Queequeg, harpoon in hand, sprang to his feet.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 46</DOCNO>
+Though not one of the oarsmen was then facing the life and death
+peril so close to them ahead, yet with their eyes on the intense
+countenance of the mate in the stern of the boat, they knew that the
+imminent instant had come; they heard, too, an enormous wallowing
+sound as of fifty elephants stirring in their litter.  Meanwhile the
+boat was still booming through the mist, the waves curling and
+hissing around us like the erected crests of enraged serpents.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 47</DOCNO>
+"That's his hump.  THERE, THERE, give it to him!" whispered Starbuck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 48</DOCNO>
+A short rushing sound leaped out of the boat; it was the darted iron
+of Queequeg.  Then all in one welded commotion came an invisible push
+from astern, while forward the boat seemed striking on a ledge; the
+sail collapsed and exploded; a gush of scalding vapour shot up near
+by; something rolled and tumbled like an earthquake beneath us.  The
+whole crew were half suffocated as they were tossed helter-skelter
+into the white curdling cream of the squall.  Squall, whale, and
+harpoon had all blended together; and the whale, merely grazed by the
+iron, escaped.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 49</DOCNO>
+Though completely swamped, the boat was nearly unharmed.  Swimming
+round it we picked up the floating oars, and lashing them across the
+gunwale, tumbled back to our places.  There we sat up to our knees in
+the sea, the water covering every rib and plank, so that to our
+downward gazing eyes the suspended craft seemed a coral boat grown up
+to us from the bottom of the ocean.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 50</DOCNO>
+The wind increased to a howl; the waves dashed their bucklers
+together; the whole squall roared, forked, and crackled around us
+like a white fire upon the prairie, in which, unconsumed, we were
+burning; immortal in these jaws of death!  In vain we hailed the
+other boats; as well roar to the live coals down the chimney of a
+flaming furnace as hail those boats in that storm.  Meanwhile the
+driving scud, rack, and mist, grew darker with the shadows of night;
+no sign of the ship could be seen.  The rising sea forbade all
+attempts to bale out the boat.  The oars were useless as propellers,
+performing now the office of life-preservers.  So, cutting the
+lashing of the waterproof match keg, after many failures Starbuck
+contrived to ignite the lamp in the lantern; then stretching it on a
+waif pole, handed it to Queequeg as the standard-bearer of this
+forlorn hope.  There, then, he sat, holding up that imbecile candle
+in the heart of that almighty forlornness.  There, then, he sat, the
+sign and symbol of a man without faith, hopelessly holding up hope in
+the midst of despair.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 51</DOCNO>
+Wet, drenched through, and shivering cold, despairing of ship or
+boat, we lifted up our eyes as the dawn came on.  The mist still
+spread over the sea, the empty lantern lay crushed in the bottom of
+the boat.  Suddenly Queequeg started to his feet, hollowing his hand
+to his ear.  We all heard a faint creaking, as of ropes and yards
+hitherto muffled by the storm.  The sound came nearer and nearer; the
+thick mists were dimly parted by a huge, vague form.  Affrighted, we
+all sprang into the sea as the ship at last loomed into view, bearing
+right down upon us within a distance of not much more than its
+length.
+</DOC>
+<DOC>
+<DOCNO>Chapter 48, Paragraph 52</DOCNO>
+Floating on the waves we saw the abandoned boat, as for one instant
+it tossed and gaped beneath the ship's bows like a chip at the base
+of a cataract; and then the vast hull rolled over it, and it was seen
+no more till it came up weltering astern.  Again we swam for it, were
+dashed against it by the seas, and were at last taken up and safely
+landed on board.  Ere the squall came close to, the other boats had
+cut loose from their fish and returned to the ship in good time.  The
+ship had given us up, but was still cruising, if haply it might light
+upon some token of our perishing,--an oar or a lance pole.
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 1</DOCNO>
+The Hyena.
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 2</DOCNO>
+There are certain queer times and occasions in this strange mixed
+affair we call life when a man takes this whole universe for a vast
+practical joke, though the wit thereof he but dimly discerns, and
+more than suspects that the joke is at nobody's expense but his own.
+However, nothing dispirits, and nothing seems worth while disputing.
+He bolts down all events, all creeds, and beliefs, and persuasions,
+all hard things visible and invisible, never mind how knobby; as an
+ostrich of potent digestion gobbles down bullets and gun flints.  And
+as for small difficulties and worryings, prospects of sudden
+disaster, peril of life and limb; all these, and death itself, seem
+to him only sly, good-natured hits, and jolly punches in the side
+bestowed by the unseen and unaccountable old joker.  That odd sort of
+wayward mood I am speaking of, comes over a man only in some time of
+extreme tribulation; it comes in the very midst of his earnestness,
+so that what just before might have seemed to him a thing most
+momentous, now seems but a part of the general joke.  There is
+nothing like the perils of whaling to breed this free and easy sort
+of genial, desperado philosophy; and with it I now regarded this
+whole voyage of the Pequod, and the great White Whale its object.
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 3</DOCNO>
+"Queequeg," said I, when they had dragged me, the last man, to the
+deck, and I was still shaking myself in my jacket to fling off the
+water; "Queequeg, my fine friend, does this sort of thing often
+happen?"  Without much emotion, though soaked through just like me,
+he gave me to understand that such things did often happen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 4</DOCNO>
+"Mr. Stubb," said I, turning to that worthy, who, buttoned up in his
+oil-jacket, was now calmly smoking his pipe in the rain; "Mr. Stubb,
+I think I have heard you say that of all whalemen you ever met, our
+chief mate, Mr. Starbuck, is by far the most careful and prudent.  I
+suppose then, that going plump on a flying whale with your sail set
+in a foggy squall is the height of a whaleman's discretion?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 5</DOCNO>
+"Certain.  I've lowered for whales from a leaking ship in a gale off
+Cape Horn."
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 6</DOCNO>
+"Mr. Flask," said I, turning to little King-Post, who was standing
+close by; "you are experienced in these things, and I am not.  Will
+you tell me whether it is an unalterable law in this fishery, Mr.
+Flask, for an oarsman to break his own back pulling himself
+back-foremost into death's jaws?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 7</DOCNO>
+"Can't you twist that smaller?" said Flask.  "Yes, that's the law.  I
+should like to see a boat's crew backing water up to a whale face
+foremost.  Ha, ha! the whale would give them squint for squint, mind
+that!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 8</DOCNO>
+Here then, from three impartial witnesses, I had a deliberate
+statement of the entire case.  Considering, therefore, that squalls
+and capsizings in the water and consequent bivouacks on the deep,
+were matters of common occurrence in this kind of life; considering
+that at the superlatively critical instant of going on to the whale I
+must resign my life into the hands of him who steered the
+boat--oftentimes a fellow who at that very moment is in his
+impetuousness upon the point of scuttling the craft with his own
+frantic stampings; considering that the particular disaster to our
+own particular boat was chiefly to be imputed to Starbuck's driving
+on to his whale almost in the teeth of a squall, and considering that
+Starbuck, notwithstanding, was famous for his great heedfulness in
+the fishery; considering that I belonged to this uncommonly prudent
+Starbuck's boat; and finally considering in what a devil's chase I
+was implicated, touching the White Whale: taking all things together,
+I say, I thought I might as well go below and make a rough draft of
+my will.  "Queequeg," said I, "come along, you shall be my lawyer,
+executor, and legatee."
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 9</DOCNO>
+It may seem strange that of all men sailors should be tinkering at
+their last wills and testaments, but there are no people in the world
+more fond of that diversion.  This was the fourth time in my nautical
+life that I had done the same thing.  After the ceremony was
+concluded upon the present occasion, I felt all the easier; a stone
+was rolled away from my heart.  Besides, all the days I should now
+live would be as good as the days that Lazarus lived after his
+resurrection; a supplementary clean gain of so many months or weeks
+as the case might be.  I survived myself; my death and burial were
+locked up in my chest.  I looked round me tranquilly and contentedly,
+like a quiet ghost with a clean conscience sitting inside the bars of
+a snug family vault.
+</DOC>
+<DOC>
+<DOCNO>Chapter 49, Paragraph 10</DOCNO>
+Now then, thought I, unconsciously rolling up the sleeves of my
+frock, here goes for a cool, collected dive at death and destruction,
+and the devil fetch the hindmost.
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 1</DOCNO>
+Ahab's Boat and Crew.  Fedallah.
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 2</DOCNO>
+"Who would have thought it, Flask!" cried Stubb; "if I had but one
+leg you would not catch me in a boat, unless maybe to stop the
+plug-hole with my timber toe.  Oh! he's a wonderful old man!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 3</DOCNO>
+"I don't think it so strange, after all, on that account," said
+Flask.  "If his leg were off at the hip, now, it would be a different
+thing.  That would disable him; but he has one knee, and good part of
+the other left, you know."
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 4</DOCNO>
+"I don't know that, my little man; I never yet saw him kneel."
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 5</DOCNO>
+Among whale-wise people it has often been argued whether, considering
+the paramount importance of his life to the success of the voyage, it
+is right for a whaling captain to jeopardize that life in the active
+perils of the chase.  So Tamerlane's soldiers often argued with tears
+in their eyes, whether that invaluable life of his ought to be
+carried into the thickest of the fight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 6</DOCNO>
+But with Ahab the question assumed a modified aspect.  Considering
+that with two legs man is but a hobbling wight in all times of
+danger; considering that the pursuit of whales is always under great
+and extraordinary difficulties; that every individual moment, indeed,
+then comprises a peril; under these circumstances is it wise for any
+maimed man to enter a whale-boat in the hunt?  As a general thing,
+the joint-owners of the Pequod must have plainly thought not.
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 7</DOCNO>
+Ahab well knew that although his friends at home would think little
+of his entering a boat in certain comparatively harmless vicissitudes
+of the chase, for the sake of being near the scene of action and
+giving his orders in person, yet for Captain Ahab to have a boat
+actually apportioned to him as a regular headsman in the hunt--above
+all for Captain Ahab to be supplied with five extra men, as that same
+boat's crew, he well knew that such generous conceits never entered the
+heads of the owners of the Pequod.  Therefore he had not solicited a
+boat's crew from them, nor had he in any way hinted his desires on
+that head.  Nevertheless he had taken private measures of his own
+touching all that matter.  Until Cabaco's published discovery, the
+sailors had little foreseen it, though to be sure when, after being a
+little while out of port, all hands had concluded the customary
+business of fitting the whaleboats for service; when some time after
+this Ahab was now and then found bestirring himself in the matter of
+making thole-pins with his own hands for what was thought to be one
+of the spare boats, and even solicitously cutting the small wooden
+skewers, which when the line is running out are pinned over the
+groove in the bow: when all this was observed in him, and
+particularly his solicitude in having an extra coat of sheathing in
+the bottom of the boat, as if to make it better withstand the pointed
+pressure of his ivory limb; and also the anxiety he evinced in
+exactly shaping the thigh board, or clumsy cleat, as it is sometimes
+called, the horizontal piece in the boat's bow for bracing the knee
+against in darting or stabbing at the whale; when it was observed how
+often he stood up in that boat with his solitary knee fixed in the
+semi-circular depression in the cleat, and with the carpenter's
+chisel gouged out a little here and straightened it a little there;
+all these things, I say, had awakened much interest and curiosity at
+the time.  But almost everybody supposed that this particular
+preparative heedfulness in Ahab must only be with a view to the
+ultimate chase of Moby Dick; for he had already revealed his
+intention to hunt that mortal monster in person.  But such a
+supposition did by no means involve the remotest suspicion as to any
+boat's crew being assigned to that boat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 8</DOCNO>
+Now, with the subordinate phantoms, what wonder remained soon waned
+away; for in a whaler wonders soon wane.  Besides, now and then such
+unaccountable odds and ends of strange nations come up from the
+unknown nooks and ash-holes of the earth to man these floating
+outlaws of whalers; and the ships themselves often pick up such queer
+castaway creatures found tossing about the open sea on planks, bits
+of wreck, oars, whaleboats, canoes, blown-off Japanese junks, and
+what not; that Beelzebub himself might climb up the side and step
+down into the cabin to chat with the captain, and it would not create
+any unsubduable excitement in the forecastle.
+</DOC>
+<DOC>
+<DOCNO>Chapter 50, Paragraph 9</DOCNO>
+But be all this as it may, certain it is that while the subordinate
+phantoms soon found their place among the crew, though still as it
+were somehow distinct from them, yet that hair-turbaned Fedallah
+remained a muffled mystery to the last.  Whence he came in a mannerly
+world like this, by what sort of unaccountable tie he soon evinced
+himself to be linked with Ahab's peculiar fortunes; nay, so far as to
+have some sort of a half-hinted influence; Heaven knows, but it might
+have been even authority over him; all this none knew.  But one
+cannot sustain an indifferent air concerning Fedallah.  He was such a
+creature as civilized, domestic people in the temperate zone only see
+in their dreams, and that but dimly; but the like of whom now and
+then glide among the unchanging Asiatic communities, especially the
+Oriental isles to the east of the continent--those insulated,
+immemorial, unalterable countries, which even in these modern days
+still preserve much of the ghostly aboriginalness of earth's primal
+generations, when the memory of the first man was a distinct
+recollection, and all men his descendants, unknowing whence he came,
+eyed each other as real phantoms, and asked of the sun and the moon
+why they were created and to what end; when though, according to
+Genesis, the angels indeed consorted with the daughters of men, the
+devils also, add the uncanonical Rabbins, indulged in mundane amours.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 1</DOCNO>
+The Spirit-Spout.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 2</DOCNO>
+Days, weeks passed, and under easy sail, the ivory Pequod had slowly
+swept across four several cruising-grounds; that off the Azores; off
+the Cape de Verdes; on the Plate (so called), being off the mouth of
+the Rio de la Plata; and the Carrol Ground, an unstaked, watery
+locality, southerly from St. Helena.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 3</DOCNO>
+It was while gliding through these latter waters that one serene and
+moonlight night, when all the waves rolled by like scrolls of silver;
+and, by their soft, suffusing seethings, made what seemed a silvery
+silence, not a solitude; on such a silent night a silvery jet was
+seen far in advance of the white bubbles at the bow.  Lit up by the
+moon, it looked celestial; seemed some plumed and glittering god
+uprising from the sea.  Fedallah first descried this jet.  For of
+these moonlight nights, it was his wont to mount to the main-mast
+head, and stand a look-out there, with the same precision as if it
+had been day.  And yet, though herds of whales were seen by night,
+not one whaleman in a hundred would venture a lowering for them.  You
+may think with what emotions, then, the seamen beheld this old
+Oriental perched aloft at such unusual hours; his turban and the
+moon, companions in one sky.  But when, after spending his uniform
+interval there for several successive nights without uttering a
+single sound; when, after all this silence, his unearthly voice was
+heard announcing that silvery, moon-lit jet, every reclining mariner
+started to his feet as if some winged spirit had lighted in the
+rigging, and hailed the mortal crew.  "There she blows!"  Had the
+trump of judgment blown, they could not have quivered more; yet still
+they felt no terror; rather pleasure.  For though it was a most
+unwonted hour, yet so impressive was the cry, and so deliriously
+exciting, that almost every soul on board instinctively desired a
+lowering.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 4</DOCNO>
+Walking the deck with quick, side-lunging strides, Ahab commanded the
+t'gallant sails and royals to be set, and every stunsail spread.  The
+best man in the ship must take the helm.  Then, with every mast-head
+manned, the piled-up craft rolled down before the wind.  The strange,
+upheaving, lifting tendency of the taffrail breeze filling the
+hollows of so many sails, made the buoyant, hovering deck to feel
+like air beneath the feet; while still she rushed along, as if two
+antagonistic influences were struggling in her--one to mount direct
+to heaven, the other to drive yawingly to some horizontal goal.  And
+had you watched Ahab's face that night, you would have thought that
+in him also two different things were warring.  While his one live
+leg made lively echoes along the deck, every stroke of his dead limb
+sounded like a coffin-tap.  On life and death this old man walked.
+But though the ship so swiftly sped, and though from every eye, like
+arrows, the eager glances shot, yet the silvery jet was no more seen
+that night.  Every sailor swore he saw it once, but not a second
+time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 5</DOCNO>
+This midnight-spout had almost grown a forgotten thing, when, some
+days after, lo! at the same silent hour, it was again announced:
+again it was descried by all; but upon making sail to overtake it,
+once more it disappeared as if it had never been.  And so it served
+us night after night, till no one heeded it but to wonder at it.
+Mysteriously jetted into the clear moonlight, or starlight, as the
+case might be; disappearing again for one whole day, or two days, or
+three; and somehow seeming at every distinct repetition to be
+advancing still further and further in our van, this solitary jet
+seemed for ever alluring us on.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 6</DOCNO>
+Nor with the immemorial superstition of their race, and in accordance
+with the preternaturalness, as it seemed, which in many things
+invested the Pequod, were there wanting some of the seamen who swore
+that whenever and wherever descried; at however remote times, or in
+however far apart latitudes and longitudes, that unnearable spout was
+cast by one self-same whale; and that whale, Moby Dick.  For a time,
+there reigned, too, a sense of peculiar dread at this flitting
+apparition, as if it were treacherously beckoning us on and on, in
+order that the monster might turn round upon us, and rend us at last
+in the remotest and most savage seas.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 7</DOCNO>
+These temporary apprehensions, so vague but so awful, derived a
+wondrous potency from the contrasting serenity of the weather, in
+which, beneath all its blue blandness, some thought there lurked a
+devilish charm, as for days and days we voyaged along, through seas
+so wearily, lonesomely mild, that all space, in repugnance to our
+vengeful errand, seemed vacating itself of life before our urn-like
+prow.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 8</DOCNO>
+But, at last, when turning to the eastward, the Cape winds began
+howling around us, and we rose and fell upon the long, troubled seas
+that are there; when the ivory-tusked Pequod sharply bowed to the
+blast, and gored the dark waves in her madness, till, like showers of
+silver chips, the foam-flakes flew over her bulwarks; then all this
+desolate vacuity of life went away, but gave place to sights more
+dismal than before.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 9</DOCNO>
+Close to our bows, strange forms in the water darted hither and
+thither before us; while thick in our rear flew the inscrutable
+sea-ravens.  And every morning, perched on our stays, rows of these
+birds were seen; and spite of our hootings, for a long time
+obstinately clung to the hemp, as though they deemed our ship some
+drifting, uninhabited craft; a thing appointed to desolation, and
+therefore fit roosting-place for their homeless selves.  And heaved
+and heaved, still unrestingly heaved the black sea, as if its vast
+tides were a conscience; and the great mundane soul were in anguish
+and remorse for the long sin and suffering it had bred.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 10</DOCNO>
+Cape of Good Hope, do they call ye?  Rather Cape Tormentoto, as
+called of yore; for long allured by the perfidious silences that
+before had attended us, we found ourselves launched into this
+tormented sea, where guilty beings transformed into those fowls and
+these fish, seemed condemned to swim on everlastingly without any
+haven in store, or beat that black air without any horizon.  But
+calm, snow-white, and unvarying; still directing its fountain of
+feathers to the sky; still beckoning us on from before, the solitary
+jet would at times be descried.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 11</DOCNO>
+During all this blackness of the elements, Ahab, though assuming for
+the time the almost continual command of the drenched and dangerous
+deck, manifested the gloomiest reserve; and more seldom than ever
+addressed his mates.  In tempestuous times like these, after
+everything above and aloft has been secured, nothing more can be done
+but passively to await the issue of the gale.  Then Captain and crew
+become practical fatalists.  So, with his ivory leg inserted into its
+accustomed hole, and with one hand firmly grasping a shroud, Ahab for
+hours and hours would stand gazing dead to windward, while an
+occasional squall of sleet or snow would all but congeal his very
+eyelashes together.  Meantime, the crew driven from the forward part
+of the ship by the perilous seas that burstingly broke over its bows,
+stood in a line along the bulwarks in the waist; and the better to
+guard against the leaping waves, each man had slipped himself into a
+sort of bowline secured to the rail, in which he swung as in a
+loosened belt.  Few or no words were spoken; and the silent ship, as
+if manned by painted sailors in wax, day after day tore on through
+all the swift madness and gladness of the demoniac waves.  By night
+the same muteness of humanity before the shrieks of the ocean
+prevailed; still in silence the men swung in the bowlines; still
+wordless Ahab stood up to the blast.  Even when wearied nature seemed
+demanding repose he would not seek that repose in his hammock.
+Never could Starbuck forget the old man's aspect, when one night
+going down into the cabin to mark how the barometer stood, he saw him
+with closed eyes sitting straight in his floor-screwed chair; the
+rain and half-melted sleet of the storm from which he had some time
+before emerged, still slowly dripping from the unremoved hat and
+coat.  On the table beside him lay unrolled one of those charts of
+tides and currents which have previously been spoken of.  His lantern
+swung from his tightly clenched hand.  Though the body was erect, the
+head was thrown back so that the closed eyes were pointed towards the
+needle of the tell-tale that swung from a beam in the ceiling.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 12</DOCNO>
+*The cabin-compass is called the tell-tale, because without going to
+the compass at the helm, the Captain, while below, can inform himself
+of the course of the ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 51, Paragraph 13</DOCNO>
+Terrible old man! thought Starbuck with a shudder, sleeping in this
+gale, still thou steadfastly eyest thy purpose.
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 1</DOCNO>
+The Albatross.
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 2</DOCNO>
+South-eastward from the Cape, off the distant Crozetts, a good
+cruising ground for Right Whalemen, a sail loomed ahead, the Goney
+(Albatross) by name.  As she slowly drew nigh, from my lofty perch at
+the fore-mast-head, I had a good view of that sight so remarkable to
+a tyro in the far ocean fisheries--a whaler at sea, and long absent
+from home.
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 3</DOCNO>
+As if the waves had been fullers, this craft was bleached like the
+skeleton of a stranded walrus.  All down her sides, this spectral
+appearance was traced with long channels of reddened rust, while all
+her spars and her rigging were like the thick branches of trees
+furred over with hoar-frost.  Only her lower sails were set.  A wild
+sight it was to see her long-bearded look-outs at those three
+mast-heads.  They seemed clad in the skins of beasts, so torn and
+bepatched the raiment that had survived nearly four years of
+cruising.  Standing in iron hoops nailed to the mast, they swayed and
+swung over a fathomless sea; and though, when the ship slowly glided
+close under our stern, we six men in the air came so nigh to each
+other that we might almost have leaped from the mast-heads of one
+ship to those of the other; yet, those forlorn-looking fishermen,
+mildly eyeing us as they passed, said not one word to our own
+look-outs, while the quarter-deck hail was being heard from below.
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 4</DOCNO>
+"Ship ahoy!  Have ye seen the White Whale?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 5</DOCNO>
+But as the strange captain, leaning over the pallid bulwarks, was in
+the act of putting his trumpet to his mouth, it somehow fell from his
+hand into the sea; and the wind now rising amain, he in vain strove
+to make himself heard without it.  Meantime his ship was still
+increasing the distance between.  While in various silent ways
+the seamen of the Pequod were evincing their observance of this
+ominous incident at the first mere mention of the White Whale's name
+to another ship, Ahab for a moment paused; it almost seemed as though
+he would have lowered a boat to board the stranger, had not the
+threatening wind forbade.  But taking advantage of his windward
+position, he again seized his trumpet, and knowing by her aspect that
+the stranger vessel was a Nantucketer and shortly bound home, he
+loudly hailed--"Ahoy there!  This is the Pequod, bound round the
+world!  Tell them to address all future letters to the Pacific ocean!
+and this time three years, if I am not at home, tell them to address
+them to--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 6</DOCNO>
+At that moment the two wakes were fairly crossed, and instantly,
+then, in accordance with their singular ways, shoals of small
+harmless fish, that for some days before had been placidly swimming
+by our side, darted away with what seemed shuddering fins, and ranged
+themselves fore and aft with the stranger's flanks.  Though in the
+course of his continual voyagings Ahab must often before have noticed
+a similar sight, yet, to any monomaniac man, the veriest trifles
+capriciously carry meanings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 7</DOCNO>
+"Swim away from me, do ye?" murmured Ahab, gazing over into the
+water.  There seemed but little in the words, but the tone conveyed
+more of deep helpless sadness than the insane old man had ever before
+evinced.  But turning to the steersman, who thus far had been holding
+the ship in the wind to diminish her headway, he cried out in his old
+lion voice,--"Up helm!  Keep her off round the world!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 8</DOCNO>
+Round the world!  There is much in that sound to inspire proud
+feelings; but whereto does all that circumnavigation conduct?  Only
+through numberless perils to the very point whence we started, where
+those that we left behind secure, were all the time before us.
+</DOC>
+<DOC>
+<DOCNO>Chapter 52, Paragraph 9</DOCNO>
+Were this world an endless plain, and by sailing eastward we could
+for ever reach new distances, and discover sights more sweet and
+strange than any Cyclades or Islands of King Solomon, then there were
+promise in the voyage.  But in pursuit of those far mysteries we
+dream of, or in tormented chase of that demon phantom that, some time
+or other, swims before all human hearts; while chasing such over this
+round globe, they either lead us on in barren mazes or midway leave
+us whelmed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 1</DOCNO>
+The Gam.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 2</DOCNO>
+The ostensible reason why Ahab did not go on board of the whaler we
+had spoken was this: the wind and sea betokened storms.  But even had
+this not been the case, he would not after all, perhaps, have boarded
+her--judging by his subsequent conduct on similar occasions--if so it
+had been that, by the process of hailing, he had obtained a negative
+answer to the question he put.  For, as it eventually turned out, he
+cared not to consort, even for five minutes, with any stranger
+captain, except he could contribute some of that information he so
+absorbingly sought.  But all this might remain inadequately
+estimated, were not something said here of the peculiar usages of
+whaling-vessels when meeting each other in foreign seas, and
+especially on a common cruising-ground.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 3</DOCNO>
+If two strangers crossing the Pine Barrens in New York State, or the
+equally desolate Salisbury Plain in England; if casually encountering
+each other in such inhospitable wilds, these twain, for the life of
+them, cannot well avoid a mutual salutation; and stopping for a
+moment to interchange the news; and, perhaps, sitting down for a
+while and resting in concert: then, how much more natural that upon
+the illimitable Pine Barrens and Salisbury Plains of the sea, two
+whaling vessels descrying each other at the ends of the earth--off
+lone Fanning's Island, or the far away King's Mills; how much more
+natural, I say, that under such circumstances these ships should not
+only interchange hails, but come into still closer, more friendly and
+sociable contact.  And especially would this seem to be a matter of
+course, in the case of vessels owned in one seaport, and whose
+captains, officers, and not a few of the men are personally known to
+each other; and consequently, have all sorts of dear domestic things
+to talk about.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 4</DOCNO>
+For the long absent ship, the outward-bounder, perhaps, has letters
+on board; at any rate, she will be sure to let her have some papers
+of a date a year or two later than the last one on her blurred and
+thumb-worn files.  And in return for that courtesy, the outward-bound
+ship would receive the latest whaling intelligence from the
+cruising-ground to which she may be destined, a thing of the utmost
+importance to her.  And in degree, all this will hold true concerning
+whaling vessels crossing each other's track on the cruising-ground
+itself, even though they are equally long absent from home.  For one
+of them may have received a transfer of letters from some third, and
+now far remote vessel; and some of those letters may be for the
+people of the ship she now meets.  Besides, they would exchange the
+whaling news, and have an agreeable chat.  For not only would they
+meet with all the sympathies of sailors, but likewise with all the
+peculiar congenialities arising from a common pursuit and mutually
+shared privations and perils.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 5</DOCNO>
+Nor would difference of country make any very essential difference;
+that is, so long as both parties speak one language, as is the case
+with Americans and English.  Though, to be sure, from the small
+number of English whalers, such meetings do not very often occur, and
+when they do occur there is too apt to be a sort of shyness between
+them; for your Englishman is rather reserved, and your Yankee, he
+does not fancy that sort of thing in anybody but himself.  Besides,
+the English whalers sometimes affect a kind of metropolitan
+superiority over the American whalers; regarding the long, lean
+Nantucketer, with his nondescript provincialisms, as a sort of
+sea-peasant.  But where this superiority in the English whalemen
+does really consist, it would be hard to say, seeing that the Yankees
+in one day, collectively, kill more whales than all the English,
+collectively, in ten years.  But this is a harmless little foible in
+the English whale-hunters, which the Nantucketer does not take much
+to heart; probably, because he knows that he has a few foibles
+himself.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 6</DOCNO>
+So, then, we see that of all ships separately sailing the sea, the
+whalers have most reason to be sociable--and they are so.  Whereas,
+some merchant ships crossing each other's wake in the mid-Atlantic,
+will oftentimes pass on without so much as a single word of
+recognition, mutually cutting each other on the high seas, like a
+brace of dandies in Broadway; and all the time indulging, perhaps, in
+finical criticism upon each other's rig.  As for Men-of-War, when
+they chance to meet at sea, they first go through such a string of
+silly bowings and scrapings, such a ducking of ensigns, that there
+does not seem to be much right-down hearty good-will and brotherly
+love about it at all.  As touching Slave-ships meeting, why, they are
+in such a prodigious hurry, they run away from each other as soon as
+possible.  And as for Pirates, when they chance to cross each other's
+cross-bones, the first hail is--"How many skulls?"--the same way that
+whalers hail--"How many barrels?"  And that question once answered,
+pirates straightway steer apart, for they are infernal villains on
+both sides, and don't like to see overmuch of each other's villanous
+likenesses.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 7</DOCNO>
+But look at the godly, honest, unostentatious, hospitable, sociable,
+free-and-easy whaler!  What does the whaler do when she meets another
+whaler in any sort of decent weather?  She has a "GAM," a thing so
+utterly unknown to all other ships that they never heard of the name
+even; and if by chance they should hear of it, they only grin at it,
+and repeat gamesome stuff about "spouters" and "blubber-boilers," and
+such like pretty exclamations.  Why it is that all Merchant-seamen,
+and also all Pirates and Man-of-War's men, and Slave-ship sailors,
+cherish such a scornful feeling towards Whale-ships; this is a
+question it would be hard to answer.  Because, in the case of
+pirates, say, I should like to know whether that profession of theirs
+has any peculiar glory about it.  It sometimes ends in uncommon
+elevation, indeed; but only at the gallows.  And besides, when a man
+is elevated in that odd fashion, he has no proper foundation for his
+superior altitude.  Hence, I conclude, that in boasting himself to be
+high lifted above a whaleman, in that assertion the pirate has no
+solid basis to stand on.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 8</DOCNO>
+But what is a GAM?  You might wear out your index-finger running up
+and down the columns of dictionaries, and never find the word.  Dr.
+Johnson never attained to that erudition; Noah Webster's ark does not
+hold it.  Nevertheless, this same expressive word has now for many
+years been in constant use among some fifteen thousand true born
+Yankees.  Certainly, it needs a definition, and should be
+incorporated into the Lexicon.  With that view, let me learnedly
+define it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 9</DOCNO>
+GAM.  NOUN--A SOCIAL MEETING OF TWO (OR MORE) WHALESHIPS, GENERALLY
+ON A CRUISING-GROUND; WHEN, AFTER EXCHANGING HAILS, THEY EXCHANGE
+VISITS BY BOATS' CREWS; THE TWO CAPTAINS REMAINING, FOR THE TIME, ON
+BOARD OF ONE SHIP, AND THE TWO CHIEF MATES ON THE OTHER.
+</DOC>
+<DOC>
+<DOCNO>Chapter 53, Paragraph 10</DOCNO>
+There is another little item about Gamming which must not be
+forgotten here.  All professions have their own little peculiarities
+of detail; so has the whale fishery.  In a pirate, man-of-war, or
+slave ship, when the captain is rowed anywhere in his boat, he always
+sits in the stern sheets on a comfortable, sometimes cushioned seat
+there, and often steers himself with a pretty little milliner's
+tiller decorated with gay cords and ribbons.  But the whale-boat has
+no seat astern, no sofa of that sort whatever, and no tiller at all.
+High times indeed, if whaling captains were wheeled about the water
+on castors like gouty old aldermen in patent chairs.  And as for a
+tiller, the whale-boat never admits of any such effeminacy; and
+therefore as in gamming a complete boat's crew must leave the ship,
+and hence as the boat steerer or harpooneer is of the number, that
+subordinate is the steersman upon the occasion, and the captain,
+having no place to sit in, is pulled off to his visit all standing
+like a pine tree.  And often you will notice that being conscious of
+the eyes of the whole visible world resting on him from the sides of
+the two ships, this standing captain is all alive to the importance
+of sustaining his dignity by maintaining his legs.  Nor is this any
+very easy matter; for in his rear is the immense projecting steering
+oar hitting him now and then in the small of his back, the after-oar
+reciprocating by rapping his knees in front.  He is thus completely
+wedged before and behind, and can only expand himself sideways by
+settling down on his stretched legs; but a sudden, violent pitch of
+the boat will often go far to topple him, because length of
+foundation is nothing without corresponding breadth.  Merely make a
+spread angle of two poles, and you cannot stand them up.  Then,
+again, it would never do in plain sight of the world's riveted eyes,
+it would never do, I say, for this straddling captain to be seen
+steadying himself the slightest particle by catching hold of anything
+with his hands; indeed, as token of his entire, buoyant self-command,
+he generally carries his hands in his trowsers' pockets; but perhaps
+being generally very large, heavy hands, he carries them there for
+ballast.  Nevertheless there have occurred instances, well
+authenticated ones too, where the captain has been known for an
+uncommonly critical moment or two, in a sudden squall say--to seize
+hold of the nearest oarsman's hair, and hold on there like grim
+death.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 1</DOCNO>
+The Town-Ho's Story.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 2</DOCNO>
+(AS TOLD AT THE GOLDEN INN)
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 3</DOCNO>
+The Cape of Good Hope, and all the watery region round about there,
+is much like some noted four corners of a great highway, where you
+meet more travellers than in any other part.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 4</DOCNO>
+It was not very long after speaking the Goney that another
+homeward-bound whaleman, the Town-Ho,* was encountered.  She was
+manned almost wholly by Polynesians.  In the short gam that ensued
+she gave us strong news of Moby Dick.  To some the general interest
+in the White Whale was now wildly heightened by a circumstance of the
+Town-Ho's story, which seemed obscurely to involve with the whale a
+certain wondrous, inverted visitation of one of those so called
+judgments of God which at times are said to overtake some men.  This
+latter circumstance, with its own particular accompaniments, forming
+what may be called the secret part of the tragedy about to be
+narrated, never reached the ears of Captain Ahab or his mates.  For
+that secret part of the story was unknown to the captain of the
+Town-Ho himself.  It was the private property of three confederate
+white seamen of that ship, one of whom, it seems, communicated it to
+Tashtego with Romish injunctions of secrecy, but the following night
+Tashtego rambled in his sleep, and revealed so much of it in that
+way, that when he was wakened he could not well withhold the rest.
+Nevertheless, so potent an influence did this thing have on those
+seamen in the Pequod who came to the full knowledge of it, and by
+such a strange delicacy, to call it so, were they governed in this
+matter, that they kept the secret among themselves so that it never
+transpired abaft the Pequod's main-mast.  Interweaving in its proper
+place this darker thread with the story as publicly narrated on the
+ship, the whole of this strange affair I now proceed to put on
+lasting record.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 5</DOCNO>
+*The ancient whale-cry upon first sighting a whale from the
+mast-head, still used by whalemen in hunting the famous Gallipagos
+terrapin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 6</DOCNO>
+For my humor's sake, I shall preserve the style in which I once
+narrated it at Lima, to a lounging circle of my Spanish friends, one
+saint's eve, smoking upon the thick-gilt tiled piazza of the Golden
+Inn.  Of those fine cavaliers, the young Dons, Pedro and Sebastian,
+were on the closer terms with me; and hence the interluding questions
+they occasionally put, and which are duly answered at the time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 7</DOCNO>
+"Some two years prior to my first learning the events which I am
+about rehearsing to you, gentlemen, the Town-Ho, Sperm Whaler of
+Nantucket, was cruising in your Pacific here, not very many days'
+sail eastward from the eaves of this good Golden Inn.  She was
+somewhere to the northward of the Line.  One morning upon handling
+the pumps, according to daily usage, it was observed that she made
+more water in her hold than common.  They supposed a sword-fish had
+stabbed her, gentlemen.  But the captain, having some unusual reason
+for believing that rare good luck awaited him in those latitudes; and
+therefore being very averse to quit them, and the leak not being then
+considered at all dangerous, though, indeed, they could not find it
+after searching the hold as low down as was possible in rather heavy
+weather, the ship still continued her cruisings, the mariners working
+at the pumps at wide and easy intervals; but no good luck came; more
+days went by, and not only was the leak yet undiscovered, but it
+sensibly increased.  So much so, that now taking some alarm, the
+captain, making all sail, stood away for the nearest harbor among the
+islands, there to have his hull hove out and repaired.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 8</DOCNO>
+"Though no small passage was before her, yet, if the commonest chance
+favoured, he did not at all fear that his ship would founder by the
+way, because his pumps were of the best, and being periodically
+relieved at them, those six-and-thirty men of his could easily keep
+the ship free; never mind if the leak should double on her.  In
+truth, well nigh the whole of this passage being attended by very
+prosperous breezes, the Town-Ho had all but certainly arrived in
+perfect safety at her port without the occurrence of the least
+fatality, had it not been for the brutal overbearing of Radney, the
+mate, a Vineyarder, and the bitterly provoked vengeance of Steelkilt,
+a Lakeman and desperado from Buffalo.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 9</DOCNO>
+"'Lakeman!--Buffalo!  Pray, what is a Lakeman, and where is Buffalo?'
+said Don Sebastian, rising in his swinging mat of grass.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 10</DOCNO>
+"On the eastern shore of our Lake Erie, Don; but--I crave your
+courtesy--may be, you shall soon hear further of all that.  Now,
+gentlemen, in square-sail brigs and three-masted ships, well-nigh as
+large and stout as any that ever sailed out of your old Callao to far
+Manilla; this Lakeman, in the land-locked heart of our America, had
+yet been nurtured by all those agrarian freebooting impressions
+popularly connected with the open ocean.  For in their interflowing
+aggregate, those grand fresh-water seas of ours,--Erie, and Ontario,
+and Huron, and Superior, and Michigan,--possess an ocean-like
+expansiveness, with many of the ocean's noblest traits; with many of
+its rimmed varieties of races and of climes.  They contain round
+archipelagoes of romantic isles, even as the Polynesian waters do; in
+large part, are shored by two great contrasting nations, as the
+Atlantic is; they furnish long maritime approaches to our numerous
+territorial colonies from the East, dotted all round their banks;
+here and there are frowned upon by batteries, and by the goat-like
+craggy guns of lofty Mackinaw; they have heard the fleet thunderings
+of naval victories; at intervals, they yield their beaches to wild
+barbarians, whose red painted faces flash from out their peltry
+wigwams; for leagues and leagues are flanked by ancient and unentered
+forests, where the gaunt pines stand like serried lines of kings in
+Gothic genealogies; those same woods harboring wild Afric beasts of
+prey, and silken creatures whose exported furs give robes to Tartar
+Emperors; they mirror the paved capitals of Buffalo and Cleveland, as
+well as Winnebago villages; they float alike the full-rigged merchant
+ship, the armed cruiser of the State, the steamer, and the beech
+canoe; they are swept by Borean and dismasting blasts as direful as
+any that lash the salted wave; they know what shipwrecks are, for out
+of sight of land, however inland, they have drowned full many a
+midnight ship with all its shrieking crew.  Thus, gentlemen, though
+an inlander, Steelkilt was wild-ocean born, and wild-ocean nurtured;
+as much of an audacious mariner as any.  And for Radney, though in
+his infancy he may have laid him down on the lone Nantucket beach, to
+nurse at his maternal sea; though in after life he had long followed
+our austere Atlantic and your contemplative Pacific; yet was he quite
+as vengeful and full of social quarrel as the backwoods seaman, fresh
+from the latitudes of buck-horn handled bowie-knives.  Yet was this
+Nantucketer a man with some good-hearted traits; and this Lakeman, a
+mariner, who though a sort of devil indeed, might yet by inflexible
+firmness, only tempered by that common decency of human recognition
+which is the meanest slave's right; thus treated, this Steelkilt had
+long been retained harmless and docile.  At all events, he had proved
+so thus far; but Radney was doomed and made mad, and Steelkilt--but,
+gentlemen, you shall hear.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 11</DOCNO>
+"It was not more than a day or two at the furthest after pointing her
+prow for her island haven, that the Town-Ho's leak seemed again
+increasing, but only so as to require an hour or more at the pumps
+every day.  You must know that in a settled and civilized ocean like
+our Atlantic, for example, some skippers think little of pumping
+their whole way across it; though of a still, sleepy night, should
+the officer of the deck happen to forget his duty in that respect,
+the probability would be that he and his shipmates would never again
+remember it, on account of all hands gently subsiding to the bottom.
+Nor in the solitary and savage seas far from you to the westward,
+gentlemen, is it altogether unusual for ships to keep clanging at
+their pump-handles in full chorus even for a voyage of considerable
+length; that is, if it lie along a tolerably accessible coast, or if
+any other reasonable retreat is afforded them.  It is only when a
+leaky vessel is in some very out of the way part of those waters,
+some really landless latitude, that her captain begins to feel a
+little anxious.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 12</DOCNO>
+"Much this way had it been with the Town-Ho; so when her leak was
+found gaining once more, there was in truth some small concern
+manifested by several of her company; especially by Radney the mate.
+He commanded the upper sails to be well hoisted, sheeted home anew,
+and every way expanded to the breeze.  Now this Radney, I suppose,
+was as little of a coward, and as little inclined to any sort of
+nervous apprehensiveness touching his own person as any fearless,
+unthinking creature on land or on sea that you can conveniently
+imagine, gentlemen.  Therefore when he betrayed this solicitude about
+the safety of the ship, some of the seamen declared that it was only
+on account of his being a part owner in her.  So when they were
+working that evening at the pumps, there was on this head no small
+gamesomeness slily going on among them, as they stood with their feet
+continually overflowed by the rippling clear water; clear as any
+mountain spring, gentlemen--that bubbling from the pumps ran across
+the deck, and poured itself out in steady spouts at the lee
+scupper-holes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 13</DOCNO>
+"Now, as you well know, it is not seldom the case in this
+conventional world of ours--watery or otherwise; that when a person
+placed in command over his fellow-men finds one of them to be very
+significantly his superior in general pride of manhood, straightway
+against that man he conceives an unconquerable dislike and
+bitterness; and if he have a chance he will pull down and pulverize
+that subaltern's tower, and make a little heap of dust of it.  Be
+this conceit of mine as it may, gentlemen, at all events Steelkilt
+was a tall and noble animal with a head like a Roman, and a flowing
+golden beard like the tasseled housings of your last viceroy's
+snorting charger; and a brain, and a heart, and a soul in him,
+gentlemen, which had made Steelkilt Charlemagne, had he been born son
+to Charlemagne's father.  But Radney, the mate, was ugly as a mule;
+yet as hardy, as stubborn, as malicious.  He did not love Steelkilt,
+and Steelkilt knew it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 14</DOCNO>
+"Espying the mate drawing near as he was toiling at the pump with the
+rest, the Lakeman affected not to notice him, but unawed, went on
+with his gay banterings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 15</DOCNO>
+"'Aye, aye, my merry lads, it's a lively leak this; hold a cannikin,
+one of ye, and let's have a taste.  By the Lord, it's worth bottling!
+I tell ye what, men, old Rad's investment must go for it! he had
+best cut away his part of the hull and tow it home.  The fact is,
+boys, that sword-fish only began the job; he's come back again with a
+gang of ship-carpenters, saw-fish, and file-fish, and what not; and
+the whole posse of 'em are now hard at work cutting and slashing at
+the bottom; making improvements, I suppose.  If old Rad were here
+now, I'd tell him to jump overboard and scatter 'em.  They're playing
+the devil with his estate, I can tell him.  But he's a simple old
+soul,--Rad, and a beauty too.  Boys, they say the rest of his
+property is invested in looking-glasses.  I wonder if he'd give a
+poor devil like me the model of his nose.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 16</DOCNO>
+"'Damn your eyes! what's that pump stopping for?' roared Radney,
+pretending not to have heard the sailors' talk.  'Thunder away at
+it!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 17</DOCNO>
+'Aye, aye, sir,' said Steelkilt, merry as a cricket.  'Lively, boys,
+lively, now!'  And with that the pump clanged like fifty
+fire-engines; the men tossed their hats off to it, and ere long that
+peculiar gasping of the lungs was heard which denotes the fullest
+tension of life's utmost energies.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 18</DOCNO>
+"Quitting the pump at last, with the rest of his band, the Lakeman
+went forward all panting, and sat himself down on the windlass; his
+face fiery red, his eyes bloodshot, and wiping the profuse sweat from
+his brow.  Now what cozening fiend it was, gentlemen, that possessed
+Radney to meddle with such a man in that corporeally exasperated
+state, I know not; but so it happened.  Intolerably striding along
+the deck, the mate commanded him to get a broom and sweep down the
+planks, and also a shovel, and remove some offensive matters
+consequent upon allowing a pig to run at large.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 19</DOCNO>
+"Now, gentlemen, sweeping a ship's deck at sea is a piece of
+household work which in all times but raging gales is regularly
+attended to every evening; it has been known to be done in the case
+of ships actually foundering at the time.  Such, gentlemen, is the
+inflexibility of sea-usages and the instinctive love of neatness in
+seamen; some of whom would not willingly drown without first washing
+their faces.  But in all vessels this broom business is the
+prescriptive province of the boys, if boys there be aboard.  Besides,
+it was the stronger men in the Town-Ho that had been divided into
+gangs, taking turns at the pumps; and being the most athletic seaman
+of them all, Steelkilt had been regularly assigned captain of one of
+the gangs; consequently he should have been freed from any trivial
+business not connected with truly nautical duties, such being the
+case with his comrades.  I mention all these particulars so that you
+may understand exactly how this affair stood between the two men.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 20</DOCNO>
+"But there was more than this: the order about the shovel was almost
+as plainly meant to sting and insult Steelkilt, as though Radney had
+spat in his face.  Any man who has gone sailor in a whale-ship will
+understand this; and all this and doubtless much more, the Lakeman
+fully comprehended when the mate uttered his command.  But as he sat
+still for a moment, and as he steadfastly looked into the mate's
+malignant eye and perceived the stacks of powder-casks heaped up in
+him and the slow-match silently burning along towards them; as he
+instinctively saw all this, that strange forbearance and
+unwillingness to stir up the deeper passionateness in any already
+ireful being--a repugnance most felt, when felt at all, by really
+valiant men even when aggrieved--this nameless phantom feeling,
+gentlemen, stole over Steelkilt.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 21</DOCNO>
+"Therefore, in his ordinary tone, only a little broken by the bodily
+exhaustion he was temporarily in, he answered him saying that
+sweeping the deck was not his business, and he would not do it.  And
+then, without at all alluding to the shovel, he pointed to three
+lads as the customary sweepers; who, not being billeted at the
+pumps, had done little or nothing all day.  To this, Radney replied
+with an oath, in a most domineering and outrageous manner
+unconditionally reiterating his command; meanwhile advancing upon the
+still seated Lakeman, with an uplifted cooper's club hammer which he
+had snatched from a cask near by.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 22</DOCNO>
+"Heated and irritated as he was by his spasmodic toil at the pumps,
+for all his first nameless feeling of forbearance the sweating
+Steelkilt could but ill brook this bearing in the mate; but somehow
+still smothering the conflagration within him, without speaking he
+remained doggedly rooted to his seat, till at last the incensed
+Radney shook the hammer within a few inches of his face, furiously
+commanding him to do his bidding.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 23</DOCNO>
+"Steelkilt rose, and slowly retreating round the windlass, steadily
+followed by the mate with his menacing hammer, deliberately repeated
+his intention not to obey.  Seeing, however, that his forbearance had
+not the slightest effect, by an awful and unspeakable intimation with
+his twisted hand he warned off the foolish and infatuated man; but it
+was to no purpose.  And in this way the two went once slowly round
+the windlass; when, resolved at last no longer to retreat, bethinking
+him that he had now forborne as much as comported with his humor, the
+Lakeman paused on the hatches and thus spoke to the officer:
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 24</DOCNO>
+"'Mr. Radney, I will not obey you.  Take that hammer away, or look to
+yourself.'  But the predestinated mate coming still closer to him,
+where the Lakeman stood fixed, now shook the heavy hammer within an
+inch of his teeth; meanwhile repeating a string of insufferable
+maledictions.  Retreating not the thousandth part of an inch;
+stabbing him in the eye with the unflinching poniard of his glance,
+Steelkilt, clenching his right hand behind him and creepingly drawing
+it back, told his persecutor that if the hammer but grazed his cheek
+he (Steelkilt) would murder him.  But, gentlemen, the fool had been
+branded for the slaughter by the gods.  Immediately the hammer
+touched the cheek; the next instant the lower jaw of the mate was
+stove in his head; he fell on the hatch spouting blood like a whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 25</DOCNO>
+"Ere the cry could go aft Steelkilt was shaking one of the backstays
+leading far aloft to where two of his comrades were standing their
+mastheads.  They were both Canallers.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 26</DOCNO>
+"'Canallers!' cried Don Pedro.  'We have seen many whale-ships in our
+harbours, but never heard of your Canallers.  Pardon: who and what are
+they?'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 27</DOCNO>
+"'Canallers, Don, are the boatmen belonging to our grand Erie Canal.
+You must have heard of it.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 28</DOCNO>
+"'Nay, Senor; hereabouts in this dull, warm, most lazy, and
+hereditary land, we know but little of your vigorous North.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 29</DOCNO>
+"'Aye?  Well then, Don, refill my cup.  Your chicha's very fine; and
+ere proceeding further I will tell ye what our Canallers are; for
+such information may throw side-light upon my story.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 30</DOCNO>
+"For three hundred and sixty miles, gentlemen, through the entire
+breadth of the state of New York; through numerous populous cities
+and most thriving villages; through long, dismal, uninhabited swamps,
+and affluent, cultivated fields, unrivalled for fertility; by
+billiard-room and bar-room; through the holy-of-holies of great
+forests; on Roman arches over Indian rivers; through sun and shade;
+by happy hearts or broken; through all the wide contrasting scenery
+of those noble Mohawk counties; and especially, by rows of snow-white
+chapels, whose spires stand almost like milestones, flows one
+continual stream of Venetianly corrupt and often lawless life.
+There's your true Ashantee, gentlemen; there howl your pagans; where
+you ever find them, next door to you; under the long-flung shadow,
+and the snug patronising lee of churches.  For by some curious
+fatality, as it is often noted of your metropolitan freebooters that
+they ever encamp around the halls of justice, so sinners, gentlemen,
+most abound in holiest vicinities.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 31</DOCNO>
+"'Is that a friar passing?' said Don Pedro, looking downwards into
+the crowded plazza, with humorous concern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 32</DOCNO>
+"'Well for our northern friend, Dame Isabella's Inquisition wanes in
+Lima,' laughed Don Sebastian.  'Proceed, Senor.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 33</DOCNO>
+"'A moment!  Pardon!' cried another of the company.  'In the name of
+all us Limeese, I but desire to express to you, sir sailor, that we
+have by no means overlooked your delicacy in not substituting present
+Lima for distant Venice in your corrupt comparison.  Oh! do not bow
+and look surprised; you know the proverb all along this
+coast--"Corrupt as Lima."  It but bears out your saying, too;
+churches more plentiful than billiard-tables, and for ever open--and
+"Corrupt as Lima."  So, too, Venice; I have been there; the holy city
+of the blessed evangelist, St. Mark!--St. Dominic, purge it!  Your
+cup!  Thanks: here I refill; now, you pour out again.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 34</DOCNO>
+"Freely depicted in his own vocation, gentlemen, the Canaller would
+make a fine dramatic hero, so abundantly and picturesquely wicked is
+he.  Like Mark Antony, for days and days along his green-turfed,
+flowery Nile, he indolently floats, openly toying with his
+red-cheeked Cleopatra, ripening his apricot thigh upon the sunny
+deck.  But ashore, all this effeminacy is dashed.  The brigandish
+guise which the Canaller so proudly sports; his slouched and
+gaily-ribboned hat betoken his grand features.  A terror to the
+smiling innocence of the villages through which he floats; his swart
+visage and bold swagger are not unshunned in cities.  Once a vagabond
+on his own canal, I have received good turns from one of these
+Canallers; I thank him heartily; would fain be not ungrateful; but it
+is often one of the prime redeeming qualities of your man of
+violence, that at times he has as stiff an arm to back a poor
+stranger in a strait, as to plunder a wealthy one.  In sum,
+gentlemen, what the wildness of this canal life is, is emphatically
+evinced by this; that our wild whale-fishery contains so many of its
+most finished graduates, and that scarce any race of mankind, except
+Sydney men, are so much distrusted by our whaling captains.  Nor does
+it at all diminish the curiousness of this matter, that to many
+thousands of our rural boys and young men born along its line, the
+probationary life of the Grand Canal furnishes the sole transition
+between quietly reaping in a Christian corn-field, and recklessly
+ploughing the waters of the most barbaric seas.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 35</DOCNO>
+"'I see!  I see!' impetuously exclaimed Don Pedro, spilling his
+chicha upon his silvery ruffles.  'No need to travel!  The world's
+one Lima.  I had thought, now, that at your temperate North the
+generations were cold and holy as the hills.--But the story.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 36</DOCNO>
+"I left off, gentlemen, where the Lakeman shook the backstay.
+Hardly had he done so, when he was surrounded by the three junior
+mates and the four harpooneers, who all crowded him to the deck.  But
+sliding down the ropes like baleful comets, the two Canallers rushed
+into the uproar, and sought to drag their man out of it towards the
+forecastle.  Others of the sailors joined with them in this attempt,
+and a twisted turmoil ensued; while standing out of harm's way, the
+valiant captain danced up and down with a whale-pike, calling upon
+his officers to manhandle that atrocious scoundrel, and smoke him
+along to the quarter-deck.  At intervals, he ran close up to the
+revolving border of the confusion, and prying into the heart of it
+with his pike, sought to prick out the object of his resentment.  But
+Steelkilt and his desperadoes were too much for them all; they
+succeeded in gaining the forecastle deck, where, hastily slewing
+about three or four large casks in a line with the windlass, these
+sea-Parisians entrenched themselves behind the barricade.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 37</DOCNO>
+"'Come out of that, ye pirates!' roared the captain, now menacing
+them with a pistol in each hand, just brought to him by the steward.
+'Come out of that, ye cut-throats!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 38</DOCNO>
+"Steelkilt leaped on the barricade, and striding up and down there,
+defied the worst the pistols could do; but gave the captain to
+understand distinctly, that his (Steelkilt's) death would be the
+signal for a murderous mutiny on the part of all hands.  Fearing in
+his heart lest this might prove but too true, the captain a little
+desisted, but still commanded the insurgents instantly to return to
+their duty.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 39</DOCNO>
+"'Will you promise not to touch us, if we do?' demanded their
+ringleader.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 40</DOCNO>
+"'Turn to! turn to!--I make no promise;--to your duty!  Do you want
+to sink the ship, by knocking off at a time like this?  Turn to!' and
+he once more raised a pistol.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 41</DOCNO>
+"'Sink the ship?' cried Steelkilt.  'Aye, let her sink.  Not a man of
+us turns to, unless you swear not to raise a rope-yarn against us.
+What say ye, men?' turning to his comrades.  A fierce cheer was their
+response.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 42</DOCNO>
+"The Lakeman now patrolled the barricade, all the while keeping his
+eye on the Captain, and jerking out such sentences as these:--'It's
+not our fault; we didn't want it; I told him to take his hammer away;
+it was boy's business; he might have known me before this; I told him
+not to prick the buffalo; I believe I have broken a finger here
+against his cursed jaw; ain't those mincing knives down in the
+forecastle there, men? look to those handspikes, my hearties.
+Captain, by God, look to yourself; say the word; don't be a fool;
+forget it all; we are ready to turn to; treat us decently, and we're
+your men; but we won't be flogged.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 43</DOCNO>
+"'Turn to!  I make no promises, turn to, I say!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 44</DOCNO>
+"'Look ye, now,' cried the Lakeman, flinging out his arm towards him,
+'there are a few of us here (and I am one of them) who have shipped
+for the cruise, d'ye see; now as you well know, sir, we can claim our
+discharge as soon as the anchor is down; so we don't want a row; it's
+not our interest; we want to be peaceable; we are ready to work, but
+we won't be flogged.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 45</DOCNO>
+"'Turn to!' roared the Captain.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 46</DOCNO>
+"Steelkilt glanced round him a moment, and then said:--'I tell you
+what it is now, Captain, rather than kill ye, and be hung for such a
+shabby rascal, we won't lift a hand against ye unless ye attack us;
+but till you say the word about not flogging us, we don't do a hand's
+turn.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 47</DOCNO>
+"'Down into the forecastle then, down with ye, I'll keep ye there
+till ye're sick of it.  Down ye go.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 48</DOCNO>
+"'Shall we?' cried the ringleader to his men.  Most of them were
+against it; but at length, in obedience to Steelkilt, they preceded
+him down into their dark den, growlingly disappearing, like bears
+into a cave.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 49</DOCNO>
+"As the Lakeman's bare head was just level with the planks, the
+Captain and his posse leaped the barricade, and rapidly drawing over
+the slide of the scuttle, planted their group of hands upon it, and
+loudly called for the steward to bring the heavy brass padlock
+belonging to the companionway.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 50</DOCNO>
+Then opening the slide a little, the Captain whispered something down
+the crack, closed it, and turned the key upon them--ten in
+number--leaving on deck some twenty or more, who thus far had
+remained neutral.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 51</DOCNO>
+"All night a wide-awake watch was kept by all the officers, forward
+and aft, especially about the forecastle scuttle and fore hatchway;
+at which last place it was feared the insurgents might emerge, after
+breaking through the bulkhead below.  But the hours of darkness
+passed in peace; the men who still remained at their duty toiling
+hard at the pumps, whose clinking and clanking at intervals through
+the dreary night dismally resounded through the ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 52</DOCNO>
+"At sunrise the Captain went forward, and knocking on the deck,
+summoned the prisoners to work; but with a yell they refused.  Water
+was then lowered down to them, and a couple of handfuls of biscuit
+were tossed after it; when again turning the key upon them and
+pocketing it, the Captain returned to the quarter-deck.  Twice every
+day for three days this was repeated; but on the fourth morning a
+confused wrangling, and then a scuffling was heard, as the customary
+summons was delivered; and suddenly four men burst up from the
+forecastle, saying they were ready to turn to.  The fetid closeness
+of the air, and a famishing diet, united perhaps to some fears of
+ultimate retribution, had constrained them to surrender at
+discretion.  Emboldened by this, the Captain reiterated his demand to
+the rest, but Steelkilt shouted up to him a terrific hint to stop his
+babbling and betake himself where he belonged.  On the fifth morning
+three others of the mutineers bolted up into the air from the
+desperate arms below that sought to restrain them.  Only three were
+left.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 53</DOCNO>
+"'Better turn to, now?' said the Captain with a heartless jeer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 54</DOCNO>
+"'Shut us up again, will ye!' cried Steelkilt.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 55</DOCNO>
+"'Oh certainly,' the Captain, and the key clicked.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 56</DOCNO>
+"It was at this point, gentlemen, that enraged by the defection of
+seven of his former associates, and stung by the mocking voice that
+had last hailed him, and maddened by his long entombment in a place
+as black as the bowels of despair; it was then that Steelkilt
+proposed to the two Canallers, thus far apparently of one mind with
+him, to burst out of their hole at the next summoning of the
+garrison; and armed with their keen mincing knives (long, crescentic,
+heavy implements with a handle at each end) run amuck from the
+bowsprit to the taffrail; and if by any devilishness of desperation
+possible, seize the ship.  For himself, he would do this, he said,
+whether they joined him or not.  That was the last night he should
+spend in that den.  But the scheme met with no opposition on the part
+of the other two; they swore they were ready for that, or for any
+other mad thing, for anything in short but a surrender.  And what was
+more, they each insisted upon being the first man on deck, when the
+time to make the rush should come.  But to this their leader as
+fiercely objected, reserving that priority for himself; particularly
+as his two comrades would not yield, the one to the other, in the
+matter; and both of them could not be first, for the ladder would but
+admit one man at a time.  And here, gentlemen, the foul play of these
+miscreants must come out.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 57</DOCNO>
+"Upon hearing the frantic project of their leader, each in his own
+separate soul had suddenly lighted, it would seem, upon the same
+piece of treachery, namely: to be foremost in breaking out, in
+order to be the first of the three, though the last of the ten, to
+surrender; and thereby secure whatever small chance of pardon such
+conduct might merit.  But when Steelkilt made known his determination
+still to lead them to the last, they in some way, by some subtle
+chemistry of villany, mixed their before secret treacheries together;
+and when their leader fell into a doze, verbally opened their souls
+to each other in three sentences; and bound the sleeper with cords,
+and gagged him with cords; and shrieked out for the Captain at
+midnight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 58</DOCNO>
+"Thinking murder at hand, and smelling in the dark for the blood, he
+and all his armed mates and harpooneers rushed for the forecastle.
+In a few minutes the scuttle was opened, and, bound hand and foot,
+the still struggling ringleader was shoved up into the air by his
+perfidious allies, who at once claimed the honour of securing a man
+who had been fully ripe for murder.  But all these were collared, and
+dragged along the deck like dead cattle; and, side by side, were
+seized up into the mizzen rigging, like three quarters of meat, and
+there they hung till morning.  'Damn ye,' cried the Captain, pacing
+to and fro before them, 'the vultures would not touch ye, ye
+villains!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 59</DOCNO>
+"At sunrise he summoned all hands; and separating those who had
+rebelled from those who had taken no part in the mutiny, he told the
+former that he had a good mind to flog them all round--thought, upon
+the whole, he would do so--he ought to--justice demanded it; but for
+the present, considering their timely surrender, he would let them go
+with a reprimand, which he accordingly administered in the vernacular.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 60</DOCNO>
+"'But as for you, ye carrion rogues,' turning to the three men in the
+rigging--'for you, I mean to mince ye up for the try-pots;' and,
+seizing a rope, he applied it with all his might to the backs of the
+two traitors, till they yelled no more, but lifelessly hung their
+heads sideways, as the two crucified thieves are drawn.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 61</DOCNO>
+"'My wrist is sprained with ye!' he cried, at last; 'but there is
+still rope enough left for you, my fine bantam, that wouldn't give
+up.  Take that gag from his mouth, and let us hear what he can say
+for himself.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 62</DOCNO>
+"For a moment the exhausted mutineer made a tremulous motion of his
+cramped jaws, and then painfully twisting round his head, said in a
+sort of hiss, 'What I say is this--and mind it well--if you flog me,
+I murder you!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 63</DOCNO>
+"'Say ye so? then see how ye frighten me'--and the Captain drew off
+with the rope to strike.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 64</DOCNO>
+"'Best not,' hissed the Lakeman.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 65</DOCNO>
+"'But I must,'--and the rope was once more drawn back for the stroke.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 66</DOCNO>
+"Steelkilt here hissed out something, inaudible to all but the
+Captain; who, to the amazement of all hands, started back, paced the
+deck rapidly two or three times, and then suddenly throwing down his
+rope, said, 'I won't do it--let him go--cut him down: d'ye hear?'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 67</DOCNO>
+But as the junior mates were hurrying to execute the order, a pale
+man, with a bandaged head, arrested them--Radney the chief mate.
+Ever since the blow, he had lain in his berth; but that morning,
+hearing the tumult on the deck, he had crept out, and thus far had
+watched the whole scene.  Such was the state of his mouth, that he
+could hardly speak; but mumbling something about his being willing
+and able to do what the captain dared not attempt, he snatched the
+rope and advanced to his pinioned foe.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 68</DOCNO>
+"'You are a coward!' hissed the Lakeman.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 69</DOCNO>
+"'So I am, but take that.'  The mate was in the very act of striking,
+when another hiss stayed his uplifted arm.  He paused: and then
+pausing no more, made good his word, spite of Steelkilt's threat,
+whatever that might have been.  The three men were then cut down, all
+hands were turned to, and, sullenly worked by the moody seamen, the
+iron pumps clanged as before.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 70</DOCNO>
+"Just after dark that day, when one watch had retired below, a clamor
+was heard in the forecastle; and the two trembling traitors running
+up, besieged the cabin door, saying they durst not consort with the
+crew.  Entreaties, cuffs, and kicks could not drive them back, so at
+their own instance they were put down in the ship's run for
+salvation.  Still, no sign of mutiny reappeared among the rest.  On
+the contrary, it seemed, that mainly at Steelkilt's instigation, they
+had resolved to maintain the strictest peacefulness, obey all orders
+to the last, and, when the ship reached port, desert her in a body.
+But in order to insure the speediest end to the voyage, they all
+agreed to another thing--namely, not to sing out for whales, in case
+any should be discovered.  For, spite of her leak, and spite of all her
+other perils, the Town-Ho still maintained her mast-heads, and her
+captain was just as willing to lower for a fish that moment, as on
+the day his craft first struck the cruising ground; and Radney the mate
+was quite as ready to change his berth for a boat, and with his
+bandaged mouth seek to gag in death the vital jaw of the whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 71</DOCNO>
+"But though the Lakeman had induced the seamen to adopt this sort of
+passiveness in their conduct, he kept his own counsel (at least till
+all was over) concerning his own proper and private revenge upon the
+man who had stung him in the ventricles of his heart.  He was in
+Radney the chief mate's watch; and as if the infatuated man sought to
+run more than half way to meet his doom, after the scene at the
+rigging, he insisted, against the express counsel of the captain,
+upon resuming the head of his watch at night.  Upon this, and one or
+two other circumstances, Steelkilt systematically built the plan of
+his revenge.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 72</DOCNO>
+"During the night, Radney had an unseamanlike way of sitting on the
+bulwarks of the quarter-deck, and leaning his arm upon the gunwale of
+the boat which was hoisted up there, a little above the ship's side.
+In this attitude, it was well known, he sometimes dozed.  There was a
+considerable vacancy between the boat and the ship, and down between
+this was the sea.  Steelkilt calculated his time, and found that his
+next trick at the helm would come round at two o'clock, in the
+morning of the third day from that in which he had been betrayed.  At
+his leisure, he employed the interval in braiding something very
+carefully in his watches below.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 73</DOCNO>
+"'What are you making there?' said a shipmate.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 74</DOCNO>
+"'What do you think? what does it look like?'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 75</DOCNO>
+"'Like a lanyard for your bag; but it's an odd one, seems to me.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 76</DOCNO>
+'Yes, rather oddish,' said the Lakeman, holding it at arm's length
+before him; 'but I think it will answer.  Shipmate, I haven't enough
+twine,--have you any?'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 77</DOCNO>
+"But there was none in the forecastle.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 78</DOCNO>
+"'Then I must get some from old Rad;' and he rose to go aft.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 79</DOCNO>
+"'You don't mean to go a begging to HIM!' said a sailor.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 80</DOCNO>
+"'Why not?  Do you think he won't do me a turn, when it's to help
+himself in the end, shipmate?' and going to the mate, he looked at
+him quietly, and asked him for some twine to mend his hammock.  It
+was given him--neither twine nor lanyard were seen again; but the
+next night an iron ball, closely netted, partly rolled from the
+pocket of the Lakeman's monkey jacket, as he was tucking the coat
+into his hammock for a pillow.  Twenty-four hours after, his trick at
+the silent helm--nigh to the man who was apt to doze over the grave
+always ready dug to the seaman's hand--that fatal hour was then to
+come; and in the fore-ordaining soul of Steelkilt, the mate was
+already stark and stretched as a corpse, with his forehead crushed
+in.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 81</DOCNO>
+"But, gentlemen, a fool saved the would-be murderer from the bloody
+deed he had planned.  Yet complete revenge he had, and without being
+the avenger.  For by a mysterious fatality, Heaven itself seemed to
+step in to take out of his hands into its own the damning thing he
+would have done.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 82</DOCNO>
+"It was just between daybreak and sunrise of the morning of the
+second day, when they were washing down the decks, that a stupid
+Teneriffe man, drawing water in the main-chains, all at once shouted
+out, 'There she rolls! there she rolls!'  Jesu, what a whale!  It was
+Moby Dick.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 83</DOCNO>
+"'Moby Dick!' cried Don Sebastian; 'St. Dominic!  Sir sailor, but do
+whales have christenings?  Whom call you Moby Dick?'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 84</DOCNO>
+"'A very white, and famous, and most deadly immortal monster,
+Don;--but that would be too long a story.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 85</DOCNO>
+"'How? how?' cried all the young Spaniards, crowding.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 86</DOCNO>
+"'Nay, Dons, Dons--nay, nay!  I cannot rehearse that now.  Let me get
+more into the air, Sirs.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 87</DOCNO>
+"'The chicha! the chicha!' cried Don Pedro; 'our vigorous friend looks
+faint;--fill up his empty glass!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 88</DOCNO>
+"No need, gentlemen; one moment, and I proceed.--Now, gentlemen, so
+suddenly perceiving the snowy whale within fifty yards of the
+ship--forgetful of the compact among the crew--in the excitement of
+the moment, the Teneriffe man had instinctively and involuntarily
+lifted his voice for the monster, though for some little time past it
+had been plainly beheld from the three sullen mast-heads.  All was
+now a phrensy.  'The White Whale--the White Whale!' was the cry from
+captain, mates, and harpooneers, who, undeterred by fearful rumours,
+were all anxious to capture so famous and precious a fish; while the
+dogged crew eyed askance, and with curses, the appalling beauty of
+the vast milky mass, that lit up by a horizontal spangling sun,
+shifted and glistened like a living opal in the blue morning sea.
+Gentlemen, a strange fatality pervades the whole career of these
+events, as if verily mapped out before the world itself was charted.
+The mutineer was the bowsman of the mate, and when fast to a fish, it
+was his duty to sit next him, while Radney stood up with his lance in
+the prow, and haul in or slacken the line, at the word of command.
+Moreover, when the four boats were lowered, the mate's got the start;
+and none howled more fiercely with delight than did Steelkilt, as he
+strained at his oar.  After a stiff pull, their harpooneer got fast,
+and, spear in hand, Radney sprang to the bow.  He was always a
+furious man, it seems, in a boat.  And now his bandaged cry was, to
+beach him on the whale's topmost back.  Nothing loath, his bowsman
+hauled him up and up, through a blinding foam that blent two
+whitenesses together; till of a sudden the boat struck as against a
+sunken ledge, and keeling over, spilled out the standing mate.  That
+instant, as he fell on the whale's slippery back, the boat righted,
+and was dashed aside by the swell, while Radney was tossed over into
+the sea, on the other flank of the whale.  He struck out through the
+spray, and, for an instant, was dimly seen through that veil, wildly
+seeking to remove himself from the eye of Moby Dick.  But the whale
+rushed round in a sudden maelstrom; seized the swimmer between his
+jaws; and rearing high up with him, plunged headlong again, and went
+down.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 89</DOCNO>
+"Meantime, at the first tap of the boat's bottom, the Lakeman had
+slackened the line, so as to drop astern from the whirlpool; calmly
+looking on, he thought his own thoughts.  But a sudden, terrific,
+downward jerking of the boat, quickly brought his knife to the line.
+He cut it; and the whale was free.  But, at some distance, Moby Dick
+rose again, with some tatters of Radney's red woollen shirt, caught
+in the teeth that had destroyed him.  All four boats gave chase
+again; but the whale eluded them, and finally wholly disappeared.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 90</DOCNO>
+"In good time, the Town-Ho reached her port--a savage, solitary
+place--where no civilized creature resided.  There, headed by the
+Lakeman, all but five or six of the foremastmen deliberately
+deserted among the palms; eventually, as it turned out, seizing a
+large double war-canoe of the savages, and setting sail for some
+other harbor.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 91</DOCNO>
+"The ship's company being reduced to but a handful, the captain
+called upon the Islanders to assist him in the laborious business of
+heaving down the ship to stop the leak.  But to such unresting
+vigilance over their dangerous allies was this small band of whites
+necessitated, both by night and by day, and so extreme was the hard
+work they underwent, that upon the vessel being ready again for sea,
+they were in such a weakened condition that the captain durst not put
+off with them in so heavy a vessel.  After taking counsel with his
+officers, he anchored the ship as far off shore as possible; loaded
+and ran out his two cannon from the bows; stacked his muskets on the
+poop; and warning the Islanders not to approach the ship at their
+peril, took one man with him, and setting the sail of his best
+whale-boat, steered straight before the wind for Tahiti, five hundred
+miles distant, to procure a reinforcement to his crew.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 92</DOCNO>
+"On the fourth day of the sail, a large canoe was descried, which
+seemed to have touched at a low isle of corals.  He steered away from
+it; but the savage craft bore down on him; and soon the voice of
+Steelkilt hailed him to heave to, or he would run him under water.
+The captain presented a pistol.  With one foot on each prow of the
+yoked war-canoes, the Lakeman laughed him to scorn; assuring him that
+if the pistol so much as clicked in the lock, he would bury him in
+bubbles and foam.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 93</DOCNO>
+"'What do you want of me?' cried the captain.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 94</DOCNO>
+"'Where are you bound? and for what are you bound?' demanded
+Steelkilt; 'no lies.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 95</DOCNO>
+"'I am bound to Tahiti for more men.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 96</DOCNO>
+"'Very good.  Let me board you a moment--I come in peace.'  With that
+he leaped from the canoe, swam to the boat; and climbing the gunwale,
+stood face to face with the captain.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 97</DOCNO>
+"'Cross your arms, sir; throw back your head.  Now, repeat after me.
+As soon as Steelkilt leaves me, I swear to beach this boat on yonder
+island, and remain there six days.  If I do not, may lightning strike
+me!'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 98</DOCNO>
+"'A pretty scholar,' laughed the Lakeman.  'Adios, Senor!' and
+leaping into the sea, he swam back to his comrades.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 99</DOCNO>
+"Watching the boat till it was fairly beached, and drawn up to the
+roots of the cocoa-nut trees, Steelkilt made sail again, and in due
+time arrived at Tahiti, his own place of destination.  There, luck
+befriended him; two ships were about to sail for France, and were
+providentially in want of precisely that number of men which the
+sailor headed.  They embarked; and so for ever got the start of
+their former captain, had he been at all minded to work them legal
+retribution.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 100</DOCNO>
+"Some ten days after the French ships sailed, the whale-boat arrived,
+and the captain was forced to enlist some of the more civilized
+Tahitians, who had been somewhat used to the sea.  Chartering a small
+native schooner, he returned with them to his vessel; and finding all
+right there, again resumed his cruisings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 101</DOCNO>
+"Where Steelkilt now is, gentlemen, none know; but upon the island of
+Nantucket, the widow of Radney still turns to the sea which refuses
+to give up its dead; still in dreams sees the awful white whale that
+destroyed him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 102</DOCNO>
+"'Are you through?' said Don Sebastian, quietly.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 103</DOCNO>
+"'I am, Don.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 104</DOCNO>
+"'Then I entreat you, tell me if to the best of your own convictions,
+this your story is in substance really true?  It is so passing
+wonderful!  Did you get it from an unquestionable source?  Bear with
+me if I seem to press.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 105</DOCNO>
+"'Also bear with all of us, sir sailor; for we all join in Don
+Sebastian's suit,' cried the company, with exceeding interest.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 106</DOCNO>
+"'Is there a copy of the Holy Evangelists in the Golden Inn,
+gentlemen?'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 107</DOCNO>
+"'Nay,' said Don Sebastian; 'but I know a worthy priest near by, who
+will quickly procure one for me.  I go for it; but are you well
+advised? this may grow too serious.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 108</DOCNO>
+"'Will you be so good as to bring the priest also, Don?'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 109</DOCNO>
+"'Though there are no Auto-da-Fe's in Lima now,' said one of the
+company to another; 'I fear our sailor friend runs risk of the
+archiepiscopacy.  Let us withdraw more out of the moonlight.  I see
+no need of this.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 110</DOCNO>
+"'Excuse me for running after you, Don Sebastian; but may I also beg
+that you will be particular in procuring the largest sized
+Evangelists you can.'
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 111</DOCNO>
+'This is the priest, he brings you the Evangelists,' said Don
+Sebastian, gravely, returning with a tall and solemn figure.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 112</DOCNO>
+"'Let me remove my hat.  Now, venerable priest, further into the
+light, and hold the Holy Book before me that I may touch it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 54, Paragraph 113</DOCNO>
+"'So help me Heaven, and on my honour the story I have told ye,
+gentlemen, is in substance and its great items, true.  I know it to
+be true; it happened on this ball; I trod the ship; I knew the crew;
+I have seen and talked with Steelkilt since the death of Radney.'"
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 1</DOCNO>
+Of the Monstrous Pictures of Whales.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 2</DOCNO>
+I shall ere long paint to you as well as one can without canvas,
+something like the true form of the whale as he actually appears to
+the eye of the whaleman when in his own absolute body the whale is
+moored alongside the whale-ship so that he can be fairly stepped upon
+there.  It may be worth while, therefore, previously to advert to
+those curious imaginary portraits of him which even down to the
+present day confidently challenge the faith of the landsman.  It is
+time to set the world right in this matter, by proving such pictures
+of the whale all wrong.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 3</DOCNO>
+It may be that the primal source of all those pictorial delusions
+will be found among the oldest Hindoo, Egyptian, and Grecian
+sculptures.  For ever since those inventive but unscrupulous times
+when on the marble panellings of temples, the pedestals of statues,
+and on shields, medallions, cups, and coins, the dolphin was drawn in
+scales of chain-armor like Saladin's, and a helmeted head like St.
+George's; ever since then has something of the same sort of license
+prevailed, not only in most popular pictures of the whale, but in
+many scientific presentations of him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 4</DOCNO>
+Now, by all odds, the most ancient extant portrait anyways purporting
+to be the whale's, is to be found in the famous cavern-pagoda of
+Elephanta, in India.  The Brahmins maintain that in the almost
+endless sculptures of that immemorial pagoda, all the trades and
+pursuits, every conceivable avocation of man, were prefigured ages
+before any of them actually came into being.  No wonder then, that in
+some sort our noble profession of whaling should have been there
+shadowed forth.  The Hindoo whale referred to, occurs in a separate
+department of the wall, depicting the incarnation of Vishnu in the
+form of leviathan, learnedly known as the Matse Avatar.  But though
+this sculpture is half man and half whale, so as only to give the
+tail of the latter, yet that small section of him is all wrong.  It
+looks more like the tapering tail of an anaconda, than the broad palms
+of the true whale's majestic flukes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 5</DOCNO>
+But go to the old Galleries, and look now at a great Christian
+painter's portrait of this fish; for he succeeds no better than the
+antediluvian Hindoo.  It is Guido's picture of Perseus rescuing
+Andromeda from the sea-monster or whale.  Where did Guido get the
+model of such a strange creature as that?  Nor does Hogarth, in
+painting the same scene in his own "Perseus Descending," make out one
+whit better.  The huge corpulence of that Hogarthian monster
+undulates on the surface, scarcely drawing one inch of water.  It has
+a sort of howdah on its back, and its distended tusked mouth into
+which the billows are rolling, might be taken for the Traitors' Gate
+leading from the Thames by water into the Tower.  Then, there are the
+Prodromus whales of old Scotch Sibbald, and Jonah's whale, as
+depicted in the prints of old Bibles and the cuts of old primers.
+What shall be said of these?  As for the book-binder's whale winding
+like a vine-stalk round the stock of a descending anchor--as stamped
+and gilded on the backs and title-pages of many books both old and
+new--that is a very picturesque but purely fabulous creature,
+imitated, I take it, from the like figures on antique vases.  Though
+universally denominated a dolphin, I nevertheless call this
+book-binder's fish an attempt at a whale; because it was so intended
+when the device was first introduced.  It was introduced by an old
+Italian publisher somewhere about the 15th century, during the
+Revival of Learning; and in those days, and even down to a
+comparatively late period, dolphins were popularly supposed to be a
+species of the Leviathan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 6</DOCNO>
+In the vignettes and other embellishments of some ancient books you
+will at times meet with very curious touches at the whale, where all
+manner of spouts, jets d'eau, hot springs and cold, Saratoga and
+Baden-Baden, come bubbling up from his unexhausted brain.  In the
+title-page of the original edition of the "Advancement of Learning"
+you will find some curious whales.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 7</DOCNO>
+But quitting all these unprofessional attempts, let us glance at
+those pictures of leviathan purporting to be sober, scientific
+delineations, by those who know.  In old Harris's collection of
+voyages there are some plates of whales extracted from a Dutch book
+of voyages, A.D. 1671, entitled "A Whaling Voyage to Spitzbergen in
+the ship Jonas in the Whale, Peter Peterson of Friesland, master."
+In one of those plates the whales, like great rafts of logs, are
+represented lying among ice-isles, with white bears running over
+their living backs.  In another plate, the prodigious blunder is made
+of representing the whale with perpendicular flukes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 8</DOCNO>
+Then again, there is an imposing quarto, written by one Captain
+Colnett, a Post Captain in the English navy, entitled "A Voyage round
+Cape Horn into the South Seas, for the purpose of extending the
+Spermaceti Whale Fisheries."  In this book is an outline purporting
+to be a "Picture of a Physeter or Spermaceti whale, drawn by scale
+from one killed on the coast of Mexico, August, 1793, and hoisted on
+deck."  I doubt not the captain had this veracious picture taken for
+the benefit of his marines.  To mention but one thing about it, let
+me say that it has an eye which applied, according to the
+accompanying scale, to a full grown sperm whale, would make the eye
+of that whale a bow-window some five feet long.  Ah, my gallant
+captain, why did ye not give us Jonah looking out of that eye!
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 9</DOCNO>
+Nor are the most conscientious compilations of Natural History for
+the benefit of the young and tender, free from the same heinousness
+of mistake.  Look at that popular work "Goldsmith's Animated Nature."
+In the abridged London edition of 1807, there are plates of an
+alleged "whale" and a "narwhale."  I do not wish to seem inelegant,
+but this unsightly whale looks much like an amputated sow; and, as
+for the narwhale, one glimpse at it is enough to amaze one, that in
+this nineteenth century such a hippogriff could be palmed for genuine
+upon any intelligent public of schoolboys.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 10</DOCNO>
+Then, again, in 1825, Bernard Germain, Count de Lacepede, a great
+naturalist, published a scientific systemized whale book, wherein are
+several pictures of the different species of the Leviathan.  All
+these are not only incorrect, but the picture of the Mysticetus or
+Greenland whale (that is to say, the Right whale), even Scoresby, a
+long experienced man as touching that species, declares not to have
+its counterpart in nature.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 11</DOCNO>
+But the placing of the cap-sheaf to all this blundering business was
+reserved for the scientific Frederick Cuvier, brother to the famous
+Baron.  In 1836, he published a Natural History of Whales, in which
+he gives what he calls a picture of the Sperm Whale.  Before showing
+that picture to any Nantucketer, you had best provide for your
+summary retreat from Nantucket.  In a word, Frederick Cuvier's Sperm
+Whale is not a Sperm Whale, but a squash.  Of course, he never had
+the benefit of a whaling voyage (such men seldom have), but whence he
+derived that picture, who can tell?  Perhaps he got it as his
+scientific predecessor in the same field, Desmarest, got one of his
+authentic abortions; that is, from a Chinese drawing.  And what sort
+of lively lads with the pencil those Chinese are, many queer cups and
+saucers inform us.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 12</DOCNO>
+As for the sign-painters' whales seen in the streets hanging over the
+shops of oil-dealers, what shall be said of them?  They are generally
+Richard III. whales, with dromedary humps, and very savage;
+breakfasting on three or four sailor tarts, that is whaleboats full
+of mariners: their deformities floundering in seas of blood and blue
+paint.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 13</DOCNO>
+But these manifold mistakes in depicting the whale are not so very
+surprising after all.  Consider!  Most of the scientific drawings
+have been taken from the stranded fish; and these are about as
+correct as a drawing of a wrecked ship, with broken back, would
+correctly represent the noble animal itself in all its undashed pride
+of hull and spars.  Though elephants have stood for their
+full-lengths, the living Leviathan has never yet fairly floated
+himself for his portrait.  The living whale, in his full majesty and
+significance, is only to be seen at sea in unfathomable waters; and
+afloat the vast bulk of him is out of sight, like a launched
+line-of-battle ship; and out of that element it is a thing eternally
+impossible for mortal man to hoist him bodily into the air, so as to
+preserve all his mighty swells and undulations.  And, not to speak of
+the highly presumable difference of contour between a young sucking
+whale and a full-grown Platonian Leviathan; yet, even in the case of
+one of those young sucking whales hoisted to a ship's deck, such is
+then the outlandish, eel-like, limbered, varying shape of him, that
+his precise expression the devil himself could not catch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 14</DOCNO>
+But it may be fancied, that from the naked skeleton of the stranded
+whale, accurate hints may be derived touching his true form.  Not at
+all.  For it is one of the more curious things about this Leviathan,
+that his skeleton gives very little idea of his general shape.
+Though Jeremy Bentham's skeleton, which hangs for candelabra in the
+library of one of his executors, correctly conveys the idea of a
+burly-browed utilitarian old gentleman, with all Jeremy's other
+leading personal characteristics; yet nothing of this kind could be
+inferred from any leviathan's articulated bones.  In fact, as the
+great Hunter says, the mere skeleton of the whale bears the same
+relation to the fully invested and padded animal as the insect does
+to the chrysalis that so roundingly envelopes it.  This peculiarity
+is strikingly evinced in the head, as in some part of this book will
+be incidentally shown.  It is also very curiously displayed in the
+side fin, the bones of which almost exactly answer to the bones of the
+human hand, minus only the thumb.  This fin has four regular
+bone-fingers, the index, middle, ring, and little finger.  But all
+these are permanently lodged in their fleshy covering, as the human
+fingers in an artificial covering.  "However recklessly the whale may
+sometimes serve us," said humorous Stubb one day, "he can never be
+truly said to handle us without mittens."
+</DOC>
+<DOC>
+<DOCNO>Chapter 55, Paragraph 15</DOCNO>
+For all these reasons, then, any way you may look at it, you must
+needs conclude that the great Leviathan is that one creature in the
+world which must remain unpainted to the last.  True, one portrait
+may hit the mark much nearer than another, but none can hit it with
+any very considerable degree of exactness.  So there is no earthly
+way of finding out precisely what the whale really looks like.  And
+the only mode in which you can derive even a tolerable idea of his
+living contour, is by going a whaling yourself; but by so doing, you
+run no small risk of being eternally stove and sunk by him.
+Wherefore, it seems to me you had best not be too fastidious in your
+curiosity touching this Leviathan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 1</DOCNO>
+Of the Less Erroneous Pictures of Whales, and the True Pictures of
+Whaling Scenes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 2</DOCNO>
+In connexion with the monstrous pictures of whales, I am strongly
+tempted here to enter upon those still more monstrous stories of them
+which are to be found in certain books, both ancient and modern,
+especially in Pliny, Purchas, Hackluyt, Harris, Cuvier, etc.  But I
+pass that matter by.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 3</DOCNO>
+I know of only four published outlines of the great Sperm Whale;
+Colnett's, Huggins's, Frederick Cuvier's, and Beale's.  In the
+previous chapter Colnett and Cuvier have been referred to.  Huggins's
+is far better than theirs; but, by great odds, Beale's is the best.
+All Beale's drawings of this whale are good, excepting the middle
+figure in the picture of three whales in various attitudes, capping
+his second chapter.  His frontispiece, boats attacking Sperm Whales,
+though no doubt calculated to excite the civil scepticism of some
+parlor men, is admirably correct and life-like in its general effect.
+Some of the Sperm Whale drawings in J.  Ross Browne are pretty
+correct in contour; but they are wretchedly engraved.  That is not
+his fault though.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 4</DOCNO>
+Of the Right Whale, the best outline pictures are in Scoresby; but
+they are drawn on too small a scale to convey a desirable impression.
+He has but one picture of whaling scenes, and this is a sad
+deficiency, because it is by such pictures only, when at all well
+done, that you can derive anything like a truthful idea of the living
+whale as seen by his living hunters.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 5</DOCNO>
+But, taken for all in all, by far the finest, though in some details
+not the most correct, presentations of whales and whaling scenes to
+be anywhere found, are two large French engravings, well executed,
+and taken from paintings by one Garnery.  Respectively, they
+represent attacks on the Sperm and Right Whale.  In the first
+engraving a noble Sperm Whale is depicted in full majesty of might,
+just risen beneath the boat from the profundities of the ocean, and
+bearing high in the air upon his back the terrific wreck of the
+stoven planks.  The prow of the boat is partially unbroken, and is
+drawn just balancing upon the monster's spine; and standing in that
+prow, for that one single incomputable flash of time, you behold an
+oarsman, half shrouded by the incensed boiling spout of the whale,
+and in the act of leaping, as if from a precipice.  The action of the
+whole thing is wonderfully good and true.  The half-emptied line-tub
+floats on the whitened sea; the wooden poles of the spilled harpoons
+obliquely bob in it; the heads of the swimming crew are scattered
+about the whale in contrasting expressions of affright; while in the
+black stormy distance the ship is bearing down upon the scene.
+Serious fault might be found with the anatomical details of this
+whale, but let that pass; since, for the life of me, I could not draw
+so good a one.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 6</DOCNO>
+In the second engraving, the boat is in the act of drawing alongside
+the barnacled flank of a large running Right Whale, that rolls his
+black weedy bulk in the sea like some mossy rock-slide from the
+Patagonian cliffs.  His jets are erect, full, and black like soot; so
+that from so abounding a smoke in the chimney, you would think there
+must be a brave supper cooking in the great bowels below.  Sea fowls
+are pecking at the small crabs, shell-fish, and other sea candies and
+maccaroni, which the Right Whale sometimes carries on his pestilent
+back.  And all the while the thick-lipped leviathan is rushing
+through the deep, leaving tons of tumultuous white curds in his wake,
+and causing the slight boat to rock in the swells like a skiff caught
+nigh the paddle-wheels of an ocean steamer.  Thus, the foreground is
+all raging commotion; but behind, in admirable artistic contrast, is
+the glassy level of a sea becalmed, the drooping unstarched sails of
+the powerless ship, and the inert mass of a dead whale, a conquered
+fortress, with the flag of capture lazily hanging from the whale-pole
+inserted into his spout-hole.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 7</DOCNO>
+Who Garnery the painter is, or was, I know not.  But my life for it
+he was either practically conversant with his subject, or else
+marvellously tutored by some experienced whaleman.  The French are
+the lads for painting action.  Go and gaze upon all the paintings of
+Europe, and where will you find such a gallery of living and
+breathing commotion on canvas, as in that triumphal hall at
+Versailles; where the beholder fights his way, pell-mell, through the
+consecutive great battles of France; where every sword seems a flash
+of the Northern Lights, and the successive armed kings and Emperors
+dash by, like a charge of crowned centaurs?  Not wholly unworthy of a
+place in that gallery, are these sea battle-pieces of Garnery.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 8</DOCNO>
+The natural aptitude of the French for seizing the picturesqueness of
+things seems to be peculiarly evinced in what paintings and
+engravings they have of their whaling scenes.  With not one tenth of
+England's experience in the fishery, and not the thousandth part of
+that of the Americans, they have nevertheless furnished both nations
+with the only finished sketches at all capable of conveying the real
+spirit of the whale hunt.  For the most part, the English and
+American whale draughtsmen seem entirely content with presenting the
+mechanical outline of things, such as the vacant profile of the
+whale; which, so far as picturesqueness of effect is concerned, is
+about tantamount to sketching the profile of a pyramid.  Even
+Scoresby, the justly renowned Right whaleman, after giving us a stiff
+full length of the Greenland whale, and three or four delicate
+miniatures of narwhales and porpoises, treats us to a series of
+classical engravings of boat hooks, chopping knives, and grapnels;
+and with the microscopic diligence of a Leuwenhoeck submits to the
+inspection of a shivering world ninety-six fac-similes of magnified
+Arctic snow crystals.  I mean no disparagement to the excellent
+voyager (I honour him for a veteran), but in so important a matter it
+was certainly an oversight not to have procured for every crystal a
+sworn affidavit taken before a Greenland Justice of the Peace.
+</DOC>
+<DOC>
+<DOCNO>Chapter 56, Paragraph 9</DOCNO>
+In addition to those fine engravings from Garnery, there are two
+other French engravings worthy of note, by some one who subscribes
+himself "H.  Durand."  One of them, though not precisely adapted to
+our present purpose, nevertheless deserves mention on other accounts.
+It is a quiet noon-scene among the isles of the Pacific; a French
+whaler anchored, inshore, in a calm, and lazily taking water on
+board; the loosened sails of the ship, and the long leaves of the
+palms in the background, both drooping together in the breezeless
+air.  The effect is very fine, when considered with reference to its
+presenting the hardy fishermen under one of their few aspects of
+oriental repose.  The other engraving is quite a different affair:
+the ship hove-to upon the open sea, and in the very heart of the
+Leviathanic life, with a Right Whale alongside; the vessel (in the
+act of cutting-in) hove over to the monster as if to a quay; and a
+boat, hurriedly pushing off from this scene of activity, is about
+giving chase to whales in the distance.  The harpoons and lances lie
+levelled for use; three oarsmen are just setting the mast in its
+hole; while from a sudden roll of the sea, the little craft stands
+half-erect out of the water, like a rearing horse.  From the ship,
+the smoke of the torments of the boiling whale is going up like the
+smoke over a village of smithies; and to windward, a black cloud,
+rising up with earnest of squalls and rains, seems to quicken the
+activity of the excited seamen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 1</DOCNO>
+Of Whales in Paint; in Teeth; in Wood; in Sheet-Iron; in Stone; in
+Mountains; in Stars.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 2</DOCNO>
+On Tower-hill, as you go down to the London docks, you may have seen
+a crippled beggar (or KEDGER, as the sailors say) holding a painted
+board before him, representing the tragic scene in which he lost his
+leg.  There are three whales and three boats; and one of the boats
+(presumed to contain the missing leg in all its original integrity)
+is being crunched by the jaws of the foremost whale.  Any time these
+ten years, they tell me, has that man held up that picture, and
+exhibited that stump to an incredulous world.  But the time of his
+justification has now come.  His three whales are as good whales as
+were ever published in Wapping, at any rate; and his stump as
+unquestionable a stump as any you will find in the western clearings.
+But, though for ever mounted on that stump, never a stump-speech
+does the poor whaleman make; but, with downcast eyes, stands ruefully
+contemplating his own amputation.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 3</DOCNO>
+Throughout the Pacific, and also in Nantucket, and New Bedford, and
+Sag Harbor, you will come across lively sketches of whales and
+whaling-scenes, graven by the fishermen themselves on Sperm
+Whale-teeth, or ladies' busks wrought out of the Right Whale-bone,
+and other like skrimshander articles, as the whalemen call the
+numerous little ingenious contrivances they elaborately carve out of
+the rough material, in their hours of ocean leisure.  Some of them
+have little boxes of dentistical-looking implements, specially
+intended for the skrimshandering business.  But, in general, they
+toil with their jack-knives alone; and, with that almost omnipotent
+tool of the sailor, they will turn you out anything you please, in
+the way of a mariner's fancy.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 4</DOCNO>
+Long exile from Christendom and civilization inevitably restores a
+man to that condition in which God placed him, i.e. what is called
+savagery.  Your true whale-hunter is as much a savage as an Iroquois.
+I myself am a savage, owning no allegiance but to the King of the
+Cannibals; and ready at any moment to rebel against him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 5</DOCNO>
+Now, one of the peculiar characteristics of the savage in his
+domestic hours, is his wonderful patience of industry.  An ancient
+Hawaiian war-club or spear-paddle, in its full multiplicity and
+elaboration of carving, is as great a trophy of human perseverance as
+a Latin lexicon.  For, with but a bit of broken sea-shell or a
+shark's tooth, that miraculous intricacy of wooden net-work has been
+achieved; and it has cost steady years of steady application.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 6</DOCNO>
+As with the Hawaiian savage, so with the white sailor-savage.  With
+the same marvellous patience, and with the same single shark's tooth,
+of his one poor jack-knife, he will carve you a bit of bone
+sculpture, not quite as workmanlike, but as close packed in its
+maziness of design, as the Greek savage, Achilles's shield; and full
+of barbaric spirit and suggestiveness, as the prints of that fine old
+Dutch savage, Albert Durer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 7</DOCNO>
+Wooden whales, or whales cut in profile out of the small dark slabs
+of the noble South Sea war-wood, are frequently met with in the
+forecastles of American whalers.  Some of them are done with much
+accuracy.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 8</DOCNO>
+At some old gable-roofed country houses you will see brass whales
+hung by the tail for knockers to the road-side door.  When the porter
+is sleepy, the anvil-headed whale would be best.  But these knocking
+whales are seldom remarkable as faithful essays.  On the spires of
+some old-fashioned churches you will see sheet-iron whales placed
+there for weather-cocks; but they are so elevated, and besides that
+are to all intents and purposes so labelled with "HANDS OFF!" you
+cannot examine them closely enough to decide upon their merit.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 9</DOCNO>
+In bony, ribby regions of the earth, where at the base of high broken
+cliffs masses of rock lie strewn in fantastic groupings upon the
+plain, you will often discover images as of the petrified forms of
+the Leviathan partly merged in grass, which of a windy day breaks
+against them in a surf of green surges.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 10</DOCNO>
+Then, again, in mountainous countries where the traveller is
+continually girdled by amphitheatrical heights; here and there from
+some lucky point of view you will catch passing glimpses of the
+profiles of whales defined along the undulating ridges.  But you must
+be a thorough whaleman, to see these sights; and not only that, but
+if you wish to return to such a sight again, you must be sure and
+take the exact intersecting latitude and longitude of your first
+stand-point, else so chance-like are such observations of the hills,
+that your precise, previous stand-point would require a laborious
+re-discovery; like the Soloma Islands, which still remain incognita,
+though once high-ruffed Mendanna trod them and old Figuera
+chronicled them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 11</DOCNO>
+Nor when expandingly lifted by your subject, can you fail to trace
+out great whales in the starry heavens, and boats in pursuit of them;
+as when long filled with thoughts of war the Eastern nations saw
+armies locked in battle among the clouds.  Thus at the North have I
+chased Leviathan round and round the Pole with the revolutions of the
+bright points that first defined him to me.  And beneath the
+effulgent Antarctic skies I have boarded the Argo-Navis, and joined
+the chase against the starry Cetus far beyond the utmost stretch of
+Hydrus and the Flying Fish.
+</DOC>
+<DOC>
+<DOCNO>Chapter 57, Paragraph 12</DOCNO>
+With a frigate's anchors for my bridle-bitts and fasces of harpoons
+for spurs, would I could mount that whale and leap the topmost skies,
+to see whether the fabled heavens with all their countless tents
+really lie encamped beyond my mortal sight!
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 1</DOCNO>
+Brit.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 2</DOCNO>
+Steering north-eastward from the Crozetts, we fell in with vast
+meadows of brit, the minute, yellow substance, upon which the Right
+Whale largely feeds.  For leagues and leagues it undulated round us,
+so that we seemed to be sailing through boundless fields of ripe and
+golden wheat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 3</DOCNO>
+On the second day, numbers of Right Whales were seen, who, secure
+from the attack of a Sperm Whaler like the Pequod, with open jaws
+sluggishly swam through the brit, which, adhering to the fringing
+fibres of that wondrous Venetian blind in their mouths, was in that
+manner separated from the water that escaped at the lip.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 4</DOCNO>
+As morning mowers, who side by side slowly and seethingly advance
+their scythes through the long wet grass of marshy meads; even so
+these monsters swam, making a strange, grassy, cutting sound; and
+leaving behind them endless swaths of blue upon the yellow sea.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 5</DOCNO>
+*That part of the sea known among whalemen as the "Brazil Banks" does
+not bear that name as the Banks of Newfoundland do, because of there
+being shallows and soundings there, but because of this remarkable
+meadow-like appearance, caused by the vast drifts of brit continually
+floating in those latitudes, where the Right Whale is often chased.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 6</DOCNO>
+But it was only the sound they made as they parted the brit which at
+all reminded one of mowers.  Seen from the mast-heads, especially
+when they paused and were stationary for a while, their vast black
+forms looked more like lifeless masses of rock than anything else.
+And as in the great hunting countries of India, the stranger at a
+distance will sometimes pass on the plains recumbent elephants
+without knowing them to be such, taking them for bare, blackened
+elevations of the soil; even so, often, with him, who for the first
+time beholds this species of the leviathans of the sea.  And even
+when recognised at last, their immense magnitude renders it very
+hard really to believe that such bulky masses of overgrowth can
+possibly be instinct, in all parts, with the same sort of life that
+lives in a dog or a horse.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 7</DOCNO>
+Indeed, in other respects, you can hardly regard any creatures of the
+deep with the same feelings that you do those of the shore.  For
+though some old naturalists have maintained that all creatures of the
+land are of their kind in the sea; and though taking a broad general
+view of the thing, this may very well be; yet coming to specialties,
+where, for example, does the ocean furnish any fish that in
+disposition answers to the sagacious kindness of the dog?  The
+accursed shark alone can in any generic respect be said to bear
+comparative analogy to him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 8</DOCNO>
+But though, to landsmen in general, the native inhabitants of the
+seas have ever been regarded with emotions unspeakably unsocial and
+repelling; though we know the sea to be an everlasting terra
+incognita, so that Columbus sailed over numberless unknown worlds to
+discover his one superficial western one; though, by vast odds, the
+most terrific of all mortal disasters have immemorially and
+indiscriminately befallen tens and hundreds of thousands of those who
+have gone upon the waters; though but a moment's consideration will
+teach, that however baby man may brag of his science and skill, and
+however much, in a flattering future, that science and skill may
+augment; yet for ever and for ever, to the crack of doom, the sea
+will insult and murder him, and pulverize the stateliest, stiffest
+frigate he can make; nevertheless, by the continual repetition of
+these very impressions, man has lost that sense of the full awfulness
+of the sea which aboriginally belongs to it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 9</DOCNO>
+The first boat we read of, floated on an ocean, that with Portuguese
+vengeance had whelmed a whole world without leaving so much as a
+widow.  That same ocean rolls now; that same ocean destroyed the
+wrecked ships of last year.  Yea, foolish mortals, Noah's flood is
+not yet subsided; two thirds of the fair world it yet covers.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 10</DOCNO>
+Wherein differ the sea and the land, that a miracle upon one is not a
+miracle upon the other?  Preternatural terrors rested upon the
+Hebrews, when under the feet of Korah and his company the live ground
+opened and swallowed them up for ever; yet not a modern sun ever
+sets, but in precisely the same manner the live sea swallows up ships
+and crews.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 11</DOCNO>
+But not only is the sea such a foe to man who is an alien to it, but
+it is also a fiend to its own off-spring; worse than the Persian host
+who murdered his own guests; sparing not the creatures which itself
+hath spawned.  Like a savage tigress that tossing in the jungle
+overlays her own cubs, so the sea dashes even the mightiest whales
+against the rocks, and leaves them there side by side with the split
+wrecks of ships.  No mercy, no power but its own controls it.
+Panting and snorting like a mad battle steed that has lost its rider,
+the masterless ocean overruns the globe.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 12</DOCNO>
+Consider the subtleness of the sea; how its most dreaded creatures
+glide under water, unapparent for the most part, and treacherously
+hidden beneath the loveliest tints of azure.  Consider also the
+devilish brilliance and beauty of many of its most remorseless
+tribes, as the dainty embellished shape of many species of sharks.
+Consider, once more, the universal cannibalism of the sea; all whose
+creatures prey upon each other, carrying on eternal war since the
+world began.
+</DOC>
+<DOC>
+<DOCNO>Chapter 58, Paragraph 13</DOCNO>
+Consider all this; and then turn to this green, gentle, and most
+docile earth; consider them both, the sea and the land; and do you
+not find a strange analogy to something in yourself?  For as this
+appalling ocean surrounds the verdant land, so in the soul of man
+there lies one insular Tahiti, full of peace and joy, but encompassed
+by all the horrors of the half known life.  God keep thee!  Push not
+off from that isle, thou canst never return!
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 1</DOCNO>
+Squid.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 2</DOCNO>
+Slowly wading through the meadows of brit, the Pequod still held on
+her way north-eastward towards the island of Java; a gentle air
+impelling her keel, so that in the surrounding serenity her three
+tall tapering masts mildly waved to that languid breeze, as three
+mild palms on a plain.  And still, at wide intervals in the silvery
+night, the lonely, alluring jet would be seen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 3</DOCNO>
+But one transparent blue morning, when a stillness almost
+preternatural spread over the sea, however unattended with any
+stagnant calm; when the long burnished sun-glade on the waters seemed
+a golden finger laid across them, enjoining some secrecy; when the
+slippered waves whispered together as they softly ran on; in this
+profound hush of the visible sphere a strange spectre was seen by
+Daggoo from the main-mast-head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 4</DOCNO>
+In the distance, a great white mass lazily rose, and rising higher
+and higher, and disentangling itself from the azure, at last gleamed
+before our prow like a snow-slide, new slid from the hills.  Thus
+glistening for a moment, as slowly it subsided, and sank.  Then once
+more arose, and silently gleamed.  It seemed not a whale; and yet is
+this Moby Dick? thought Daggoo.  Again the phantom went down, but on
+re-appearing once more, with a stiletto-like cry that startled every
+man from his nod, the negro yelled out--"There! there again! there
+she breaches! right ahead!  The White Whale, the White Whale!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 5</DOCNO>
+Upon this, the seamen rushed to the yard-arms, as in swarming-time
+the bees rush to the boughs.  Bare-headed in the sultry sun, Ahab
+stood on the bowsprit, and with one hand pushed far behind in
+readiness to wave his orders to the helmsman, cast his eager glance
+in the direction indicated aloft by the outstretched motionless arm
+of Daggoo.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 6</DOCNO>
+Whether the flitting attendance of the one still and solitary jet had
+gradually worked upon Ahab, so that he was now prepared to connect
+the ideas of mildness and repose with the first sight of the
+particular whale he pursued; however this was, or whether his
+eagerness betrayed him; whichever way it might have been, no sooner
+did he distinctly perceive the white mass, than with a quick
+intensity he instantly gave orders for lowering.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 7</DOCNO>
+The four boats were soon on the water; Ahab's in advance, and all
+swiftly pulling towards their prey.  Soon it went down, and while,
+with oars suspended, we were awaiting its reappearance, lo! in the
+same spot where it sank, once more it slowly rose.  Almost forgetting
+for the moment all thoughts of Moby Dick, we now gazed at the most
+wondrous phenomenon which the secret seas have hitherto revealed to
+mankind.  A vast pulpy mass, furlongs in length and breadth, of a
+glancing cream-colour, lay floating on the water, innumerable long
+arms radiating from its centre, and curling and twisting like a nest
+of anacondas, as if blindly to clutch at any hapless object within
+reach.  No perceptible face or front did it have; no conceivable
+token of either sensation or instinct; but undulated there on the
+billows, an unearthly, formless, chance-like apparition of life.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 8</DOCNO>
+As with a low sucking sound it slowly disappeared again, Starbuck
+still gazing at the agitated waters where it had sunk, with a wild
+voice exclaimed--"Almost rather had I seen Moby Dick and fought him,
+than to have seen thee, thou white ghost!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 9</DOCNO>
+"What was it, Sir?" said Flask.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 10</DOCNO>
+"The great live squid, which, they say, few whale-ships ever beheld,
+and returned to their ports to tell of it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 11</DOCNO>
+But Ahab said nothing; turning his boat, he sailed back to the
+vessel; the rest as silently following.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 12</DOCNO>
+Whatever superstitions the sperm whalemen in general have connected
+with the sight of this object, certain it is, that a glimpse of it
+being so very unusual, that circumstance has gone far to invest it
+with portentousness.  So rarely is it beheld, that though one and all
+of them declare it to be the largest animated thing in the ocean, yet
+very few of them have any but the most vague ideas concerning its
+true nature and form; notwithstanding, they believe it to furnish to
+the sperm whale his only food.  For though other species of whales
+find their food above water, and may be seen by man in the act of
+feeding, the spermaceti whale obtains his whole food in unknown zones
+below the surface; and only by inference is it that any one can tell
+of what, precisely, that food consists.  At times, when closely
+pursued, he will disgorge what are supposed to be the detached arms
+of the squid; some of them thus exhibited exceeding twenty and thirty
+feet in length.  They fancy that the monster to which these arms
+belonged ordinarily clings by them to the bed of the ocean; and that
+the sperm whale, unlike other species, is supplied with teeth in
+order to attack and tear it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 13</DOCNO>
+There seems some ground to imagine that the great Kraken of Bishop
+Pontoppodan may ultimately resolve itself into Squid.  The manner in
+which the Bishop describes it, as alternately rising and sinking,
+with some other particulars he narrates, in all this the two
+correspond.  But much abatement is necessary with respect to the
+incredible bulk he assigns it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 59, Paragraph 14</DOCNO>
+By some naturalists who have vaguely heard rumors of the mysterious
+creature, here spoken of, it is included among the class of
+cuttle-fish, to which, indeed, in certain external respects it would
+seem to belong, but only as the Anak of the tribe.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 1</DOCNO>
+The Line.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 2</DOCNO>
+With reference to the whaling scene shortly to be described, as well
+as for the better understanding of all similar scenes elsewhere
+presented, I have here to speak of the magical, sometimes horrible
+whale-line.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 3</DOCNO>
+The line originally used in the fishery was of the best hemp,
+slightly vapoured with tar, not impregnated with it, as in the case of
+ordinary ropes; for while tar, as ordinarily used, makes the hemp
+more pliable to the rope-maker, and also renders the rope itself more
+convenient to the sailor for common ship use; yet, not only would the
+ordinary quantity too much stiffen the whale-line for the close
+coiling to which it must be subjected; but as most seamen are
+beginning to learn, tar in general by no means adds to the rope's
+durability or strength, however much it may give it compactness and
+gloss.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 4</DOCNO>
+Of late years the Manilla rope has in the American fishery almost
+entirely superseded hemp as a material for whale-lines; for, though
+not so durable as hemp, it is stronger, and far more soft and
+elastic; and I will add (since there is an aesthetics in all things),
+is much more handsome and becoming to the boat, than hemp.  Hemp is a
+dusky, dark fellow, a sort of Indian; but Manilla is as a
+golden-haired Circassian to behold.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 5</DOCNO>
+The whale-line is only two-thirds of an inch in thickness.  At first
+sight, you would not think it so strong as it really is.  By
+experiment its one and fifty yarns will each suspend a weight of one
+hundred and twenty pounds; so that the whole rope will bear a strain
+nearly equal to three tons.  In length, the common sperm whale-line
+measures something over two hundred fathoms.  Towards the stern of
+the boat it is spirally coiled away in the tub, not like the
+worm-pipe of a still though, but so as to form one round,
+cheese-shaped mass of densely bedded "sheaves," or layers of
+concentric spiralizations, without any hollow but the "heart," or
+minute vertical tube formed at the axis of the cheese.  As the least
+tangle or kink in the coiling would, in running out, infallibly take
+somebody's arm, leg, or entire body off, the utmost precaution is
+used in stowing the line in its tub.  Some harpooneers will consume
+almost an entire morning in this business, carrying the line high
+aloft and then reeving it downwards through a block towards the tub,
+so as in the act of coiling to free it from all possible wrinkles and
+twists.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 6</DOCNO>
+In the English boats two tubs are used instead of one; the same line
+being continuously coiled in both tubs.  There is some advantage in
+this; because these twin-tubs being so small they fit more readily
+into the boat, and do not strain it so much; whereas, the American
+tub, nearly three feet in diameter and of proportionate depth, makes
+a rather bulky freight for a craft whose planks are but one half-inch
+in thickness; for the bottom of the whale-boat is like critical ice,
+which will bear up a considerable distributed weight, but not very
+much of a concentrated one.  When the painted canvas cover is clapped
+on the American line-tub, the boat looks as if it were pulling off
+with a prodigious great wedding-cake to present to the whales.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 7</DOCNO>
+Both ends of the line are exposed; the lower end terminating in an
+eye-splice or loop coming up from the bottom against the side of the
+tub, and hanging over its edge completely disengaged from everything.
+This arrangement of the lower end is necessary on two accounts.
+First: In order to facilitate the fastening to it of an additional
+line from a neighboring boat, in case the stricken whale should sound
+so deep as to threaten to carry off the entire line originally
+attached to the harpoon.  In these instances, the whale of course is
+shifted like a mug of ale, as it were, from the one boat to the
+other; though the first boat always hovers at hand to assist its
+consort.  Second: This arrangement is indispensable for common
+safety's sake; for were the lower end of the line in any way attached
+to the boat, and were the whale then to run the line out to the end
+almost in a single, smoking minute as he sometimes does, he would not
+stop there, for the doomed boat would infallibly be dragged down
+after him into the profundity of the sea; and in that case no
+town-crier would ever find her again.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 8</DOCNO>
+Before lowering the boat for the chase, the upper end of the line is
+taken aft from the tub, and passing round the loggerhead there, is
+again carried forward the entire length of the boat, resting
+crosswise upon the loom or handle of every man's oar, so that it jogs
+against his wrist in rowing; and also passing between the men, as
+they alternately sit at the opposite gunwales, to the leaded chocks
+or grooves in the extreme pointed prow of the boat, where a wooden
+pin or skewer the size of a common quill, prevents it from slipping
+out.  From the chocks it hangs in a slight festoon over the bows, and
+is then passed inside the boat again; and some ten or twenty fathoms
+(called box-line) being coiled upon the box in the bows, it continues
+its way to the gunwale still a little further aft, and is then
+attached to the short-warp--the rope which is immediately connected
+with the harpoon; but previous to that connexion, the short-warp goes
+through sundry mystifications too tedious to detail.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 9</DOCNO>
+Thus the whale-line folds the whole boat in its complicated coils,
+twisting and writhing around it in almost every direction.  All the
+oarsmen are involved in its perilous contortions; so that to the
+timid eye of the landsman, they seem as Indian jugglers, with the
+deadliest snakes sportively festooning their limbs.  Nor can any son
+of mortal woman, for the first time, seat himself amid those hempen
+intricacies, and while straining his utmost at the oar, bethink him
+that at any unknown instant the harpoon may be darted, and all these
+horrible contortions be put in play like ringed lightnings; he cannot
+be thus circumstanced without a shudder that makes the very marrow in
+his bones to quiver in him like a shaken jelly.  Yet habit--strange
+thing! what cannot habit accomplish?--Gayer sallies, more merry
+mirth, better jokes, and brighter repartees, you never heard over
+your mahogany, than you will hear over the half-inch white cedar of
+the whale-boat, when thus hung in hangman's nooses; and, like the six
+burghers of Calais before King Edward, the six men composing the crew
+pull into the jaws of death, with a halter around every neck, as you
+may say.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 10</DOCNO>
+Perhaps a very little thought will now enable you to account for
+those repeated whaling disasters--some few of which are casually
+chronicled--of this man or that man being taken out of the boat by
+the line, and lost.  For, when the line is darting out, to be seated
+then in the boat, is like being seated in the midst of the manifold
+whizzings of a steam-engine in full play, when every flying beam, and
+shaft, and wheel, is grazing you.  It is worse; for you cannot sit
+motionless in the heart of these perils, because the boat is rocking
+like a cradle, and you are pitched one way and the other, without the
+slightest warning; and only by a certain self-adjusting buoyancy and
+simultaneousness of volition and action, can you escape being made a
+Mazeppa of, and run away with where the all-seeing sun himself could
+never pierce you out.
+</DOC>
+<DOC>
+<DOCNO>Chapter 60, Paragraph 11</DOCNO>
+Again: as the profound calm which only apparently precedes and
+prophesies of the storm, is perhaps more awful than the storm itself;
+for, indeed, the calm is but the wrapper and envelope of the storm;
+and contains it in itself, as the seemingly harmless rifle holds the
+fatal powder, and the ball, and the explosion; so the graceful repose
+of the line, as it silently serpentines about the oarsmen before
+being brought into actual play--this is a thing which carries more of
+true terror than any other aspect of this dangerous affair.  But why
+say more?  All men live enveloped in whale-lines.  All are born with
+halters round their necks; but it is only when caught in the swift,
+sudden turn of death, that mortals realize the silent, subtle,
+ever-present perils of life.  And if you be a philosopher, though
+seated in the whale-boat, you would not at heart feel one whit more
+of terror, than though seated before your evening fire with a poker,
+and not a harpoon, by your side.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 1</DOCNO>
+Stubb Kills a Whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 2</DOCNO>
+If to Starbuck the apparition of the Squid was a thing of portents,
+to Queequeg it was quite a different object.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 3</DOCNO>
+"When you see him 'quid," said the savage, honing his harpoon in the
+bow of his hoisted boat, "then you quick see him 'parm whale."
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 4</DOCNO>
+The next day was exceedingly still and sultry, and with nothing
+special to engage them, the Pequod's crew could hardly resist the
+spell of sleep induced by such a vacant sea.  For this part of the
+Indian Ocean through which we then were voyaging is not what whalemen
+call a lively ground; that is, it affords fewer glimpses of
+porpoises, dolphins, flying-fish, and other vivacious denizens of
+more stirring waters, than those off the Rio de la Plata, or the
+in-shore ground off Peru.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 5</DOCNO>
+It was my turn to stand at the foremast-head; and with my shoulders
+leaning against the slackened royal shrouds, to and fro I idly swayed
+in what seemed an enchanted air.  No resolution could withstand it;
+in that dreamy mood losing all consciousness, at last my soul went
+out of my body; though my body still continued to sway as a pendulum
+will, long after the power which first moved it is withdrawn.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 6</DOCNO>
+Ere forgetfulness altogether came over me, I had noticed that the
+seamen at the main and mizzen-mast-heads were already drowsy.  So
+that at last all three of us lifelessly swung from the spars, and for
+every swing that we made there was a nod from below from the
+slumbering helmsman.  The waves, too, nodded their indolent crests;
+and across the wide trance of the sea, east nodded to west, and the
+sun over all.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 7</DOCNO>
+Suddenly bubbles seemed bursting beneath my closed eyes; like vices
+my hands grasped the shrouds; some invisible, gracious agency
+preserved me; with a shock I came back to life.  And lo! close under
+our lee, not forty fathoms off, a gigantic Sperm Whale lay rolling in
+the water like the capsized hull of a frigate, his broad, glossy
+back, of an Ethiopian hue, glistening in the sun's rays like a
+mirror.  But lazily undulating in the trough of the sea, and ever and
+anon tranquilly spouting his vapoury jet, the whale looked like a
+portly burgher smoking his pipe of a warm afternoon.  But that pipe,
+poor whale, was thy last.  As if struck by some enchanter's wand, the
+sleepy ship and every sleeper in it all at once started into
+wakefulness; and more than a score of voices from all parts of the
+vessel, simultaneously with the three notes from aloft, shouted forth
+the accustomed cry, as the great fish slowly and regularly spouted
+the sparkling brine into the air.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 8</DOCNO>
+"Clear away the boats!  Luff!" cried Ahab.  And obeying his own
+order, he dashed the helm down before the helmsman could handle the
+spokes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 9</DOCNO>
+The sudden exclamations of the crew must have alarmed the whale; and
+ere the boats were down, majestically turning, he swam away to the
+leeward, but with such a steady tranquillity, and making so few
+ripples as he swam, that thinking after all he might not as yet be
+alarmed, Ahab gave orders that not an oar should be used, and no man
+must speak but in whispers.  So seated like Ontario Indians on the
+gunwales of the boats, we swiftly but silently paddled along; the
+calm not admitting of the noiseless sails being set.  Presently, as
+we thus glided in chase, the monster perpendicularly flitted his tail
+forty feet into the air, and then sank out of sight like a tower
+swallowed up.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 10</DOCNO>
+"There go flukes!" was the cry, an announcement immediately followed
+by Stubb's producing his match and igniting his pipe, for now a
+respite was granted.  After the full interval of his sounding had
+elapsed, the whale rose again, and being now in advance of the
+smoker's boat, and much nearer to it than to any of the others, Stubb
+counted upon the honour of the capture.  It was obvious, now, that the
+whale had at length become aware of his pursuers.  All silence of
+cautiousness was therefore no longer of use.  Paddles were dropped,
+and oars came loudly into play.  And still puffing at his pipe, Stubb
+cheered on his crew to the assault.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 11</DOCNO>
+Yes, a mighty change had come over the fish.  All alive to his
+jeopardy, he was going "head out"; that part obliquely projecting
+from the mad yeast which he brewed.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 12</DOCNO>
+*It will be seen in some other place of what a very light substance
+the entire interior of the sperm whale's enormous head consists.
+Though apparently the most massive, it is by far the most buoyant
+part about him.  So that with ease he elevates it in the air, and
+invariably does so when going at his utmost speed.  Besides, such is
+the breadth of the upper part of the front of his head, and such the
+tapering cut-water formation of the lower part, that by obliquely
+elevating his head, he thereby may be said to transform himself from
+a bluff-bowed sluggish galliot into a sharppointed New York
+pilot-boat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 13</DOCNO>
+"Start her, start her, my men!  Don't hurry yourselves; take plenty
+of time--but start her; start her like thunder-claps, that's all,"
+cried Stubb, spluttering out the smoke as he spoke.  "Start her, now;
+give 'em the long and strong stroke, Tashtego.  Start her, Tash, my
+boy--start her, all; but keep cool, keep cool--cucumbers is the
+word--easy, easy--only start her like grim death and grinning devils,
+and raise the buried dead perpendicular out of their graves,
+boys--that's all.  Start her!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 14</DOCNO>
+"Woo-hoo!  Wa-hee!" screamed the Gay-Header in reply, raising some
+old war-whoop to the skies; as every oarsman in the strained boat
+involuntarily bounced forward with the one tremendous leading stroke
+which the eager Indian gave.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 15</DOCNO>
+But his wild screams were answered by others quite as wild.
+"Kee-hee!  Kee-hee!" yelled Daggoo, straining forwards and backwards
+on his seat, like a pacing tiger in his cage.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 16</DOCNO>
+"Ka-la!  Koo-loo!" howled Queequeg, as if smacking his lips over a
+mouthful of Grenadier's steak.  And thus with oars and yells the
+keels cut the sea.  Meanwhile, Stubb retaining his place in the
+van, still encouraged his men to the onset, all the while puffing the
+smoke from his mouth.  Like desperadoes they tugged and they
+strained, till the welcome cry was heard--"Stand up, Tashtego!--give
+it to him!"  The harpoon was hurled.  "Stern all!"  The oarsmen
+backed water; the same moment something went hot and hissing along
+every one of their wrists.  It was the magical line.  An instant
+before, Stubb had swiftly caught two additional turns with it round
+the loggerhead, whence, by reason of its increased rapid circlings, a
+hempen blue smoke now jetted up and mingled with the steady fumes
+from his pipe.  As the line passed round and round the loggerhead; so
+also, just before reaching that point, it blisteringly passed through
+and through both of Stubb's hands, from which the hand-cloths, or
+squares of quilted canvas sometimes worn at these times, had
+accidentally dropped.  It was like holding an enemy's sharp two-edged
+sword by the blade, and that enemy all the time striving to wrest it
+out of your clutch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 17</DOCNO>
+"Wet the line! wet the line!" cried Stubb to the tub oarsman (him
+seated by the tub) who, snatching off his hat, dashed sea-water into
+it.*  More turns were taken, so that the line began holding its place.
+The boat now flew through the boiling water like a shark all fins.
+Stubb and Tashtego here changed places--stem for stern--a staggering
+business truly in that rocking commotion.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 18</DOCNO>
+*Partly to show the indispensableness of this act, it may here be
+stated, that, in the old Dutch fishery, a mop was used to dash the
+running line with water; in many other ships, a wooden piggin, or
+bailer, is set apart for that purpose.  Your hat, however, is the
+most convenient.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 19</DOCNO>
+>From the vibrating line extending the entire length of the upper part
+of the boat, and from its now being more tight than a harpstring, you
+would have thought the craft had two keels--one cleaving the water,
+the other the air--as the boat churned on through both opposing
+elements at once.  A continual cascade played at the bows; a
+ceaseless whirling eddy in her wake; and, at the slightest motion
+from within, even but of a little finger, the vibrating, cracking
+craft canted over her spasmodic gunwale into the sea.  Thus they
+rushed; each man with might and main clinging to his seat, to prevent
+being tossed to the foam; and the tall form of Tashtego at the
+steering oar crouching almost double, in order to bring down his
+centre of gravity.  Whole Atlantics and Pacifics seemed passed as
+they shot on their way, till at length the whale somewhat slackened
+his flight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 20</DOCNO>
+"Haul in--haul in!" cried Stubb to the bowsman! and, facing round
+towards the whale, all hands began pulling the boat up to him, while
+yet the boat was being towed on.  Soon ranging up by his flank,
+Stubb, firmly planting his knee in the clumsy cleat, darted dart
+after dart into the flying fish; at the word of command, the boat
+alternately sterning out of the way of the whale's horrible wallow,
+and then ranging up for another fling.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 21</DOCNO>
+The red tide now poured from all sides of the monster like brooks
+down a hill.  His tormented body rolled not in brine but in blood,
+which bubbled and seethed for furlongs behind in their wake.  The
+slanting sun playing upon this crimson pond in the sea, sent back
+its reflection into every face, so that they all glowed to each other
+like red men.  And all the while, jet after jet of white smoke was
+agonizingly shot from the spiracle of the whale, and vehement puff
+after puff from the mouth of the excited headsman; as at every dart,
+hauling in upon his crooked lance (by the line attached to it), Stubb
+straightened it again and again, by a few rapid blows against the
+gunwale, then again and again sent it into the whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 22</DOCNO>
+"Pull up--pull up!" he now cried to the bowsman, as the waning whale
+relaxed in his wrath.  "Pull up!--close to!" and the boat ranged
+along the fish's flank.  When reaching far over the bow, Stubb slowly
+churned his long sharp lance into the fish, and kept it there,
+carefully churning and churning, as if cautiously seeking to feel
+after some gold watch that the whale might have swallowed, and which
+he was fearful of breaking ere he could hook it out.  But that gold
+watch he sought was the innermost life of the fish.  And now it is
+struck; for, starting from his trance into that unspeakable thing
+called his "flurry," the monster horribly wallowed in his blood,
+overwrapped himself in impenetrable, mad, boiling spray, so that the
+imperilled craft, instantly dropping astern, had much ado blindly to
+struggle out from that phrensied twilight into the clear air of the
+day.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 23</DOCNO>
+And now abating in his flurry, the whale once more rolled out into
+view; surging from side to side; spasmodically dilating and
+contracting his spout-hole, with sharp, cracking, agonized
+respirations.  At last, gush after gush of clotted red gore, as if it
+had been the purple lees of red wine, shot into the frighted air; and
+falling back again, ran dripping down his motionless flanks into
+the sea.  His heart had burst!
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 24</DOCNO>
+"He's dead, Mr. Stubb," said Daggoo.
+</DOC>
+<DOC>
+<DOCNO>Chapter 61, Paragraph 25</DOCNO>
+"Yes; both pipes smoked out!" and withdrawing his own from his mouth,
+Stubb scattered the dead ashes over the water; and, for a moment,
+stood thoughtfully eyeing the vast corpse he had made.
+</DOC>
+<DOC>
+<DOCNO>Chapter 62, Paragraph 1</DOCNO>
+The Dart.
+</DOC>
+<DOC>
+<DOCNO>Chapter 62, Paragraph 2</DOCNO>
+A word concerning an incident in the last chapter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 62, Paragraph 3</DOCNO>
+According to the invariable usage of the fishery, the whale-boat
+pushes off from the ship, with the headsman or whale-killer as
+temporary steersman, and the harpooneer or whale-fastener pulling the
+foremost oar, the one known as the harpooneer-oar.  Now it needs a
+strong, nervous arm to strike the first iron into the fish; for
+often, in what is called a long dart, the heavy implement has to be
+flung to the distance of twenty or thirty feet.  But however
+prolonged and exhausting the chase, the harpooneer is expected to
+pull his oar meanwhile to the uttermost; indeed, he is expected to
+set an example of superhuman activity to the rest, not only by
+incredible rowing, but by repeated loud and intrepid exclamations;
+and what it is to keep shouting at the top of one's compass, while
+all the other muscles are strained and half started--what that is
+none know but those who have tried it.  For one, I cannot bawl very
+heartily and work very recklessly at one and the same time.  In this
+straining, bawling state, then, with his back to the fish, all at
+once the exhausted harpooneer hears the exciting cry--"Stand up, and
+give it to him!"  He now has to drop and secure his oar, turn round
+on his centre half way, seize his harpoon from the crotch, and with
+what little strength may remain, he essays to pitch it somehow into
+the whale.  No wonder, taking the whole fleet of whalemen in a body,
+that out of fifty fair chances for a dart, not five are successful;
+no wonder that so many hapless harpooneers are madly cursed and
+disrated; no wonder that some of them actually burst their
+blood-vessels in the boat; no wonder that some sperm whalemen are
+absent four years with four barrels; no wonder that to many ship
+owners, whaling is but a losing concern; for it is the harpooneer
+that makes the voyage, and if you take the breath out of his body how
+can you expect to find it there when most wanted!
+</DOC>
+<DOC>
+<DOCNO>Chapter 62, Paragraph 4</DOCNO>
+Again, if the dart be successful, then at the second critical
+instant, that is, when the whale starts to run, the boatheader and
+harpooneer likewise start to running fore and aft, to the imminent
+jeopardy of themselves and every one else.  It is then they change
+places; and the headsman, the chief officer of the little craft,
+takes his proper station in the bows of the boat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 62, Paragraph 5</DOCNO>
+Now, I care not who maintains the contrary, but all this is both
+foolish and unnecessary.  The headsman should stay in the bows from
+first to last; he should both dart the harpoon and the lance, and no
+rowing whatever should be expected of him, except under circumstances
+obvious to any fisherman.  I know that this would sometimes involve a
+slight loss of speed in the chase; but long experience in various
+whalemen of more than one nation has convinced me that in the vast
+majority of failures in the fishery, it has not by any means been so
+much the speed of the whale as the before described exhaustion of the
+harpooneer that has caused them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 62, Paragraph 6</DOCNO>
+To insure the greatest efficiency in the dart, the harpooneers of
+this world must start to their feet from out of idleness, and not
+from out of toil.
+</DOC>
+<DOC>
+<DOCNO>Chapter 63, Paragraph 1</DOCNO>
+The Crotch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 63, Paragraph 2</DOCNO>
+Out of the trunk, the branches grow; out of them, the twigs.  So, in
+productive subjects, grow the chapters.
+</DOC>
+<DOC>
+<DOCNO>Chapter 63, Paragraph 3</DOCNO>
+The crotch alluded to on a previous page deserves independent
+mention.  It is a notched stick of a peculiar form, some two feet in
+length, which is perpendicularly inserted into the starboard gunwale
+near the bow, for the purpose of furnishing a rest for the wooden
+extremity of the harpoon, whose other naked, barbed end slopingly
+projects from the prow.  Thereby the weapon is instantly at hand to
+its hurler, who snatches it up as readily from its rest as a
+backwoodsman swings his rifle from the wall.  It is customary to have
+two harpoons reposing in the crotch, respectively called the first
+and second irons.
+</DOC>
+<DOC>
+<DOCNO>Chapter 63, Paragraph 4</DOCNO>
+But these two harpoons, each by its own cord, are both connected with
+the line; the object being this: to dart them both, if possible, one
+instantly after the other into the same whale; so that if, in the
+coming drag, one should draw out, the other may still retain a hold.
+It is a doubling of the chances.  But it very often happens that
+owing to the instantaneous, violent, convulsive running of the whale
+upon receiving the first iron, it becomes impossible for the
+harpooneer, however lightning-like in his movements, to pitch the
+second iron into him.  Nevertheless, as the second iron is already
+connected with the line, and the line is running, hence that weapon
+must, at all events, be anticipatingly tossed out of the boat,
+somehow and somewhere; else the most terrible jeopardy would involve
+all hands.  Tumbled into the water, it accordingly is in such cases;
+the spare coils of box line (mentioned in a preceding chapter) making
+this feat, in most instances, prudently practicable.  But this
+critical act is not always unattended with the saddest and most fatal
+casualties.
+</DOC>
+<DOC>
+<DOCNO>Chapter 63, Paragraph 5</DOCNO>
+Furthermore: you must know that when the second iron is thrown
+overboard, it thenceforth becomes a dangling, sharp-edged terror,
+skittishly curvetting about both boat and whale, entangling the
+lines, or cutting them, and making a prodigious sensation in all
+directions.  Nor, in general, is it possible to secure it again until
+the whale is fairly captured and a corpse.
+</DOC>
+<DOC>
+<DOCNO>Chapter 63, Paragraph 6</DOCNO>
+Consider, now, how it must be in the case of four boats all engaging
+one unusually strong, active, and knowing whale; when owing to these
+qualities in him, as well as to the thousand concurring accidents of
+such an audacious enterprise, eight or ten loose second irons may be
+simultaneously dangling about him.  For, of course, each boat is
+supplied with several harpoons to bend on to the line should the
+first one be ineffectually darted without recovery.  All these
+particulars are faithfully narrated here, as they will not fail to
+elucidate several most important, however intricate passages, in
+scenes hereafter to be painted.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 1</DOCNO>
+Stubb's Supper.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 2</DOCNO>
+Stubb's whale had been killed some distance from the ship.  It was a
+calm; so, forming a tandem of three boats, we commenced the slow
+business of towing the trophy to the Pequod.  And now, as we eighteen
+men with our thirty-six arms, and one hundred and eighty thumbs and
+fingers, slowly toiled hour after hour upon that inert, sluggish
+corpse in the sea; and it seemed hardly to budge at all, except at
+long intervals; good evidence was hereby furnished of the
+enormousness of the mass we moved.  For, upon the great canal of
+Hang-Ho, or whatever they call it, in China, four or five laborers on
+the foot-path will draw a bulky freighted junk at the rate of a mile
+an hour; but this grand argosy we towed heavily forged along, as if
+laden with pig-lead in bulk.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 3</DOCNO>
+Darkness came on; but three lights up and down in the Pequod's
+main-rigging dimly guided our way; till drawing nearer we saw Ahab
+dropping one of several more lanterns over the bulwarks.  Vacantly
+eyeing the heaving whale for a moment, he issued the usual orders for
+securing it for the night, and then handing his lantern to a seaman,
+went his way into the cabin, and did not come forward again until
+morning.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 4</DOCNO>
+Though, in overseeing the pursuit of this whale, Captain Ahab had
+evinced his customary activity, to call it so; yet now that the
+creature was dead, some vague dissatisfaction, or impatience, or
+despair, seemed working in him; as if the sight of that dead body
+reminded him that Moby Dick was yet to be slain; and though a
+thousand other whales were brought to his ship, all that would not
+one jot advance his grand, monomaniac object.  Very soon you would
+have thought from the sound on the Pequod's decks, that all hands
+were preparing to cast anchor in the deep; for heavy chains are being
+dragged along the deck, and thrust rattling out of the port-holes.
+But by those clanking links, the vast corpse itself, not the ship, is
+to be moored.  Tied by the head to the stern, and by the tail to the
+bows, the whale now lies with its black hull close to the vessel's
+and seen through the darkness of the night, which obscured the spars
+and rigging aloft, the two--ship and whale, seemed yoked together
+like colossal bullocks, whereof one reclines while the other remains
+standing.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 5</DOCNO>
+*A little item may as well be related here.  The strongest and most
+reliable hold which the ship has upon the whale when moored
+alongside, is by the flukes or tail; and as from its greater density
+that part is relatively heavier than any other (excepting the
+side-fins), its flexibility even in death, causes it to sink low
+beneath the surface; so that with the hand you cannot get at it from
+the boat, in order to put the chain round it.  But this difficulty is
+ingeniously overcome: a small, strong line is prepared with a wooden
+float at its outer end, and a weight in its middle, while the other
+end is secured to the ship.  By adroit management the wooden float is
+made to rise on the other side of the mass, so that now having
+girdled the whale, the chain is readily made to follow suit; and
+being slipped along the body, is at last locked fast round the
+smallest part of the tail, at the point of junction with its broad
+flukes or lobes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 6</DOCNO>
+If moody Ahab was now all quiescence, at least so far as could be
+known on deck, Stubb, his second mate, flushed with conquest,
+betrayed an unusual but still good-natured excitement.  Such an
+unwonted bustle was he in that the staid Starbuck, his official
+superior, quietly resigned to him for the time the sole management of
+affairs.  One small, helping cause of all this liveliness in Stubb,
+was soon made strangely manifest.  Stubb was a high liver; he was
+somewhat intemperately fond of the whale as a flavorish thing to his
+palate.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 7</DOCNO>
+"A steak, a steak, ere I sleep!  You, Daggoo! overboard you go, and
+cut me one from his small!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 8</DOCNO>
+Here be it known, that though these wild fishermen do not, as a
+general thing, and according to the great military maxim, make the
+enemy defray the current expenses of the war (at least before
+realizing the proceeds of the voyage), yet now and then you find some
+of these Nantucketers who have a genuine relish for that particular
+part of the Sperm Whale designated by Stubb; comprising the tapering
+extremity of the body.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 9</DOCNO>
+About midnight that steak was cut and cooked; and lighted by two
+lanterns of sperm oil, Stubb stoutly stood up to his spermaceti
+supper at the capstan-head, as if that capstan were a sideboard.  Nor
+was Stubb the only banqueter on whale's flesh that night.  Mingling
+their mumblings with his own mastications, thousands on thousands of
+sharks, swarming round the dead leviathan, smackingly feasted on its
+fatness.  The few sleepers below in their bunks were often startled
+by the sharp slapping of their tails against the hull, within a few
+inches of the sleepers' hearts.  Peering over the side you could just
+see them (as before you heard them) wallowing in the sullen, black
+waters, and turning over on their backs as they scooped out huge
+globular pieces of the whale of the bigness of a human head.  This
+particular feat of the shark seems all but miraculous.  How at such
+an apparently unassailable surface, they contrive to gouge out such
+symmetrical mouthfuls, remains a part of the universal problem of all
+things.  The mark they thus leave on the whale, may best be likened
+to the hollow made by a carpenter in countersinking for a screw.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 10</DOCNO>
+Though amid all the smoking horror and diabolism of a sea-fight,
+sharks will be seen longingly gazing up to the ship's decks, like
+hungry dogs round a table where red meat is being carved, ready to
+bolt down every killed man that is tossed to them; and though, while
+the valiant butchers over the deck-table are thus cannibally carving
+each other's live meat with carving-knives all gilded and tasselled,
+the sharks, also, with their jewel-hilted mouths, are quarrelsomely
+carving away under the table at the dead meat; and though, were you
+to turn the whole affair upside down, it would still be pretty much
+the same thing, that is to say, a shocking sharkish business enough
+for all parties; and though sharks also are the invariable outriders
+of all slave ships crossing the Atlantic, systematically trotting
+alongside, to be handy in case a parcel is to be carried anywhere, or
+a dead slave to be decently buried; and though one or two other like
+instances might be set down, touching the set terms, places, and
+occasions, when sharks do most socially congregate, and most
+hilariously feast; yet is there no conceivable time or occasion when
+you will find them in such countless numbers, and in gayer or more
+jovial spirits, than around a dead sperm whale, moored by night to a
+whaleship at sea.  If you have never seen that sight, then suspend
+your decision about the propriety of devil-worship, and the
+expediency of conciliating the devil.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 11</DOCNO>
+But, as yet, Stubb heeded not the mumblings of the banquet that was
+going on so nigh him, no more than the sharks heeded the smacking of
+his own epicurean lips.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 12</DOCNO>
+"Cook, cook!--where's that old Fleece?" he cried at length, widening
+his legs still further, as if to form a more secure base for his
+supper; and, at the same time darting his fork into the dish, as if
+stabbing with his lance; "cook, you cook!--sail this way, cook!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 13</DOCNO>
+The old black, not in any very high glee at having been previously
+roused from his warm hammock at a most unseasonable hour, came
+shambling along from his galley, for, like many old blacks, there was
+something the matter with his knee-pans, which he did not keep well
+scoured like his other pans; this old Fleece, as they called him,
+came shuffling and limping along, assisting his step with his tongs,
+which, after a clumsy fashion, were made of straightened iron hoops;
+this old Ebony floundered along, and in obedience to the word of
+command, came to a dead stop on the opposite side of Stubb's
+sideboard; when, with both hands folded before him, and resting on
+his two-legged cane, he bowed his arched back still further over, at
+the same time sideways inclining his head, so as to bring his best
+ear into play.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 14</DOCNO>
+"Cook," said Stubb, rapidly lifting a rather reddish morsel to his
+mouth, "don't you think this steak is rather overdone?  You've been
+beating this steak too much, cook; it's too tender.  Don't I always
+say that to be good, a whale-steak must be tough?  There are those
+sharks now over the side, don't you see they prefer it tough and
+rare?  What a shindy they are kicking up!  Cook, go and talk to 'em;
+tell 'em they are welcome to help themselves civilly, and in
+moderation, but they must keep quiet.  Blast me, if I can hear my own
+voice.  Away, cook, and deliver my message.  Here, take this
+lantern," snatching one from his sideboard; "now then, go and preach
+to 'em!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 15</DOCNO>
+Sullenly taking the offered lantern, old Fleece limped across the
+deck to the bulwarks; and then, with one hand dropping his light low
+over the sea, so as to get a good view of his congregation, with the
+other hand he solemnly flourished his tongs, and leaning far over the
+side in a mumbling voice began addressing the sharks, while Stubb,
+softly crawling behind, overheard all that was said.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 16</DOCNO>
+"Fellow-critters: I'se ordered here to say dat you must stop dat dam
+noise dare.  You hear?  Stop dat dam smackin' ob de lips!  Massa
+Stubb say dat you can fill your dam bellies up to de hatchings, but
+by Gor! you must stop dat dam racket!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 17</DOCNO>
+"Cook," here interposed Stubb, accompanying the word with a sudden
+slap on the shoulder,--"Cook! why, damn your eyes, you mustn't swear
+that way when you're preaching.  That's no way to convert sinners,
+cook!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 18</DOCNO>
+"Who dat?  Den preach to him yourself," sullenly turning to go.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 19</DOCNO>
+"No, cook; go on, go on."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 20</DOCNO>
+"Well, den, Belubed fellow-critters:"-
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 21</DOCNO>
+"Right!" exclaimed Stubb, approvingly, "coax 'em to it; try that,"
+and Fleece continued.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 22</DOCNO>
+"Do you is all sharks, and by natur wery woracious, yet I zay to you,
+fellow-critters, dat dat woraciousness--'top dat dam slappin' ob de
+tail!  How you tink to hear, spose you keep up such a dam slappin'
+and bitin' dare?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 23</DOCNO>
+"Cook," cried Stubb, collaring him, "I won't have that swearing.
+Talk to 'em gentlemanly."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 24</DOCNO>
+Once more the sermon proceeded.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 25</DOCNO>
+"Your woraciousness, fellow-critters, I don't blame ye so much for;
+dat is natur, and can't be helped; but to gobern dat wicked natur,
+dat is de pint.  You is sharks, sartin; but if you gobern de shark in
+you, why den you be angel; for all angel is not'ing more dan de shark
+well goberned.  Now, look here, bred'ren, just try wonst to be cibil,
+a helping yourselbs from dat whale.  Don't be tearin' de blubber out
+your neighbour's mout, I say.  Is not one shark dood right as toder
+to dat whale?  And, by Gor, none on you has de right to dat whale;
+dat whale belong to some one else.  I know some o' you has berry brig
+mout, brigger dan oders; but den de brig mouts sometimes has de
+small bellies; so dat de brigness of de mout is not to swaller wid,
+but to bit off de blubber for de small fry ob sharks, dat can't get
+into de scrouge to help demselves."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 26</DOCNO>
+"Well done, old Fleece!" cried Stubb, "that's Christianity; go on."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 27</DOCNO>
+"No use goin' on; de dam willains will keep a scougin' and slappin'
+each oder, Massa Stubb; dey don't hear one word; no use a-preaching
+to such dam g'uttons as you call 'em, till dare bellies is full, and
+dare bellies is bottomless; and when dey do get 'em full, dey wont
+hear you den; for den dey sink in the sea, go fast to sleep on de
+coral, and can't hear noting at all, no more, for eber and eber."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 28</DOCNO>
+"Upon my soul, I am about of the same opinion; so give the
+benediction, Fleece, and I'll away to my supper."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 29</DOCNO>
+Upon this, Fleece, holding both hands over the fishy mob, raised his
+shrill voice, and cried--
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 30</DOCNO>
+"Cussed fellow-critters!  Kick up de damndest row as ever you can;
+fill your dam bellies 'till dey bust--and den die."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 31</DOCNO>
+"Now, cook," said Stubb, resuming his supper at the capstan; "stand
+just where you stood before, there, over against me, and pay
+particular attention."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 32</DOCNO>
+"All 'dention," said Fleece, again stooping over upon his tongs in
+the desired position.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 33</DOCNO>
+"Well," said Stubb, helping himself freely meanwhile; "I shall now go
+back to the subject of this steak.  In the first place, how old are
+you, cook?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 34</DOCNO>
+"What dat do wid de 'teak," said the old black, testily.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 35</DOCNO>
+"Silence!  How old are you, cook?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 36</DOCNO>
+"'Bout ninety, dey say," he gloomily muttered.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 37</DOCNO>
+"And you have lived in this world hard upon one hundred years, cook,
+and don't know yet how to cook a whale-steak?" rapidly bolting
+another mouthful at the last word, so that morsel seemed a
+continuation of the question.  "Where were you born, cook?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 38</DOCNO>
+"'Hind de hatchway, in ferry-boat, goin' ober de Roanoke."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 39</DOCNO>
+"Born in a ferry-boat!  That's queer, too.  But I want to know what
+country you were born in, cook!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 40</DOCNO>
+"Didn't I say de Roanoke country?" he cried sharply.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 41</DOCNO>
+"No, you didn't, cook; but I'll tell you what I'm coming to, cook.
+You must go home and be born over again; you don't know how to cook a
+whale-steak yet."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 42</DOCNO>
+"Bress my soul, if I cook noder one," he growled, angrily, turning
+round to depart.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 43</DOCNO>
+"Come back here, cook;--here, hand me those tongs;--now take that bit
+of steak there, and tell me if you think that steak cooked as it
+should be?  Take it, I say"--holding the tongs towards him--"take it,
+and taste it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 44</DOCNO>
+Faintly smacking his withered lips over it for a moment, the old
+negro muttered, "Best cooked 'teak I eber taste; joosy, berry joosy."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 45</DOCNO>
+"Cook," said Stubb, squaring himself once more; "do you belong to the
+church?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 46</DOCNO>
+"Passed one once in Cape-Down," said the old man sullenly.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 47</DOCNO>
+"And you have once in your life passed a holy church in Cape-Town,
+where you doubtless overheard a holy parson addressing his hearers as
+his beloved fellow-creatures, have you, cook!  And yet you come here,
+and tell me such a dreadful lie as you did just now, eh?" said Stubb.
+"Where do you expect to go to, cook?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 48</DOCNO>
+"Go to bed berry soon," he mumbled, half-turning as he spoke.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 49</DOCNO>
+"Avast! heave to!  I mean when you die, cook.  It's an awful
+question.  Now what's your answer?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 50</DOCNO>
+"When dis old brack man dies," said the negro slowly, changing his
+whole air and demeanor, "he hisself won't go nowhere; but some
+bressed angel will come and fetch him."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 51</DOCNO>
+"Fetch him?  How?  In a coach and four, as they fetched Elijah?  And
+fetch him where?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 52</DOCNO>
+"Up dere," said Fleece, holding his tongs straight over his head, and
+keeping it there very solemnly.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 53</DOCNO>
+"So, then, you expect to go up into our main-top, do you, cook, when
+you are dead?  But don't you know the higher you climb, the colder it
+gets?  Main-top, eh?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 54</DOCNO>
+"Didn't say dat t'all," said Fleece, again in the sulks.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 55</DOCNO>
+"You said up there, didn't you? and now look yourself, and see where
+your tongs are pointing.  But, perhaps you expect to get into heaven
+by crawling through the lubber's hole, cook; but, no, no, cook, you
+don't get there, except you go the regular way, round by the rigging.
+It's a ticklish business, but must be done, or else it's no go.  But
+none of us are in heaven yet.  Drop your tongs, cook, and hear my
+orders.  Do ye hear?  Hold your hat in one hand, and clap t'other
+a'top of your heart, when I'm giving my orders, cook.  What! that
+your heart, there?--that's your gizzard!  Aloft! aloft!--that's
+it--now you have it.  Hold it there now, and pay attention."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 56</DOCNO>
+"All 'dention," said the old black, with both hands placed as
+desired, vainly wriggling his grizzled head, as if to get both ears
+in front at one and the same time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 57</DOCNO>
+"Well then, cook, you see this whale-steak of yours was so very bad,
+that I have put it out of sight as soon as possible; you see that,
+don't you?  Well, for the future, when you cook another whale-steak
+for my private table here, the capstan, I'll tell you what to do so
+as not to spoil it by overdoing.  Hold the steak in one hand, and
+show a live coal to it with the other; that done, dish it; d'ye hear?
+And now to-morrow, cook, when we are cutting in the fish, be sure
+you stand by to get the tips of his fins; have them put in pickle.
+As for the ends of the flukes, have them soused, cook.  There, now ye
+may go."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 58</DOCNO>
+But Fleece had hardly got three paces off, when he was recalled.
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 59</DOCNO>
+"Cook, give me cutlets for supper to-morrow night in the mid-watch.
+D'ye hear? away you sail, then.--Halloa! stop! make a bow before you
+go.--Avast heaving again!  Whale-balls for breakfast--don't forget."
+</DOC>
+<DOC>
+<DOCNO>Chapter 64, Paragraph 60</DOCNO>
+"Wish, by gor! whale eat him, 'stead of him eat whale.  I'm bressed
+if he ain't more of shark dan Massa Shark hisself," muttered the old
+man, limping away; with which sage ejaculation he went to his
+hammock.
+</DOC>
+<DOC>
+<DOCNO>Chapter 65, Paragraph 1</DOCNO>
+The Whale as a Dish.
+</DOC>
+<DOC>
+<DOCNO>Chapter 65, Paragraph 2</DOCNO>
+That mortal man should feed upon the creature that feeds his lamp,
+and, like Stubb, eat him by his own light, as you may say; this seems
+so outlandish a thing that one must needs go a little into the
+history and philosophy of it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 65, Paragraph 3</DOCNO>
+It is upon record, that three centuries ago the tongue of the Right
+Whale was esteemed a great delicacy in France, and commanded large
+prices there.  Also, that in Henry VIIIth's time, a certain cook of
+the court obtained a handsome reward for inventing an admirable sauce
+to be eaten with barbacued porpoises, which, you remember, are a
+species of whale.  Porpoises, indeed, are to this day considered fine
+eating.  The meat is made into balls about the size of billiard
+balls, and being well seasoned and spiced might be taken for
+turtle-balls or veal balls.  The old monks of Dunfermline were very
+fond of them.  They had a great porpoise grant from the crown.
+</DOC>
+<DOC>
+<DOCNO>Chapter 65, Paragraph 4</DOCNO>
+The fact is, that among his hunters at least, the whale would by all
+hands be considered a noble dish, were there not so much of him; but
+when you come to sit down before a meat-pie nearly one hundred feet
+long, it takes away your appetite.  Only the most unprejudiced of men
+like Stubb, nowadays partake of cooked whales; but the Esquimaux are
+not so fastidious.  We all know how they live upon whales, and have
+rare old vintages of prime old train oil.  Zogranda, one of their
+most famous doctors, recommends strips of blubber for infants, as
+being exceedingly juicy and nourishing.  And this reminds me that
+certain Englishmen, who long ago were accidentally left in Greenland
+by a whaling vessel--that these men actually lived for several months
+on the mouldy scraps of whales which had been left ashore after
+trying out the blubber.  Among the Dutch whalemen these scraps are
+called "fritters"; which, indeed, they greatly resemble, being brown
+and crisp, and smelling something like old Amsterdam housewives'
+dough-nuts or oly-cooks, when fresh.  They have such an eatable look
+that the most self-denying stranger can hardly keep his hands off.
+</DOC>
+<DOC>
+<DOCNO>Chapter 65, Paragraph 5</DOCNO>
+But what further depreciates the whale as a civilized dish, is his
+exceeding richness.  He is the great prize ox of the sea, too fat to
+be delicately good.  Look at his hump, which would be as fine eating
+as the buffalo's (which is esteemed a rare dish), were it not such a
+solid pyramid of fat.  But the spermaceti itself, how bland and
+creamy that is; like the transparent, half-jellied, white meat of a
+cocoanut in the third month of its growth, yet far too rich to supply
+a substitute for butter.  Nevertheless, many whalemen have a method
+of absorbing it into some other substance, and then partaking of it.
+In the long try watches of the night it is a common thing for the
+seamen to dip their ship-biscuit into the huge oil-pots and let them
+fry there awhile.  Many a good supper have I thus made.
+</DOC>
+<DOC>
+<DOCNO>Chapter 65, Paragraph 6</DOCNO>
+In the case of a small Sperm Whale the brains are accounted a fine
+dish.  The casket of the skull is broken into with an axe, and the
+two plump, whitish lobes being withdrawn (precisely resembling two
+large puddings), they are then mixed with flour, and cooked into a
+most delectable mess, in flavor somewhat resembling calves' head,
+which is quite a dish among some epicures; and every one knows that
+some young bucks among the epicures, by continually dining upon
+calves' brains, by and by get to have a little brains of their own,
+so as to be able to tell a calf's head from their own heads; which,
+indeed, requires uncommon discrimination.  And that is the reason why
+a young buck with an intelligent looking calf's head before him, is
+somehow one of the saddest sights you can see.  The head looks a sort
+of reproachfully at him, with an "Et tu Brute!" expression.
+</DOC>
+<DOC>
+<DOCNO>Chapter 65, Paragraph 7</DOCNO>
+It is not, perhaps, entirely because the whale is so excessively
+unctuous that landsmen seem to regard the eating of him with
+abhorrence; that appears to result, in some way, from the
+consideration before mentioned: i.e. that a man should eat a newly
+murdered thing of the sea, and eat it too by its own light.  But no
+doubt the first man that ever murdered an ox was regarded as a
+murderer; perhaps he was hung; and if he had been put on his trial by
+oxen, he certainly would have been; and he certainly deserved it if
+any murderer does.  Go to the meat-market of a Saturday night and see
+the crowds of live bipeds staring up at the long rows of dead
+quadrupeds.  Does not that sight take a tooth out of the cannibal's
+jaw?  Cannibals? who is not a cannibal?  I tell you it will be more
+tolerable for the Fejee that salted down a lean missionary in his
+cellar against a coming famine; it will be more tolerable for that
+provident Fejee, I say, in the day of judgment, than for thee,
+civilized and enlightened gourmand, who nailest geese to the ground
+and feastest on their bloated livers in thy pate-de-foie-gras.
+</DOC>
+<DOC>
+<DOCNO>Chapter 65, Paragraph 8</DOCNO>
+But Stubb, he eats the whale by its own light, does he? and that is
+adding insult to injury, is it?  Look at your knife-handle, there, my
+civilized and enlightened gourmand dining off that roast beef, what
+is that handle made of?--what but the bones of the brother of the
+very ox you are eating?  And what do you pick your teeth with, after
+devouring that fat goose?  With a feather of the same fowl.  And with
+what quill did the Secretary of the Society for the Suppression of
+Cruelty to Ganders formally indite his circulars?  It is only within
+the last month or two that that society passed a resolution to
+patronise nothing but steel pens.
+</DOC>
+<DOC>
+<DOCNO>Chapter 66, Paragraph 1</DOCNO>
+The Shark Massacre.
+</DOC>
+<DOC>
+<DOCNO>Chapter 66, Paragraph 2</DOCNO>
+When in the Southern Fishery, a captured Sperm Whale, after long and
+weary toil, is brought alongside late at night, it is not, as a
+general thing at least, customary to proceed at once to the business
+of cutting him in.  For that business is an exceedingly laborious
+one; is not very soon completed; and requires all hands to set about
+it.  Therefore, the common usage is to take in all sail; lash the
+helm a'lee; and then send every one below to his hammock till
+daylight, with the reservation that, until that time, anchor-watches
+shall be kept; that is, two and two for an hour, each couple, the
+crew in rotation shall mount the deck to see that all goes well.
+</DOC>
+<DOC>
+<DOCNO>Chapter 66, Paragraph 3</DOCNO>
+But sometimes, especially upon the Line in the Pacific, this plan
+will not answer at all; because such incalculable hosts of sharks
+gather round the moored carcase, that were he left so for six hours,
+say, on a stretch, little more than the skeleton would be visible by
+morning.  In most other parts of the ocean, however, where these fish
+do not so largely abound, their wondrous voracity can be at times
+considerably diminished, by vigorously stirring them up with sharp
+whaling-spades, a procedure notwithstanding, which, in some
+instances, only seems to tickle them into still greater activity.
+But it was not thus in the present case with the Pequod's sharks;
+though, to be sure, any man unaccustomed to such sights, to have
+looked over her side that night, would have almost thought the whole
+round sea was one huge cheese, and those sharks the maggots in it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 66, Paragraph 4</DOCNO>
+Nevertheless, upon Stubb setting the anchor-watch after his supper
+was concluded; and when, accordingly, Queequeg and a forecastle
+seaman came on deck, no small excitement was created among the
+sharks; for immediately suspending the cutting stages over the side,
+and lowering three lanterns, so that they cast long gleams of light
+over the turbid sea, these two mariners, darting their long
+whaling-spades, kept up an incessant murdering of the sharks,* by
+striking the keen steel deep into their skulls, seemingly their only
+vital part.  But in the foamy confusion of their mixed and struggling
+hosts, the marksmen could not always hit their mark; and this brought
+about new revelations of the incredible ferocity of the foe.  They
+viciously snapped, not only at each other's disembowelments, but like
+flexible bows, bent round, and bit their own; till those entrails
+seemed swallowed over and over again by the same mouth, to be
+oppositely voided by the gaping wound.  Nor was this all.  It was
+unsafe to meddle with the corpses and ghosts of these creatures.  A
+sort of generic or Pantheistic vitality seemed to lurk in their very
+joints and bones, after what might be called the individual life had
+departed.  Killed and hoisted on deck for the sake of his skin, one
+of these sharks almost took poor Queequeg's hand off, when he tried
+to shut down the dead lid of his murderous jaw.
+</DOC>
+<DOC>
+<DOCNO>Chapter 66, Paragraph 5</DOCNO>
+*The whaling-spade used for cutting-in is made of the very best
+steel; is about the bigness of a man's spread hand; and in general
+shape, corresponds to the garden implement after which it is named;
+only its sides are perfectly flat, and its upper end considerably
+narrower than the lower.  This weapon is always kept as sharp as
+possible; and when being used is occasionally honed, just like a
+razor.  In its socket, a stiff pole, from twenty to thirty feet long,
+is inserted for a handle.
+</DOC>
+<DOC>
+<DOCNO>Chapter 66, Paragraph 6</DOCNO>
+"Queequeg no care what god made him shark," said the savage,
+agonizingly lifting his hand up and down; "wedder Fejee god or
+Nantucket god; but de god wat made shark must be one dam Ingin."
+</DOC>
+<DOC>
+<DOCNO>Chapter 67, Paragraph 1</DOCNO>
+Cutting In.
+</DOC>
+<DOC>
+<DOCNO>Chapter 67, Paragraph 2</DOCNO>
+It was a Saturday night, and such a Sabbath as followed!  Ex officio
+professors of Sabbath breaking are all whalemen.  The ivory Pequod
+was turned into what seemed a shamble; every sailor a butcher.  You
+would have thought we were offering up ten thousand red oxen to the
+sea gods.
+</DOC>
+<DOC>
+<DOCNO>Chapter 67, Paragraph 3</DOCNO>
+In the first place, the enormous cutting tackles, among other
+ponderous things comprising a cluster of blocks generally painted
+green, and which no single man can possibly lift--this vast bunch of
+grapes was swayed up to the main-top and firmly lashed to the lower
+mast-head, the strongest point anywhere above a ship's deck.  The end
+of the hawser-like rope winding through these intricacies, was then
+conducted to the windlass, and the huge lower block of the tackles
+was swung over the whale; to this block the great blubber hook,
+weighing some one hundred pounds, was attached.  And now suspended in
+stages over the side, Starbuck and Stubb, the mates, armed with their
+long spades, began cutting a hole in the body for the insertion of
+the hook just above the nearest of the two side-fins.  This done, a
+broad, semicircular line is cut round the hole, the hook is inserted,
+and the main body of the crew striking up a wild chorus, now commence
+heaving in one dense crowd at the windlass.  When instantly, the
+entire ship careens over on her side; every bolt in her starts like
+the nail-heads of an old house in frosty weather; she trembles,
+quivers, and nods her frighted mast-heads to the sky.  More and more
+she leans over to the whale, while every gasping heave of the
+windlass is answered by a helping heave from the billows; till at
+last, a swift, startling snap is heard; with a great swash the ship
+rolls upwards and backwards from the whale, and the triumphant tackle
+rises into sight dragging after it the disengaged semicircular end of
+the first strip of blubber.  Now as the blubber envelopes the whale
+precisely as the rind does an orange, so is it stripped off from the
+body precisely as an orange is sometimes stripped by spiralizing it.
+For the strain constantly kept up by the windlass continually keeps
+the whale rolling over and over in the water, and as the blubber in
+one strip uniformly peels off along the line called the "scarf,"
+simultaneously cut by the spades of Starbuck and Stubb, the mates;
+and just as fast as it is thus peeled off, and indeed by that very
+act itself, it is all the time being hoisted higher and higher aloft
+till its upper end grazes the main-top; the men at the windlass then
+cease heaving, and for a moment or two the prodigious blood-dripping
+mass sways to and fro as if let down from the sky, and every one
+present must take good heed to dodge it when it swings, else it may
+box his ears and pitch him headlong overboard.
+</DOC>
+<DOC>
+<DOCNO>Chapter 67, Paragraph 4</DOCNO>
+One of the attending harpooneers now advances with a long, keen
+weapon called a boarding-sword, and watching his chance he
+dexterously slices out a considerable hole in the lower part of the
+swaying mass.  Into this hole, the end of the second alternating
+great tackle is then hooked so as to retain a hold upon the blubber,
+in order to prepare for what follows.  Whereupon, this accomplished
+swordsman, warning all hands to stand off, once more makes a
+scientific dash at the mass, and with a few sidelong, desperate,
+lunging slicings, severs it completely in twain; so that while the
+short lower part is still fast, the long upper strip, called a
+blanket-piece, swings clear, and is all ready for lowering.  The
+heavers forward now resume their song, and while the one tackle is
+peeling and hoisting a second strip from the whale, the other is
+slowly slackened away, and down goes the first strip through the main
+hatchway right beneath, into an unfurnished parlor called the
+blubber-room.  Into this twilight apartment sundry nimble hands keep
+coiling away the long blanket-piece as if it were a great live mass
+of plaited serpents.  And thus the work proceeds; the two tackles
+hoisting and lowering simultaneously; both whale and windlass
+heaving, the heavers singing, the blubber-room gentlemen coiling, the
+mates scarfing, the ship straining, and all hands swearing
+occasionally, by way of assuaging the general friction.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 1</DOCNO>
+The Blanket.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 2</DOCNO>
+I have given no small attention to that not unvexed subject, the skin
+of the whale.  I have had controversies about it with experienced
+whalemen afloat, and learned naturalists ashore.  My original opinion
+remains unchanged; but it is only an opinion.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 3</DOCNO>
+The question is, what and where is the skin of the whale?  Already
+you know what his blubber is.  That blubber is something of the
+consistence of firm, close-grained beef, but tougher, more elastic
+and compact, and ranges from eight or ten to twelve and fifteen
+inches in thickness.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 4</DOCNO>
+Now, however preposterous it may at first seem to talk of any
+creature's skin as being of that sort of consistence and thickness,
+yet in point of fact these are no arguments against such a
+presumption; because you cannot raise any other dense enveloping
+layer from the whale's body but that same blubber; and the outermost
+enveloping layer of any animal, if reasonably dense, what can that be
+but the skin?  True, from the unmarred dead body of the whale, you
+may scrape off with your hand an infinitely thin, transparent
+substance, somewhat resembling the thinnest shreds of isinglass, only
+it is almost as flexible and soft as satin; that is, previous to
+being dried, when it not only contracts and thickens, but becomes
+rather hard and brittle.  I have several such dried bits, which I use
+for marks in my whale-books.  It is transparent, as I said before;
+and being laid upon the printed page, I have sometimes pleased myself
+with fancying it exerted a magnifying influence.  At any rate, it is
+pleasant to read about whales through their own spectacles, as you
+may say.  But what I am driving at here is this.  That same
+infinitely thin, isinglass substance, which, I admit, invests the
+entire body of the whale, is not so much to be regarded as the skin
+of the creature, as the skin of the skin, so to speak; for it were
+simply ridiculous to say, that the proper skin of the tremendous
+whale is thinner and more tender than the skin of a new-born child.
+But no more of this.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 5</DOCNO>
+Assuming the blubber to be the skin of the whale; then, when this
+skin, as in the case of a very large Sperm Whale, will yield the bulk
+of one hundred barrels of oil; and, when it is considered that, in
+quantity, or rather weight, that oil, in its expressed state, is only
+three fourths, and not the entire substance of the coat; some idea
+may hence be had of the enormousness of that animated mass, a mere
+part of whose mere integument yields such a lake of liquid as that.
+Reckoning ten barrels to the ton, you have ten tons for the net
+weight of only three quarters of the stuff of the whale's skin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 6</DOCNO>
+In life, the visible surface of the Sperm Whale is not the least
+among the many marvels he presents.  Almost invariably it is all over
+obliquely crossed and re-crossed with numberless straight marks in
+thick array, something like those in the finest Italian line
+engravings.  But these marks do not seem to be impressed upon the
+isinglass substance above mentioned, but seem to be seen through it,
+as if they were engraved upon the body itself.  Nor is this all.  In
+some instances, to the quick, observant eye, those linear marks, as
+in a veritable engraving, but afford the ground for far other
+delineations.  These are hieroglyphical; that is, if you call those
+mysterious cyphers on the walls of pyramids hieroglyphics, then that
+is the proper word to use in the present connexion.  By my retentive
+memory of the hieroglyphics upon one Sperm Whale in particular, I was
+much struck with a plate representing the old Indian characters
+chiselled on the famous hieroglyphic palisades on the banks of the
+Upper Mississippi.  Like those mystic rocks, too, the mystic-marked
+whale remains undecipherable.  This allusion to the Indian rocks
+reminds me of another thing.  Besides all the other phenomena which
+the exterior of the Sperm Whale presents, he not seldom displays the
+back, and more especially his flanks, effaced in great part of the
+regular linear appearance, by reason of numerous rude scratches,
+altogether of an irregular, random aspect.  I should say that those
+New England rocks on the sea-coast, which Agassiz imagines to bear
+the marks of violent scraping contact with vast floating icebergs--I
+should say, that those rocks must not a little resemble the Sperm
+Whale in this particular.  It also seems to me that such scratches in
+the whale are probably made by hostile contact with other whales; for
+I have most remarked them in the large, full-grown bulls of the
+species.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 7</DOCNO>
+A word or two more concerning this matter of the skin or blubber of
+the whale.  It has already been said, that it is stript from him in
+long pieces, called blanket-pieces.  Like most sea-terms, this one is
+very happy and significant.  For the whale is indeed wrapt up in his
+blubber as in a real blanket or counterpane; or, still better, an
+Indian poncho slipt over his head, and skirting his extremity.  It is
+by reason of this cosy blanketing of his body, that the whale is
+enabled to keep himself comfortable in all weathers, in all seas,
+times, and tides.  What would become of a Greenland whale, say, in
+those shuddering, icy seas of the North, if unsupplied with his cosy
+surtout?  True, other fish are found exceedingly brisk in those
+Hyperborean waters; but these, be it observed, are your cold-blooded,
+lungless fish, whose very bellies are refrigerators; creatures, that
+warm themselves under the lee of an iceberg, as a traveller in winter
+would bask before an inn fire; whereas, like man, the whale has lungs
+and warm blood.  Freeze his blood, and he dies.  How wonderful is it
+then--except after explanation--that this great monster, to whom
+corporeal warmth is as indispensable as it is to man; how wonderful
+that he should be found at home, immersed to his lips for life in
+those Arctic waters! where, when seamen fall overboard, they are
+sometimes found, months afterwards, perpendicularly frozen into the
+hearts of fields of ice, as a fly is found glued in amber.  But more
+surprising is it to know, as has been proved by experiment, that the
+blood of a Polar whale is warmer than that of a Borneo negro in
+summer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 8</DOCNO>
+It does seem to me, that herein we see the rare virtue of a strong
+individual vitality, and the rare virtue of thick walls, and the rare
+virtue of interior spaciousness.  Oh, man! admire and model thyself
+after the whale!  Do thou, too, remain warm among ice.  Do thou, too,
+live in this world without being of it.  Be cool at the equator; keep
+thy blood fluid at the Pole.  Like the great dome of St. Peter's, and
+like the great whale, retain, O man! in all seasons a temperature of
+thine own.
+</DOC>
+<DOC>
+<DOCNO>Chapter 68, Paragraph 9</DOCNO>
+But how easy and how hopeless to teach these fine things!  Of
+erections, how few are domed like St. Peter's! of creatures, how few
+vast as the whale!
+</DOC>
+<DOC>
+<DOCNO>Chapter 69, Paragraph 1</DOCNO>
+The Funeral.
+</DOC>
+<DOC>
+<DOCNO>Chapter 69, Paragraph 2</DOCNO>
+Haul in the chains!  Let the carcase go astern!
+</DOC>
+<DOC>
+<DOCNO>Chapter 69, Paragraph 3</DOCNO>
+The vast tackles have now done their duty.  The peeled white body of
+the beheaded whale flashes like a marble sepulchre; though changed in
+hue, it has not perceptibly lost anything in bulk.  It is still
+colossal.  Slowly it floats more and more away, the water round it
+torn and splashed by the insatiate sharks, and the air above vexed
+with rapacious flights of screaming fowls, whose beaks are like so
+many insulting poniards in the whale.  The vast white headless
+phantom floats further and further from the ship, and every rod that
+it so floats, what seem square roods of sharks and cubic roods of
+fowls, augment the murderous din.  For hours and hours from the
+almost stationary ship that hideous sight is seen.  Beneath the
+unclouded and mild azure sky, upon the fair face of the pleasant sea,
+wafted by the joyous breezes, that great mass of death floats on and
+on, till lost in infinite perspectives.
+</DOC>
+<DOC>
+<DOCNO>Chapter 69, Paragraph 4</DOCNO>
+There's a most doleful and most mocking funeral!  The sea-vultures
+all in pious mourning, the air-sharks all punctiliously in black or
+speckled.  In life but few of them would have helped the whale, I
+ween, if peradventure he had needed it; but upon the banquet of his
+funeral they most piously do pounce.  Oh, horrible vultureism of
+earth! from which not the mightiest whale is free.
+</DOC>
+<DOC>
+<DOCNO>Chapter 69, Paragraph 5</DOCNO>
+Nor is this the end.  Desecrated as the body is, a vengeful ghost
+survives and hovers over it to scare.  Espied by some timid
+man-of-war or blundering discovery-vessel from afar, when the
+distance obscuring the swarming fowls, nevertheless still shows the
+white mass floating in the sun, and the white spray heaving high
+against it; straightway the whale's unharming corpse, with trembling
+fingers is set down in the log--SHOALS, ROCKS, AND BREAKERS
+HEREABOUTS: BEWARE!  And for years afterwards, perhaps, ships shun
+the place; leaping over it as silly sheep leap over a vacuum, because
+their leader originally leaped there when a stick was held.  There's
+your law of precedents; there's your utility of traditions; there's
+the story of your obstinate survival of old beliefs never bottomed on
+the earth, and now not even hovering in the air!  There's orthodoxy!
+</DOC>
+<DOC>
+<DOCNO>Chapter 69, Paragraph 6</DOCNO>
+Thus, while in life the great whale's body may have been a real
+terror to his foes, in his death his ghost becomes a powerless panic
+to a world.
+</DOC>
+<DOC>
+<DOCNO>Chapter 69, Paragraph 7</DOCNO>
+Are you a believer in ghosts, my friend?  There are other ghosts than
+the Cock-Lane one, and far deeper men than Doctor Johnson who believe
+in them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 1</DOCNO>
+The Sphynx.
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 2</DOCNO>
+It should not have been omitted that previous to completely stripping
+the body of the leviathan, he was beheaded.  Now, the beheading of
+the Sperm Whale is a scientific anatomical feat, upon which
+experienced whale surgeons very much pride themselves: and not
+without reason.
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 3</DOCNO>
+Consider that the whale has nothing that can properly be called a
+neck; on the contrary, where his head and body seem to join, there,
+in that very place, is the thickest part of him.  Remember, also,
+that the surgeon must operate from above, some eight or ten feet
+intervening between him and his subject, and that subject almost
+hidden in a discoloured, rolling, and oftentimes tumultuous and
+bursting sea.  Bear in mind, too, that under these untoward
+circumstances he has to cut many feet deep in the flesh; and in that
+subterraneous manner, without so much as getting one single peep into
+the ever-contracting gash thus made, he must skilfully steer clear
+of all adjacent, interdicted parts, and exactly divide the spine at a
+critical point hard by its insertion into the skull.  Do you not
+marvel, then, at Stubb's boast, that he demanded but ten minutes to
+behead a sperm whale?
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 4</DOCNO>
+When first severed, the head is dropped astern and held there by a
+cable till the body is stripped.  That done, if it belong to a small
+whale it is hoisted on deck to be deliberately disposed of.  But,
+with a full grown leviathan this is impossible; for the sperm whale's
+head embraces nearly one third of his entire bulk, and completely to
+suspend such a burden as that, even by the immense tackles of a
+whaler, this were as vain a thing as to attempt weighing a Dutch barn
+in jewellers' scales.
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 5</DOCNO>
+The Pequod's whale being decapitated and the body stripped, the head
+was hoisted against the ship's side--about half way out of the sea,
+so that it might yet in great part be buoyed up by its native
+element.  And there with the strained craft steeply leaning over to it,
+by reason of the enormous downward drag from the lower mast-head, and
+every yard-arm on that side projecting like a crane over the waves;
+there, that blood-dripping head hung to the Pequod's waist like the
+giant Holofernes's from the girdle of Judith.
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 6</DOCNO>
+When this last task was accomplished it was noon, and the seamen went
+below to their dinner.  Silence reigned over the before tumultuous
+but now deserted deck.  An intense copper calm, like a universal
+yellow lotus, was more and more unfolding its noiseless measureless
+leaves upon the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 7</DOCNO>
+A short space elapsed, and up into this noiselessness came Ahab alone
+from his cabin.  Taking a few turns on the quarter-deck, he paused to
+gaze over the side, then slowly getting into the main-chains he took
+Stubb's long spade--still remaining there after the whale's
+Decapitation--and striking it into the lower part of the
+half-suspended mass, placed its other end crutch-wise under one arm,
+and so stood leaning over with eyes attentively fixed on this head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 8</DOCNO>
+It was a black and hooded head; and hanging there in the midst of so
+intense a calm, it seemed the Sphynx's in the desert.  "Speak, thou
+vast and venerable head," muttered Ahab, "which, though ungarnished
+with a beard, yet here and there lookest hoary with mosses; speak,
+mighty head, and tell us the secret thing that is in thee.  Of all
+divers, thou hast dived the deepest.  That head upon which the upper
+sun now gleams, has moved amid this world's foundations.  Where
+unrecorded names and navies rust, and untold hopes and anchors rot;
+where in her murderous hold this frigate earth is ballasted with
+bones of millions of the drowned; there, in that awful water-land,
+there was thy most familiar home.  Thou hast been where bell or diver
+never went; hast slept by many a sailor's side, where sleepless
+mothers would give their lives to lay them down.  Thou saw'st the
+locked lovers when leaping from their flaming ship; heart to heart
+they sank beneath the exulting wave; true to each other, when heaven
+seemed false to them.  Thou saw'st the murdered mate when tossed by
+pirates from the midnight deck; for hours he fell into the deeper
+midnight of the insatiate maw; and his murderers still sailed on
+unharmed--while swift lightnings shivered the neighboring ship that
+would have borne a righteous husband to outstretched, longing arms.
+O head! thou hast seen enough to split the planets and make an
+infidel of Abraham, and not one syllable is thine!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 9</DOCNO>
+"Sail ho!" cried a triumphant voice from the main-mast-head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 10</DOCNO>
+"Aye?  Well, now, that's cheering," cried Ahab, suddenly erecting
+himself, while whole thunder-clouds swept aside from his brow.  "That
+lively cry upon this deadly calm might almost convert a better
+man.--Where away?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 11</DOCNO>
+"Three points on the starboard bow, sir, and bringing down her breeze
+to us!
+</DOC>
+<DOC>
+<DOCNO>Chapter 70, Paragraph 12</DOCNO>
+"Better and better, man.  Would now St. Paul would come along that
+way, and to my breezelessness bring his breeze!  O Nature, and O soul
+of man! how far beyond all utterance are your linked analogies! not
+the smallest atom stirs or lives on matter, but has its cunning
+duplicate in mind."
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 1</DOCNO>
+The Jeroboam's Story.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 2</DOCNO>
+Hand in hand, ship and breeze blew on; but the breeze came faster
+than the ship, and soon the Pequod began to rock.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 3</DOCNO>
+By and by, through the glass the stranger's boats and manned
+mast-heads proved her a whale-ship.  But as she was so far to
+windward, and shooting by, apparently making a passage to some other
+ground, the Pequod could not hope to reach her.  So the signal was
+set to see what response would be made.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 4</DOCNO>
+Here be it said, that like the vessels of military marines, the ships
+of the American Whale Fleet have each a private signal; all which
+signals being collected in a book with the names of the respective
+vessels attached, every captain is provided with it.  Thereby, the
+whale commanders are enabled to recognise each other upon the ocean,
+even at considerable distances and with no small facility.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 5</DOCNO>
+The Pequod's signal was at last responded to by the stranger's
+setting her own; which proved the ship to be the Jeroboam of
+Nantucket.  Squaring her yards, she bore down, ranged abeam under the
+Pequod's lee, and lowered a boat; it soon drew nigh; but, as the
+side-ladder was being rigged by Starbuck's order to accommodate the
+visiting captain, the stranger in question waved his hand from his
+boat's stern in token of that proceeding being entirely unnecessary.
+It turned out that the Jeroboam had a malignant epidemic on board,
+and that Mayhew, her captain, was fearful of infecting the Pequod's
+company.  For, though himself and boat's crew remained untainted, and
+though his ship was half a rifle-shot off, and an incorruptible sea
+and air rolling and flowing between; yet conscientiously adhering to
+the timid quarantine of the land, he peremptorily refused to come
+into direct contact with the Pequod.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 6</DOCNO>
+But this did by no means prevent all communications.  Preserving an
+interval of some few yards between itself and the ship, the
+Jeroboam's boat by the occasional use of its oars contrived to keep
+parallel to the Pequod, as she heavily forged through the sea (for by
+this time it blew very fresh), with her main-topsail aback; though,
+indeed, at times by the sudden onset of a large rolling wave, the
+boat would be pushed some way ahead; but would be soon skilfully
+brought to her proper bearings again.  Subject to this, and other the
+like interruptions now and then, a conversation was sustained between
+the two parties; but at intervals not without still another
+interruption of a very different sort.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 7</DOCNO>
+Pulling an oar in the Jeroboam's boat, was a man of a singular
+appearance, even in that wild whaling life where individual
+notabilities make up all totalities.  He was a small, short, youngish
+man, sprinkled all over his face with freckles, and wearing redundant
+yellow hair.  A long-skirted, cabalistically-cut coat of a faded
+walnut tinge enveloped him; the overlapping sleeves of which were
+rolled up on his wrists.  A deep, settled, fanatic delirium was in
+his eyes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 8</DOCNO>
+So soon as this figure had been first descried, Stubb had
+exclaimed--"That's he! that's he!--the long-togged scaramouch the
+Town-Ho's company told us of!"  Stubb here alluded to a strange story
+told of the Jeroboam, and a certain man among her crew, some time
+previous when the Pequod spoke the Town-Ho.  According to this
+account and what was subsequently learned, it seemed that the
+scaramouch in question had gained a wonderful ascendency over almost
+everybody in the Jeroboam.  His story was this:
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 9</DOCNO>
+He had been originally nurtured among the crazy society of Neskyeuna
+Shakers, where he had been a great prophet; in their cracked, secret
+meetings having several times descended from heaven by the way of a
+trap-door, announcing the speedy opening of the seventh vial, which
+he carried in his vest-pocket; but, which, instead of containing
+gunpowder, was supposed to be charged with laudanum.  A strange,
+apostolic whim having seized him, he had left Neskyeuna for
+Nantucket, where, with that cunning peculiar to craziness, he assumed
+a steady, common-sense exterior, and offered himself as a green-hand
+candidate for the Jeroboam's whaling voyage.  They engaged him; but
+straightway upon the ship's getting out of sight of land, his
+insanity broke out in a freshet.  He announced himself as the
+archangel Gabriel, and commanded the captain to jump overboard.  He
+published his manifesto, whereby he set himself forth as the
+deliverer of the isles of the sea and vicar-general of all Oceanica.
+The unflinching earnestness with which he declared these things;--the
+dark, daring play of his sleepless, excited imagination, and all the
+preternatural terrors of real delirium, united to invest this Gabriel
+in the minds of the majority of the ignorant crew, with an atmosphere
+of sacredness.  Moreover, they were afraid of him.  As such a man,
+however, was not of much practical use in the ship, especially as he
+refused to work except when he pleased, the incredulous captain would
+fain have been rid of him; but apprised that that individual's
+intention was to land him in the first convenient port, the archangel
+forthwith opened all his seals and vials--devoting the ship and all
+hands to unconditional perdition, in case this intention was carried
+out.  So strongly did he work upon his disciples among the crew, that
+at last in a body they went to the captain and told him if Gabriel
+was sent from the ship, not a man of them would remain.  He was
+therefore forced to relinquish his plan.  Nor would they permit
+Gabriel to be any way maltreated, say or do what he would; so that it
+came to pass that Gabriel had the complete freedom of the ship.  The
+consequence of all this was, that the archangel cared little or
+nothing for the captain and mates; and since the epidemic had broken
+out, he carried a higher hand than ever; declaring that the plague,
+as he called it, was at his sole command; nor should it be stayed but
+according to his good pleasure.  The sailors, mostly poor devils,
+cringed, and some of them fawned before him; in obedience to his
+instructions, sometimes rendering him personal homage, as to a god.
+Such things may seem incredible; but, however wondrous, they are
+true.  Nor is the history of fanatics half so striking in respect to
+the measureless self-deception of the fanatic himself, as his
+measureless power of deceiving and bedevilling so many others.  But
+it is time to return to the Pequod.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 10</DOCNO>
+"I fear not thy epidemic, man," said Ahab from the bulwarks, to
+Captain Mayhew, who stood in the boat's stern; "come on board."
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 11</DOCNO>
+But now Gabriel started to his feet.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 12</DOCNO>
+"Think, think of the fevers, yellow and bilious!  Beware of the
+horrible plague!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 13</DOCNO>
+"Gabriel!  Gabriel!" cried Captain Mayhew; "thou must either--"  But
+that instant a headlong wave shot the boat far ahead, and its
+seethings drowned all speech.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 14</DOCNO>
+"Hast thou seen the White Whale?" demanded Ahab, when the boat
+drifted back.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 15</DOCNO>
+"Think, think of thy whale-boat, stoven and sunk!  Beware of the
+horrible tail!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 16</DOCNO>
+"I tell thee again, Gabriel, that--"  But again the boat tore ahead
+as if dragged by fiends.  Nothing was said for some moments, while a
+succession of riotous waves rolled by, which by one of those
+occasional caprices of the seas were tumbling, not heaving it.
+Meantime, the hoisted sperm whale's head jogged about very violently,
+and Gabriel was seen eyeing it with rather more apprehensiveness than
+his archangel nature seemed to warrant.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 17</DOCNO>
+When this interlude was over, Captain Mayhew began a dark story
+concerning Moby Dick; not, however, without frequent interruptions
+from Gabriel, whenever his name was mentioned, and the crazy sea that
+seemed leagued with him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 18</DOCNO>
+It seemed that the Jeroboam had not long left home, when upon
+speaking a whale-ship, her people were reliably apprised of the
+existence of Moby Dick, and the havoc he had made.  Greedily sucking
+in this intelligence, Gabriel solemnly warned the captain against
+attacking the White Whale, in case the monster should be seen; in his
+gibbering insanity, pronouncing the White Whale to be no less a being
+than the Shaker God incarnated; the Shakers receiving the Bible.  But
+when, some year or two afterwards, Moby Dick was fairly sighted from
+the mast-heads, Macey, the chief mate, burned with ardour to encounter
+him; and the captain himself being not unwilling to let him have the
+opportunity, despite all the archangel's denunciations and
+forewarnings, Macey succeeded in persuading five men to man his boat.
+With them he pushed off; and, after much weary pulling, and many
+perilous, unsuccessful onsets, he at last succeeded in getting one
+iron fast.  Meantime, Gabriel, ascending to the main-royal mast-head,
+was tossing one arm in frantic gestures, and hurling forth prophecies
+of speedy doom to the sacrilegious assailants of his divinity.  Now,
+while Macey, the mate, was standing up in his boat's bow, and with
+all the reckless energy of his tribe was venting his wild
+exclamations upon the whale, and essaying to get a fair chance for
+his poised lance, lo! a broad white shadow rose from the sea; by its
+quick, fanning motion, temporarily taking the breath out of the
+bodies of the oarsmen.  Next instant, the luckless mate, so full of
+furious life, was smitten bodily into the air, and making a long arc
+in his descent, fell into the sea at the distance of about fifty
+yards.  Not a chip of the boat was harmed, nor a hair of any
+oarsman's head; but the mate for ever sank.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 19</DOCNO>
+It is well to parenthesize here, that of the fatal accidents in the
+Sperm-Whale Fishery, this kind is perhaps almost as frequent as any.
+Sometimes, nothing is injured but the man who is thus annihilated;
+oftener the boat's bow is knocked off, or the thigh-board, in which
+the headsman stands, is torn from its place and accompanies the body.
+But strangest of all is the circumstance, that in more instances
+than one, when the body has been recovered, not a single mark of
+violence is discernible; the man being stark dead.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 20</DOCNO>
+The whole calamity, with the falling form of Macey, was plainly
+descried from the ship.  Raising a piercing shriek--"The vial! the
+vial!"  Gabriel called off the terror-stricken crew from the further
+hunting of the whale.  This terrible event clothed the archangel with
+added influence; because his credulous disciples believed that he had
+specifically fore-announced it, instead of only making a general
+prophecy, which any one might have done, and so have chanced to hit
+one of many marks in the wide margin allowed.  He became a nameless
+terror to the ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 21</DOCNO>
+Mayhew having concluded his narration, Ahab put such questions to
+him, that the stranger captain could not forbear inquiring whether he
+intended to hunt the White Whale, if opportunity should offer.  To
+which Ahab answered--"Aye."  Straightway, then, Gabriel once more
+started to his feet, glaring upon the old man, and vehemently
+exclaimed, with downward pointed finger--"Think, think of the
+blasphemer--dead, and down there!--beware of the blasphemer's end!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 22</DOCNO>
+Ahab stolidly turned aside; then said to Mayhew, "Captain, I have
+just bethought me of my letter-bag; there is a letter for one of thy
+officers, if I mistake not.  Starbuck, look over the bag."
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 23</DOCNO>
+Every whale-ship takes out a goodly number of letters for various
+ships, whose delivery to the persons to whom they may be addressed,
+depends upon the mere chance of encountering them in the four oceans.
+Thus, most letters never reach their mark; and many are only
+received after attaining an age of two or three years or more.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 24</DOCNO>
+Soon Starbuck returned with a letter in his hand.  It was sorely
+tumbled, damp, and covered with a dull, spotted, green mould, in
+consequence of being kept in a dark locker of the cabin.  Of such a
+letter, Death himself might well have been the post-boy.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 25</DOCNO>
+"Can'st not read it?" cried Ahab.  "Give it me, man.  Aye, aye, it's
+but a dim scrawl;--what's this?"  As he was studying it out, Starbuck
+took a long cutting-spade pole, and with his knife slightly split the
+end, to insert the letter there, and in that way, hand it to the
+boat, without its coming any closer to the ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 26</DOCNO>
+Meantime, Ahab holding the letter, muttered, "Mr. Har--yes, Mr.
+Harry--(a woman's pinny hand,--the man's wife, I'll wager)--Aye--Mr.
+Harry Macey, Ship Jeroboam;--why it's Macey, and he's dead!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 27</DOCNO>
+"Poor fellow! poor fellow! and from his wife," sighed Mayhew; "but
+let me have it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 28</DOCNO>
+"Nay, keep it thyself," cried Gabriel to Ahab; "thou art soon going
+that way."
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 29</DOCNO>
+"Curses throttle thee!" yelled Ahab.  "Captain Mayhew, stand by now
+to receive it"; and taking the fatal missive from Starbuck's hands,
+he caught it in the slit of the pole, and reached it over towards the
+boat.  But as he did so, the oarsmen expectantly desisted from
+rowing; the boat drifted a little towards the ship's stern; so that,
+as if by magic, the letter suddenly ranged along with Gabriel's eager
+hand.  He clutched it in an instant, seized the boat-knife, and
+impaling the letter on it, sent it thus loaded back into the ship.
+It fell at Ahab's feet.  Then Gabriel shrieked out to his comrades to
+give way with their oars, and in that manner the mutinous boat
+rapidly shot away from the Pequod.
+</DOC>
+<DOC>
+<DOCNO>Chapter 71, Paragraph 30</DOCNO>
+As, after this interlude, the seamen resumed their work upon the
+jacket of the whale, many strange things were hinted in reference to
+this wild affair.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 1</DOCNO>
+The Monkey-Rope.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 2</DOCNO>
+In the tumultuous business of cutting-in and attending to a whale,
+there is much running backwards and forwards among the crew.  Now
+hands are wanted here, and then again hands are wanted there.  There
+is no staying in any one place; for at one and the same time
+everything has to be done everywhere.  It is much the same with him
+who endeavors the description of the scene.  We must now retrace our
+way a little.  It was mentioned that upon first breaking ground in
+the whale's back, the blubber-hook was inserted into the original
+hole there cut by the spades of the mates.  But how did so clumsy and
+weighty a mass as that same hook get fixed in that hole?  It was
+inserted there by my particular friend Queequeg, whose duty it was,
+as harpooneer, to descend upon the monster's back for the special
+purpose referred to.  But in very many cases, circumstances require
+that the harpooneer shall remain on the whale till the whole tensing
+or stripping operation is concluded.  The whale, be it observed, lies
+almost entirely submerged, excepting the immediate parts operated
+upon.  So down there, some ten feet below the level of the deck, the
+poor harpooneer flounders about, half on the whale and half in the
+water, as the vast mass revolves like a tread-mill beneath him.  On
+the occasion in question, Queequeg figured in the Highland costume--a
+shirt and socks--in which to my eyes, at least, he appeared to
+uncommon advantage; and no one had a better chance to observe him, as
+will presently be seen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 3</DOCNO>
+Being the savage's bowsman, that is, the person who pulled the
+bow-oar in his boat (the second one from forward), it was my cheerful
+duty to attend upon him while taking that hard-scrabble scramble upon
+the dead whale's back.  You have seen Italian organ-boys holding a
+dancing-ape by a long cord.  Just so, from the ship's steep side, did
+I hold Queequeg down there in the sea, by what is technically called
+in the fishery a monkey-rope, attached to a strong strip of canvas
+belted round his waist.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 4</DOCNO>
+It was a humorously perilous business for both of us.  For, before we
+proceed further, it must be said that the monkey-rope was fast at
+both ends; fast to Queequeg's broad canvas belt, and fast to my
+narrow leather one.  So that for better or for worse, we two, for the
+time, were wedded; and should poor Queequeg sink to rise no more,
+then both usage and honour demanded, that instead of cutting the cord,
+it should drag me down in his wake.  So, then, an elongated Siamese
+ligature united us.  Queequeg was my own inseparable twin brother;
+nor could I any way get rid of the dangerous liabilities which the
+hempen bond entailed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 5</DOCNO>
+So strongly and metaphysically did I conceive of my situation then,
+that while earnestly watching his motions, I seemed distinctly to
+perceive that my own individuality was now merged in a joint stock
+company of two; that my free will had received a mortal wound; and
+that another's mistake or misfortune might plunge innocent me into
+unmerited disaster and death.  Therefore, I saw that here was a sort
+of interregnum in Providence; for its even-handed equity never could
+have so gross an injustice.  And yet still further pondering--while I
+jerked him now and then from between the whale and ship, which would
+threaten to jam him--still further pondering, I say, I saw that this
+situation of mine was the precise situation of every mortal that
+breathes; only, in most cases, he, one way or other, has this Siamese
+connexion with a plurality of other mortals.  If your banker breaks,
+you snap; if your apothecary by mistake sends you poison in your
+pills, you die.  True, you may say that, by exceeding caution, you
+may possibly escape these and the multitudinous other evil chances of
+life.  But handle Queequeg's monkey-rope heedfully as I would,
+sometimes he jerked it so, that I came very near sliding overboard.
+Nor could I possibly forget that, do what I would, I only had the
+management of one end of it.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 6</DOCNO>
+*The monkey-rope is found in all whalers; but it was only in the
+Pequod that the monkey and his holder were ever tied together.  This
+improvement upon the original usage was introduced by no less a man
+than Stubb, in order to afford the imperilled harpooneer the strongest
+possible guarantee for the faithfulness and vigilance of his
+monkey-rope holder.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 7</DOCNO>
+I have hinted that I would often jerk poor Queequeg from between the
+whale and the ship--where he would occasionally fall, from the
+incessant rolling and swaying of both.  But this was not the only
+jamming jeopardy he was exposed to.  Unappalled by the massacre made
+upon them during the night, the sharks now freshly and more keenly
+allured by the before pent blood which began to flow from the
+carcass--the rabid creatures swarmed round it like bees in a beehive.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 8</DOCNO>
+And right in among those sharks was Queequeg; who often pushed them
+aside with his floundering feet.  A thing altogether incredible were
+it not that attracted by such prey as a dead whale, the otherwise
+miscellaneously carnivorous shark will seldom touch a man.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 9</DOCNO>
+Nevertheless, it may well be believed that since they have such a
+ravenous finger in the pie, it is deemed but wise to look sharp to
+them.  Accordingly, besides the monkey-rope, with which I now and
+then jerked the poor fellow from too close a vicinity to the maw of
+what seemed a peculiarly ferocious shark--he was provided with still
+another protection.  Suspended over the side in one of the stages,
+Tashtego and Daggoo continually flourished over his head a couple of
+keen whale-spades, wherewith they slaughtered as many sharks as they
+could reach.  This procedure of theirs, to be sure, was very
+disinterested and benevolent of them.  They meant Queequeg's best
+happiness, I admit; but in their hasty zeal to befriend him, and from
+the circumstance that both he and the sharks were at times half
+hidden by the blood-muddled water, those indiscreet spades of theirs
+would come nearer amputating a leg than a tall.  But poor Queequeg, I
+suppose, straining and gasping there with that great iron hook--poor
+Queequeg, I suppose, only prayed to his Yojo, and gave up his life
+into the hands of his gods.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 10</DOCNO>
+Well, well, my dear comrade and twin-brother, thought I, as I drew in
+and then slacked off the rope to every swell of the sea--what matters
+it, after all?  Are you not the precious image of each and all of us
+men in this whaling world?  That unsounded ocean you gasp in, is
+Life; those sharks, your foes; those spades, your friends; and what
+between sharks and spades you are in a sad pickle and peril, poor
+lad.
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 11</DOCNO>
+But courage! there is good cheer in store for you, Queequeg.  For
+now, as with blue lips and blood-shot eyes the exhausted savage at
+last climbs up the chains and stands all dripping and involuntarily
+trembling over the side; the steward advances, and with a benevolent,
+consolatory glance hands him--what?  Some hot Cognac?  No! hands him,
+ye gods! hands him a cup of tepid ginger and water!
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 12</DOCNO>
+"Ginger?  Do I smell ginger?" suspiciously asked Stubb, coming near.
+"Yes, this must be ginger," peering into the as yet untasted cup.
+Then standing as if incredulous for a while, he calmly walked towards
+the astonished steward slowly saying, "Ginger? ginger? and will you
+have the goodness to tell me, Mr. Dough-Boy, where lies the virtue of
+ginger?  Ginger! is ginger the sort of fuel you use, Dough-boy, to
+kindle a fire in this shivering cannibal?  Ginger!--what the devil is
+ginger?--sea-coal? firewood?--lucifer
+matches?--tinder?--gunpowder?--what the devil is ginger, I say, that
+you offer this cup to our poor Queequeg here."
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 13</DOCNO>
+"There is some sneaking Temperance Society movement about this
+business," he suddenly added, now approaching Starbuck, who had just
+come from forward.  "Will you look at that kannakin, sir; smell of
+it, if you please."  Then watching the mate's countenance, he added,
+"The steward, Mr. Starbuck, had the face to offer that calomel and
+jalap to Queequeg, there, this instant off the whale.  Is the steward
+an apothecary, sir? and may I ask whether this is the sort of bitters
+by which he blows back the life into a half-drowned man?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 14</DOCNO>
+"I trust not," said Starbuck, "it is poor stuff enough."
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 15</DOCNO>
+"Aye, aye, steward," cried Stubb, "we'll teach you to drug it
+harpooneer; none of your apothecary's medicine here; you want to
+poison us, do ye?  You have got out insurances on our lives and want
+to murder us all, and pocket the proceeds, do ye?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 16</DOCNO>
+"It was not me," cried Dough-Boy, "it was Aunt Charity that brought
+the ginger on board; and bade me never give the harpooneers any
+spirits, but only this ginger-jub--so she called it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 17</DOCNO>
+"Ginger-jub! you gingerly rascal! take that! and run along with ye to
+the lockers, and get something better.  I hope I do no wrong, Mr.
+Starbuck.  It is the captain's orders--grog for the harpooneer on a
+whale."
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 18</DOCNO>
+"Enough," replied Starbuck, "only don't hit him again, but--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 19</DOCNO>
+"Oh, I never hurt when I hit, except when I hit a whale or something
+of that sort; and this fellow's a weazel.  What were you about
+saying, sir?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 20</DOCNO>
+"Only this: go down with him, and get what thou wantest thyself."
+</DOC>
+<DOC>
+<DOCNO>Chapter 72, Paragraph 21</DOCNO>
+When Stubb reappeared, he came with a dark flask in one hand, and a
+sort of tea-caddy in the other.  The first contained strong spirits,
+and was handed to Queequeg; the second was Aunt Charity's gift, and
+that was freely given to the waves.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 1</DOCNO>
+Stubb and Flask Kill a Right Whale; and Then Have a Talk Over Him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 2</DOCNO>
+It must be borne in mind that all this time we have a Sperm Whale's
+prodigious head hanging to the Pequod's side.  But we must let it
+continue hanging there a while till we can get a chance to attend to
+it.  For the present other matters press, and the best we can do now
+for the head, is to pray heaven the tackles may hold.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 3</DOCNO>
+Now, during the past night and forenoon, the Pequod had gradually
+drifted into a sea, which, by its occasional patches of yellow brit,
+gave unusual tokens of the vicinity of Right Whales, a species of the
+Leviathan that but few supposed to be at this particular time lurking
+anywhere near.  And though all hands commonly disdained the capture
+of those inferior creatures; and though the Pequod was not
+commissioned to cruise for them at all, and though she had passed
+numbers of them near the Crozetts without lowering a boat; yet now
+that a Sperm Whale had been brought alongside and beheaded, to the
+surprise of all, the announcement was made that a Right Whale should
+be captured that day, if opportunity offered.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 4</DOCNO>
+Nor was this long wanting.  Tall spouts were seen to leeward; and two
+boats, Stubb's and Flask's, were detached in pursuit.  Pulling
+further and further away, they at last became almost invisible to the
+men at the mast-head.  But suddenly in the distance, they saw a great
+heap of tumultuous white water, and soon after news came from aloft
+that one or both the boats must be fast.  An interval passed and the
+boats were in plain sight, in the act of being dragged right towards
+the ship by the towing whale.  So close did the monster come to the
+hull, that at first it seemed as if he meant it malice; but suddenly
+going down in a maelstrom, within three rods of the planks, he wholly
+disappeared from view, as if diving under the keel.  "Cut, cut!" was
+the cry from the ship to the boats, which, for one instant, seemed on
+the point of being brought with a deadly dash against the vessel's
+side.  But having plenty of line yet in the tubs, and the whale not
+sounding very rapidly, they paid out abundance of rope, and at the
+same time pulled with all their might so as to get ahead of the ship.
+For a few minutes the struggle was intensely critical; for while
+they still slacked out the tightened line in one direction, and still
+plied their oars in another, the contending strain threatened to take
+them under.  But it was only a few feet advance they sought to gain.
+And they stuck to it till they did gain it; when instantly, a swift
+tremor was felt running like lightning along the keel, as the
+strained line, scraping beneath the ship, suddenly rose to view under
+her bows, snapping and quivering; and so flinging off its drippings,
+that the drops fell like bits of broken glass on the water, while the
+whale beyond also rose to sight, and once more the boats were free to
+fly.  But the fagged whale abated his speed, and blindly altering his
+course, went round the stern of the ship towing the two boats after
+him, so that they performed a complete circuit.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 5</DOCNO>
+Meantime, they hauled more and more upon their lines, till close
+flanking him on both sides, Stubb answered Flask with lance for
+lance; and thus round and round the Pequod the battle went, while the
+multitudes of sharks that had before swum round the Sperm Whale's
+body, rushed to the fresh blood that was spilled, thirstily drinking
+at every new gash, as the eager Israelites did at the new bursting
+fountains that poured from the smitten rock.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 6</DOCNO>
+At last his spout grew thick, and with a frightful roll and vomit, he
+turned upon his back a corpse.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 7</DOCNO>
+While the two headsmen were engaged in making fast cords to his
+flukes, and in other ways getting the mass in readiness for towing,
+some conversation ensued between them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 8</DOCNO>
+"I wonder what the old man wants with this lump of foul lard," said
+Stubb, not without some disgust at the thought of having to do with
+so ignoble a leviathan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 9</DOCNO>
+"Wants with it?" said Flask, coiling some spare line in the boat's
+bow, "did you never hear that the ship which but once has a Sperm
+Whale's head hoisted on her starboard side, and at the same time a
+Right Whale's on the larboard; did you never hear, Stubb, that that
+ship can never afterwards capsize?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 10</DOCNO>
+"Why not?
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 11</DOCNO>
+"I don't know, but I heard that gamboge ghost of a Fedallah saying
+so, and he seems to know all about ships' charms.  But I sometimes
+think he'll charm the ship to no good at last.  I don't half like
+that chap, Stubb.  Did you ever notice how that tusk of his is a sort
+of carved into a snake's head, Stubb?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 12</DOCNO>
+"Sink him!  I never look at him at all; but if ever I get a chance of
+a dark night, and he standing hard by the bulwarks, and no one by;
+look down there, Flask"--pointing into the sea with a peculiar motion
+of both hands--"Aye, will I!  Flask, I take that Fedallah to be the
+devil in disguise.  Do you believe that cock and bull story about his
+having been stowed away on board ship?  He's the devil, I say.  The
+reason why you don't see his tail, is because he tucks it up out of
+sight; he carries it coiled away in his pocket, I guess.  Blast him!
+now that I think of it, he's always wanting oakum to stuff into the
+toes of his boots."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 13</DOCNO>
+"He sleeps in his boots, don't he?  He hasn't got any hammock; but
+I've seen him lay of nights in a coil of rigging."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 14</DOCNO>
+"No doubt, and it's because of his cursed tail; he coils it down, do
+ye see, in the eye of the rigging."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 15</DOCNO>
+"What's the old man have so much to do with him for?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 16</DOCNO>
+"Striking up a swap or a bargain, I suppose."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 17</DOCNO>
+"Bargain?--about what?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 18</DOCNO>
+"Why, do ye see, the old man is hard bent after that White Whale, and
+the devil there is trying to come round him, and get him to swap away
+his silver watch, or his soul, or something of that sort, and then
+he'll surrender Moby Dick."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 19</DOCNO>
+"Pooh!  Stubb, you are skylarking; how can Fedallah do that?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 20</DOCNO>
+"I don't know, Flask, but the devil is a curious chap, and a wicked
+one, I tell ye.  Why, they say as how he went a sauntering into the
+old flag-ship once, switching his tail about devilish easy and
+gentlemanlike, and inquiring if the old governor was at home.  Well,
+he was at home, and asked the devil what he wanted.  The devil,
+switching his hoofs, up and says, 'I want John.'  'What for?' says
+the old governor.  'What business is that of yours,' says the devil,
+getting mad,--'I want to use him.'  'Take him,' says the
+governor--and by the Lord, Flask, if the devil didn't give John the
+Asiatic cholera before he got through with him, I'll eat this whale
+in one mouthful.  But look sharp--ain't you all ready there?  Well,
+then, pull ahead, and let's get the whale alongside."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 21</DOCNO>
+"I think I remember some such story as you were telling," said Flask,
+when at last the two boats were slowly advancing with their burden
+towards the ship, "but I can't remember where."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 22</DOCNO>
+"Three Spaniards?  Adventures of those three bloody-minded soladoes?
+Did ye read it there, Flask?  I guess ye did?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 23</DOCNO>
+"No: never saw such a book; heard of it, though.  But now, tell me,
+Stubb, do you suppose that that devil you was speaking of just now,
+was the same you say is now on board the Pequod?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 24</DOCNO>
+"Am I the same man that helped kill this whale?  Doesn't the devil
+live for ever; who ever heard that the devil was dead?  Did you ever
+see any parson a wearing mourning for the devil?  And if the devil
+has a latch-key to get into the admiral's cabin, don't you suppose he
+can crawl into a porthole?  Tell me that, Mr. Flask?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 25</DOCNO>
+"How old do you suppose Fedallah is, Stubb?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 26</DOCNO>
+"Do you see that mainmast there?" pointing to the ship; "well, that's
+the figure one; now take all the hoops in the Pequod's hold, and
+string along in a row with that mast, for oughts, do you see; well,
+that wouldn't begin to be Fedallah's age.  Nor all the coopers in
+creation couldn't show hoops enough to make oughts enough."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 27</DOCNO>
+"But see here, Stubb, I thought you a little boasted just now, that
+you meant to give Fedallah a sea-toss, if you got a good chance.
+Now, if he's so old as all those hoops of yours come to, and if he is
+going to live for ever, what good will it do to pitch him
+overboard--tell me that?
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 28</DOCNO>
+"Give him a good ducking, anyhow."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 29</DOCNO>
+"But he'd crawl back."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 30</DOCNO>
+"Duck him again; and keep ducking him."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 31</DOCNO>
+"Suppose he should take it into his head to duck you, though--yes,
+and drown you--what then?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 32</DOCNO>
+"I should like to see him try it; I'd give him such a pair of black
+eyes that he wouldn't dare to show his face in the admiral's cabin
+again for a long while, let alone down in the orlop there, where he
+lives, and hereabouts on the upper decks where he sneaks so much.
+Damn the devil, Flask; so you suppose I'm afraid of the devil?  Who's
+afraid of him, except the old governor who daresn't catch him and put
+him in double-darbies, as he deserves, but lets him go about
+kidnapping people; aye, and signed a bond with him, that all the
+people the devil kidnapped, he'd roast for him?  There's a governor!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 33</DOCNO>
+"Do you suppose Fedallah wants to kidnap Captain Ahab?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 34</DOCNO>
+"Do I suppose it?  You'll know it before long, Flask.  But I am going
+now to keep a sharp look-out on him; and if I see anything very
+suspicious going on, I'll just take him by the nape of his neck, and
+say--Look here, Beelzebub, you don't do it; and if he makes any fuss,
+by the Lord I'll make a grab into his pocket for his tail, take it to
+the capstan, and give him such a wrenching and heaving, that his tail
+will come short off at the stump--do you see; and then, I rather
+guess when he finds himself docked in that queer fashion, he'll sneak
+off without the poor satisfaction of feeling his tail between his
+legs."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 35</DOCNO>
+"And what will you do with the tail, Stubb?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 36</DOCNO>
+"Do with it?  Sell it for an ox whip when we get home;--what else?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 37</DOCNO>
+"Now, do you mean what you say, and have been saying all along,
+Stubb?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 38</DOCNO>
+"Mean or not mean, here we are at the ship."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 39</DOCNO>
+The boats were here hailed, to tow the whale on the larboard side,
+where fluke chains and other necessaries were already prepared for
+securing him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 40</DOCNO>
+"Didn't I tell you so?" said Flask; "yes, you'll soon see this right
+whale's head hoisted up opposite that parmacetti's."
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 41</DOCNO>
+In good time, Flask's saying proved true.  As before, the Pequod
+steeply leaned over towards the sperm whale's head, now, by the
+counterpoise of both heads, she regained her even keel; though sorely
+strained, you may well believe.  So, when on one side you hoist in
+Locke's head, you go over that way; but now, on the other side, hoist
+in Kant's and you come back again; but in very poor plight.  Thus,
+some minds for ever keep trimming boat.  Oh, ye foolish! throw all
+these thunder-heads overboard, and then you will float light and
+right.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 42</DOCNO>
+In disposing of the body of a right whale, when brought alongside the
+ship, the same preliminary proceedings commonly take place as in the
+case of a sperm whale; only, in the latter instance, the head is cut
+off whole, but in the former the lips and tongue are separately
+removed and hoisted on deck, with all the well known black bone
+attached to what is called the crown-piece.  But nothing like this,
+in the present case, had been done.  The carcases of both whales had
+dropped astern; and the head-laden ship not a little resembled a mule
+carrying a pair of overburdening panniers.
+</DOC>
+<DOC>
+<DOCNO>Chapter 73, Paragraph 43</DOCNO>
+Meantime, Fedallah was calmly eyeing the right whale's head, and ever
+and anon glancing from the deep wrinkles there to the lines in his
+own hand.  And Ahab chanced so to stand, that the Parsee occupied his
+shadow; while, if the Parsee's shadow was there at all it seemed only
+to blend with, and lengthen Ahab's.  As the crew toiled on,
+Laplandish speculations were bandied among them, concerning all these
+passing things.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 1</DOCNO>
+The Sperm Whale's Head--Contrasted View.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 2</DOCNO>
+Here, now, are two great whales, laying their heads together; let us
+join them, and lay together our own.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 3</DOCNO>
+Of the grand order of folio leviathans, the Sperm Whale and the Right
+Whale are by far the most noteworthy.  They are the only whales
+regularly hunted by man.  To the Nantucketer, they present the two
+extremes of all the known varieties of the whale.  As the external
+difference between them is mainly observable in their heads; and as a
+head of each is this moment hanging from the Pequod's side; and as we
+may freely go from one to the other, by merely stepping across the
+deck:--where, I should like to know, will you obtain a better chance
+to study practical cetology than here?
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 4</DOCNO>
+In the first place, you are struck by the general contrast between
+these heads.  Both are massive enough in all conscience; but there
+is a certain mathematical symmetry in the Sperm Whale's which the
+Right Whale's sadly lacks.  There is more character in the Sperm
+Whale's head.  As you behold it, you involuntarily yield the immense
+superiority to him, in point of pervading dignity.  In the present
+instance, too, this dignity is heightened by the pepper and salt
+colour of his head at the summit, giving token of advanced age and
+large experience.  In short, he is what the fishermen technically
+call a "grey-headed whale."
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 5</DOCNO>
+Let us now note what is least dissimilar in these heads--namely, the
+two most important organs, the eye and the ear.  Far back on the side
+of the head, and low down, near the angle of either whale's jaw, if
+you narrowly search, you will at last see a lashless eye, which you
+would fancy to be a young colt's eye; so out of all proportion is it
+to the magnitude of the head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 6</DOCNO>
+Now, from this peculiar sideway position of the whale's eyes, it is
+plain that he can never see an object which is exactly ahead, no more
+than he can one exactly astern.  In a word, the position of the
+whale's eyes corresponds to that of a man's ears; and you may fancy,
+for yourself, how it would fare with you, did you sideways survey
+objects through your ears.  You would find that you could only
+command some thirty degrees of vision in advance of the straight
+side-line of sight; and about thirty more behind it.  If your
+bitterest foe were walking straight towards you, with dagger uplifted
+in broad day, you would not be able to see him, any more than if he
+were stealing upon you from behind.  In a word, you would have two
+backs, so to speak; but, at the same time, also, two fronts (side
+fronts): for what is it that makes the front of a man--what, indeed,
+but his eyes?
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 7</DOCNO>
+Moreover, while in most other animals that I can now think of, the
+eyes are so planted as imperceptibly to blend their visual power, so
+as to produce one picture and not two to the brain; the peculiar
+position of the whale's eyes, effectually divided as they are by many
+cubic feet of solid head, which towers between them like a great
+mountain separating two lakes in valleys; this, of course, must
+wholly separate the impressions which each independent organ imparts.
+The whale, therefore, must see one distinct picture on this side,
+and another distinct picture on that side; while all between must be
+profound darkness and nothingness to him.  Man may, in effect, be
+said to look out on the world from a sentry-box with two joined
+sashes for his window.  But with the whale, these two sashes are
+separately inserted, making two distinct windows, but sadly impairing
+the view.  This peculiarity of the whale's eyes is a thing always to
+be borne in mind in the fishery; and to be remembered by the reader
+in some subsequent scenes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 8</DOCNO>
+A curious and most puzzling question might be started concerning this
+visual matter as touching the Leviathan.  But I must be content with
+a hint.  So long as a man's eyes are open in the light, the act of
+seeing is involuntary; that is, he cannot then help mechanically
+seeing whatever objects are before him.  Nevertheless, any one's
+experience will teach him, that though he can take in an
+undiscriminating sweep of things at one glance, it is quite
+impossible for him, attentively, and completely, to examine any two
+things--however large or however small--at one and the same instant
+of time; never mind if they lie side by side and touch each other.
+But if you now come to separate these two objects, and surround each
+by a circle of profound darkness; then, in order to see one of them,
+in such a manner as to bring your mind to bear on it, the other will
+be utterly excluded from your contemporary consciousness.  How is it,
+then, with the whale?  True, both his eyes, in themselves, must
+simultaneously act; but is his brain so much more comprehensive,
+combining, and subtle than man's, that he can at the same moment of
+time attentively examine two distinct prospects, one on one side of
+him, and the other in an exactly opposite direction?  If he can, then
+is it as marvellous a thing in him, as if a man were able
+simultaneously to go through the demonstrations of two distinct
+problems in Euclid.  Nor, strictly investigated, is there any
+incongruity in this comparison.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 9</DOCNO>
+It may be but an idle whim, but it has always seemed to me, that the
+extraordinary vacillations of movement displayed by some whales when
+beset by three or four boats; the timidity and liability to queer
+frights, so common to such whales; I think that all this indirectly
+proceeds from the helpless perplexity of volition, in which their
+divided and diametrically opposite powers of vision must involve
+them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 10</DOCNO>
+But the ear of the whale is full as curious as the eye.  If you are
+an entire stranger to their race, you might hunt over these two heads
+for hours, and never discover that organ.  The ear has no external
+leaf whatever; and into the hole itself you can hardly insert a
+quill, so wondrously minute is it.  It is lodged a little behind the
+eye.  With respect to their ears, this important difference is to be
+observed between the sperm whale and the right.  While the ear of
+the former has an external opening, that of the latter is entirely
+and evenly covered over with a membrane, so as to be quite
+imperceptible from without.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 11</DOCNO>
+Is it not curious, that so vast a being as the whale should see the
+world through so small an eye, and hear the thunder through an ear
+which is smaller than a hare's?  But if his eyes were broad as the
+lens of Herschel's great telescope; and his ears capacious as the
+porches of cathedrals; would that make him any longer of sight, or
+sharper of hearing?  Not at all.--Why then do you try to "enlarge"
+your mind?  Subtilize it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 12</DOCNO>
+Let us now with whatever levers and steam-engines we have at hand,
+cant over the sperm whale's head, that it may lie bottom up;
+then, ascending by a ladder to the summit, have a peep down the
+mouth; and were it not that the body is now completely separated from
+it, with a lantern we might descend into the great Kentucky Mammoth
+Cave of his stomach.  But let us hold on here by this tooth, and look
+about us where we are.  What a really beautiful and chaste-looking
+mouth! from floor to ceiling, lined, or rather papered with a
+glistening white membrane, glossy as bridal satins.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 13</DOCNO>
+But come out now, and look at this portentous lower jaw, which seems
+like the long narrow lid of an immense snuff-box, with the hinge at
+one end, instead of one side.  If you pry it up, so as to get it
+overhead, and expose its rows of teeth, it seems a terrific
+portcullis; and such, alas! it proves to many a poor wight in the
+fishery, upon whom these spikes fall with impaling force.  But far
+more terrible is it to behold, when fathoms down in the sea, you see
+some sulky whale, floating there suspended, with his prodigious jaw,
+some fifteen feet long, hanging straight down at right-angles with
+his body, for all the world like a ship's jib-boom.  This whale is
+not dead; he is only dispirited; out of sorts, perhaps;
+hypochondriac; and so supine, that the hinges of his jaw have
+relaxed, leaving him there in that ungainly sort of plight, a
+reproach to all his tribe, who must, no doubt, imprecate lock-jaws
+upon him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 14</DOCNO>
+In most cases this lower jaw--being easily unhinged by a practised
+artist--is disengaged and hoisted on deck for the purpose of
+extracting the ivory teeth, and furnishing a supply of that hard
+white whalebone with which the fishermen fashion all sorts of curious
+articles, including canes, umbrella-stocks, and handles to
+riding-whips.
+</DOC>
+<DOC>
+<DOCNO>Chapter 74, Paragraph 15</DOCNO>
+With a long, weary hoist the jaw is dragged on board, as if it were
+an anchor; and when the proper time comes--some few days after the
+other work--Queequeg, Daggoo, and Tashtego, being all accomplished
+dentists, are set to drawing teeth.  With a keen cutting-spade,
+Queequeg lances the gums; then the jaw is lashed down to ringbolts,
+and a tackle being rigged from aloft, they drag out these teeth, as
+Michigan oxen drag stumps of old oaks out of wild wood lands.  There
+are generally forty-two teeth in all; in old whales, much worn down,
+but undecayed; nor filled after our artificial fashion.  The jaw is
+afterwards sawn into slabs, and piled away like joists for building
+houses.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 1</DOCNO>
+The Right Whale's Head--Contrasted View.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 2</DOCNO>
+Crossing the deck, let us now have a good long look at the Right
+Whale's head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 3</DOCNO>
+As in general shape the noble Sperm Whale's head may be compared to a
+Roman war-chariot (especially in front, where it is so broadly
+rounded); so, at a broad view, the Right Whale's head bears a rather
+inelegant resemblance to a gigantic galliot-toed shoe.  Two hundred
+years ago an old Dutch voyager likened its shape to that of a
+shoemaker's last.  And in this same last or shoe, that old woman of
+the nursery tale, with the swarming brood, might very comfortably be
+lodged, she and all her progeny.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 4</DOCNO>
+But as you come nearer to this great head it begins to assume
+different aspects, according to your point of view.  If you stand on
+its summit and look at these two F-shaped spoutholes, you would take
+the whole head for an enormous bass-viol, and these spiracles, the
+apertures in its sounding-board.  Then, again, if you fix your eye
+upon this strange, crested, comb-like incrustation on the top of the
+mass--this green, barnacled thing, which the Greenlanders call the
+"crown," and the Southern fishers the "bonnet" of the Right Whale;
+fixing your eyes solely on this, you would take the head for the
+trunk of some huge oak, with a bird's nest in its crotch.  At any
+rate, when you watch those live crabs that nestle here on this
+bonnet, such an idea will be almost sure to occur to you; unless,
+indeed, your fancy has been fixed by the technical term "crown" also
+bestowed upon it; in which case you will take great interest in
+thinking how this mighty monster is actually a diademed king of the
+sea, whose green crown has been put together for him in this
+marvellous manner.  But if this whale be a king, he is a very sulky
+looking fellow to grace a diadem.  Look at that hanging lower lip!
+what a huge sulk and pout is there! a sulk and pout, by carpenter's
+measurement, about twenty feet long and five feet deep; a sulk and
+pout that will yield you some 500 gallons of oil and more.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 5</DOCNO>
+A great pity, now, that this unfortunate whale should be hare-lipped.
+The fissure is about a foot across.  Probably the mother during an
+important interval was sailing down the Peruvian coast, when
+earthquakes caused the beach to gape.  Over this lip, as over a
+slippery threshold, we now slide into the mouth.  Upon my word were I
+at Mackinaw, I should take this to be the inside of an Indian wigwam.
+Good Lord! is this the road that Jonah went?  The roof is about
+twelve feet high, and runs to a pretty sharp angle, as if there were
+a regular ridge-pole there; while these ribbed, arched, hairy sides,
+present us with those wondrous, half vertical, scimetar-shaped slats
+of whalebone, say three hundred on a side, which depending from the
+upper part of the head or crown bone, form those Venetian blinds
+which have elsewhere been cursorily mentioned.  The edges of these
+bones are fringed with hairy fibres, through which the Right Whale
+strains the water, and in whose intricacies he retains the small
+fish, when openmouthed he goes through the seas of brit in feeding
+time.  In the central blinds of bone, as they stand in their natural
+order, there are certain curious marks, curves, hollows, and ridges,
+whereby some whalemen calculate the creature's age, as the age of an
+oak by its circular rings.  Though the certainty of this criterion is
+far from demonstrable, yet it has the savor of analogical
+probability.  At any rate, if we yield to it, we must grant a far
+greater age to the Right Whale than at first glance will seem
+reasonable.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 6</DOCNO>
+In old times, there seem to have prevailed the most curious fancies
+concerning these blinds.  One voyager in Purchas calls them the
+wondrous "whiskers" inside of the whale's mouth;* another, "hogs'
+bristles"; a third old gentleman in Hackluyt uses the following
+elegant language: "There are about two hundred and fifty fins growing
+on each side of his upper CHOP, which arch over his tongue on each
+side of his mouth."
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 7</DOCNO>
+*This reminds us that the Right Whale really has a sort of whisker,
+or rather a moustache, consisting of a few scattered white hairs on
+the upper part of the outer end of the lower jaw.  Sometimes these
+tufts impart a rather brigandish expression to his otherwise solemn
+countenance.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 8</DOCNO>
+As every one knows, these same "hogs' bristles," "fins," "whiskers,"
+"blinds," or whatever you please, furnish to the ladies their busks
+and other stiffening contrivances.  But in this particular, the
+demand has long been on the decline.  It was in Queen Anne's time
+that the bone was in its glory, the farthingale being then all the
+fashion.  And as those ancient dames moved about gaily, though in the
+jaws of the whale, as you may say; even so, in a shower, with the
+like thoughtlessness, do we nowadays fly under the same jaws for
+protection; the umbrella being a tent spread over the same bone.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 9</DOCNO>
+But now forget all about blinds and whiskers for a moment, and,
+standing in the Right Whale's mouth, look around you afresh.  Seeing
+all these colonnades of bone so methodically ranged about, would you
+not think you were inside of the great Haarlem organ, and gazing
+upon its thousand pipes?  For a carpet to the organ we have a rug of
+the softest Turkey--the tongue, which is glued, as it were, to the
+floor of the mouth.  It is very fat and tender, and apt to tear in
+pieces in hoisting it on deck.  This particular tongue now before us;
+at a passing glance I should say it was a six-barreler; that is, it
+will yield you about that amount of oil.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 10</DOCNO>
+Ere this, you must have plainly seen the truth of what I started
+with--that the Sperm Whale and the Right Whale have almost entirely
+different heads.  To sum up, then: in the Right Whale's there is no
+great well of sperm; no ivory teeth at all; no long, slender mandible
+of a lower jaw, like the Sperm Whale's.  Nor in the Sperm Whale are
+there any of those blinds of bone; no huge lower lip; and scarcely
+anything of a tongue.  Again, the Right Whale has two external
+spout-holes, the Sperm Whale only one.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 11</DOCNO>
+Look your last, now, on these venerable hooded heads, while they yet
+lie together; for one will soon sink, unrecorded, in the sea; the
+other will not be very long in following.
+</DOC>
+<DOC>
+<DOCNO>Chapter 75, Paragraph 12</DOCNO>
+Can you catch the expression of the Sperm Whale's there?  It is the
+same he died with, only some of the longer wrinkles in the forehead
+seem now faded away.  I think his broad brow to be full of a
+prairie-like placidity, born of a speculative indifference as to
+death.  But mark the other head's expression.  See that amazing lower
+lip, pressed by accident against the vessel's side, so as firmly to
+embrace the jaw.  Does not this whole head seem to speak of an
+enormous practical resolution in facing death?  This Right Whale I
+take to have been a Stoic; the Sperm Whale, a Platonian, who might
+have taken up Spinoza in his latter years.
+</DOC>
+<DOC>
+<DOCNO>Chapter 76, Paragraph 1</DOCNO>
+The Battering-Ram.
+</DOC>
+<DOC>
+<DOCNO>Chapter 76, Paragraph 2</DOCNO>
+Ere quitting, for the nonce, the Sperm Whale's head, I would have
+you, as a sensible physiologist, simply--particularly remark its
+front aspect, in all its compacted collectedness.  I would have you
+investigate it now with the sole view of forming to yourself some
+unexaggerated, intelligent estimate of whatever battering-ram power
+may be lodged there.  Here is a vital point; for you must either
+satisfactorily settle this matter with yourself, or for ever remain
+an infidel as to one of the most appalling, but not the less true
+events, perhaps anywhere to be found in all recorded history.
+</DOC>
+<DOC>
+<DOCNO>Chapter 76, Paragraph 3</DOCNO>
+You observe that in the ordinary swimming position of the Sperm
+Whale, the front of his head presents an almost wholly vertical plane
+to the water; you observe that the lower part of that front slopes
+considerably backwards, so as to furnish more of a retreat for the
+long socket which receives the boom-like lower jaw; you observe that
+the mouth is entirely under the head, much in the same way, indeed,
+as though your own mouth were entirely under your chin.  Moreover you
+observe that the whale has no external nose; and that what nose he
+has--his spout hole--is on the top of his head; you observe that his
+eyes and ears are at the sides of his head, nearly one third of his
+entire length from the front.  Wherefore, you must now have perceived
+that the front of the Sperm Whale's head is a dead, blind wall,
+without a single organ or tender prominence of any sort whatsoever.
+Furthermore, you are now to consider that only in the extreme, lower,
+backward sloping part of the front of the head, is there the
+slightest vestige of bone; and not till you get near twenty feet from
+the forehead do you come to the full cranial development.  So that
+this whole enormous boneless mass is as one wad.  Finally, though, as
+will soon be revealed, its contents partly comprise the most delicate
+oil; yet, you are now to be apprised of the nature of the substance
+which so impregnably invests all that apparent effeminacy.  In some
+previous place I have described to you how the blubber wraps the body
+of the whale, as the rind wraps an orange.  Just so with the head;
+but with this difference: about the head this envelope, though not so
+thick, is of a boneless toughness, inestimable by any man who has not
+handled it.  The severest pointed harpoon, the sharpest lance darted
+by the strongest human arm, impotently rebounds from it.  It is as
+though the forehead of the Sperm Whale were paved with horses' hoofs.
+I do not think that any sensation lurks in it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 76, Paragraph 4</DOCNO>
+Bethink yourself also of another thing.  When two large, loaded
+Indiamen chance to crowd and crush towards each other in the
+docks, what do the sailors do?  They do not suspend between them, at
+the point of coming contact, any merely hard substance, like iron or
+wood.  No, they hold there a large, round wad of tow and cork,
+enveloped in the thickest and toughest of ox-hide.  That bravely and
+uninjured takes the jam which would have snapped all their oaken
+handspikes and iron crow-bars.  By itself this sufficiently
+illustrates the obvious fact I drive at.  But supplementary to this,
+it has hypothetically occurred to me, that as ordinary fish possess
+what is called a swimming bladder in them, capable, at will, of
+distension or contraction; and as the Sperm Whale, as far as I know,
+has no such provision in him; considering, too, the otherwise
+inexplicable manner in which he now depresses his head altogether
+beneath the surface, and anon swims with it high elevated out of the
+water; considering the unobstructed elasticity of its envelope;
+considering the unique interior of his head; it has hypothetically
+occurred to me, I say, that those mystical lung-celled honeycombs
+there may possibly have some hitherto unknown and unsuspected
+connexion with the outer air, so as to be susceptible to atmospheric
+distension and contraction.  If this be so, fancy the
+irresistibleness of that might, to which the most impalpable and
+destructive of all elements contributes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 76, Paragraph 5</DOCNO>
+Now, mark.  Unerringly impelling this dead, impregnable, uninjurable
+wall, and this most buoyant thing within; there swims behind it all a
+mass of tremendous life, only to be adequately estimated as piled
+wood is--by the cord; and all obedient to one volition, as the
+smallest insect.  So that when I shall hereafter detail to you all
+the specialities and concentrations of potency everywhere lurking in
+this expansive monster; when I shall show you some of his more
+inconsiderable braining feats; I trust you will have renounced all
+ignorant incredulity, and be ready to abide by this; that though the
+Sperm Whale stove a passage through the Isthmus of Darien, and mixed
+the Atlantic with the Pacific, you would not elevate one hair of your
+eye-brow.  For unless you own the whale, you are but a provincial and
+sentimentalist in Truth.  But clear Truth is a thing for salamander
+giants only to encounter; how small the chances for the provincials
+then?  What befell the weakling youth lifting the dread goddess's
+veil at Lais?
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 1</DOCNO>
+The Great Heidelburgh Tun.
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 2</DOCNO>
+Now comes the Baling of the Case.  But to comprehend it aright, you
+must know something of the curious internal structure of the thing
+operated upon.
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 3</DOCNO>
+Regarding the Sperm Whale's head as a solid oblong, you may, on an
+inclined plane, sideways divide it into two quoins,* whereof the
+lower is the bony structure, forming the cranium and jaws, and the
+upper an unctuous mass wholly free from bones; its broad forward end
+forming the expanded vertical apparent forehead of the whale.  At the
+middle of the forehead horizontally subdivide this upper quoin, and
+then you have two almost equal parts, which before were naturally
+divided by an internal wall of a thick tendinous substance.
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 4</DOCNO>
+*Quoin is not a Euclidean term.  It belongs to the pure nautical
+mathematics.  I know not that it has been defined before.  A quoin is
+a solid which differs from a wedge in having its sharp end formed by
+the steep inclination of one side, instead of the mutual tapering of
+both sides.
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 5</DOCNO>
+The lower subdivided part, called the junk, is one immense honeycomb
+of oil, formed by the crossing and recrossing, into ten thousand
+infiltrated cells, of tough elastic white fibres throughout its whole
+extent.  The upper part, known as the Case, may be regarded as the
+great Heidelburgh Tun of the Sperm Whale.  And as that famous great
+tierce is mystically carved in front, so the whale's vast plaited
+forehead forms innumerable strange devices for the emblematical
+adornment of his wondrous tun.  Moreover, as that of Heidelburgh was
+always replenished with the most excellent of the wines of the
+Rhenish valleys, so the tun of the whale contains by far the most
+precious of all his oily vintages; namely, the highly-prized
+spermaceti, in its absolutely pure, limpid, and odoriferous state.
+Nor is this precious substance found unalloyed in any other part of
+the creature.  Though in life it remains perfectly fluid, yet, upon
+exposure to the air, after death, it soon begins to concrete; sending
+forth beautiful crystalline shoots, as when the first thin delicate
+ice is just forming in water.  A large whale's case generally yields
+about five hundred gallons of sperm, though from unavoidable
+circumstances, considerable of it is spilled, leaks, and dribbles
+away, or is otherwise irrevocably lost in the ticklish business of
+securing what you can.
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 6</DOCNO>
+I know not with what fine and costly material the Heidelburgh Tun was
+coated within, but in superlative richness that coating could not
+possibly have compared with the silken pearl-coloured membrane, like
+the lining of a fine pelisse, forming the inner surface of the Sperm
+Whale's case.
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 7</DOCNO>
+It will have been seen that the Heidelburgh Tun of the Sperm Whale
+embraces the entire length of the entire top of the head; and
+since--as has been elsewhere set forth--the head embraces one third
+of the whole length of the creature, then setting that length down at
+eighty feet for a good sized whale, you have more than twenty-six
+feet for the depth of the tun, when it is lengthwise hoisted up and
+down against a ship's side.
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 8</DOCNO>
+As in decapitating the whale, the operator's instrument is brought
+close to the spot where an entrance is subsequently forced into the
+spermaceti magazine; he has, therefore, to be uncommonly heedful,
+lest a careless, untimely stroke should invade the sanctuary and
+wastingly let out its invaluable contents.  It is this decapitated
+end of the head, also, which is at last elevated out of the water,
+and retained in that position by the enormous cutting tackles, whose
+hempen combinations, on one side, make quite a wilderness of ropes in
+that quarter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 77, Paragraph 9</DOCNO>
+Thus much being said, attend now, I pray you, to that marvellous
+and--in this particular instance--almost fatal operation whereby the
+Sperm Whale's great Heidelburgh Tun is tapped.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 1</DOCNO>
+Cistern and Buckets.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 2</DOCNO>
+Nimble as a cat, Tashtego mounts aloft; and without altering his
+erect posture, runs straight out upon the overhanging mainyard-arm,
+to the part where it exactly projects over the hoisted Tun.  He has
+carried with him a light tackle called a whip, consisting of only two
+parts, travelling through a single-sheaved block.  Securing this
+block, so that it hangs down from the yard-arm, he swings one end of
+the rope, till it is caught and firmly held by a hand on deck.
+Then, hand-over-hand, down the other part, the Indian drops through
+the air, till dexterously he lands on the summit of the head.
+There--still high elevated above the rest of the company, to whom he
+vivaciously cries--he seems some Turkish Muezzin calling the good
+people to prayers from the top of a tower.  A short-handled sharp
+spade being sent up to him, he diligently searches for the proper
+place to begin breaking into the Tun.  In this business he proceeds
+very heedfully, like a treasure-hunter in some old house, sounding
+the walls to find where the gold is masoned in.  By the time this
+cautious search is over, a stout iron-bound bucket, precisely like a
+well-bucket, has been attached to one end of the whip; while the
+other end, being stretched across the deck, is there held by two or
+three alert hands.  These last now hoist the bucket within grasp of
+the Indian, to whom another person has reached up a very long pole.
+Inserting this pole into the bucket, Tashtego downward guides the
+bucket into the Tun, till it entirely disappears; then giving the
+word to the seamen at the whip, up comes the bucket again, all
+bubbling like a dairy-maid's pail of new milk.  Carefully lowered
+from its height, the full-freighted vessel is caught by an appointed
+hand, and quickly emptied into a large tub.  Then remounting aloft,
+it again goes through the same round until the deep cistern will
+yield no more.  Towards the end, Tashtego has to ram his long pole
+harder and harder, and deeper and deeper into the Tun, until some
+twenty feet of the pole have gone down.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 3</DOCNO>
+Now, the people of the Pequod had been baling some time in this way;
+several tubs had been filled with the fragrant sperm; when all at
+once a queer accident happened.  Whether it was that Tashtego, that
+wild Indian, was so heedless and reckless as to let go for a moment
+his one-handed hold on the great cabled tackles suspending the head;
+or whether the place where he stood was so treacherous and oozy; or
+whether the Evil One himself would have it to fall out so, without
+stating his particular reasons; how it was exactly, there is no
+telling now; but, on a sudden, as the eightieth or ninetieth bucket
+came suckingly up--my God! poor Tashtego--like the twin reciprocating
+bucket in a veritable well, dropped head-foremost down into this
+great Tun of Heidelburgh, and with a horrible oily gurgling, went
+clean out of sight!
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 4</DOCNO>
+"Man overboard!" cried Daggoo, who amid the general consternation
+first came to his senses.  "Swing the bucket this way!" and putting
+one foot into it, so as the better to secure his slippery hand-hold
+on the whip itself, the hoisters ran him high up to the top of the
+head, almost before Tashtego could have reached its interior bottom.
+Meantime, there was a terrible tumult.  Looking over the side, they
+saw the before lifeless head throbbing and heaving just below the
+surface of the sea, as if that moment seized with some momentous
+idea; whereas it was only the poor Indian unconsciously revealing by
+those struggles the perilous depth to which he had sunk.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 5</DOCNO>
+At this instant, while Daggoo, on the summit of the head, was
+clearing the whip--which had somehow got foul of the great cutting
+tackles--a sharp cracking noise was heard; and to the unspeakable
+horror of all, one of the two enormous hooks suspending the head tore
+out, and with a vast vibration the enormous mass sideways swung, till
+the drunk ship reeled and shook as if smitten by an iceberg.  The one
+remaining hook, upon which the entire strain now depended, seemed
+every instant to be on the point of giving way; an event still more
+likely from the violent motions of the head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 6</DOCNO>
+"Come down, come down!" yelled the seamen to Daggoo, but with one
+hand holding on to the heavy tackles, so that if the head should
+drop, he would still remain suspended; the negro having cleared the
+foul line, rammed down the bucket into the now collapsed well,
+meaning that the buried harpooneer should grasp it, and so be hoisted
+out.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 7</DOCNO>
+"In heaven's name, man," cried Stubb, "are you ramming home a
+cartridge there?--Avast!  How will that help him; jamming that
+iron-bound bucket on top of his head?  Avast, will ye!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 8</DOCNO>
+"Stand clear of the tackle!" cried a voice like the bursting of a
+rocket.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 9</DOCNO>
+Almost in the same instant, with a thunder-boom, the enormous mass
+dropped into the sea, like Niagara's Table-Rock into the whirlpool;
+the suddenly relieved hull rolled away from it, to far down her
+glittering copper; and all caught their breath, as half swinging--now
+over the sailors' heads, and now over the water--Daggoo, through a
+thick mist of spray, was dimly beheld clinging to the pendulous
+tackles, while poor, buried-alive Tashtego was sinking utterly down
+to the bottom of the sea!  But hardly had the blinding vapour cleared
+away, when a naked figure with a boarding-sword in his hand, was for
+one swift moment seen hovering over the bulwarks.  The next, a loud
+splash announced that my brave Queequeg had dived to the rescue.  One
+packed rush was made to the side, and every eye counted every ripple,
+as moment followed moment, and no sign of either the sinker or the
+diver could be seen.  Some hands now jumped into a boat alongside,
+and pushed a little off from the ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 10</DOCNO>
+"Ha! ha!" cried Daggoo, all at once, from his now quiet, swinging
+perch overhead; and looking further off from the side, we saw an arm
+thrust upright from the blue waves; a sight strange to see, as an arm
+thrust forth from the grass over a grave.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 11</DOCNO>
+"Both! both!--it is both!"--cried Daggoo again with a joyful shout;
+and soon after, Queequeg was seen boldly striking out with one hand,
+and with the other clutching the long hair of the Indian.  Drawn into
+the waiting boat, they were quickly brought to the deck; but Tashtego
+was long in coming to, and Queequeg did not look very brisk.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 12</DOCNO>
+Now, how had this noble rescue been accomplished?  Why, diving after
+the slowly descending head, Queequeg with his keen sword had made
+side lunges near its bottom, so as to scuttle a large hole there;
+then dropping his sword, had thrust his long arm far inwards and
+upwards, and so hauled out poor Tash by the head.  He averred, that
+upon first thrusting in for him, a leg was presented; but well
+knowing that that was not as it ought to be, and might occasion great
+trouble;--he had thrust back the leg, and by a dexterous heave and
+toss, had wrought a somerset upon the Indian; so that with the next
+trial, he came forth in the good old way--head foremost.  As for the
+great head itself, that was doing as well as could be expected.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 13</DOCNO>
+And thus, through the courage and great skill in obstetrics of
+Queequeg, the deliverance, or rather, delivery of Tashtego, was
+successfully accomplished, in the teeth, too, of the most untoward
+and apparently hopeless impediments; which is a lesson by no means to
+be forgotten.  Midwifery should be taught in the same course with
+fencing and boxing, riding and rowing.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 14</DOCNO>
+I know that this queer adventure of the Gay-Header's will be sure to
+seem incredible to some landsmen, though they themselves may have
+either seen or heard of some one's falling into a cistern ashore; an
+accident which not seldom happens, and with much less reason too than
+the Indian's, considering the exceeding slipperiness of the curb of
+the Sperm Whale's well.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 15</DOCNO>
+But, peradventure, it may be sagaciously urged, how is this?  We
+thought the tissued, infiltrated head of the Sperm Whale, was the
+lightest and most corky part about him; and yet thou makest it sink
+in an element of a far greater specific gravity than itself.  We have
+thee there.  Not at all, but I have ye; for at the time poor Tash
+fell in, the case had been nearly emptied of its lighter contents,
+leaving little but the dense tendinous wall of the well--a double
+welded, hammered substance, as I have before said, much heavier than
+the sea water, and a lump of which sinks in it like lead almost.  But
+the tendency to rapid sinking in this substance was in the present
+instance materially counteracted by the other parts of the head
+remaining undetached from it, so that it sank very slowly and
+deliberately indeed, affording Queequeg a fair chance for performing
+his agile obstetrics on the run, as you may say.  Yes, it was a
+running delivery, so it was.
+</DOC>
+<DOC>
+<DOCNO>Chapter 78, Paragraph 16</DOCNO>
+Now, had Tashtego perished in that head, it had been a very precious
+perishing; smothered in the very whitest and daintiest of fragrant
+spermaceti; coffined, hearsed, and tombed in the secret inner chamber
+and sanctum sanctorum of the whale.  Only one sweeter end can readily
+be recalled--the delicious death of an Ohio honey-hunter, who seeking
+honey in the crotch of a hollow tree, found such exceeding store of
+it, that leaning too far over, it sucked him in, so that he died
+embalmed.  How many, think ye, have likewise fallen into Plato's
+honey head, and sweetly perished there?
+</DOC>
+<DOC>
+<DOCNO>Chapter 79, Paragraph 1</DOCNO>
+The Prairie.
+</DOC>
+<DOC>
+<DOCNO>Chapter 79, Paragraph 2</DOCNO>
+To scan the lines of his face, or feel the bumps on the head of this
+Leviathan; this is a thing which no Physiognomist or Phrenologist has
+as yet undertaken.  Such an enterprise would seem almost as hopeful
+as for Lavater to have scrutinized the wrinkles on the Rock of
+Gibraltar, or for Gall to have mounted a ladder and manipulated the
+Dome of the Pantheon.  Still, in that famous work of his, Lavater
+not only treats of the various faces of men, but also attentively
+studies the faces of horses, birds, serpents, and fish; and dwells in
+detail upon the modifications of expression discernible therein.  Nor
+have Gall and his disciple Spurzheim failed to throw out some hints
+touching the phrenological characteristics of other beings than man.
+Therefore, though I am but ill qualified for a pioneer, in the
+application of these two semi-sciences to the whale, I will do my
+endeavor.  I try all things; I achieve what I can.
+</DOC>
+<DOC>
+<DOCNO>Chapter 79, Paragraph 3</DOCNO>
+Physiognomically regarded, the Sperm Whale is an anomalous creature.
+He has no proper nose.  And since the nose is the central and most
+conspicuous of the features; and since it perhaps most modifies and
+finally controls their combined expression; hence it would seem that
+its entire absence, as an external appendage, must very largely
+affect the countenance of the whale.  For as in landscape gardening,
+a spire, cupola, monument, or tower of some sort, is deemed almost
+indispensable to the completion of the scene; so no face can be
+physiognomically in keeping without the elevated open-work belfry of
+the nose.  Dash the nose from Phidias's marble Jove, and what a sorry
+remainder!  Nevertheless, Leviathan is of so mighty a magnitude, all
+his proportions are so stately, that the same deficiency which in the
+sculptured Jove were hideous, in him is no blemish at all.  Nay, it
+is an added grandeur.  A nose to the whale would have been
+impertinent.  As on your physiognomical voyage you sail round his
+vast head in your jolly-boat, your noble conceptions of him are never
+insulted by the reflection that he has a nose to be pulled.  A
+pestilent conceit, which so often will insist upon obtruding even
+when beholding the mightiest royal beadle on his throne.
+</DOC>
+<DOC>
+<DOCNO>Chapter 79, Paragraph 4</DOCNO>
+In some particulars, perhaps the most imposing physiognomical view
+to be had of the Sperm Whale, is that of the full front of his head.
+This aspect is sublime.
+</DOC>
+<DOC>
+<DOCNO>Chapter 79, Paragraph 5</DOCNO>
+In thought, a fine human brow is like the East when troubled with
+the morning.  In the repose of the pasture, the curled brow of the
+bull has a touch of the grand in it.  Pushing heavy cannon up
+mountain defiles, the elephant's brow is majestic.  Human or animal,
+the mystical brow is as that great golden seal affixed by the German
+Emperors to their decrees.  It signifies--"God: done this day by my
+hand."  But in most creatures, nay in man himself, very often the
+brow is but a mere strip of alpine land lying along the snow line.
+Few are the foreheads which like Shakespeare's or Melancthon's rise
+so high, and descend so low, that the eyes themselves seem clear,
+eternal, tideless mountain lakes; and all above them in the forehead's
+wrinkles, you seem to track the antlered thoughts descending there to
+drink, as the Highland hunters track the snow prints of the deer.
+But in the great Sperm Whale, this high and mighty god-like dignity
+inherent in the brow is so immensely amplified, that gazing on it, in
+that full front view, you feel the Deity and the dread powers more
+forcibly than in beholding any other object in living nature.  For
+you see no one point precisely; not one distinct feature is revealed;
+no nose, eyes, ears, or mouth; no face; he has none, proper; nothing
+but that one broad firmament of a forehead, pleated with riddles;
+dumbly lowering with the doom of boats, and ships, and men.  Nor, in
+profile, does this wondrous brow diminish; though that way viewed its
+grandeur does not domineer upon you so.  In profile, you plainly
+perceive that horizontal, semi-crescentic depression in the
+forehead's middle, which, in man, is Lavater's mark of genius.
+</DOC>
+<DOC>
+<DOCNO>Chapter 79, Paragraph 6</DOCNO>
+But how?  Genius in the Sperm Whale?  Has the Sperm Whale ever
+written a book, spoken a speech?  No, his great genius is declared in
+his doing nothing particular to prove it.  It is moreover declared in
+his pyramidical silence.  And this reminds me that had the great
+Sperm Whale been known to the young Orient World, he would have been
+deified by their child-magian thoughts.  They deified the crocodile
+of the Nile, because the crocodile is tongueless; and the Sperm Whale
+has no tongue, or at least it is so exceedingly small, as to be
+incapable of protrusion.  If hereafter any highly cultured, poetical
+nation shall lure back to their birth-right, the merry May-day gods
+of old; and livingly enthrone them again in the now egotistical sky;
+in the now unhaunted hill; then be sure, exalted to Jove's high seat,
+the great Sperm Whale shall lord it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 79, Paragraph 7</DOCNO>
+Champollion deciphered the wrinkled granite hieroglyphics.  But there
+is no Champollion to decipher the Egypt of every man's and every
+being's face.  Physiognomy, like every other human science, is but a
+passing fable.  If then, Sir William Jones, who read in thirty
+languages, could not read the simplest peasant's face in its
+profounder and more subtle meanings, how may unlettered Ishmael hope
+to read the awful Chaldee of the Sperm Whale's brow?  I but put that
+brow before you.  Read it if you can.
+</DOC>
+<DOC>
+<DOCNO>Chapter 80, Paragraph 1</DOCNO>
+The Nut.
+</DOC>
+<DOC>
+<DOCNO>Chapter 80, Paragraph 2</DOCNO>
+If the Sperm Whale be physiognomically a Sphinx, to the phrenologist
+his brain seems that geometrical circle which it is impossible to
+square.
+</DOC>
+<DOC>
+<DOCNO>Chapter 80, Paragraph 3</DOCNO>
+In the full-grown creature the skull will measure at least twenty
+feet in length.  Unhinge the lower jaw, and the side view of this
+skull is as the side of a moderately inclined plane resting
+throughout on a level base.  But in life--as we have elsewhere
+seen--this inclined plane is angularly filled up, and almost squared
+by the enormous superincumbent mass of the junk and sperm.  At the
+high end the skull forms a crater to bed that part of the mass; while
+under the long floor of this crater--in another cavity seldom
+exceeding ten inches in length and as many in depth--reposes the
+mere handful of this monster's brain.  The brain is at least twenty
+feet from his apparent forehead in life; it is hidden away behind its
+vast outworks, like the innermost citadel within the amplified
+fortifications of Quebec.  So like a choice casket is it secreted in
+him, that I have known some whalemen who peremptorily deny that the
+Sperm Whale has any other brain than that palpable semblance of one
+formed by the cubic-yards of his sperm magazine.  Lying in strange
+folds, courses, and convolutions, to their apprehensions, it seems
+more in keeping with the idea of his general might to regard that
+mystic part of him as the seat of his intelligence.
+</DOC>
+<DOC>
+<DOCNO>Chapter 80, Paragraph 4</DOCNO>
+It is plain, then, that phrenologically the head of this Leviathan,
+in the creature's living intact state, is an entire delusion.  As for
+his true brain, you can then see no indications of it, nor feel any.
+The whale, like all things that are mighty, wears a false brow to the
+common world.
+</DOC>
+<DOC>
+<DOCNO>Chapter 80, Paragraph 5</DOCNO>
+If you unload his skull of its spermy heaps and then take a rear view
+of its rear end, which is the high end, you will be struck by its
+resemblance to the human skull, beheld in the same situation, and
+from the same point of view.  Indeed, place this reversed skull
+(scaled down to the human magnitude) among a plate of men's skulls,
+and you would involuntarily confound it with them; and remarking the
+depressions on one part of its summit, in phrenological phrase you
+would say--This man had no self-esteem, and no veneration.  And by
+those negations, considered along with the affirmative fact of his
+prodigious bulk and power, you can best form to yourself the truest,
+though not the most exhilarating conception of what the most exalted
+potency is.
+</DOC>
+<DOC>
+<DOCNO>Chapter 80, Paragraph 6</DOCNO>
+But if from the comparative dimensions of the whale's proper brain,
+you deem it incapable of being adequately charted, then I have
+another idea for you.  If you attentively regard almost any
+quadruped's spine, you will be struck with the resemblance of its
+vertebrae to a strung necklace of dwarfed skulls, all bearing
+rudimental resemblance to the skull proper.  It is a German conceit,
+that the vertebrae are absolutely undeveloped skulls.  But the
+curious external resemblance, I take it the Germans were not the
+first men to perceive.  A foreign friend once pointed it out to me,
+in the skeleton of a foe he had slain, and with the vertebrae of
+which he was inlaying, in a sort of basso-relievo, the beaked prow
+of his canoe.  Now, I consider that the phrenologists have omitted an
+important thing in not pushing their investigations from the
+cerebellum through the spinal canal.  For I believe that much of a
+man's character will be found betokened in his backbone.  I would
+rather feel your spine than your skull, whoever you are.  A thin
+joist of a spine never yet upheld a full and noble soul.  I rejoice
+in my spine, as in the firm audacious staff of that flag which I
+fling half out to the world.
+</DOC>
+<DOC>
+<DOCNO>Chapter 80, Paragraph 7</DOCNO>
+Apply this spinal branch of phrenology to the Sperm Whale.  His
+cranial cavity is continuous with the first neck-vertebra; and in
+that vertebra the bottom of the spinal canal will measure ten inches
+across, being eight in height, and of a triangular figure with the
+base downwards.  As it passes through the remaining vertebrae the
+canal tapers in size, but for a considerable distance remains of
+large capacity.  Now, of course, this canal is filled with much the
+same strangely fibrous substance--the spinal cord--as the brain; and
+directly communicates with the brain.  And what is still more, for
+many feet after emerging from the brain's cavity, the spinal cord
+remains of an undecreasing girth, almost equal to that of the brain.
+Under all these circumstances, would it be unreasonable to survey and
+map out the whale's spine phrenologically?  For, viewed in this
+light, the wonderful comparative smallness of his brain proper is
+more than compensated by the wonderful comparative magnitude of his
+spinal cord.
+</DOC>
+<DOC>
+<DOCNO>Chapter 80, Paragraph 8</DOCNO>
+But leaving this hint to operate as it may with the phrenologists, I
+would merely assume the spinal theory for a moment, in reference to
+the Sperm Whale's hump.  This august hump, if I mistake not, rises
+over one of the larger vertebrae, and is, therefore, in some sort,
+the outer convex mould of it.  From its relative situation then, I
+should call this high hump the organ of firmness or indomitableness
+in the Sperm Whale.  And that the great monster is indomitable, you
+will yet have reason to know.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 1</DOCNO>
+The Pequod Meets The Virgin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 2</DOCNO>
+The predestinated day arrived, and we duly met the ship Jungfrau,
+Derick De Deer, master, of Bremen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 3</DOCNO>
+At one time the greatest whaling people in the world, the Dutch and
+Germans are now among the least; but here and there at very wide
+intervals of latitude and longitude, you still occasionally meet with
+their flag in the Pacific.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 4</DOCNO>
+For some reason, the Jungfrau seemed quite eager to pay her respects.
+While yet some distance from the Pequod, she rounded to, and
+dropping a boat, her captain was impelled towards us, impatiently
+standing in the bows instead of the stern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 5</DOCNO>
+"What has he in his hand there?" cried Starbuck, pointing to
+something wavingly held by the German.  "Impossible!--a lamp-feeder!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 6</DOCNO>
+"Not that," said Stubb, "no, no, it's a coffee-pot, Mr. Starbuck;
+he's coming off to make us our coffee, is the Yarman; don't you see
+that big tin can there alongside of him?--that's his boiling water.
+Oh! he's all right, is the Yarman."
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 7</DOCNO>
+"Go along with you," cried Flask, "it's a lamp-feeder and an oil-can.
+He's out of oil, and has come a-begging."
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 8</DOCNO>
+However curious it may seem for an oil-ship to be borrowing oil on
+the whale-ground, and however much it may invertedly contradict the
+old proverb about carrying coals to Newcastle, yet sometimes such a
+thing really happens; and in the present case Captain Derick De Deer
+did indubitably conduct a lamp-feeder as Flask did declare.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 9</DOCNO>
+As he mounted the deck, Ahab abruptly accosted him, without at all
+heeding what he had in his hand; but in his broken lingo, the German
+soon evinced his complete ignorance of the White Whale; immediately
+turning the conversation to his lamp-feeder and oil can, with some
+remarks touching his having to turn into his hammock at night in
+profound darkness--his last drop of Bremen oil being gone, and not a
+single flying-fish yet captured to supply the deficiency; concluding
+by hinting that his ship was indeed what in the Fishery is
+technically called a CLEAN one (that is, an empty one), well
+deserving the name of Jungfrau or the Virgin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 10</DOCNO>
+His necessities supplied, Derick departed; but he had not gained his
+ship's side, when whales were almost simultaneously raised from the
+mast-heads of both vessels; and so eager for the chase was Derick,
+that without pausing to put his oil-can and lamp-feeder aboard, he
+slewed round his boat and made after the leviathan lamp-feeders.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 11</DOCNO>
+Now, the game having risen to leeward, he and the other three German
+boats that soon followed him, had considerably the start of the
+Pequod's keels.  There were eight whales, an average pod.  Aware of
+their danger, they were going all abreast with great speed straight
+before the wind, rubbing their flanks as closely as so many spans of
+horses in harness.  They left a great, wide wake, as though
+continually unrolling a great wide parchment upon the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 12</DOCNO>
+Full in this rapid wake, and many fathoms in the rear, swam a huge,
+humped old bull, which by his comparatively slow progress, as well as
+by the unusual yellowish incrustations overgrowing him, seemed
+afflicted with the jaundice, or some other infirmity.  Whether this
+whale belonged to the pod in advance, seemed questionable; for it is
+not customary for such venerable leviathans to be at all social.
+Nevertheless, he stuck to their wake, though indeed their back water
+must have retarded him, because the white-bone or swell at his broad
+muzzle was a dashed one, like the swell formed when two hostile
+currents meet.  His spout was short, slow, and laborious; coming
+forth with a choking sort of gush, and spending itself in torn
+shreds, followed by strange subterranean commotions in him, which
+seemed to have egress at his other buried extremity, causing the
+waters behind him to upbubble.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 13</DOCNO>
+"Who's got some paregoric?" said Stubb, "he has the stomach-ache, I'm
+afraid.  Lord, think of having half an acre of stomach-ache!  Adverse
+winds are holding mad Christmas in him, boys.  It's the first foul
+wind I ever knew to blow from astern; but look, did ever whale yaw
+so before? it must be, he's lost his tiller."
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 14</DOCNO>
+As an overladen Indiaman bearing down the Hindostan coast with a deck
+load of frightened horses, careens, buries, rolls, and wallows on her
+way; so did this old whale heave his aged bulk, and now and then
+partly turning over on his cumbrous rib-ends, expose the cause of his
+devious wake in the unnatural stump of his starboard fin.  Whether he
+had lost that fin in battle, or had been born without it, it were
+hard to say.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 15</DOCNO>
+"Only wait a bit, old chap, and I'll give ye a sling for that wounded
+arm," cried cruel Flask, pointing to the whale-line near him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 16</DOCNO>
+"Mind he don't sling thee with it," cried Starbuck.  "Give way, or
+the German will have him."
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 17</DOCNO>
+With one intent all the combined rival boats were pointed for this
+one fish, because not only was he the largest, and therefore the most
+valuable whale, but he was nearest to them, and the other whales were
+going with such great velocity, moreover, as almost to defy pursuit
+for the time.  At this juncture the Pequod's keels had shot by the
+three German boats last lowered; but from the great start he had had,
+Derick's boat still led the chase, though every moment neared by his
+foreign rivals.  The only thing they feared, was, that from being
+already so nigh to his mark, he would be enabled to dart his iron
+before they could completely overtake and pass him.  As for Derick,
+he seemed quite confident that this would be the case, and
+occasionally with a deriding gesture shook his lamp-feeder at the
+other boats.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 18</DOCNO>
+"The ungracious and ungrateful dog!" cried Starbuck; "he mocks and
+dares me with the very poor-box I filled for him not five minutes
+ago!"--then in his old intense whisper--"Give way, greyhounds!  Dog
+to it!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 19</DOCNO>
+"I tell ye what it is, men"--cried Stubb to his crew--"it's against
+my religion to get mad; but I'd like to eat that villainous
+Yarman--Pull--won't ye?  Are ye going to let that rascal beat ye?  Do
+ye love brandy?  A hogshead of brandy, then, to the best man.  Come,
+why don't some of ye burst a blood-vessel?  Who's that been dropping
+an anchor overboard--we don't budge an inch--we're becalmed.  Halloo,
+here's grass growing in the boat's bottom--and by the Lord, the mast
+there's budding.  This won't do, boys.  Look at that Yarman!  The
+short and long of it is, men, will ye spit fire or not?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 20</DOCNO>
+"Oh! see the suds he makes!" cried Flask, dancing up and down--"What
+a hump--Oh, DO pile on the beef--lays like a log!  Oh! my lads, DO
+spring--slap-jacks and quahogs for supper, you know, my lads--baked
+clams and muffins--oh, DO, DO, spring,--he's a hundred barreller--don't
+lose him now--don't oh, DON'T!--see that Yarman--Oh,
+won't ye pull for your duff, my lads--such a sog! such a sogger!
+Don't ye love sperm?  There goes three thousand dollars, men!--a
+bank!--a whole bank!  The bank of England!--Oh, DO, DO, DO!--What's
+that Yarman about now?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 21</DOCNO>
+At this moment Derick was in the act of pitching his lamp-feeder at
+the advancing boats, and also his oil-can; perhaps with the double
+view of retarding his rivals' way, and at the same time economically
+accelerating his own by the momentary impetus of the backward toss.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 22</DOCNO>
+"The unmannerly Dutch dogger!" cried Stubb.  "Pull now, men, like
+fifty thousand line-of-battle-ship loads of red-haired devils.  What
+d'ye say, Tashtego; are you the man to snap your spine in
+two-and-twenty pieces for the honour of old Gayhead?  What d'ye say?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 23</DOCNO>
+"I say, pull like god-dam,"--cried the Indian.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 24</DOCNO>
+Fiercely, but evenly incited by the taunts of the German, the
+Pequod's three boats now began ranging almost abreast; and, so
+disposed, momentarily neared him.  In that fine, loose, chivalrous
+attitude of the headsman when drawing near to his prey, the three
+mates stood up proudly, occasionally backing the after oarsman with
+an exhilarating cry of, "There she slides, now!  Hurrah for the
+white-ash breeze!  Down with the Yarman!  Sail over him!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 25</DOCNO>
+But so decided an original start had Derick had, that spite of all
+their gallantry, he would have proved the victor in this race, had
+not a righteous judgment descended upon him in a crab which caught
+the blade of his midship oarsman.  While this clumsy lubber was
+striving to free his white-ash, and while, in consequence, Derick's
+boat was nigh to capsizing, and he thundering away at his men in a
+mighty rage;--that was a good time for Starbuck, Stubb, and Flask.
+With a shout, they took a mortal start forwards, and slantingly
+ranged up on the German's quarter.  An instant more, and all four
+boats were diagonically in the whale's immediate wake, while
+stretching from them, on both sides, was the foaming swell that he
+made.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 26</DOCNO>
+It was a terrific, most pitiable, and maddening sight.  The whale was
+now going head out, and sending his spout before him in a continual
+tormented jet; while his one poor fin beat his side in an agony of
+fright.  Now to this hand, now to that, he yawed in his faltering
+flight, and still at every billow that he broke, he spasmodically
+sank in the sea, or sideways rolled towards the sky his one beating
+fin.  So have I seen a bird with clipped wing making affrighted
+broken circles in the air, vainly striving to escape the piratical
+hawks.  But the bird has a voice, and with plaintive cries will make
+known her fear; but the fear of this vast dumb brute of the sea, was
+chained up and enchanted in him; he had no voice, save that choking
+respiration through his spiracle, and this made the sight of him
+unspeakably pitiable; while still, in his amazing bulk, portcullis
+jaw, and omnipotent tail, there was enough to appal the stoutest man
+who so pitied.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 27</DOCNO>
+Seeing now that but a very few moments more would give the Pequod's
+boats the advantage, and rather than be thus foiled of his game,
+Derick chose to hazard what to him must have seemed a most unusually
+long dart, ere the last chance would for ever escape.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 28</DOCNO>
+But no sooner did his harpooneer stand up for the stroke, than all
+three tigers--Queequeg, Tashtego, Daggoo--instinctively sprang to
+their feet, and standing in a diagonal row, simultaneously pointed
+their barbs; and darted over the head of the German harpooneer, their
+three Nantucket irons entered the whale.  Blinding vapours of foam and
+white-fire!  The three boats, in the first fury of the whale's
+headlong rush, bumped the German's aside with such force, that both
+Derick and his baffled harpooneer were spilled out, and sailed over
+by the three flying keels.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 29</DOCNO>
+"Don't be afraid, my butter-boxes," cried Stubb, casting a passing
+glance upon them as he shot by; "ye'll be picked up presently--all
+right--I saw some sharks astern--St. Bernard's dogs, you
+know--relieve distressed travellers.  Hurrah! this is the way to sail
+now.  Every keel a sunbeam!  Hurrah!--Here we go like three tin
+kettles at the tail of a mad cougar!  This puts me in mind of
+fastening to an elephant in a tilbury on a plain--makes the
+wheel-spokes fly, boys, when you fasten to him that way; and there's
+danger of being pitched out too, when you strike a hill.  Hurrah!
+this is the way a fellow feels when he's going to Davy Jones--all a
+rush down an endless inclined plane!  Hurrah! this whale carries the
+everlasting mail!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 30</DOCNO>
+But the monster's run was a brief one.  Giving a sudden gasp, he
+tumultuously sounded.  With a grating rush, the three lines flew
+round the loggerheads with such a force as to gouge deep grooves in
+them; while so fearful were the harpooneers that this rapid sounding
+would soon exhaust the lines, that using all their dexterous might,
+they caught repeated smoking turns with the rope to hold on; till at
+last--owing to the perpendicular strain from the lead-lined chocks of
+the boats, whence the three ropes went straight down into the
+blue--the gunwales of the bows were almost even with the water, while
+the three sterns tilted high in the air.  And the whale soon ceasing
+to sound, for some time they remained in that attitude, fearful of
+expending more line, though the position was a little ticklish.  But
+though boats have been taken down and lost in this way, yet it is
+this "holding on," as it is called; this hooking up by the sharp
+barbs of his live flesh from the back; this it is that often torments
+the Leviathan into soon rising again to meet the sharp lance of his
+foes.  Yet not to speak of the peril of the thing, it is to be
+doubted whether this course is always the best; for it is but
+reasonable to presume, that the longer the stricken whale stays under
+water, the more he is exhausted.  Because, owing to the enormous
+surface of him--in a full grown sperm whale something less than 2000
+square feet--the pressure of the water is immense.  We all know what
+an astonishing atmospheric weight we ourselves stand up under; even
+here, above-ground, in the air; how vast, then, the burden of a
+whale, bearing on his back a column of two hundred fathoms of ocean!
+It must at least equal the weight of fifty atmospheres.  One whaleman
+has estimated it at the weight of twenty line-of-battle ships, with
+all their guns, and stores, and men on board.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 31</DOCNO>
+As the three boats lay there on that gently rolling sea, gazing down
+into its eternal blue noon; and as not a single groan or cry of any
+sort, nay, not so much as a ripple or a bubble came up from its
+depths; what landsman would have thought, that beneath all that
+silence and placidity, the utmost monster of the seas was writhing
+and wrenching in agony!  Not eight inches of perpendicular rope were
+visible at the bows.  Seems it credible that by three such thin
+threads the great Leviathan was suspended like the big weight to an
+eight day clock.  Suspended? and to what?  To three bits of board.
+Is this the creature of whom it was once so triumphantly said--"Canst
+thou fill his skin with barbed irons? or his head with fish-spears?
+The sword of him that layeth at him cannot hold, the spear, the dart,
+nor the habergeon: he esteemeth iron as straw; the arrow cannot make
+him flee; darts are counted as stubble; he laugheth at the shaking of
+a spear!"  This the creature? this he?  Oh! that unfulfilments should
+follow the prophets.  For with the strength of a thousand thighs in
+his tail, Leviathan had run his head under the mountains of the sea,
+to hide him from the Pequod's fish-spears!
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 32</DOCNO>
+In that sloping afternoon sunlight, the shadows that the three boats
+sent down beneath the surface, must have been long enough and broad
+enough to shade half Xerxes' army.  Who can tell how appalling to the
+wounded whale must have been such huge phantoms flitting over his
+head!
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 33</DOCNO>
+"Stand by, men; he stirs," cried Starbuck, as the three lines
+suddenly vibrated in the water, distinctly conducting upwards to
+them, as by magnetic wires, the life and death throbs of the whale,
+so that every oarsman felt them in his seat.  The next moment,
+relieved in great part from the downward strain at the bows, the
+boats gave a sudden bounce upwards, as a small icefield will, when a
+dense herd of white bears are scared from it into the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 34</DOCNO>
+"Haul in!  Haul in!" cried Starbuck again; "he's rising."
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 35</DOCNO>
+The lines, of which, hardly an instant before, not one hand's breadth
+could have been gained, were now in long quick coils flung back all
+dripping into the boats, and soon the whale broke water within two
+ship's lengths of the hunters.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 36</DOCNO>
+His motions plainly denoted his extreme exhaustion.  In most land
+animals there are certain valves or flood-gates in many of their
+veins, whereby when wounded, the blood is in some degree at least
+instantly shut off in certain directions.  Not so with the whale; one
+of whose peculiarities it is to have an entire non-valvular structure
+of the blood-vessels, so that when pierced even by so small a point
+as a harpoon, a deadly drain is at once begun upon his whole
+arterial system; and when this is heightened by the extraordinary
+pressure of water at a great distance below the surface, his life may
+be said to pour from him in incessant streams.  Yet so vast is the
+quantity of blood in him, and so distant and numerous its interior
+fountains, that he will keep thus bleeding and bleeding for a
+considerable period; even as in a drought a river will flow, whose
+source is in the well-springs of far-off and undiscernible hills.
+Even now, when the boats pulled upon this whale, and perilously drew
+over his swaying flukes, and the lances were darted into him, they
+were followed by steady jets from the new made wound, which kept
+continually playing, while the natural spout-hole in his head was
+only at intervals, however rapid, sending its affrighted moisture
+into the air.  From this last vent no blood yet came, because no
+vital part of him had thus far been struck.  His life, as they
+significantly call it, was untouched.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 37</DOCNO>
+As the boats now more closely surrounded him, the whole upper part of
+his form, with much of it that is ordinarily submerged, was plainly
+revealed.  His eyes, or rather the places where his eyes had been,
+were beheld.  As strange misgrown masses gather in the knot-holes of
+the noblest oaks when prostrate, so from the points which the whale's
+eyes had once occupied, now protruded blind bulbs, horribly pitiable
+to see.  But pity there was none.  For all his old age, and his one
+arm, and his blind eyes, he must die the death and be murdered, in
+order to light the gay bridals and other merry-makings of men, and
+also to illuminate the solemn churches that preach unconditional
+inoffensiveness by all to all.  Still rolling in his blood, at last
+he partially disclosed a strangely discoloured bunch or protuberance,
+the size of a bushel, low down on the flank.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 38</DOCNO>
+"A nice spot," cried Flask; "just let me prick him there once."
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 39</DOCNO>
+"Avast!" cried Starbuck, "there's no need of that!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 40</DOCNO>
+But humane Starbuck was too late.  At the instant of the dart an
+ulcerous jet shot from this cruel wound, and goaded by it into more
+than sufferable anguish, the whale now spouting thick blood, with
+swift fury blindly darted at the craft, bespattering them and their
+glorying crews all over with showers of gore, capsizing Flask's boat
+and marring the bows.  It was his death stroke.  For, by this time,
+so spent was he by loss of blood, that he helplessly rolled away from
+the wreck he had made; lay panting on his side, impotently flapped
+with his stumped fin, then over and over slowly revolved like a
+waning world; turned up the white secrets of his belly; lay like a
+log, and died.  It was most piteous, that last expiring spout.  As
+when by unseen hands the water is gradually drawn off from some
+mighty fountain, and with half-stifled melancholy gurglings the
+spray-column lowers and lowers to the ground--so the last long dying
+spout of the whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 41</DOCNO>
+Soon, while the crews were awaiting the arrival of the ship, the body
+showed symptoms of sinking with all its treasures unrifled.
+Immediately, by Starbuck's orders, lines were secured to it at
+different points, so that ere long every boat was a buoy; the sunken
+whale being suspended a few inches beneath them by the cords.  By
+very heedful management, when the ship drew nigh, the whale was
+transferred to her side, and was strongly secured there by the
+stiffest fluke-chains, for it was plain that unless artificially
+upheld, the body would at once sink to the bottom.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 42</DOCNO>
+It so chanced that almost upon first cutting into him with the
+spade, the entire length of a corroded harpoon was found imbedded in
+his flesh, on the lower part of the bunch before described.  But as
+the stumps of harpoons are frequently found in the dead bodies of
+captured whales, with the flesh perfectly healed around them, and no
+prominence of any kind to denote their place; therefore, there must
+needs have been some other unknown reason in the present case fully
+to account for the ulceration alluded to.  But still more curious was
+the fact of a lance-head of stone being found in him, not far from
+the buried iron, the flesh perfectly firm about it.  Who had darted
+that stone lance?  And when?  It might have been darted by some Nor'
+West Indian long before America was discovered.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 43</DOCNO>
+What other marvels might have been rummaged out of this monstrous
+cabinet there is no telling.  But a sudden stop was put to further
+discoveries, by the ship's being unprecedentedly dragged over
+sideways to the sea, owing to the body's immensely increasing
+tendency to sink.  However, Starbuck, who had the ordering of
+affairs, hung on to it to the last; hung on to it so resolutely,
+indeed, that when at length the ship would have been capsized, if
+still persisting in locking arms with the body; then, when the
+command was given to break clear from it, such was the immovable
+strain upon the timber-heads to which the fluke-chains and cables
+were fastened, that it was impossible to cast them off.  Meantime
+everything in the Pequod was aslant.  To cross to the other side of
+the deck was like walking up the steep gabled roof of a house.  The
+ship groaned and gasped.  Many of the ivory inlayings of her bulwarks
+and cabins were started from their places, by the unnatural
+dislocation.  In vain handspikes and crows were brought to bear upon
+the immovable fluke-chains, to pry them adrift from the timberheads;
+and so low had the whale now settled that the submerged ends could
+not be at all approached, while every moment whole tons of
+ponderosity seemed added to the sinking bulk, and the ship seemed on
+the point of going over.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 44</DOCNO>
+"Hold on, hold on, won't ye?" cried Stubb to the body, "don't be in
+such a devil of a hurry to sink!  By thunder, men, we must do
+something or go for it.  No use prying there; avast, I say with your
+handspikes, and run one of ye for a prayer book and a pen-knife, and
+cut the big chains."
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 45</DOCNO>
+"Knife?  Aye, aye," cried Queequeg, and seizing the carpenter's heavy
+hatchet, he leaned out of a porthole, and steel to iron, began
+slashing at the largest fluke-chains.  But a few strokes, full of
+sparks, were given, when the exceeding strain effected the rest.
+With a terrific snap, every fastening went adrift; the ship righted,
+the carcase sank.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 46</DOCNO>
+Now, this occasional inevitable sinking of the recently killed Sperm
+Whale is a very curious thing; nor has any fisherman yet adequately
+accounted for it.  Usually the dead Sperm Whale floats with great
+buoyancy, with its side or belly considerably elevated above the
+surface.  If the only whales that thus sank were old, meagre, and
+broken-hearted creatures, their pads of lard diminished and all their
+bones heavy and rheumatic; then you might with some reason assert
+that this sinking is caused by an uncommon specific gravity in the
+fish so sinking, consequent upon this absence of buoyant matter in
+him.  But it is not so.  For young whales, in the highest health, and
+swelling with noble aspirations, prematurely cut off in the warm
+flush and May of life, with all their panting lard about them; even
+these brawny, buoyant heroes do sometimes sink.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 47</DOCNO>
+Be it said, however, that the Sperm Whale is far less liable to this
+accident than any other species.  Where one of that sort go down,
+twenty Right Whales do.  This difference in the species is no doubt
+imputable in no small degree to the greater quantity of bone in the
+Right Whale; his Venetian blinds alone sometimes weighing more than a
+ton; from this incumbrance the Sperm Whale is wholly free.  But there
+are instances where, after the lapse of many hours or several days,
+the sunken whale again rises, more buoyant than in life.  But the
+reason of this is obvious.  Gases are generated in him; he swells to
+a prodigious magnitude; becomes a sort of animal balloon.  A
+line-of-battle ship could hardly keep him under then.  In the Shore
+Whaling, on soundings, among the Bays of New Zealand, when a Right
+Whale gives token of sinking, they fasten buoys to him, with plenty
+of rope; so that when the body has gone down, they know where to look
+for it when it shall have ascended again.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 48</DOCNO>
+It was not long after the sinking of the body that a cry was heard
+from the Pequod's mast-heads, announcing that the Jungfrau was again
+lowering her boats; though the only spout in sight was that of a
+Fin-Back, belonging to the species of uncapturable whales, because of
+its incredible power of swimming.  Nevertheless, the Fin-Back's spout
+is so similar to the Sperm Whale's, that by unskilful fishermen it is
+often mistaken for it.  And consequently Derick and all his host were
+now in valiant chase of this unnearable brute.  The Virgin crowding
+all sail, made after her four young keels, and thus they all
+disappeared far to leeward, still in bold, hopeful chase.
+</DOC>
+<DOC>
+<DOCNO>Chapter 81, Paragraph 49</DOCNO>
+Oh! many are the Fin-Backs, and many are the Dericks, my friend.
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 1</DOCNO>
+The Honour and Glory of Whaling.
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 2</DOCNO>
+There are some enterprises in which a careful disorderliness is the
+true method.
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 3</DOCNO>
+The more I dive into this matter of whaling, and push my researches
+up to the very spring-head of it so much the more am I impressed with
+its great honourableness and antiquity; and especially when I find so
+many great demi-gods and heroes, prophets of all sorts, who one way
+or other have shed distinction upon it, I am transported with the
+reflection that I myself belong, though but subordinately, to so
+emblazoned a fraternity.
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 4</DOCNO>
+The gallant Perseus, a son of Jupiter, was the first whaleman; and to
+the eternal honour of our calling be it said, that the first whale
+attacked by our brotherhood was not killed with any sordid intent.
+Those were the knightly days of our profession, when we only bore
+arms to succor the distressed, and not to fill men's lamp-feeders.
+Every one knows the fine story of Perseus and Andromeda; how the
+lovely Andromeda, the daughter of a king, was tied to a rock on the
+sea-coast, and as Leviathan was in the very act of carrying her off,
+Perseus, the prince of whalemen, intrepidly advancing, harpooned the
+monster, and delivered and married the maid.  It was an admirable
+artistic exploit, rarely achieved by the best harpooneers of the
+present day; inasmuch as this Leviathan was slain at the very first
+dart.  And let no man doubt this Arkite story; for in the ancient
+Joppa, now Jaffa, on the Syrian coast, in one of the Pagan temples,
+there stood for many ages the vast skeleton of a whale, which the
+city's legends and all the inhabitants asserted to be the identical
+bones of the monster that Perseus slew.  When the Romans took Joppa,
+the same skeleton was carried to Italy in triumph.  What seems most
+singular and suggestively important in this story, is this: it was
+from Joppa that Jonah set sail.
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 5</DOCNO>
+Akin to the adventure of Perseus and Andromeda--indeed, by some
+supposed to be indirectly derived from it--is that famous story of
+St. George and the Dragon; which dragon I maintain to have been a
+whale; for in many old chronicles whales and dragons are strangely
+jumbled together, and often stand for each other.  "Thou art as a
+lion of the waters, and as a dragon of the sea," saith Ezekiel;
+hereby, plainly meaning a whale; in truth, some versions of the Bible
+use that word itself.  Besides, it would much subtract from the glory
+of the exploit had St. George but encountered a crawling reptile of
+the land, instead of doing battle with the great monster of the deep.
+Any man may kill a snake, but only a Perseus, a St. George, a
+Coffin, have the heart in them to march boldly up to a whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 6</DOCNO>
+Let not the modern paintings of this scene mislead us; for though the
+creature encountered by that valiant whaleman of old is vaguely
+represented of a griffin-like shape, and though the battle is
+depicted on land and the saint on horseback, yet considering the
+great ignorance of those times, when the true form of the whale was
+unknown to artists; and considering that as in Perseus' case, St.
+George's whale might have crawled up out of the sea on the beach; and
+considering that the animal ridden by St. George might have been only
+a large seal, or sea-horse; bearing all this in mind, it will not
+appear altogether incompatible with the sacred legend and the
+ancientest draughts of the scene, to hold this so-called dragon no
+other than the great Leviathan himself.  In fact, placed before the
+strict and piercing truth, this whole story will fare like that fish,
+flesh, and fowl idol of the Philistines, Dagon by name; who being
+planted before the ark of Israel, his horse's head and both the palms
+of his hands fell off from him, and only the stump or fishy part of
+him remained.  Thus, then, one of our own noble stamp, even a
+whaleman, is the tutelary guardian of England; and by good rights, we
+harpooneers of Nantucket should be enrolled in the most noble order
+of St. George.  And therefore, let not the knights of that honourable
+company (none of whom, I venture to say, have ever had to do with a
+whale like their great patron), let them never eye a Nantucketer with
+disdain, since even in our woollen frocks and tarred trowsers we are
+much better entitled to St. George's decoration than they.
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 7</DOCNO>
+Whether to admit Hercules among us or not, concerning this I long
+remained dubious: for though according to the Greek mythologies, that
+antique Crockett and Kit Carson--that brawny doer of rejoicing good
+deeds, was swallowed down and thrown up by a whale; still, whether
+that strictly makes a whaleman of him, that might be mooted.  It
+nowhere appears that he ever actually harpooned his fish, unless,
+indeed, from the inside.  Nevertheless, he may be deemed a sort of
+involuntary whaleman; at any rate the whale caught him, if he did not
+the whale.  I claim him for one of our clan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 8</DOCNO>
+But, by the best contradictory authorities, this Grecian story of
+Hercules and the whale is considered to be derived from the still
+more ancient Hebrew story of Jonah and the whale; and vice versa;
+certainly they are very similar.  If I claim the demigod then, why
+not the prophet?
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 9</DOCNO>
+Nor do heroes, saints, demigods, and prophets alone comprise the
+whole roll of our order.  Our grand master is still to be named; for
+like royal kings of old times, we find the head waters of our
+fraternity in nothing short of the great gods themselves.  That
+wondrous oriental story is now to be rehearsed from the Shaster,
+which gives us the dread Vishnoo, one of the three persons in the
+godhead of the Hindoos; gives us this divine Vishnoo himself for our
+Lord;--Vishnoo, who, by the first of his ten earthly incarnations,
+has for ever set apart and sanctified the whale.  When Brahma, or the
+God of Gods, saith the Shaster, resolved to recreate the world after
+one of its periodical dissolutions, he gave birth to Vishnoo, to
+preside over the work; but the Vedas, or mystical books, whose
+perusal would seem to have been indispensable to Vishnoo before
+beginning the creation, and which therefore must have contained
+something in the shape of practical hints to young architects, these
+Vedas were lying at the bottom of the waters; so Vishnoo became
+incarnate in a whale, and sounding down in him to the uttermost
+depths, rescued the sacred volumes.  Was not this Vishnoo a whaleman,
+then? even as a man who rides a horse is called a horseman?
+</DOC>
+<DOC>
+<DOCNO>Chapter 82, Paragraph 10</DOCNO>
+Perseus, St. George, Hercules, Jonah, and Vishnoo! there's a
+member-roll for you!  What club but the whaleman's can head off like
+that?
+</DOC>
+<DOC>
+<DOCNO>Chapter 83, Paragraph 1</DOCNO>
+Jonah Historically Regarded.
+</DOC>
+<DOC>
+<DOCNO>Chapter 83, Paragraph 2</DOCNO>
+Reference was made to the historical story of Jonah and the whale in
+the preceding chapter.  Now some Nantucketers rather distrust this
+historical story of Jonah and the whale.  But then there were some
+sceptical Greeks and Romans, who, standing out from the orthodox
+pagans of their times, equally doubted the story of Hercules and the
+whale, and Arion and the dolphin; and yet their doubting those
+traditions did not make those traditions one whit the less facts, for
+all that.
+</DOC>
+<DOC>
+<DOCNO>Chapter 83, Paragraph 3</DOCNO>
+One old Sag-Harbor whaleman's chief reason for questioning the Hebrew
+story was this:--He had one of those quaint old-fashioned Bibles,
+embellished with curious, unscientific plates; one of which
+represented Jonah's whale with two spouts in his head--a peculiarity
+only true with respect to a species of the Leviathan (the Right
+Whale, and the varieties of that order), concerning which the
+fishermen have this saying, "A penny roll would choke him"; his
+swallow is so very small.  But, to this, Bishop Jebb's anticipative
+answer is ready.  It is not necessary, hints the Bishop, that we
+consider Jonah as tombed in the whale's belly, but as temporarily
+lodged in some part of his mouth.  And this seems reasonable enough
+in the good Bishop.  For truly, the Right Whale's mouth would
+accommodate a couple of whist-tables, and comfortably seat all the
+players.  Possibly, too, Jonah might have ensconced himself in a
+hollow tooth; but, on second thoughts, the Right Whale is toothless.
+</DOC>
+<DOC>
+<DOCNO>Chapter 83, Paragraph 4</DOCNO>
+Another reason which Sag-Harbor (he went by that name) urged for his
+want of faith in this matter of the prophet, was something obscurely
+in reference to his incarcerated body and the whale's gastric juices.
+But this objection likewise falls to the ground, because a German
+exegetist supposes that Jonah must have taken refuge in the floating
+body of a DEAD whale--even as the French soldiers in the Russian
+campaign turned their dead horses into tents, and crawled into them.
+Besides, it has been divined by other continental commentators, that
+when Jonah was thrown overboard from the Joppa ship, he straightway
+effected his escape to another vessel near by, some vessel with a
+whale for a figure-head; and, I would add, possibly called "The
+Whale," as some craft are nowadays christened the "Shark," the
+"Gull," the "Eagle."  Nor have there been wanting learned exegetists
+who have opined that the whale mentioned in the book of Jonah merely
+meant a life-preserver--an inflated bag of wind--which the endangered
+prophet swam to, and so was saved from a watery doom.  Poor
+Sag-Harbor, therefore, seems worsted all round.  But he had still
+another reason for his want of faith.  It was this, if I remember
+right: Jonah was swallowed by the whale in the Mediterranean Sea, and
+after three days he was vomited up somewhere within three days'
+journey of Nineveh, a city on the Tigris, very much more than three
+days' journey across from the nearest point of the Mediterranean
+coast.  How is that?
+</DOC>
+<DOC>
+<DOCNO>Chapter 83, Paragraph 5</DOCNO>
+But was there no other way for the whale to land the prophet within
+that short distance of Nineveh?  Yes.  He might have carried him
+round by the way of the Cape of Good Hope.  But not to speak of the
+passage through the whole length of the Mediterranean, and another
+passage up the Persian Gulf and Red Sea, such a supposition would
+involve the complete circumnavigation of all Africa in three days,
+not to speak of the Tigris waters, near the site of Nineveh, being
+too shallow for any whale to swim in.  Besides, this idea of Jonah's
+weathering the Cape of Good Hope at so early a day would wrest the
+honour of the discovery of that great headland from Bartholomew Diaz,
+its reputed discoverer, and so make modern history a liar.
+</DOC>
+<DOC>
+<DOCNO>Chapter 83, Paragraph 6</DOCNO>
+But all these foolish arguments of old Sag-Harbor only evinced his
+foolish pride of reason--a thing still more reprehensible in him,
+seeing that he had but little learning except what he had picked up
+from the sun and the sea.  I say it only shows his foolish, impious
+pride, and abominable, devilish rebellion against the reverend
+clergy.  For by a Portuguese Catholic priest, this very idea of
+Jonah's going to Nineveh via the Cape of Good Hope was advanced as a
+signal magnification of the general miracle.  And so it was.
+Besides, to this day, the highly enlightened Turks devoutly believe
+in the historical story of Jonah.  And some three centuries ago, an
+English traveller in old Harris's Voyages, speaks of a Turkish Mosque
+built in honour of Jonah, in which Mosque was a miraculous lamp that
+burnt without any oil.
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 1</DOCNO>
+Pitchpoling.
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 2</DOCNO>
+To make them run easily and swiftly, the axles of carriages are
+anointed; and for much the same purpose, some whalers perform an
+analogous operation upon their boat; they grease the bottom.  Nor is
+it to be doubted that as such a procedure can do no harm, it may
+possibly be of no contemptible advantage; considering that oil and
+water are hostile; that oil is a sliding thing, and that the object
+in view is to make the boat slide bravely.  Queequeg believed
+strongly in anointing his boat, and one morning not long after the
+German ship Jungfrau disappeared, took more than customary pains in
+that occupation; crawling under its bottom, where it hung over the
+side, and rubbing in the unctuousness as though diligently seeking to
+insure a crop of hair from the craft's bald keel.  He seemed to be
+working in obedience to some particular presentiment.  Nor did it
+remain unwarranted by the event.
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 3</DOCNO>
+Towards noon whales were raised; but so soon as the ship sailed down
+to them, they turned and fled with swift precipitancy; a disordered
+flight, as of Cleopatra's barges from Actium.
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 4</DOCNO>
+Nevertheless, the boats pursued, and Stubb's was foremost.  By great
+exertion, Tashtego at last succeeded in planting one iron; but the
+stricken whale, without at all sounding, still continued his
+horizontal flight, with added fleetness.  Such unintermitted
+strainings upon the planted iron must sooner or later inevitably
+extract it.  It became imperative to lance the flying whale, or be
+content to lose him.  But to haul the boat up to his flank was
+impossible, he swam so fast and furious.  What then remained?
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 5</DOCNO>
+Of all the wondrous devices and dexterities, the sleights of hand and
+countless subtleties, to which the veteran whaleman is so often
+forced, none exceed that fine manoeuvre with the lance called
+pitchpoling.  Small sword, or broad sword, in all its exercises
+boasts nothing like it.  It is only indispensable with an inveterate
+running whale; its grand fact and feature is the wonderful distance
+to which the long lance is accurately darted from a violently
+rocking, jerking boat, under extreme headway.  Steel and wood
+included, the entire spear is some ten or twelve feet in length; the
+staff is much slighter than that of the harpoon, and also of a
+lighter material--pine.  It is furnished with a small rope called a
+warp, of considerable length, by which it can be hauled back to the
+hand after darting.
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 6</DOCNO>
+But before going further, it is important to mention here, that
+though the harpoon may be pitchpoled in the same way with the lance,
+yet it is seldom done; and when done, is still less frequently
+successful, on account of the greater weight and inferior length of
+the harpoon as compared with the lance, which in effect become
+serious drawbacks.  As a general thing, therefore, you must first
+get fast to a whale, before any pitchpoling comes into play.
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 7</DOCNO>
+Look now at Stubb; a man who from his humorous, deliberate coolness
+and equanimity in the direst emergencies, was specially qualified to
+excel in pitchpoling.  Look at him; he stands upright in the tossed
+bow of the flying boat; wrapt in fleecy foam, the towing whale is
+forty feet ahead.  Handling the long lance lightly, glancing twice or
+thrice along its length to see if it be exactly straight, Stubb
+whistlingly gathers up the coil of the warp in one hand, so as to
+secure its free end in his grasp, leaving the rest unobstructed.
+Then holding the lance full before his waistband's middle, he levels
+it at the whale; when, covering him with it, he steadily depresses
+the butt-end in his hand, thereby elevating the point till the weapon
+stands fairly balanced upon his palm, fifteen feet in the air.  He
+minds you somewhat of a juggler, balancing a long staff on his chin.
+Next moment with a rapid, nameless impulse, in a superb lofty arch the
+bright steel spans the foaming distance, and quivers in the life spot
+of the whale.  Instead of sparkling water, he now spouts red blood.
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 8</DOCNO>
+"That drove the spigot out of him!" cried Stubb.  "'Tis July's
+immortal Fourth; all fountains must run wine today!  Would now, it
+were old Orleans whiskey, or old Ohio, or unspeakable old
+Monongahela!  Then, Tashtego, lad, I'd have ye hold a canakin to the
+jet, and we'd drink round it!  Yea, verily, hearts alive, we'd brew
+choice punch in the spread of his spout-hole there, and from that
+live punch-bowl quaff the living stuff."
+</DOC>
+<DOC>
+<DOCNO>Chapter 84, Paragraph 9</DOCNO>
+Again and again to such gamesome talk, the dexterous dart is
+repeated, the spear returning to its master like a greyhound held in
+skilful leash.  The agonized whale goes into his flurry; the tow-line
+is slackened, and the pitchpoler dropping astern, folds his hands,
+and mutely watches the monster die.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 1</DOCNO>
+The Fountain.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 2</DOCNO>
+That for six thousand years--and no one knows how many millions of
+ages before--the great whales should have been spouting all over the
+sea, and sprinkling and mistifying the gardens of the deep, as with
+so many sprinkling or mistifying pots; and that for some centuries
+back, thousands of hunters should have been close by the fountain of
+the whale, watching these sprinklings and spoutings--that all this
+should be, and yet, that down to this blessed minute (fifteen and a
+quarter minutes past one o'clock P.M. of this sixteenth day of
+December, A.D. 1851), it should still remain a problem, whether these
+spoutings are, after all, really water, or nothing but vapour--this is
+surely a noteworthy thing.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 3</DOCNO>
+Let us, then, look at this matter, along with some interesting items
+contingent.  Every one knows that by the peculiar cunning of their
+gills, the finny tribes in general breathe the air which at all times
+is combined with the element in which they swim; hence, a herring or
+a cod might live a century, and never once raise its head above the
+surface.  But owing to his marked internal structure which gives him
+regular lungs, like a human being's, the whale can only live by
+inhaling the disengaged air in the open atmosphere.  Wherefore the
+necessity for his periodical visits to the upper world.  But he
+cannot in any degree breathe through his mouth, for, in his ordinary
+attitude, the Sperm Whale's mouth is buried at least eight feet
+beneath the surface; and what is still more, his windpipe has no
+connexion with his mouth.  No, he breathes through his spiracle
+alone; and this is on the top of his head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 4</DOCNO>
+If I say, that in any creature breathing is only a function
+indispensable to vitality, inasmuch as it withdraws from the air a
+certain element, which being subsequently brought into contact with
+the blood imparts to the blood its vivifying principle, I do not
+think I shall err; though I may possibly use some superfluous
+scientific words.  Assume it, and it follows that if all the blood in
+a man could be aerated with one breath, he might then seal up his
+nostrils and not fetch another for a considerable time.  That is to
+say, he would then live without breathing.  Anomalous as it may seem,
+this is precisely the case with the whale, who systematically lives,
+by intervals, his full hour and more (when at the bottom) without
+drawing a single breath, or so much as in any way inhaling a particle
+of air; for, remember, he has no gills.  How is this?  Between his
+ribs and on each side of his spine he is supplied with a remarkable
+involved Cretan labyrinth of vermicelli-like vessels, which vessels,
+when he quits the surface, are completely distended with oxygenated
+blood.  So that for an hour or more, a thousand fathoms in the sea,
+he carries a surplus stock of vitality in him, just as the camel
+crossing the waterless desert carries a surplus supply of drink for
+future use in its four supplementary stomachs.  The anatomical fact
+of this labyrinth is indisputable; and that the supposition founded
+upon it is reasonable and true, seems the more cogent to me, when I
+consider the otherwise inexplicable obstinacy of that leviathan in
+HAVING HIS SPOUTINGS OUT, as the fishermen phrase it.  This is what I
+mean.  If unmolested, upon rising to the surface, the Sperm Whale
+will continue there for a period of time exactly uniform with all his
+other unmolested risings.  Say he stays eleven minutes, and jets
+seventy times, that is, respires seventy breaths; then whenever he
+rises again, he will be sure to have his seventy breaths over again,
+to a minute.  Now, if after he fetches a few breaths you alarm him,
+so that he sounds, he will be always dodging up again to make good
+his regular allowance of air.  And not till those seventy breaths are
+told, will he finally go down to stay out his full term below.
+Remark, however, that in different individuals these rates are
+different; but in any one they are alike.  Now, why should the whale
+thus insist upon having his spoutings out, unless it be to replenish
+his reservoir of air, ere descending for good?  How obvious is it,
+too, that this necessity for the whale's rising exposes him to all
+the fatal hazards of the chase.  For not by hook or by net could
+this vast leviathan be caught, when sailing a thousand fathoms
+beneath the sunlight.  Not so much thy skill, then, O hunter, as the
+great necessities that strike the victory to thee!
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 5</DOCNO>
+In man, breathing is incessantly going on--one breath only serving
+for two or three pulsations; so that whatever other business he has
+to attend to, waking or sleeping, breathe he must, or die he will.
+But the Sperm Whale only breathes about one seventh or Sunday of his
+time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 6</DOCNO>
+It has been said that the whale only breathes through his spout-hole;
+if it could truthfully be added that his spouts are mixed with water,
+then I opine we should be furnished with the reason why his sense of
+smell seems obliterated in him; for the only thing about him that at
+all answers to his nose is that identical spout-hole; and being so
+clogged with two elements, it could not be expected to have the power
+of smelling.  But owing to the mystery of the spout--whether it be
+water or whether it be vapour--no absolute certainty can as yet be
+arrived at on this head.  Sure it is, nevertheless, that the Sperm
+Whale has no proper olfactories.  But what does he want of them?  No
+roses, no violets, no Cologne-water in the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 7</DOCNO>
+Furthermore, as his windpipe solely opens into the tube of his
+spouting canal, and as that long canal--like the grand Erie Canal--is
+furnished with a sort of locks (that open and shut) for the downward
+retention of air or the upward exclusion of water, therefore the
+whale has no voice; unless you insult him by saying, that when he so
+strangely rumbles, he talks through his nose.  But then again, what
+has the whale to say?  Seldom have I known any profound being that
+had anything to say to this world, unless forced to stammer out
+something by way of getting a living.  Oh! happy that the world is
+such an excellent listener!
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 8</DOCNO>
+Now, the spouting canal of the Sperm Whale, chiefly intended as it is
+for the conveyance of air, and for several feet laid along,
+horizontally, just beneath the upper surface of his head, and a
+little to one side; this curious canal is very much like a gas-pipe
+laid down in a city on one side of a street.  But the question
+returns whether this gas-pipe is also a water-pipe; in other words,
+whether the spout of the Sperm Whale is the mere vapour of the exhaled
+breath, or whether that exhaled breath is mixed with water taken in
+at the mouth, and discharged through the spiracle.  It is certain
+that the mouth indirectly communicates with the spouting canal; but
+it cannot be proved that this is for the purpose of discharging water
+through the spiracle.  Because the greatest necessity for so doing
+would seem to be, when in feeding he accidentally takes in water.
+But the Sperm Whale's food is far beneath the surface, and there he
+cannot spout even if he would.  Besides, if you regard him very
+closely, and time him with your watch, you will find that when
+unmolested, there is an undeviating rhyme between the periods of his
+jets and the ordinary periods of respiration.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 9</DOCNO>
+But why pester one with all this reasoning on the subject?  Speak
+out!  You have seen him spout; then declare what the spout is; can
+you not tell water from air?  My dear sir, in this world it is not so
+easy to settle these plain things.  I have ever found your plain
+things the knottiest of all.  And as for this whale spout, you might
+almost stand in it, and yet be undecided as to what it is precisely.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 10</DOCNO>
+The central body of it is hidden in the snowy sparkling mist
+enveloping it; and how can you certainly tell whether any water falls
+from it, when, always, when you are close enough to a whale to get a
+close view of his spout, he is in a prodigious commotion, the water
+cascading all around him.  And if at such times you should think that
+you really perceived drops of moisture in the spout, how do you know
+that they are not merely condensed from its vapour; or how do you know
+that they are not those identical drops superficially lodged in the
+spout-hole fissure, which is countersunk into the summit of the
+whale's head?  For even when tranquilly swimming through the mid-day
+sea in a calm, with his elevated hump sun-dried as a dromedary's in
+the desert; even then, the whale always carries a small basin of
+water on his head, as under a blazing sun you will sometimes see a
+cavity in a rock filled up with rain.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 11</DOCNO>
+Nor is it at all prudent for the hunter to be over curious touching
+the precise nature of the whale spout.  It will not do for him to be
+peering into it, and putting his face in it.  You cannot go with your
+pitcher to this fountain and fill it, and bring it away.  For even
+when coming into slight contact with the outer, vapoury shreds of the
+jet, which will often happen, your skin will feverishly smart, from
+the acridness of the thing so touching it.  And I know one, who
+coming into still closer contact with the spout, whether with some
+scientific object in view, or otherwise, I cannot say, the skin
+peeled off from his cheek and arm.  Wherefore, among whalemen, the
+spout is deemed poisonous; they try to evade it.  Another thing; I
+have heard it said, and I do not much doubt it, that if the jet is
+fairly spouted into your eyes, it will blind you.  The wisest thing
+the investigator can do then, it seems to me, is to let this deadly
+spout alone.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 12</DOCNO>
+Still, we can hypothesize, even if we cannot prove and establish.  My
+hypothesis is this: that the spout is nothing but mist.  And besides
+other reasons, to this conclusion I am impelled, by considerations
+touching the great inherent dignity and sublimity of the Sperm Whale;
+I account him no common, shallow being, inasmuch as it is an
+undisputed fact that he is never found on soundings, or near shores;
+all other whales sometimes are.  He is both ponderous and profound.
+And I am convinced that from the heads of all ponderous profound
+beings, such as Plato, Pyrrho, the Devil, Jupiter, Dante, and so on,
+there always goes up a certain semi-visible steam, while in the act
+of thinking deep thoughts.  While composing a little treatise on
+Eternity, I had the curiosity to place a mirror before me; and ere
+long saw reflected there, a curious involved worming and undulation
+in the atmosphere over my head.  The invariable moisture of my hair,
+while plunged in deep thought, after six cups of hot tea in my thin
+shingled attic, of an August noon; this seems an additional argument
+for the above supposition.
+</DOC>
+<DOC>
+<DOCNO>Chapter 85, Paragraph 13</DOCNO>
+And how nobly it raises our conceit of the mighty, misty monster, to
+behold him solemnly sailing through a calm tropical sea; his vast,
+mild head overhung by a canopy of vapour, engendered by his
+incommunicable contemplations, and that vapour--as you will sometimes
+see it--glorified by a rainbow, as if Heaven itself had put its seal
+upon his thoughts.  For, d'ye see, rainbows do not visit the clear
+air; they only irradiate vapour.  And so, through all the thick mists
+of the dim doubts in my mind, divine intuitions now and then shoot,
+enkindling my fog with a heavenly ray.  And for this I thank God; for
+all have doubts; many deny; but doubts or denials, few along with
+them, have intuitions.  Doubts of all things earthly, and intuitions
+of some things heavenly; this combination makes neither believer nor
+infidel, but makes a man who regards them both with equal eye.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 1</DOCNO>
+The Tail.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 2</DOCNO>
+Other poets have warbled the praises of the soft eye of the antelope,
+and the lovely plumage of the bird that never alights; less
+celestial, I celebrate a tail.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 3</DOCNO>
+Reckoning the largest sized Sperm Whale's tail to begin at that point
+of the trunk where it tapers to about the girth of a man, it
+comprises upon its upper surface alone, an area of at least fifty
+square feet.  The compact round body of its root expands into two
+broad, firm, flat palms or flukes, gradually shoaling away to less
+than an inch in thickness.  At the crotch or junction, these flukes
+slightly overlap, then sideways recede from each other like wings,
+leaving a wide vacancy between.  In no living thing are the lines of
+beauty more exquisitely defined than in the crescentic borders of
+these flukes.  At its utmost expansion in the full grown whale, the
+tail will considerably exceed twenty feet across.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 4</DOCNO>
+The entire member seems a dense webbed bed of welded sinews; but cut
+into it, and you find that three distinct strata compose it:--upper,
+middle, and lower.  The fibres in the upper and lower layers, are
+long and horizontal; those of the middle one, very short, and running
+crosswise between the outside layers.  This triune structure, as much
+as anything else, imparts power to the tail.  To the student of old
+Roman walls, the middle layer will furnish a curious parallel to the
+thin course of tiles always alternating with the stone in those
+wonderful relics of the antique, and which undoubtedly contribute so
+much to the great strength of the masonry.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 5</DOCNO>
+But as if this vast local power in the tendinous tail were not
+enough, the whole bulk of the leviathan is knit over with a warp and
+woof of muscular fibres and filaments, which passing on either side
+the loins and running down into the flukes, insensibly blend with
+them, and largely contribute to their might; so that in the tail the
+confluent measureless force of the whole whale seems concentrated to
+a point.  Could annihilation occur to matter, this were the thing to
+do it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 6</DOCNO>
+Nor does this--its amazing strength, at all tend to cripple the
+graceful flexion of its motions; where infantileness of ease
+undulates through a Titanism of power.  On the contrary, those
+motions derive their most appalling beauty from it.  Real strength
+never impairs beauty or harmony, but it often bestows it; and in
+everything imposingly beautiful, strength has much to do with the
+magic.  Take away the tied tendons that all over seem bursting from
+the marble in the carved Hercules, and its charm would be gone.  As
+devout Eckerman lifted the linen sheet from the naked corpse of
+Goethe, he was overwhelmed with the massive chest of the man, that
+seemed as a Roman triumphal arch.  When Angelo paints even God the
+Father in human form, mark what robustness is there.  And whatever
+they may reveal of the divine love in the Son, the soft, curled,
+hermaphroditical Italian pictures, in which his idea has been most
+successfully embodied; these pictures, so destitute as they are of
+all brawniness, hint nothing of any power, but the mere negative,
+feminine one of submission and endurance, which on all hands it is
+conceded, form the peculiar practical virtues of his teachings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 7</DOCNO>
+Such is the subtle elasticity of the organ I treat of, that whether
+wielded in sport, or in earnest, or in anger, whatever be the mood it
+be in, its flexions are invariably marked by exceeding grace.
+Therein no fairy's arm can transcend it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 8</DOCNO>
+Five great motions are peculiar to it.  First, when used as a fin for
+progression; Second, when used as a mace in battle; Third, in
+sweeping; Fourth, in lobtailing; Fifth, in peaking flukes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 9</DOCNO>
+First: Being horizontal in its position, the Leviathan's tail acts in
+a different manner from the tails of all other sea creatures.  It
+never wriggles.  In man or fish, wriggling is a sign of inferiority.
+To the whale, his tail is the sole means of propulsion.  Scroll-wise
+coiled forwards beneath the body, and then rapidly sprung backwards,
+it is this which gives that singular darting, leaping motion to the
+monster when furiously swimming.  His side-fins only serve to steer
+by.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 10</DOCNO>
+Second: It is a little significant, that while one sperm whale only
+fights another sperm whale with his head and jaw, nevertheless, in
+his conflicts with man, he chiefly and contemptuously uses his tail.
+In striking at a boat, he swiftly curves away his flukes from it, and
+the blow is only inflicted by the recoil.  If it be made in the
+unobstructed air, especially if it descend to its mark, the stroke is
+then simply irresistible.  No ribs of man or boat can withstand it.
+Your only salvation lies in eluding it; but if it comes sideways
+through the opposing water, then partly owing to the light buoyancy
+of the whale boat, and the elasticity of its materials, a cracked
+rib or a dashed plank or two, a sort of stitch in the side, is
+generally the most serious result.  These submerged side blows are so
+often received in the fishery, that they are accounted mere child's
+play.  Some one strips off a frock, and the hole is stopped.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 11</DOCNO>
+Third: I cannot demonstrate it, but it seems to me, that in the whale
+the sense of touch is concentrated in the tail; for in this respect
+there is a delicacy in it only equalled by the daintiness of the
+elephant's trunk.  This delicacy is chiefly evinced in the action of
+sweeping, when in maidenly gentleness the whale with a certain soft
+slowness moves his immense flukes from side to side upon the surface of
+the sea; and if he feel but a sailor's whisker, woe to that sailor,
+whiskers and all.  What tenderness there is in that preliminary
+touch!  Had this tail any prehensile power, I should straightway
+bethink me of Darmonodes' elephant that so frequented the
+flower-market, and with low salutations presented nosegays to
+damsels, and then caressed their zones.  On more accounts than one, a
+pity it is that the whale does not possess this prehensile virtue in
+his tail; for I have heard of yet another elephant, that when wounded
+in the fight, curved round his trunk and extracted the dart.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 12</DOCNO>
+Fourth: Stealing unawares upon the whale in the fancied security of
+the middle of solitary seas, you find him unbent from the vast
+corpulence of his dignity, and kitten-like, he plays on the ocean as
+if it were a hearth.  But still you see his power in his play.  The
+broad palms of his tail are flirted high into the air; then smiting
+the surface, the thunderous concussion resounds for miles.  You would
+almost think a great gun had been discharged; and if you noticed the
+light wreath of vapour from the spiracle at his other extremity, you
+would think that that was the smoke from the touch-hole.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 13</DOCNO>
+Fifth: As in the ordinary floating posture of the leviathan the
+flukes lie considerably below the level of his back, they are then
+completely out of sight beneath the surface; but when he is about to
+plunge into the deeps, his entire flukes with at least thirty feet of
+his body are tossed erect in the air, and so remain vibrating a
+moment, till they downwards shoot out of view.  Excepting the sublime
+BREACH--somewhere else to be described--this peaking of the whale's
+flukes is perhaps the grandest sight to be seen in all animated
+nature.  Out of the bottomless profundities the gigantic tail seems
+spasmodically snatching at the highest heaven.  So in dreams, have I
+seen majestic Satan thrusting forth his tormented colossal claw from
+the flame Baltic of Hell.  But in gazing at such scenes, it is all in
+all what mood you are in; if in the Dantean, the devils will occur to
+you; if in that of Isaiah, the archangels.  Standing at the mast-head
+of my ship during a sunrise that crimsoned sky and sea, I once saw a
+large herd of whales in the east, all heading towards the sun, and
+for a moment vibrating in concert with peaked flukes.  As it seemed
+to me at the time, such a grand embodiment of adoration of the gods
+was never beheld, even in Persia, the home of the fire worshippers.
+As Ptolemy Philopater testified of the African elephant, I then
+testified of the whale, pronouncing him the most devout of all
+beings.  For according to King Juba, the military elephants of
+antiquity often hailed the morning with their trunks uplifted in the
+profoundest silence.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 14</DOCNO>
+The chance comparison in this chapter, between the whale and the
+elephant, so far as some aspects of the tail of the one and the trunk
+of the other are concerned, should not tend to place those two
+opposite organs on an equality, much less the creatures to which they
+respectively belong.  For as the mightiest elephant is but a terrier
+to Leviathan, so, compared with Leviathan's tail, his trunk is but
+the stalk of a lily.  The most direful blow from the elephant's trunk
+were as the playful tap of a fan, compared with the measureless crush
+and crash of the sperm whale's ponderous flukes, which in repeated
+instances have one after the other hurled entire boats with all their
+oars and crews into the air, very much as an Indian juggler tosses
+his balls.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 15</DOCNO>
+*Though all comparison in the way of general bulk between the whale
+and the elephant is preposterous, inasmuch as in that particular the
+elephant stands in much the same respect to the whale that a dog does
+to the elephant; nevertheless, there are not wanting some points of
+curious similitude; among these is the spout.  It is well known that
+the elephant will often draw up water or dust in his trunk, and then
+elevating it, jet it forth in a stream.
+</DOC>
+<DOC>
+<DOCNO>Chapter 86, Paragraph 16</DOCNO>
+The more I consider this mighty tail, the more do I deplore my
+inability to express it.  At times there are gestures in it, which,
+though they would well grace the hand of man, remain wholly
+inexplicable.  In an extensive herd, so remarkable, occasionally, are
+these mystic gestures, that I have heard hunters who have declared
+them akin to Free-Mason signs and symbols; that the whale, indeed, by
+these methods intelligently conversed with the world.  Nor are there
+wanting other motions of the whale in his general body, full of
+strangeness, and unaccountable to his most experienced assailant.
+Dissect him how I may, then, I but go skin deep; I know him not,
+and never will.  But if I know not even the tail of this whale, how
+understand his head? much more, how comprehend his face, when face he
+has none?  Thou shalt see my back parts, my tail, he seems to say,
+but my face shall not be seen.  But I cannot completely make out his
+back parts; and hint what he will about his face, I say again he has
+no face.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 1</DOCNO>
+The Grand Armada.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 2</DOCNO>
+The long and narrow peninsula of Malacca, extending south-eastward
+from the territories of Birmah, forms the most southerly point of all
+Asia.  In a continuous line from that peninsula stretch the long
+islands of Sumatra, Java, Bally, and Timor; which, with many others,
+form a vast mole, or rampart, lengthwise connecting Asia with
+Australia, and dividing the long unbroken Indian ocean from the
+thickly studded oriental archipelagoes.  This rampart is pierced by
+several sally-ports for the convenience of ships and whales;
+conspicuous among which are the straits of Sunda and Malacca.  By the
+straits of Sunda, chiefly, vessels bound to China from the west,
+emerge into the China seas.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 3</DOCNO>
+Those narrow straits of Sunda divide Sumatra from Java; and standing
+midway in that vast rampart of islands, buttressed by that bold green
+promontory, known to seamen as Java Head; they not a little
+correspond to the central gateway opening into some vast walled
+empire: and considering the inexhaustible wealth of spices, and
+silks, and jewels, and gold, and ivory, with which the thousand
+islands of that oriental sea are enriched, it seems a significant
+provision of nature, that such treasures, by the very formation of
+the land, should at least bear the appearance, however ineffectual,
+of being guarded from the all-grasping western world.  The shores of
+the Straits of Sunda are unsupplied with those domineering fortresses
+which guard the entrances to the Mediterranean, the Baltic, and the
+Propontis.  Unlike the Danes, these Orientals do not demand the
+obsequious homage of lowered top-sails from the endless procession of
+ships before the wind, which for centuries past, by night and by day,
+have passed between the islands of Sumatra and Java, freighted with
+the costliest cargoes of the east.  But while they freely waive a
+ceremonial like this, they do by no means renounce their claim to
+more solid tribute.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 4</DOCNO>
+Time out of mind the piratical proas of the Malays, lurking among the
+low shaded coves and islets of Sumatra, have sallied out upon the
+vessels sailing through the straits, fiercely demanding tribute at
+the point of their spears.  Though by the repeated bloody
+chastisements they have received at the hands of European cruisers,
+the audacity of these corsairs has of late been somewhat repressed;
+yet, even at the present day, we occasionally hear of English and
+American vessels, which, in those waters, have been remorselessly
+boarded and pillaged.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 5</DOCNO>
+With a fair, fresh wind, the Pequod was now drawing nigh to these
+straits; Ahab purposing to pass through them into the Javan sea, and
+thence, cruising northwards, over waters known to be frequented here
+and there by the Sperm Whale, sweep inshore by the Philippine
+Islands, and gain the far coast of Japan, in time for the great
+whaling season there.  By these means, the circumnavigating Pequod
+would sweep almost all the known Sperm Whale cruising grounds of the
+world, previous to descending upon the Line in the Pacific; where
+Ahab, though everywhere else foiled in his pursuit, firmly counted
+upon giving battle to Moby Dick, in the sea he was most known to
+frequent; and at a season when he might most reasonably be presumed
+to be haunting it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 6</DOCNO>
+But how now? in this zoned quest, does Ahab touch no land? does his
+crew drink air?  Surely, he will stop for water.  Nay.  For a long
+time, now, the circus-running sun has raced within his fiery ring,
+and needs no sustenance but what's in himself.  So Ahab.  Mark this,
+too, in the whaler.  While other hulls are loaded down with alien
+stuff, to be transferred to foreign wharves; the world-wandering
+whale-ship carries no cargo but herself and crew, their weapons and
+their wants.  She has a whole lake's contents bottled in her ample
+hold.  She is ballasted with utilities; not altogether with unusable
+pig-lead and kentledge.  She carries years' water in her.  Clear old
+prime Nantucket water; which, when three years afloat, the
+Nantucketer, in the Pacific, prefers to drink before the brackish
+fluid, but yesterday rafted off in casks, from the Peruvian or Indian
+streams.  Hence it is, that, while other ships may have gone to China
+from New York, and back again, touching at a score of ports, the
+whale-ship, in all that interval, may not have sighted one grain of
+soil; her crew having seen no man but floating seamen like
+themselves.  So that did you carry them the news that another flood
+had come; they would only answer--"Well, boys, here's the ark!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 7</DOCNO>
+Now, as many Sperm Whales had been captured off the western coast of
+Java, in the near vicinity of the Straits of Sunda; indeed, as most
+of the ground, roundabout, was generally recognised by the fishermen
+as an excellent spot for cruising; therefore, as the Pequod gained
+more and more upon Java Head, the look-outs were repeatedly hailed,
+and admonished to keep wide awake.  But though the green palmy cliffs
+of the land soon loomed on the starboard bow, and with delighted
+nostrils the fresh cinnamon was snuffed in the air, yet not a single
+jet was descried.  Almost renouncing all thought of falling in with
+any game hereabouts, the ship had well nigh entered the straits, when
+the customary cheering cry was heard from aloft, and ere long a
+spectacle of singular magnificence saluted us.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 8</DOCNO>
+But here be it premised, that owing to the unwearied activity with
+which of late they have been hunted over all four oceans, the Sperm
+Whales, instead of almost invariably sailing in small detached
+companies, as in former times, are now frequently met with in
+extensive herds, sometimes embracing so great a multitude, that it
+would almost seem as if numerous nations of them had sworn solemn
+league and covenant for mutual assistance and protection.  To this
+aggregation of the Sperm Whale into such immense caravans, may be
+imputed the circumstance that even in the best cruising grounds, you
+may now sometimes sail for weeks and months together, without being
+greeted by a single spout; and then be suddenly saluted by what
+sometimes seems thousands on thousands.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 9</DOCNO>
+Broad on both bows, at the distance of some two or three miles, and
+forming a great semicircle, embracing one half of the level horizon,
+a continuous chain of whale-jets were up-playing and sparkling in the
+noon-day air.  Unlike the straight perpendicular twin-jets of the
+Right Whale, which, dividing at top, fall over in two branches, like
+the cleft drooping boughs of a willow, the single forward-slanting
+spout of the Sperm Whale presents a thick curled bush of white mist,
+continually rising and falling away to leeward.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 10</DOCNO>
+Seen from the Pequod's deck, then, as she would rise on a high hill
+of the sea, this host of vapoury spouts, individually curling up into
+the air, and beheld through a blending atmosphere of bluish haze,
+showed like the thousand cheerful chimneys of some dense metropolis,
+descried of a balmy autumnal morning, by some horseman on a height.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 11</DOCNO>
+As marching armies approaching an unfriendly defile in the mountains,
+accelerate their march, all eagerness to place that perilous passage
+in their rear, and once more expand in comparative security upon the
+plain; even so did this vast fleet of whales now seem hurrying
+forward through the straits; gradually contracting the wings of their
+semicircle, and swimming on, in one solid, but still crescentic
+centre.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 12</DOCNO>
+Crowding all sail the Pequod pressed after them; the harpooneers
+handling their weapons, and loudly cheering from the heads of their
+yet suspended boats.  If the wind only held, little doubt had they,
+that chased through these Straits of Sunda, the vast host would only
+deploy into the Oriental seas to witness the capture of not a few of
+their number.  And who could tell whether, in that congregated
+caravan, Moby Dick himself might not temporarily be swimming, like
+the worshipped white-elephant in the coronation procession of the
+Siamese!  So with stun-sail piled on stun-sail, we sailed along,
+driving these leviathans before us; when, of a sudden, the voice of
+Tashtego was heard, loudly directing attention to something in our
+wake.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 13</DOCNO>
+Corresponding to the crescent in our van, we beheld another in our
+rear.  It seemed formed of detached white vapours, rising and falling
+something like the spouts of the whales; only they did not so
+completely come and go; for they constantly hovered, without finally
+disappearing.  Levelling his glass at this sight, Ahab quickly
+revolved in his pivot-hole, crying, "Aloft there, and rig whips and
+buckets to wet the sails;--Malays, sir, and after us!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 14</DOCNO>
+As if too long lurking behind the headlands, till the Pequod should
+fairly have entered the straits, these rascally Asiatics were now in
+hot pursuit, to make up for their over-cautious delay.  But when the
+swift Pequod, with a fresh leading wind, was herself in hot chase;
+how very kind of these tawny philanthropists to assist in speeding
+her on to her own chosen pursuit,--mere riding-whips and rowels to
+her, that they were.  As with glass under arm, Ahab to-and-fro paced
+the deck; in his forward turn beholding the monsters he chased, and
+in the after one the bloodthirsty pirates chasing him; some such
+fancy as the above seemed his.  And when he glanced upon the green
+walls of the watery defile in which the ship was then sailing, and
+bethought him that through that gate lay the route to his vengeance,
+and beheld, how that through that same gate he was now both chasing
+and being chased to his deadly end; and not only that, but a herd of
+remorseless wild pirates and inhuman atheistical devils were
+infernally cheering him on with their curses;--when all these
+conceits had passed through his brain, Ahab's brow was left gaunt and
+ribbed, like the black sand beach after some stormy tide has been
+gnawing it, without being able to drag the firm thing from its place.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 15</DOCNO>
+But thoughts like these troubled very few of the reckless crew; and
+when, after steadily dropping and dropping the pirates astern, the
+Pequod at last shot by the vivid green Cockatoo Point on the Sumatra
+side, emerging at last upon the broad waters beyond; then, the
+harpooneers seemed more to grieve that the swift whales had been
+gaining upon the ship, than to rejoice that the ship had so
+victoriously gained upon the Malays.  But still driving on in the
+wake of the whales, at length they seemed abating their speed;
+gradually the ship neared them; and the wind now dying away, word was
+passed to spring to the boats.  But no sooner did the herd, by some
+presumed wonderful instinct of the Sperm Whale, become notified of
+the three keels that were after them,--though as yet a mile in their
+rear,--than they rallied again, and forming in close ranks and
+battalions, so that their spouts all looked like flashing lines of
+stacked bayonets, moved on with redoubled velocity.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 16</DOCNO>
+Stripped to our shirts and drawers, we sprang to the white-ash, and
+after several hours' pulling were almost disposed to renounce the
+chase, when a general pausing commotion among the whales gave
+animating token that they were now at last under the influence of
+that strange perplexity of inert irresolution, which, when the
+fishermen perceive it in the whale, they say he is gallied.  The
+compact martial columns in which they had been hitherto rapidly and
+steadily swimming, were now broken up in one measureless rout; and
+like King Porus' elephants in the Indian battle with Alexander, they
+seemed going mad with consternation.  In all directions expanding in
+vast irregular circles, and aimlessly swimming hither and thither, by
+their short thick spoutings, they plainly betrayed their distraction
+of panic.  This was still more strangely evinced by those of their
+number, who, completely paralysed as it were, helplessly floated like
+water-logged dismantled ships on the sea.  Had these Leviathans been
+but a flock of simple sheep, pursued over the pasture by three fierce
+wolves, they could not possibly have evinced such excessive dismay.
+But this occasional timidity is characteristic of almost all herding
+creatures.  Though banding together in tens of thousands, the
+lion-maned buffaloes of the West have fled before a solitary
+horseman.  Witness, too, all human beings, how when herded together
+in the sheepfold of a theatre's pit, they will, at the slightest
+alarm of fire, rush helter-skelter for the outlets, crowding,
+trampling, jamming, and remorselessly dashing each other to death.
+Best, therefore, withhold any amazement at the strangely gallied
+whales before us, for there is no folly of the beasts of the earth
+which is not infinitely outdone by the madness of men.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 17</DOCNO>
+Though many of the whales, as has been said, were in violent motion,
+yet it is to be observed that as a whole the herd neither advanced
+nor retreated, but collectively remained in one place.  As is
+customary in those cases, the boats at once separated, each making
+for some one lone whale on the outskirts of the shoal.  In about
+three minutes' time, Queequeg's harpoon was flung; the stricken fish
+darted blinding spray in our faces, and then running away with us like
+light, steered straight for the heart of the herd.  Though such a
+movement on the part of the whale struck under such circumstances, is
+in no wise unprecedented; and indeed is almost always more or less
+anticipated; yet does it present one of the more perilous
+vicissitudes of the fishery.  For as the swift monster drags you
+deeper and deeper into the frantic shoal, you bid adieu to
+circumspect life and only exist in a delirious throb.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 18</DOCNO>
+As, blind and deaf, the whale plunged forward, as if by sheer power
+of speed to rid himself of the iron leech that had fastened to him;
+as we thus tore a white gash in the sea, on all sides menaced as we
+flew, by the crazed creatures to and fro rushing about us; our beset
+boat was like a ship mobbed by ice-isles in a tempest, and striving
+to steer through their complicated channels and straits, knowing not at
+what moment it may be locked in and crushed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 19</DOCNO>
+But not a bit daunted, Queequeg steered us manfully; now sheering off
+from this monster directly across our route in advance; now edging
+away from that, whose colossal flukes were suspended overhead, while
+all the time, Starbuck stood up in the bows, lance in hand, pricking
+out of our way whatever whales he could reach by short darts, for
+there was no time to make long ones.  Nor were the oarsmen quite
+idle, though their wonted duty was now altogether dispensed with.
+They chiefly attended to the shouting part of the business.  "Out of
+the way, Commodore!" cried one, to a great dromedary that of a sudden
+rose bodily to the surface, and for an instant threatened to swamp
+us.  "Hard down with your tail, there!" cried a second to another,
+which, close to our gunwale, seemed calmly cooling himself with his
+own fan-like extremity.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 20</DOCNO>
+All whaleboats carry certain curious contrivances, originally
+invented by the Nantucket Indians, called druggs.  Two thick squares
+of wood of equal size are stoutly clenched together, so that they
+cross each other's grain at right angles; a line of considerable
+length is then attached to the middle of this block, and the other
+end of the line being looped, it can in a moment be fastened to a
+harpoon.  It is chiefly among gallied whales that this drugg is used.
+For then, more whales are close round you than you can possibly
+chase at one time.  But sperm whales are not every day encountered;
+while you may, then, you must kill all you can.  And if you cannot
+kill them all at once, you must wing them, so that they can be
+afterwards killed at your leisure.  Hence it is, that at times like
+these the drugg, comes into requisition.  Our boat was furnished with
+three of them.  The first and second were successfully darted, and we
+saw the whales staggeringly running off, fettered by the enormous
+sidelong resistance of the towing drugg.  They were cramped like
+malefactors with the chain and ball.  But upon flinging the third, in
+the act of tossing overboard the clumsy wooden block, it caught under
+one of the seats of the boat, and in an instant tore it out and
+carried it away, dropping the oarsman in the boat's bottom as the
+seat slid from under him.  On both sides the sea came in at the
+wounded planks, but we stuffed two or three drawers and shirts in,
+and so stopped the leaks for the time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 21</DOCNO>
+It had been next to impossible to dart these drugged-harpoons, were
+it not that as we advanced into the herd, our whale's way greatly
+diminished; moreover, that as we went still further and further from
+the circumference of commotion, the direful disorders seemed waning.
+So that when at last the jerking harpoon drew out, and the towing
+whale sideways vanished; then, with the tapering force of his parting
+momentum, we glided between two whales into the innermost heart of
+the shoal, as if from some mountain torrent we had slid into a serene
+valley lake.  Here the storms in the roaring glens between the
+outermost whales, were heard but not felt.  In this central expanse
+the sea presented that smooth satin-like surface, called a sleek,
+produced by the subtle moisture thrown off by the whale in his more
+quiet moods.  Yes, we were now in that enchanted calm which they say
+lurks at the heart of every commotion.  And still in the distracted
+distance we beheld the tumults of the outer concentric circles, and
+saw successive pods of whales, eight or ten in each, swiftly going
+round and round, like multiplied spans of horses in a ring; and so
+closely shoulder to shoulder, that a Titanic circus-rider might
+easily have over-arched the middle ones, and so have gone round on
+their backs.  Owing to the density of the crowd of reposing whales,
+more immediately surrounding the embayed axis of the herd, no
+possible chance of escape was at present afforded us.  We must watch
+for a breach in the living wall that hemmed us in; the wall that had
+only admitted us in order to shut us up.  Keeping at the centre of
+the lake, we were occasionally visited by small tame cows and calves;
+the women and children of this routed host.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 22</DOCNO>
+Now, inclusive of the occasional wide intervals between the revolving
+outer circles, and inclusive of the spaces between the various pods
+in any one of those circles, the entire area at this juncture,
+embraced by the whole multitude, must have contained at least two or
+three square miles.  At any rate--though indeed such a test at such a
+time might be deceptive--spoutings might be discovered from our low
+boat that seemed playing up almost from the rim of the horizon.  I
+mention this circumstance, because, as if the cows and calves had
+been purposely locked up in this innermost fold; and as if the wide
+extent of the herd had hitherto prevented them from learning the
+precise cause of its stopping; or, possibly, being so young,
+unsophisticated, and every way innocent and inexperienced; however it
+may have been, these smaller whales--now and then visiting our
+becalmed boat from the margin of the lake--evinced a wondrous
+fearlessness and confidence, or else a still becharmed panic which it
+was impossible not to marvel at.  Like household dogs they came
+snuffling round us, right up to our gunwales, and touching them; till
+it almost seemed that some spell had suddenly domesticated them.
+Queequeg patted their foreheads; Starbuck scratched their backs with
+his lance; but fearful of the consequences, for the time refrained
+from darting it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 23</DOCNO>
+But far beneath this wondrous world upon the surface, another and
+still stranger world met our eyes as we gazed over the side.  For,
+suspended in those watery vaults, floated the forms of the nursing
+mothers of the whales, and those that by their enormous girth seemed
+shortly to become mothers.  The lake, as I have hinted, was to a
+considerable depth exceedingly transparent; and as human infants
+while suckling will calmly and fixedly gaze away from the breast, as
+if leading two different lives at the time; and while yet drawing
+mortal nourishment, be still spiritually feasting upon some unearthly
+reminiscence;--even so did the young of these whales seem looking up
+towards us, but not at us, as if we were but a bit of Gulfweed in
+their new-born sight.  Floating on their sides, the mothers also
+seemed quietly eyeing us.  One of these little infants, that from
+certain queer tokens seemed hardly a day old, might have measured
+some fourteen feet in length, and some six feet in girth.  He was a
+little frisky; though as yet his body seemed scarce yet recovered
+from that irksome position it had so lately occupied in the maternal
+reticule; where, tail to head, and all ready for the final spring,
+the unborn whale lies bent like a Tartar's bow.  The delicate
+side-fins, and the palms of his flukes, still freshly retained the
+plaited crumpled appearance of a baby's ears newly arrived from
+foreign parts.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 24</DOCNO>
+"Line! line!" cried Queequeg, looking over the gunwale; "him fast!
+him fast!--Who line him!  Who struck?--Two whale; one big, one
+little!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 25</DOCNO>
+"What ails ye, man?" cried Starbuck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 26</DOCNO>
+"Look-e here," said Queequeg, pointing down.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 27</DOCNO>
+As when the stricken whale, that from the tub has reeled out hundreds
+of fathoms of rope; as, after deep sounding, he floats up again, and
+shows the slackened curling line buoyantly rising and spiralling
+towards the air; so now, Starbuck saw long coils of the umbilical
+cord of Madame Leviathan, by which the young cub seemed still
+tethered to its dam.  Not seldom in the rapid vicissitudes of the
+chase, this natural line, with the maternal end loose, becomes
+entangled with the hempen one, so that the cub is thereby trapped.
+Some of the subtlest secrets of the seas seemed divulged to us in
+this enchanted pond.  We saw young Leviathan amours in the deep.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 28</DOCNO>
+*The sperm whale, as with all other species of the Leviathan, but
+unlike most other fish, breeds indifferently at all seasons; after a
+gestation which may probably be set down at nine months, producing
+but one at a time; though in some few known instances giving birth to
+an Esau and Jacob:--a contingency provided for in suckling by two
+teats, curiously situated, one on each side of the anus; but the
+breasts themselves extend upwards from that.  When by chance these
+precious parts in a nursing whale are cut by the hunter's lance, the
+mother's pouring milk and blood rivallingly discolour the sea for
+rods.  The milk is very sweet and rich; it has been tasted by man; it
+might do well with strawberries.  When overflowing with mutual
+esteem, the whales salute MORE HOMINUM.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 29</DOCNO>
+And thus, though surrounded by circle upon circle of consternations
+and affrights, did these inscrutable creatures at the centre freely
+and fearlessly indulge in all peaceful concernments; yea, serenely
+revelled in dalliance and delight.  But even so, amid the tornadoed
+Atlantic of my being, do I myself still for ever centrally disport in
+mute calm; and while ponderous planets of unwaning woe revolve round
+me, deep down and deep inland there I still bathe me in eternal
+mildness of joy.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 30</DOCNO>
+Meanwhile, as we thus lay entranced, the occasional sudden frantic
+spectacles in the distance evinced the activity of the other boats,
+still engaged in drugging the whales on the frontier of the host; or
+possibly carrying on the war within the first circle, where abundance
+of room and some convenient retreats were afforded them.  But the
+sight of the enraged drugged whales now and then blindly darting to
+and fro across the circles, was nothing to what at last met our eyes.
+It is sometimes the custom when fast to a whale more than commonly
+powerful and alert, to seek to hamstring him, as it were, by
+sundering or maiming his gigantic tail-tendon.  It is done by darting
+a short-handled cutting-spade, to which is attached a rope for
+hauling it back again.  A whale wounded (as we afterwards learned) in
+this part, but not effectually, as it seemed, had broken away from
+the boat, carrying along with him half of the harpoon line; and in
+the extraordinary agony of the wound, he was now dashing among the
+revolving circles like the lone mounted desperado Arnold, at the
+battle of Saratoga, carrying dismay wherever he went.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 31</DOCNO>
+But agonizing as was the wound of this whale, and an appalling
+spectacle enough, any way; yet the peculiar horror with which he
+seemed to inspire the rest of the herd, was owing to a cause which at
+first the intervening distance obscured from us.  But at length we
+perceived that by one of the unimaginable accidents of the fishery,
+this whale had become entangled in the harpoon-line that he towed; he
+had also run away with the cutting-spade in him; and while the free
+end of the rope attached to that weapon, had permanently caught in
+the coils of the harpoon-line round his tail, the cutting-spade
+itself had worked loose from his flesh.  So that tormented to
+madness, he was now churning through the water, violently flailing
+with his flexible tail, and tossing the keen spade about him,
+wounding and murdering his own comrades.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 32</DOCNO>
+This terrific object seemed to recall the whole herd from their
+stationary fright.  First, the whales forming the margin of our lake
+began to crowd a little, and tumble against each other, as if lifted
+by half spent billows from afar; then the lake itself began faintly
+to heave and swell; the submarine bridal-chambers and nurseries
+vanished; in more and more contracting orbits the whales in the more
+central circles began to swim in thickening clusters.  Yes, the long
+calm was departing.  A low advancing hum was soon heard; and then
+like to the tumultuous masses of block-ice when the great river
+Hudson breaks up in Spring, the entire host of whales came tumbling
+upon their inner centre, as if to pile themselves up in one common
+mountain.  Instantly Starbuck and Queequeg changed places; Starbuck
+taking the stern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 33</DOCNO>
+"Oars!  Oars!" he intensely whispered, seizing the helm--"gripe your
+oars, and clutch your souls, now!  My God, men, stand by!  Shove him
+off, you Queequeg--the whale there!--prick him!--hit him!  Stand
+up--stand up, and stay so!  Spring, men--pull, men; never mind their
+backs--scrape them!--scrape away!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 34</DOCNO>
+The boat was now all but jammed between two vast black bulks, leaving
+a narrow Dardanelles between their long lengths.  But by desperate
+endeavor we at last shot into a temporary opening; then giving way
+rapidly, and at the same time earnestly watching for another outlet.
+After many similar hair-breadth escapes, we at last swiftly glided
+into what had just been one of the outer circles, but now crossed by
+random whales, all violently making for one centre.  This lucky
+salvation was cheaply purchased by the loss of Queequeg's hat, who,
+while standing in the bows to prick the fugitive whales, had his hat
+taken clean from his head by the air-eddy made by the sudden tossing
+of a pair of broad flukes close by.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 35</DOCNO>
+Riotous and disordered as the universal commotion now was, it soon
+resolved itself into what seemed a systematic movement; for having
+clumped together at last in one dense body, they then renewed their
+onward flight with augmented fleetness.  Further pursuit was useless;
+but the boats still lingered in their wake to pick up what drugged
+whales might be dropped astern, and likewise to secure one which
+Flask had killed and waifed.  The waif is a pennoned pole, two or
+three of which are carried by every boat; and which, when additional
+game is at hand, are inserted upright into the floating body of a
+dead whale, both to mark its place on the sea, and also as token of
+prior possession, should the boats of any other ship draw near.
+</DOC>
+<DOC>
+<DOCNO>Chapter 87, Paragraph 36</DOCNO>
+The result of this lowering was somewhat illustrative of that
+sagacious saying in the Fishery,--the more whales the less fish.  Of
+all the drugged whales only one was captured.  The rest contrived to
+escape for the time, but only to be taken, as will hereafter be seen,
+by some other craft than the Pequod.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 1</DOCNO>
+Schools and Schoolmasters.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 2</DOCNO>
+The previous chapter gave account of an immense body or herd of Sperm
+Whales, and there was also then given the probable cause inducing
+those vast aggregations.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 3</DOCNO>
+Now, though such great bodies are at times encountered, yet, as must
+have been seen, even at the present day, small detached bands are
+occasionally observed, embracing from twenty to fifty individuals
+each.  Such bands are known as schools.  They generally are of two
+sorts; those composed almost entirely of females, and those mustering
+none but young vigorous males, or bulls, as they are familiarly
+designated.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 4</DOCNO>
+In cavalier attendance upon the school of females, you invariably see
+a male of full grown magnitude, but not old; who, upon any alarm,
+evinces his gallantry by falling in the rear and covering the flight
+of his ladies.  In truth, this gentleman is a luxurious Ottoman,
+swimming about over the watery world, surroundingly accompanied by
+all the solaces and endearments of the harem.  The contrast between
+this Ottoman and his concubines is striking; because, while he is
+always of the largest leviathanic proportions, the ladies, even at
+full growth, are not more than one-third of the bulk of an
+average-sized male.  They are comparatively delicate, indeed; I dare
+say, not to exceed half a dozen yards round the waist.  Nevertheless,
+it cannot be denied, that upon the whole they are hereditarily
+entitled to EMBONPOINT.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 5</DOCNO>
+It is very curious to watch this harem and its lord in their indolent
+ramblings.  Like fashionables, they are for ever on the move in
+leisurely search of variety.  You meet them on the Line in time for
+the full flower of the Equatorial feeding season, having just
+returned, perhaps, from spending the summer in the Northern seas, and
+so cheating summer of all unpleasant weariness and warmth.  By the
+time they have lounged up and down the promenade of the Equator
+awhile, they start for the Oriental waters in anticipation of the
+cool season there, and so evade the other excessive temperature of
+the year.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 6</DOCNO>
+When serenely advancing on one of these journeys, if any strange
+suspicious sights are seen, my lord whale keeps a wary eye on his
+interesting family.  Should any unwarrantably pert young Leviathan
+coming that way, presume to draw confidentially close to one of the
+ladies, with what prodigious fury the Bashaw assails him, and chases
+him away!  High times, indeed, if unprincipled young rakes like him
+are to be permitted to invade the sanctity of domestic bliss; though
+do what the Bashaw will, he cannot keep the most notorious Lothario
+out of his bed; for, alas! all fish bed in common.  As ashore, the
+ladies often cause the most terrible duels among their rival
+admirers; just so with the whales, who sometimes come to deadly
+battle, and all for love.  They fence with their long lower jaws,
+sometimes locking them together, and so striving for the supremacy
+like elks that warringly interweave their antlers.  Not a few are
+captured having the deep scars of these encounters,--furrowed heads,
+broken teeth, scolloped fins; and in some instances, wrenched and
+dislocated mouths.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 7</DOCNO>
+But supposing the invader of domestic bliss to betake himself away at
+the first rush of the harem's lord, then is it very diverting to
+watch that lord.  Gently he insinuates his vast bulk among them again
+and revels there awhile, still in tantalizing vicinity to young
+Lothario, like pious Solomon devoutly worshipping among his thousand
+concubines.  Granting other whales to be in sight, the fishermen
+will seldom give chase to one of these Grand Turks; for these Grand
+Turks are too lavish of their strength, and hence their unctuousness
+is small.  As for the sons and the daughters they beget, why, those sons
+and daughters must take care of themselves; at least, with only the
+maternal help.  For like certain other omnivorous roving lovers that
+might be named, my Lord Whale has no taste for the nursery, however
+much for the bower; and so, being a great traveller, he leaves his
+anonymous babies all over the world; every baby an exotic.  In good
+time, nevertheless, as the ardour of youth declines; as years and
+dumps increase; as reflection lends her solemn pauses; in short, as a
+general lassitude overtakes the sated Turk; then a love of ease and
+virtue supplants the love for maidens; our Ottoman enters upon the
+impotent, repentant, admonitory stage of life, forswears, disbands
+the harem, and grown to an exemplary, sulky old soul, goes about all
+alone among the meridians and parallels saying his prayers, and
+warning each young Leviathan from his amorous errors.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 8</DOCNO>
+Now, as the harem of whales is called by the fishermen a school, so
+is the lord and master of that school technically known as the
+schoolmaster.  It is therefore not in strict character, however
+admirably satirical, that after going to school himself, he should
+then go abroad inculcating not what he learned there, but the folly
+of it.  His title, schoolmaster, would very naturally seem derived
+from the name bestowed upon the harem itself, but some have surmised
+that the man who first thus entitled this sort of Ottoman whale, must
+have read the memoirs of Vidocq, and informed himself what sort of a
+country-schoolmaster that famous Frenchman was in his younger days,
+and what was the nature of those occult lessons he inculcated into
+some of his pupils.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 9</DOCNO>
+The same secludedness and isolation to which the schoolmaster whale
+betakes himself in his advancing years, is true of all aged Sperm
+Whales.  Almost universally, a lone whale--as a solitary Leviathan is
+called--proves an ancient one.  Like venerable moss-bearded Daniel
+Boone, he will have no one near him but Nature herself; and her he
+takes to wife in the wilderness of waters, and the best of wives she
+is, though she keeps so many moody secrets.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 10</DOCNO>
+The schools composing none but young and vigorous males, previously
+mentioned, offer a strong contrast to the harem schools.  For while
+those female whales are characteristically timid, the young males, or
+forty-barrel-bulls, as they call them, are by far the most pugnacious
+of all Leviathans, and proverbially the most dangerous to encounter;
+excepting those wondrous grey-headed, grizzled whales, sometimes met,
+and these will fight you like grim fiends exasperated by a penal
+gout.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 11</DOCNO>
+The Forty-barrel-bull schools are larger than the harem schools.
+Like a mob of young collegians, they are full of fight, fun, and
+wickedness, tumbling round the world at such a reckless, rollicking
+rate, that no prudent underwriter would insure them any more than he
+would a riotous lad at Yale or Harvard.  They soon relinquish this
+turbulence though, and when about three-fourths grown, break up, and
+separately go about in quest of settlements, that is, harems.
+</DOC>
+<DOC>
+<DOCNO>Chapter 88, Paragraph 12</DOCNO>
+Another point of difference between the male and female schools is
+still more characteristic of the sexes.  Say you strike a
+Forty-barrel-bull--poor devil! all his comrades quit him.  But strike
+a member of the harem school, and her companions swim around her with
+every token of concern, sometimes lingering so near her and so long,
+as themselves to fall a prey.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 1</DOCNO>
+Fast-Fish and Loose-Fish.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 2</DOCNO>
+The allusion to the waif and waif-poles in the last chapter but one,
+necessitates some account of the laws and regulations of the whale
+fishery, of which the waif may be deemed the grand symbol and badge.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 3</DOCNO>
+It frequently happens that when several ships are cruising in
+company, a whale may be struck by one vessel, then escape, and be
+finally killed and captured by another vessel; and herein are
+indirectly comprised many minor contingencies, all partaking of this
+one grand feature.  For example,--after a weary and perilous chase
+and capture of a whale, the body may get loose from the ship by
+reason of a violent storm; and drifting far away to leeward, be
+retaken by a second whaler, who, in a calm, snugly tows it alongside,
+without risk of life or line.  Thus the most vexatious and violent
+disputes would often arise between the fishermen, were there not some
+written or unwritten, universal, undisputed law applicable to all
+cases.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 4</DOCNO>
+Perhaps the only formal whaling code authorized by legislative
+enactment, was that of Holland.  It was decreed by the States-General
+in A.D. 1695.  But though no other nation has ever had any written
+whaling law, yet the American fishermen have been their own
+legislators and lawyers in this matter.  They have provided a system
+which for terse comprehensiveness surpasses Justinian's Pandects and
+the By-laws of the Chinese Society for the Suppression of Meddling
+with other People's Business.  Yes; these laws might be engraven on a
+Queen Anne's forthing, or the barb of a harpoon, and worn round the
+neck, so small are they.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 5</DOCNO>
+I.  A Fast-Fish belongs to the party fast to it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 6</DOCNO>
+II.  A Loose-Fish is fair game for anybody who can soonest catch it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 7</DOCNO>
+But what plays the mischief with this masterly code is the admirable
+brevity of it, which necessitates a vast volume of commentaries to
+expound it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 8</DOCNO>
+First: What is a Fast-Fish?  Alive or dead a fish is technically
+fast, when it is connected with an occupied ship or boat, by any
+medium at all controllable by the occupant or occupants,--a mast, an
+oar, a nine-inch cable, a telegraph wire, or a strand of cobweb, it
+is all the same.  Likewise a fish is technically fast when it bears a
+waif, or any other recognised symbol of possession; so long as the
+party waifing it plainly evince their ability at any time to take it
+alongside, as well as their intention so to do.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 9</DOCNO>
+These are scientific commentaries; but the commentaries of the
+whalemen themselves sometimes consist in hard words and harder
+knocks--the Coke-upon-Littleton of the fist.  True, among the more
+upright and honourable whalemen allowances are always made for
+peculiar cases, where it would be an outrageous moral injustice for
+one party to claim possession of a whale previously chased or killed
+by another party.  But others are by no means so scrupulous.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 10</DOCNO>
+Some fifty years ago there was a curious case of whale-trover
+litigated in England, wherein the plaintiffs set forth that after a
+hard chase of a whale in the Northern seas; and when indeed they (the
+plaintiffs) had succeeded in harpooning the fish; they were at last,
+through peril of their lives, obliged to forsake not only their
+lines, but their boat itself.  Ultimately the defendants (the crew of
+another ship) came up with the whale, struck, killed, seized, and
+finally appropriated it before the very eyes of the plaintiffs.  And
+when those defendants were remonstrated with, their captain snapped
+his fingers in the plaintiffs' teeth, and assured them that by way of
+doxology to the deed he had done, he would now retain their line,
+harpoons, and boat, which had remained attached to the whale at the
+time of the seizure.  Wherefore the plaintiffs now sued for the
+recovery of the value of their whale, line, harpoons, and boat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 11</DOCNO>
+Mr. Erskine was counsel for the defendants; Lord Ellenborough was the
+judge.  In the course of the defence, the witty Erskine went on to
+illustrate his position, by alluding to a recent crim. con. case,
+wherein a gentleman, after in vain trying to bridle his wife's
+viciousness, had at last abandoned her upon the seas of life; but in
+the course of years, repenting of that step, he instituted an action
+to recover possession of her.  Erskine was on the other side; and he
+then supported it by saying, that though the gentleman had originally
+harpooned the lady, and had once had her fast, and only by reason of
+the great stress of her plunging viciousness, had at last abandoned
+her; yet abandon her he did, so that she became a loose-fish; and
+therefore when a subsequent gentleman re-harpooned her, the lady then
+became that subsequent gentleman's property, along with whatever
+harpoon might have been found sticking in her.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 12</DOCNO>
+Now in the present case Erskine contended that the examples of the
+whale and the lady were reciprocally illustrative of each other.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 13</DOCNO>
+These pleadings, and the counter pleadings, being duly heard, the
+very learned Judge in set terms decided, to wit,--That as for the
+boat, he awarded it to the plaintiffs, because they had merely
+abandoned it to save their lives; but that with regard to the
+controverted whale, harpoons, and line, they belonged to the
+defendants; the whale, because it was a Loose-Fish at the time of the
+final capture; and the harpoons and line because when the fish made
+off with them, it (the fish) acquired a property in those articles;
+and hence anybody who afterwards took the fish had a right to them.
+Now the defendants afterwards took the fish; ergo, the aforesaid
+articles were theirs.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 14</DOCNO>
+A common man looking at this decision of the very learned Judge,
+might possibly object to it.  But ploughed up to the primary rock of
+the matter, the two great principles laid down in the twin whaling
+laws previously quoted, and applied and elucidated by Lord
+Ellenborough in the above cited case; these two laws touching
+Fast-Fish and Loose-Fish, I say, will, on reflection, be found the
+fundamentals of all human jurisprudence; for notwithstanding its
+complicated tracery of sculpture, the Temple of the Law, like the
+Temple of the Philistines, has but two props to stand on.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 15</DOCNO>
+Is it not a saying in every one's mouth, Possession is half of the
+law: that is, regardless of how the thing came into possession?  But
+often possession is the whole of the law.  What are the sinews and
+souls of Russian serfs and Republican slaves but Fast-Fish, whereof
+possession is the whole of the law?  What to the rapacious landlord
+is the widow's last mite but a Fast-Fish?  What is yonder undetected
+villain's marble mansion with a door-plate for a waif; what is that
+but a Fast-Fish?  What is the ruinous discount which Mordecai, the
+broker, gets from poor Woebegone, the bankrupt, on a loan to
+keep Woebegone's family from starvation; what is that ruinous
+discount but a Fast-Fish?  What is the Archbishop of Savesoul's
+income of L100,000 seized from the scant bread and cheese of
+hundreds of thousands of broken-backed laborers (all sure of heaven
+without any of Savesoul's help) what is that globular L100,000 but a
+Fast-Fish?  What are the Duke of Dunder's hereditary towns and
+hamlets but Fast-Fish?  What to that redoubted harpooneer, John Bull,
+is poor Ireland, but a Fast-Fish?  What to that apostolic lancer,
+Brother Jonathan, is Texas but a Fast-Fish?  And concerning all
+these, is not Possession the whole of the law?
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 16</DOCNO>
+But if the doctrine of Fast-Fish be pretty generally applicable, the
+kindred doctrine of Loose-Fish is still more widely so.  That is
+internationally and universally applicable.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 17</DOCNO>
+What was America in 1492 but a Loose-Fish, in which Columbus struck
+the Spanish standard by way of waifing it for his royal master and
+mistress?  What was Poland to the Czar?  What Greece to the Turk?
+What India to England?  What at last will Mexico be to the United
+States?  All Loose-Fish.
+</DOC>
+<DOC>
+<DOCNO>Chapter 89, Paragraph 18</DOCNO>
+What are the Rights of Man and the Liberties of the World but
+Loose-Fish?  What all men's minds and opinions but Loose-Fish?  What
+is the principle of religious belief in them but a Loose-Fish?  What
+to the ostentatious smuggling verbalists are the thoughts of thinkers
+but Loose-Fish?  What is the great globe itself but a Loose-Fish?
+And what are you, reader, but a Loose-Fish and a Fast-Fish, too?
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 1</DOCNO>
+Heads or Tails.
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 2</DOCNO>
+"De balena vero sufficit, si rex habeat caput, et regina caudam."
+BRACTON, L. 3, C. 3.
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 3</DOCNO>
+Latin from the books of the Laws of England, which taken along with
+the context, means, that of all whales captured by anybody on the
+coast of that land, the King, as Honourary Grand Harpooneer, must have
+the head, and the Queen be respectfully presented with the tail.  A
+division which, in the whale, is much like halving an apple; there is
+no intermediate remainder.  Now as this law, under a modified form,
+is to this day in force in England; and as it offers in various
+respects a strange anomaly touching the general law of Fast and
+Loose-Fish, it is here treated of in a separate chapter, on the same
+courteous principle that prompts the English railways to be at the
+expense of a separate car, specially reserved for the accommodation
+of royalty.  In the first place, in curious proof of the fact that
+the above-mentioned law is still in force, I proceed to lay before
+you a circumstance that happened within the last two years.
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 4</DOCNO>
+It seems that some honest mariners of Dover, or Sandwich, or some one
+of the Cinque Ports, had after a hard chase succeeded in killing and
+beaching a fine whale which they had originally descried afar off
+from the shore.  Now the Cinque Ports are partially or somehow under
+the jurisdiction of a sort of policeman or beadle, called a Lord
+Warden.  Holding the office directly from the crown, I believe, all
+the royal emoluments incident to the Cinque Port territories become
+by assignment his.  By some writers this office is called a sinecure.
+But not so.  Because the Lord Warden is busily employed at times in
+fobbing his perquisites; which are his chiefly by virtue of that same
+fobbing of them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 5</DOCNO>
+Now when these poor sun-burnt mariners, bare-footed, and with their
+trowsers rolled high up on their eely legs, had wearily hauled their
+fat fish high and dry, promising themselves a good L150 from the
+precious oil and bone; and in fantasy sipping rare tea with their
+wives, and good ale with their cronies, upon the strength of their
+respective shares; up steps a very learned and most Christian and
+charitable gentleman, with a copy of Blackstone under his arm; and
+laying it upon the whale's head, he says--"Hands off! this fish, my
+masters, is a Fast-Fish.  I seize it as the Lord Warden's."  Upon
+this the poor mariners in their respectful consternation--so truly
+English--knowing not what to say, fall to vigorously scratching their
+heads all round; meanwhile ruefully glancing from the whale to the
+stranger.  But that did in nowise mend the matter, or at all soften
+the hard heart of the learned gentleman with the copy of Blackstone.
+At length one of them, after long scratching about for his ideas,
+made bold to speak,
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 6</DOCNO>
+"Please, sir, who is the Lord Warden?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 7</DOCNO>
+"The Duke."
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 8</DOCNO>
+"But the duke had nothing to do with taking this fish?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 9</DOCNO>
+"It is his."
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 10</DOCNO>
+"We have been at great trouble, and peril, and some expense, and is
+all that to go to the Duke's benefit; we getting nothing at all for
+our pains but our blisters?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 11</DOCNO>
+"It is his."
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 12</DOCNO>
+"Is the Duke so very poor as to be forced to this desperate mode of
+getting a livelihood?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 13</DOCNO>
+"It is his."
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 14</DOCNO>
+"I thought to relieve my old bed-ridden mother by part of my share of
+this whale."
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 15</DOCNO>
+"It is his."
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 16</DOCNO>
+"Won't the Duke be content with a quarter or a half?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 17</DOCNO>
+"It is his."
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 18</DOCNO>
+In a word, the whale was seized and sold, and his Grace the Duke of
+Wellington received the money.  Thinking that viewed in some
+particular lights, the case might by a bare possibility in some small
+degree be deemed, under the circumstances, a rather hard one, an
+honest clergyman of the town respectfully addressed a note to his
+Grace, begging him to take the case of those unfortunate mariners
+into full consideration.  To which my Lord Duke in substance replied
+(both letters were published) that he had already done so, and
+received the money, and would be obliged to the reverend gentleman if
+for the future he (the reverend gentleman) would decline meddling
+with other people's business.  Is this the still militant old man,
+standing at the corners of the three kingdoms, on all hands coercing
+alms of beggars?
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 19</DOCNO>
+It will readily be seen that in this case the alleged right of the
+Duke to the whale was a delegated one from the Sovereign.  We must
+needs inquire then on what principle the Sovereign is originally
+invested with that right.  The law itself has already been set forth.
+But Plowdon gives us the reason for it.  Says Plowdon, the whale so
+caught belongs to the King and Queen, "because of its superior
+excellence."  And by the soundest commentators this has ever been
+held a cogent argument in such matters.
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 20</DOCNO>
+But why should the King have the head, and the Queen the tail?  A
+reason for that, ye lawyers!
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 21</DOCNO>
+In his treatise on "Queen-Gold," or Queen-pinmoney, an old King's
+Bench author, one William Prynne, thus discourseth: "Ye tail is ye
+Queen's, that ye Queen's wardrobe may be supplied with ye whalebone."
+Now this was written at a time when the black limber bone of the
+Greenland or Right whale was largely used in ladies' bodices.  But
+this same bone is not in the tail; it is in the head, which is a sad
+mistake for a sagacious lawyer like Prynne.  But is the Queen a
+mermaid, to be presented with a tail?  An allegorical meaning may
+lurk here.
+</DOC>
+<DOC>
+<DOCNO>Chapter 90, Paragraph 22</DOCNO>
+There are two royal fish so styled by the English law writers--the
+whale and the sturgeon; both royal property under certain
+limitations, and nominally supplying the tenth branch of the crown's
+ordinary revenue.  I know not that any other author has hinted of the
+matter; but by inference it seems to me that the sturgeon must be
+divided in the same way as the whale, the King receiving the highly
+dense and elastic head peculiar to that fish, which, symbolically
+regarded, may possibly be humorously grounded upon some presumed
+congeniality.  And thus there seems a reason in all things, even in
+law.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 1</DOCNO>
+The Pequod Meets The Rose-Bud.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 2</DOCNO>
+"In vain it was to rake for Ambergriese in the paunch of this
+Leviathan, insufferable fetor denying not inquiry."
+SIR T. BROWNE, V.E.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 3</DOCNO>
+It was a week or two after the last whaling scene recounted, and when
+we were slowly sailing over a sleepy, vapoury, mid-day sea, that the
+many noses on the Pequod's deck proved more vigilant discoverers than
+the three pairs of eyes aloft.  A peculiar and not very pleasant
+smell was smelt in the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 4</DOCNO>
+"I will bet something now," said Stubb, "that somewhere hereabouts
+are some of those drugged whales we tickled the other day.  I thought
+they would keel up before long."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 5</DOCNO>
+Presently, the vapours in advance slid aside; and there in the
+distance lay a ship, whose furled sails betokened that some sort of
+whale must be alongside.  As we glided nearer, the stranger showed
+French colours from his peak; and by the eddying cloud of vulture
+sea-fowl that circled, and hovered, and swooped around him, it was
+plain that the whale alongside must be what the fishermen call a
+blasted whale, that is, a whale that has died unmolested on the sea,
+and so floated an unappropriated corpse.  It may well be conceived,
+what an unsavory odor such a mass must exhale; worse than an Assyrian
+city in the plague, when the living are incompetent to bury the
+departed.  So intolerable indeed is it regarded by some, that no
+cupidity could persuade them to moor alongside of it.  Yet are there
+those who will still do it; notwithstanding the fact that the oil
+obtained from such subjects is of a very inferior quality, and by no
+means of the nature of attar-of-rose.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 6</DOCNO>
+Coming still nearer with the expiring breeze, we saw that the
+Frenchman had a second whale alongside; and this second whale seemed
+even more of a nosegay than the first.  In truth, it turned out to be
+one of those problematical whales that seem to dry up and die with a
+sort of prodigious dyspepsia, or indigestion; leaving their defunct
+bodies almost entirely bankrupt of anything like oil.  Nevertheless,
+in the proper place we shall see that no knowing fisherman will ever
+turn up his nose at such a whale as this, however much he may shun
+blasted whales in general.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 7</DOCNO>
+The Pequod had now swept so nigh to the stranger, that Stubb vowed he
+recognised his cutting spade-pole entangled in the lines that were
+knotted round the tail of one of these whales.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 8</DOCNO>
+"There's a pretty fellow, now," he banteringly laughed, standing in
+the ship's bows, "there's a jackal for ye!  I well know that these
+Crappoes of Frenchmen are but poor devils in the fishery; sometimes
+lowering their boats for breakers, mistaking them for Sperm Whale
+spouts; yes, and sometimes sailing from their port with their hold
+full of boxes of tallow candles, and cases of snuffers, foreseeing
+that all the oil they will get won't be enough to dip the Captain's
+wick into; aye, we all know these things; but look ye, here's a
+Crappo that is content with our leavings, the drugged whale there, I
+mean; aye, and is content too with scraping the dry bones of that
+other precious fish he has there.  Poor devil!  I say, pass round a
+hat, some one, and let's make him a present of a little oil for dear
+charity's sake.  For what oil he'll get from that drugged whale
+there, wouldn't be fit to burn in a jail; no, not in a condemned
+cell.  And as for the other whale, why, I'll agree to get more oil by
+chopping up and trying out these three masts of ours, than he'll get
+from that bundle of bones; though, now that I think of it, it may
+contain something worth a good deal more than oil; yes, ambergris.  I
+wonder now if our old man has thought of that.  It's worth trying.
+Yes, I'm for it;" and so saying he started for the quarter-deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 9</DOCNO>
+By this time the faint air had become a complete calm; so that
+whether or no, the Pequod was now fairly entrapped in the smell, with
+no hope of escaping except by its breezing up again.  Issuing from
+the cabin, Stubb now called his boat's crew, and pulled off for the
+stranger.  Drawing across her bow, he perceived that in accordance
+with the fanciful French taste, the upper part of her stem-piece was
+carved in the likeness of a huge drooping stalk, was painted green,
+and for thorns had copper spikes projecting from it here and there;
+the whole terminating in a symmetrical folded bulb of a bright red
+colour.  Upon her head boards, in large gilt letters, he read "Bouton
+de Rose,"--Rose-button, or Rose-bud; and this was the romantic name
+of this aromatic ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 10</DOCNO>
+Though Stubb did not understand the BOUTON part of the inscription,
+yet the word ROSE, and the bulbous figure-head put together,
+sufficiently explained the whole to him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 11</DOCNO>
+"A wooden rose-bud, eh?" he cried with his hand to his nose, "that
+will do very well; but how like all creation it smells!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 12</DOCNO>
+Now in order to hold direct communication with the people on deck, he
+had to pull round the bows to the starboard side, and thus come close
+to the blasted whale; and so talk over it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 13</DOCNO>
+Arrived then at this spot, with one hand still to his nose, he
+bawled--"Bouton-de-Rose, ahoy! are there any of you Bouton-de-Roses
+that speak English?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 14</DOCNO>
+"Yes," rejoined a Guernsey-man from the bulwarks, who turned out to
+be the chief-mate.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 15</DOCNO>
+"Well, then, my Bouton-de-Rose-bud, have you seen the White Whale?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 16</DOCNO>
+"WHAT whale?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 17</DOCNO>
+"The WHITE Whale--a Sperm Whale--Moby Dick, have ye seen him?
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 18</DOCNO>
+"Never heard of such a whale.  Cachalot Blanche!  White Whale--no."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 19</DOCNO>
+"Very good, then; good bye now, and I'll call again in a minute."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 20</DOCNO>
+Then rapidly pulling back towards the Pequod, and seeing Ahab leaning
+over the quarter-deck rail awaiting his report, he moulded his two
+hands into a trumpet and shouted--"No, Sir!  No!"  Upon which Ahab
+retired, and Stubb returned to the Frenchman.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 21</DOCNO>
+He now perceived that the Guernsey-man, who had just got into the
+chains, and was using a cutting-spade, had slung his nose in a sort
+of bag.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 22</DOCNO>
+"What's the matter with your nose, there?" said Stubb.  "Broke it?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 23</DOCNO>
+"I wish it was broken, or that I didn't have any nose at all!"
+answered the Guernsey-man, who did not seem to relish the job he was
+at very much.  "But what are you holding YOURS for?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 24</DOCNO>
+"Oh, nothing!  It's a wax nose; I have to hold it on.  Fine day,
+ain't it?  Air rather gardenny, I should say; throw us a bunch of
+posies, will ye, Bouton-de-Rose?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 25</DOCNO>
+"What in the devil's name do you want here?" roared the Guernseyman,
+flying into a sudden passion.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 26</DOCNO>
+"Oh! keep cool--cool? yes, that's the word! why don't you pack those
+whales in ice while you're working at 'em?  But joking aside, though;
+do you know, Rose-bud, that it's all nonsense trying to get any oil
+out of such whales?  As for that dried up one, there, he hasn't a
+gill in his whole carcase."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 27</DOCNO>
+"I know that well enough; but, d'ye see, the Captain here won't
+believe it; this is his first voyage; he was a Cologne manufacturer
+before.  But come aboard, and mayhap he'll believe you, if he won't
+me; and so I'll get out of this dirty scrape."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 28</DOCNO>
+"Anything to oblige ye, my sweet and pleasant fellow," rejoined
+Stubb, and with that he soon mounted to the deck.  There a queer
+scene presented itself.  The sailors, in tasselled caps of red
+worsted, were getting the heavy tackles in readiness for the whales.
+But they worked rather slow and talked very fast, and seemed in
+anything but a good humor.  All their noses upwardly projected from
+their faces like so many jib-booms.  Now and then pairs of them would
+drop their work, and run up to the mast-head to get some fresh air.
+Some thinking they would catch the plague, dipped oakum in coal-tar,
+and at intervals held it to their nostrils.  Others having broken the
+stems of their pipes almost short off at the bowl, were vigorously
+puffing tobacco-smoke, so that it constantly filled their
+olfactories.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 29</DOCNO>
+Stubb was struck by a shower of outcries and anathemas proceeding
+from the Captain's round-house abaft; and looking in that direction
+saw a fiery face thrust from behind the door, which was held ajar
+from within.  This was the tormented surgeon, who, after in vain
+remonstrating against the proceedings of the day, had betaken himself
+to the Captain's round-house (CABINET he called it) to avoid the
+pest; but still, could not help yelling out his entreaties and
+indignations at times.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 30</DOCNO>
+Marking all this, Stubb argued well for his scheme, and turning to
+the Guernsey-man had a little chat with him, during which the
+stranger mate expressed his detestation of his Captain as a conceited
+ignoramus, who had brought them all into so unsavory and unprofitable
+a pickle.  Sounding him carefully, Stubb further perceived that the
+Guernsey-man had not the slightest suspicion concerning the
+ambergris.  He therefore held his peace on that head, but otherwise
+was quite frank and confidential with him, so that the two quickly
+concocted a little plan for both circumventing and satirizing the
+Captain, without his at all dreaming of distrusting their sincerity.
+According to this little plan of theirs, the Guernsey-man, under
+cover of an interpreter's office, was to tell the Captain what he
+pleased, but as coming from Stubb; and as for Stubb, he was to utter
+any nonsense that should come uppermost in him during the interview.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 31</DOCNO>
+By this time their destined victim appeared from his cabin.  He was a
+small and dark, but rather delicate looking man for a sea-captain,
+with large whiskers and moustache, however; and wore a red cotton
+velvet vest with watch-seals at his side.  To this gentleman, Stubb
+was now politely introduced by the Guernsey-man, who at once
+ostentatiously put on the aspect of interpreting between them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 32</DOCNO>
+"What shall I say to him first?" said he.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 33</DOCNO>
+"Why," said Stubb, eyeing the velvet vest and the watch and seals,
+"you may as well begin by telling him that he looks a sort of babyish
+to me, though I don't pretend to be a judge."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 34</DOCNO>
+"He says, Monsieur," said the Guernsey-man, in French, turning to his
+captain, "that only yesterday his ship spoke a vessel, whose captain
+and chief-mate, with six sailors, had all died of a fever caught from
+a blasted whale they had brought alongside."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 35</DOCNO>
+Upon this the captain started, and eagerly desired to know more.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 36</DOCNO>
+"What now?" said the Guernsey-man to Stubb.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 37</DOCNO>
+"Why, since he takes it so easy, tell him that now I have eyed him
+carefully, I'm quite certain that he's no more fit to command a
+whale-ship than a St. Jago monkey.  In fact, tell him from me he's a
+baboon."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 38</DOCNO>
+"He vows and declares, Monsieur, that the other whale, the dried one,
+is far more deadly than the blasted one; in fine, Monsieur, he
+conjures us, as we value our lives, to cut loose from these fish."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 39</DOCNO>
+Instantly the captain ran forward, and in a loud voice commanded his
+crew to desist from hoisting the cutting-tackles, and at once cast
+loose the cables and chains confining the whales to the ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 40</DOCNO>
+"What now?" said the Guernsey-man, when the Captain had returned to
+them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 41</DOCNO>
+"Why, let me see; yes, you may as well tell him now that--that--in
+fact, tell him I've diddled him, and (aside to himself) perhaps
+somebody else."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 42</DOCNO>
+"He says, Monsieur, that he's very happy to have been of any service
+to us."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 43</DOCNO>
+Hearing this, the captain vowed that they were the grateful parties
+(meaning himself and mate) and concluded by inviting Stubb down
+into his cabin to drink a bottle of Bordeaux.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 44</DOCNO>
+"He wants you to take a glass of wine with him," said the
+interpreter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 45</DOCNO>
+"Thank him heartily; but tell him it's against my principles to drink
+with the man I've diddled.  In fact, tell him I must go."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 46</DOCNO>
+"He says, Monsieur, that his principles won't admit of his drinking;
+but that if Monsieur wants to live another day to drink, then
+Monsieur had best drop all four boats, and pull the ship away from
+these whales, for it's so calm they won't drift."
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 47</DOCNO>
+By this time Stubb was over the side, and getting into his boat,
+hailed the Guernsey-man to this effect,--that having a long tow-line
+in his boat, he would do what he could to help them, by pulling out
+the lighter whale of the two from the ship's side.  While the
+Frenchman's boats, then, were engaged in towing the ship one way,
+Stubb benevolently towed away at his whale the other way,
+ostentatiously slacking out a most unusually long tow-line.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 48</DOCNO>
+Presently a breeze sprang up; Stubb feigned to cast off from the
+whale; hoisting his boats, the Frenchman soon increased his distance,
+while the Pequod slid in between him and Stubb's whale.  Whereupon
+Stubb quickly pulled to the floating body, and hailing the Pequod to
+give notice of his intentions, at once proceeded to reap the fruit of
+his unrighteous cunning.  Seizing his sharp boat-spade, he commenced
+an excavation in the body, a little behind the side fin.  You would
+almost have thought he was digging a cellar there in the sea; and
+when at length his spade struck against the gaunt ribs, it was like
+turning up old Roman tiles and pottery buried in fat English loam.
+His boat's crew were all in high excitement, eagerly helping their
+chief, and looking as anxious as gold-hunters.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 49</DOCNO>
+And all the time numberless fowls were diving, and ducking, and
+screaming, and yelling, and fighting around them.  Stubb was
+beginning to look disappointed, especially as the horrible nosegay
+increased, when suddenly from out the very heart of this plague,
+there stole a faint stream of perfume, which flowed through the tide
+of bad smells without being absorbed by it, as one river will flow
+into and then along with another, without at all blending with it for
+a time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 50</DOCNO>
+"I have it, I have it," cried Stubb, with delight, striking something
+in the subterranean regions, "a purse! a purse!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 91, Paragraph 51</DOCNO>
+Dropping his spade, he thrust both hands in, and drew out handfuls of
+something that looked like ripe Windsor soap, or rich mottled old
+cheese; very unctuous and savory withal.  You might easily dent it
+with your thumb; it is of a hue between yellow and ash colour.  And
+this, good friends, is ambergris, worth a gold guinea an ounce to any
+druggist.  Some six handfuls were obtained; but more was unavoidably
+lost in the sea, and still more, perhaps, might have been secured
+were it not for impatient Ahab's loud command to Stubb to desist, and
+come on board, else the ship would bid them good bye.
+</DOC>
+<DOC>
+<DOCNO>Chapter 92, Paragraph 1</DOCNO>
+Ambergris.
+</DOC>
+<DOC>
+<DOCNO>Chapter 92, Paragraph 2</DOCNO>
+Now this ambergris is a very curious substance, and so important as
+an article of commerce, that in 1791 a certain Nantucket-born Captain
+Coffin was examined at the bar of the English House of Commons on
+that subject.  For at that time, and indeed until a comparatively
+late day, the precise origin of ambergris remained, like amber
+itself, a problem to the learned.  Though the word ambergris is but
+the French compound for grey amber, yet the two substances are quite
+distinct.  For amber, though at times found on the sea-coast, is also
+dug up in some far inland soils, whereas ambergris is never found
+except upon the sea.  Besides, amber is a hard, transparent, brittle,
+odorless substance, used for mouth-pieces to pipes, for beads and
+ornaments; but ambergris is soft, waxy, and so highly fragrant and
+spicy, that it is largely used in perfumery, in pastiles, precious
+candles, hair-powders, and pomatum.  The Turks use it in cooking, and
+also carry it to Mecca, for the same purpose that frankincense is
+carried to St. Peter's in Rome.  Some wine merchants drop a few
+grains into claret, to flavor it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 92, Paragraph 3</DOCNO>
+Who would think, then, that such fine ladies and gentlemen should
+regale themselves with an essence found in the inglorious bowels of a
+sick whale!  Yet so it is.  By some, ambergris is supposed to be the
+cause, and by others the effect, of the dyspepsia in the whale.  How
+to cure such a dyspepsia it were hard to say, unless by administering
+three or four boat loads of Brandreth's pills, and then running out
+of harm's way, as laborers do in blasting rocks.
+</DOC>
+<DOC>
+<DOCNO>Chapter 92, Paragraph 4</DOCNO>
+I have forgotten to say that there were found in this ambergris,
+certain hard, round, bony plates, which at first Stubb thought might
+be sailors' trowsers buttons; but it afterwards turned out that they
+were nothing more than pieces of small squid bones embalmed in that
+manner.
+</DOC>
+<DOC>
+<DOCNO>Chapter 92, Paragraph 5</DOCNO>
+Now that the incorruption of this most fragrant ambergris should be
+found in the heart of such decay; is this nothing?  Bethink thee of
+that saying of St. Paul in Corinthians, about corruption and
+incorruption; how that we are sown in dishonour, but raised in glory.
+And likewise call to mind that saying of Paracelsus about what it is
+that maketh the best musk.  Also forget not the strange fact that of
+all things of ill-savor, Cologne-water, in its rudimental
+manufacturing stages, is the worst.
+</DOC>
+<DOC>
+<DOCNO>Chapter 92, Paragraph 6</DOCNO>
+I should like to conclude the chapter with the above appeal, but
+cannot, owing to my anxiety to repel a charge often made against
+whalemen, and which, in the estimation of some already biased minds,
+might be considered as indirectly substantiated by what has been said
+of the Frenchman's two whales.  Elsewhere in this volume the
+slanderous aspersion has been disproved, that the vocation of whaling
+is throughout a slatternly, untidy business.  But there is another
+thing to rebut.  They hint that all whales always smell bad.  Now how
+did this odious stigma originate?
+</DOC>
+<DOC>
+<DOCNO>Chapter 92, Paragraph 7</DOCNO>
+I opine, that it is plainly traceable to the first arrival of the
+Greenland whaling ships in London, more than two centuries ago.
+Because those whalemen did not then, and do not now, try out their
+oil at sea as the Southern ships have always done; but cutting up the
+fresh blubber in small bits, thrust it through the bung holes of
+large casks, and carry it home in that manner; the shortness of the
+season in those Icy Seas, and the sudden and violent storms to which
+they are exposed, forbidding any other course.  The consequence is,
+that upon breaking into the hold, and unloading one of these whale
+cemeteries, in the Greenland dock, a savor is given forth somewhat
+similar to that arising from excavating an old city grave-yard, for
+the foundations of a Lying-in-Hospital.
+</DOC>
+<DOC>
+<DOCNO>Chapter 92, Paragraph 8</DOCNO>
+I partly surmise also, that this wicked charge against whalers may be
+likewise imputed to the existence on the coast of Greenland, in
+former times, of a Dutch village called Schmerenburgh or Smeerenberg,
+which latter name is the one used by the learned Fogo Von Slack, in
+his great work on Smells, a text-book on that subject.  As its name
+imports (smeer, fat; berg, to put up), this village was founded in
+order to afford a place for the blubber of the Dutch whale fleet to
+be tried out, without being taken home to Holland for that purpose.
+It was a collection of furnaces, fat-kettles, and oil sheds; and when
+the works were in full operation certainly gave forth no very
+pleasant savor.  But all this is quite different with a South Sea
+Sperm Whaler; which in a voyage of four years perhaps, after
+completely filling her hold with oil, does not, perhaps, consume
+fifty days in the business of boiling out; and in the state that it
+is casked, the oil is nearly scentless.  The truth is, that living or
+dead, if but decently treated, whales as a species are by no means
+creatures of ill odor; nor can whalemen be recognised, as the people
+of the middle ages affected to detect a Jew in the company, by the
+nose.  Nor indeed can the whale possibly be otherwise than fragrant,
+when, as a general thing, he enjoys such high health; taking
+abundance of exercise; always out of doors; though, it is true,
+seldom in the open air.  I say, that the motion of a Sperm Whale's
+flukes above water dispenses a perfume, as when a musk-scented lady
+rustles her dress in a warm parlor.  What then shall I liken the
+Sperm Whale to for fragrance, considering his magnitude?  Must it not
+be to that famous elephant, with jewelled tusks, and redolent with
+myrrh, which was led out of an Indian town to do honour to Alexander
+the Great?
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 1</DOCNO>
+The Castaway.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 2</DOCNO>
+It was but some few days after encountering the Frenchman, that a
+most significant event befell the most insignificant of the Pequod's
+crew; an event most lamentable; and which ended in providing the
+sometimes madly merry and predestinated craft with a living and ever
+accompanying prophecy of whatever shattered sequel might prove her
+own.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 3</DOCNO>
+Now, in the whale ship, it is not every one that goes in the boats.
+Some few hands are reserved called ship-keepers, whose province it is
+to work the vessel while the boats are pursuing the whale.  As a
+general thing, these ship-keepers are as hardy fellows as the men
+comprising the boats' crews.  But if there happen to be an unduly
+slender, clumsy, or timorous wight in the ship, that wight is certain
+to be made a ship-keeper.  It was so in the Pequod with the little
+negro Pippin by nick-name, Pip by abbreviation.  Poor Pip! ye have
+heard of him before; ye must remember his tambourine on that dramatic
+midnight, so gloomy-jolly.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 4</DOCNO>
+In outer aspect, Pip and Dough-Boy made a match, like a black pony
+and a white one, of equal developments, though of dissimilar colour,
+driven in one eccentric span.  But while hapless Dough-Boy was by
+nature dull and torpid in his intellects, Pip, though over
+tender-hearted, was at bottom very bright, with that pleasant,
+genial, jolly brightness peculiar to his tribe; a tribe, which ever
+enjoy all holidays and festivities with finer, freer relish than any
+other race.  For blacks, the year's calendar should show naught but
+three hundred and sixty-five Fourth of Julys and New Year's Days.
+Nor smile so, while I write that this little black was brilliant, for
+even blackness has its brilliancy; behold yon lustrous ebony,
+panelled in king's cabinets.  But Pip loved life, and all life's
+peaceable securities; so that the panic-striking business in which he
+had somehow unaccountably become entrapped, had most sadly blurred
+his brightness; though, as ere long will be seen, what was thus
+temporarily subdued in him, in the end was destined to be luridly
+illumined by strange wild fires, that fictitiously showed him off to
+ten times the natural lustre with which in his native Tolland County
+in Connecticut, he had once enlivened many a fiddler's frolic on the
+green; and at melodious even-tide, with his gay ha-ha! had turned the
+round horizon into one star-belled tambourine.  So, though in the
+clear air of day, suspended against a blue-veined neck, the
+pure-watered diamond drop will healthful glow; yet, when the cunning
+jeweller would show you the diamond in its most impressive lustre, he
+lays it against a gloomy ground, and then lights it up, not by the
+sun, but by some unnatural gases.  Then come out those fiery
+effulgences, infernally superb; then the evil-blazing diamond, once
+the divinest symbol of the crystal skies, looks like some crown-jewel
+stolen from the King of Hell.  But let us to the story.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 5</DOCNO>
+It came to pass, that in the ambergris affair Stubb's after-oarsman
+chanced so to sprain his hand, as for a time to become quite maimed;
+and, temporarily, Pip was put into his place.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 6</DOCNO>
+The first time Stubb lowered with him, Pip evinced much nervousness;
+but happily, for that time, escaped close contact with the whale; and
+therefore came off not altogether discreditably; though Stubb
+observing him, took care, afterwards, to exhort him to cherish his
+courageousness to the utmost, for he might often find it needful.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 7</DOCNO>
+Now upon the second lowering, the boat paddled upon the whale; and as
+the fish received the darted iron, it gave its customary rap, which
+happened, in this instance, to be right under poor Pip's seat.  The
+involuntary consternation of the moment caused him to leap, paddle in
+hand, out of the boat; and in such a way, that part of the slack
+whale line coming against his chest, he breasted it overboard with
+him, so as to become entangled in it, when at last plumping into the
+water.  That instant the stricken whale started on a fierce run, the
+line swiftly straightened; and presto! poor Pip came all foaming up
+to the chocks of the boat, remorselessly dragged there by the line,
+which had taken several turns around his chest and neck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 8</DOCNO>
+Tashtego stood in the bows.  He was full of the fire of the hunt.  He
+hated Pip for a poltroon.  Snatching the boat-knife from its sheath,
+he suspended its sharp edge over the line, and turning towards Stubb,
+exclaimed interrogatively, "Cut?"  Meantime Pip's blue, choked face
+plainly looked, Do, for God's sake!  All passed in a flash.  In less
+than half a minute, this entire thing happened.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 9</DOCNO>
+"Damn him, cut!" roared Stubb; and so the whale was lost and Pip was
+saved.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 10</DOCNO>
+So soon as he recovered himself, the poor little negro was assailed
+by yells and execrations from the crew.  Tranquilly permitting these
+irregular cursings to evaporate, Stubb then in a plain,
+business-like, but still half humorous manner, cursed Pip officially;
+and that done, unofficially gave him much wholesome advice.  The
+substance was, Never jump from a boat, Pip, except--but all the rest
+was indefinite, as the soundest advice ever is.  Now, in general,
+STICK TO THE BOAT, is your true motto in whaling; but cases will
+sometimes happen when LEAP FROM THE BOAT, is still better.  Moreover,
+as if perceiving at last that if he should give undiluted
+conscientious advice to Pip, he would be leaving him too wide a
+margin to jump in for the future; Stubb suddenly dropped all advice,
+and concluded with a peremptory command, "Stick to the boat, Pip, or
+by the Lord, I won't pick you up if you jump; mind that.  We can't
+afford to lose whales by the likes of you; a whale would sell for
+thirty times what you would, Pip, in Alabama.  Bear that in mind, and
+don't jump any more."  Hereby perhaps Stubb indirectly hinted, that
+though man loved his fellow, yet man is a money-making animal, which
+propensity too often interferes with his benevolence.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 11</DOCNO>
+But we are all in the hands of the Gods; and Pip jumped again.  It
+was under very similar circumstances to the first performance; but
+this time he did not breast out the line; and hence, when the whale
+started to run, Pip was left behind on the sea, like a hurried
+traveller's trunk.  Alas!  Stubb was but too true to his word.  It
+was a beautiful, bounteous, blue day; the spangled sea calm and
+cool, and flatly stretching away, all round, to the horizon, like
+gold-beater's skin hammered out to the extremest.  Bobbing up and
+down in that sea, Pip's ebon head showed like a head of cloves.  No
+boat-knife was lifted when he fell so rapidly astern.  Stubb's
+inexorable back was turned upon him; and the whale was winged.  In
+three minutes, a whole mile of shoreless ocean was between Pip and
+Stubb.  Out from the centre of the sea, poor Pip turned his crisp,
+curling, black head to the sun, another lonely castaway, though the
+loftiest and the brightest.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 12</DOCNO>
+Now, in calm weather, to swim in the open ocean is as easy to the
+practised swimmer as to ride in a spring-carriage ashore.  But the
+awful lonesomeness is intolerable.  The intense concentration of self
+in the middle of such a heartless immensity, my God! who can tell it?
+Mark, how when sailors in a dead calm bathe in the open sea--mark
+how closely they hug their ship and only coast along her sides.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 13</DOCNO>
+But had Stubb really abandoned the poor little negro to his fate?
+No; he did not mean to, at least.  Because there were two boats in
+his wake, and he supposed, no doubt, that they would of course come
+up to Pip very quickly, and pick him up; though, indeed, such
+considerations towards oarsmen jeopardized through their own
+timidity, is not always manifested by the hunters in all similar
+instances; and such instances not unfrequently occur; almost
+invariably in the fishery, a coward, so called, is marked with the
+same ruthless detestation peculiar to military navies and armies.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 14</DOCNO>
+But it so happened, that those boats, without seeing Pip, suddenly
+spying whales close to them on one side, turned, and gave chase; and
+Stubb's boat was now so far away, and he and all his crew so intent
+upon his fish, that Pip's ringed horizon began to expand around him
+miserably.  By the merest chance the ship itself at last rescued him;
+but from that hour the little negro went about the deck an idiot;
+such, at least, they said he was.  The sea had jeeringly kept his
+finite body up, but drowned the infinite of his soul.  Not drowned
+entirely, though.  Rather carried down alive to wondrous depths,
+where strange shapes of the unwarped primal world glided to and fro
+before his passive eyes; and the miser-merman, Wisdom, revealed his
+hoarded heaps; and among the joyous, heartless, ever-juvenile
+eternities, Pip saw the multitudinous, God-omnipresent, coral
+insects, that out of the firmament of waters heaved the colossal
+orbs.  He saw God's foot upon the treadle of the loom, and spoke it;
+and therefore his shipmates called him mad.  So man's insanity is
+heaven's sense; and wandering from all mortal reason, man comes at
+last to that celestial thought, which, to reason, is absurd and
+frantic; and weal or woe, feels then uncompromised, indifferent as
+his God.
+</DOC>
+<DOC>
+<DOCNO>Chapter 93, Paragraph 15</DOCNO>
+For the rest, blame not Stubb too hardly.  The thing is common in
+that fishery; and in the sequel of the narrative, it will then be
+seen what like abandonment befell myself.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 1</DOCNO>
+A Squeeze of the Hand.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 2</DOCNO>
+That whale of Stubb's, so dearly purchased, was duly brought to the
+Pequod's side, where all those cutting and hoisting operations
+previously detailed, were regularly gone through, even to the baling
+of the Heidelburgh Tun, or Case.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 3</DOCNO>
+While some were occupied with this latter duty, others were employed
+in dragging away the larger tubs, so soon as filled with the sperm;
+and when the proper time arrived, this same sperm was carefully
+manipulated ere going to the try-works, of which anon.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 4</DOCNO>
+It had cooled and crystallized to such a degree, that when, with
+several others, I sat down before a large Constantine's bath of it, I
+found it strangely concreted into lumps, here and there rolling about
+in the liquid part.  It was our business to squeeze these lumps back
+into fluid.  A sweet and unctuous duty!  No wonder that in old times
+this sperm was such a favourite cosmetic.  Such a clearer! such a
+sweetener! such a softener! such a delicious molifier!  After
+having my hands in it for only a few minutes, my fingers felt like
+eels, and began, as it were, to serpentine and spiralise.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 5</DOCNO>
+As I sat there at my ease, cross-legged on the deck; after the bitter
+exertion at the windlass; under a blue tranquil sky; the ship under
+indolent sail, and gliding so serenely along; as I bathed my hands
+among those soft, gentle globules of infiltrated tissues, woven
+almost within the hour; as they richly broke to my fingers, and
+discharged all their opulence, like fully ripe grapes their wine; as
+I snuffed up that uncontaminated aroma,--literally and truly, like
+the smell of spring violets; I declare to you, that for the time I
+lived as in a musky meadow; I forgot all about our horrible oath; in
+that inexpressible sperm, I washed my hands and my heart of it; I
+almost began to credit the old Paracelsan superstition that sperm is
+of rare virtue in allaying the heat of anger; while bathing in that
+bath, I felt divinely free from all ill-will, or petulance, or
+malice, of any sort whatsoever.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 6</DOCNO>
+Squeeze! squeeze! squeeze! all the morning long; I squeezed that
+sperm till I myself almost melted into it; I squeezed that sperm till
+a strange sort of insanity came over me; and I found myself
+unwittingly squeezing my co-laborers' hands in it, mistaking their
+hands for the gentle globules.  Such an abounding, affectionate,
+friendly, loving feeling did this avocation beget; that at last I was
+continually squeezing their hands, and looking up into their eyes
+sentimentally; as much as to say,--Oh! my dear fellow beings, why
+should we longer cherish any social acerbities, or know the slightest
+ill-humor or envy!  Come; let us squeeze hands all round; nay, let us
+all squeeze ourselves into each other; let us squeeze ourselves
+universally into the very milk and sperm of kindness.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 7</DOCNO>
+Would that I could keep squeezing that sperm for ever!  For now,
+since by many prolonged, repeated experiences, I have perceived that
+in all cases man must eventually lower, or at least shift, his
+conceit of attainable felicity; not placing it anywhere in the
+intellect or the fancy; but in the wife, the heart, the bed, the
+table, the saddle, the fireside, the country; now that I have
+perceived all this, I am ready to squeeze case eternally.  In
+thoughts of the visions of the night, I saw long rows of angels in
+paradise, each with his hands in a jar of spermaceti.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 8</DOCNO>
+Now, while discoursing of sperm, it behooves to speak of other things
+akin to it, in the business of preparing the sperm whale for the
+try-works.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 9</DOCNO>
+First comes white-horse, so called, which is obtained from the
+tapering part of the fish, and also from the thicker portions of his
+flukes.  It is tough with congealed tendons--a wad of muscle--but
+still contains some oil.  After being severed from the whale, the
+white-horse is first cut into portable oblongs ere going to the
+mincer.  They look much like blocks of Berkshire marble.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 10</DOCNO>
+Plum-pudding is the term bestowed upon certain fragmentary parts of
+the whale's flesh, here and there adhering to the blanket of blubber,
+and often participating to a considerable degree in its unctuousness.
+It is a most refreshing, convivial, beautiful object to behold.  As
+its name imports, it is of an exceedingly rich, mottled tint, with a
+bestreaked snowy and golden ground, dotted with spots of the deepest
+crimson and purple.  It is plums of rubies, in pictures of citron.
+Spite of reason, it is hard to keep yourself from eating it.  I
+confess, that once I stole behind the foremast to try it.  It tasted
+something as I should conceive a royal cutlet from the thigh of Louis
+le Gros might have tasted, supposing him to have been killed the
+first day after the venison season, and that particular venison
+season contemporary with an unusually fine vintage of the vineyards
+of Champagne.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 11</DOCNO>
+There is another substance, and a very singular one, which turns up
+in the course of this business, but which I feel it to be very
+puzzling adequately to describe.  It is called slobgollion; an
+appellation original with the whalemen, and even so is the nature of
+the substance.  It is an ineffably oozy, stringy affair, most
+frequently found in the tubs of sperm, after a prolonged squeezing,
+and subsequent decanting.  I hold it to be the wondrously thin,
+ruptured membranes of the case, coalescing.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 12</DOCNO>
+Gurry, so called, is a term properly belonging to right whalemen, but
+sometimes incidentally used by the sperm fishermen.  It designates
+the dark, glutinous substance which is scraped off the back of the
+Greenland or right whale, and much of which covers the decks of those
+inferior souls who hunt that ignoble Leviathan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 13</DOCNO>
+Nippers.  Strictly this word is not indigenous to the whale's
+vocabulary.  But as applied by whalemen, it becomes so.  A whaleman's
+nipper is a short firm strip of tendinous stuff cut from the tapering
+part of Leviathan's tail: it averages an inch in thickness, and for
+the rest, is about the size of the iron part of a hoe.  Edgewise
+moved along the oily deck, it operates like a leathern squilgee; and
+by nameless blandishments, as of magic, allures along with it all
+impurities.
+</DOC>
+<DOC>
+<DOCNO>Chapter 94, Paragraph 14</DOCNO>
+But to learn all about these recondite matters, your best way is at
+once to descend into the blubber-room, and have a long talk with its
+inmates.  This place has previously been mentioned as the receptacle
+for the blanket-pieces, when stript and hoisted from the whale.  When
+the proper time arrives for cutting up its contents, this apartment
+is a scene of terror to all tyros, especially by night.  On one side,
+lit by a dull lantern, a space has been left clear for the workmen.
+They generally go in pairs,--a pike-and-gaffman and a spade-man.
+The whaling-pike is similar to a frigate's boarding-weapon of the
+same name.  The gaff is something like a boat-hook.  With his gaff,
+the gaffman hooks on to a sheet of blubber, and strives to hold it
+from slipping, as the ship pitches and lurches about.  Meanwhile, the
+spade-man stands on the sheet itself, perpendicularly chopping it
+into the portable horse-pieces.  This spade is sharp as hone can make
+it; the spademan's feet are shoeless; the thing he stands on will
+sometimes irresistibly slide away from him, like a sledge.  If he
+cuts off one of his own toes, or one of his assistants', would you be
+very much astonished?  Toes are scarce among veteran blubber-room
+men.
+</DOC>
+<DOC>
+<DOCNO>Chapter 95, Paragraph 1</DOCNO>
+The Cassock.
+</DOC>
+<DOC>
+<DOCNO>Chapter 95, Paragraph 2</DOCNO>
+Had you stepped on board the Pequod at a certain juncture of this
+post-mortemizing of the whale; and had you strolled forward nigh the
+windlass, pretty sure am I that you would have scanned with no small
+curiosity a very strange, enigmatical object, which you would have
+seen there, lying along lengthwise in the lee scuppers.  Not the
+wondrous cistern in the whale's huge head; not the prodigy of his
+unhinged lower jaw; not the miracle of his symmetrical tail; none of
+these would so surprise you, as half a glimpse of that unaccountable
+cone,--longer than a Kentuckian is tall, nigh a foot in diameter at
+the base, and jet-black as Yojo, the ebony idol of Queequeg.  And an
+idol, indeed, it is; or, rather, in old times, its likeness was.
+Such an idol as that found in the secret groves of Queen Maachah in
+Judea; and for worshipping which, King Asa, her son, did depose her,
+and destroyed the idol, and burnt it for an abomination at the brook
+Kedron, as darkly set forth in the 15th chapter of the First Book of
+Kings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 95, Paragraph 3</DOCNO>
+Look at the sailor, called the mincer, who now comes along, and
+assisted by two allies, heavily backs the grandissimus, as the
+mariners call it, and with bowed shoulders, staggers off with it as
+if he were a grenadier carrying a dead comrade from the field.
+Extending it upon the forecastle deck, he now proceeds cylindrically
+to remove its dark pelt, as an African hunter the pelt of a boa.
+This done he turns the pelt inside out, like a pantaloon leg; gives
+it a good stretching, so as almost to double its diameter; and at
+last hangs it, well spread, in the rigging, to dry.  Ere long, it is
+taken down; when removing some three feet of it, towards the pointed
+extremity, and then cutting two slits for arm-holes at the other end,
+he lengthwise slips himself bodily into it.  The mincer now stands
+before you invested in the full canonicals of his calling.
+Immemorial to all his order, this investiture alone will adequately
+protect him, while employed in the peculiar functions of his office.
+</DOC>
+<DOC>
+<DOCNO>Chapter 95, Paragraph 4</DOCNO>
+That office consists in mincing the horse-pieces of blubber for the
+pots; an operation which is conducted at a curious wooden horse,
+planted endwise against the bulwarks, and with a capacious tub
+beneath it, into which the minced pieces drop, fast as the sheets
+from a rapt orator's desk.  Arrayed in decent black; occupying a
+conspicuous pulpit; intent on bible leaves; what a candidate for an
+archbishopric, what a lad for a Pope were this mincer!*
+</DOC>
+<DOC>
+<DOCNO>Chapter 95, Paragraph 5</DOCNO>
+*Bible leaves!  Bible leaves!  This is the invariable cry from the
+mates to the mincer.  It enjoins him to be careful, and cut his work
+into as thin slices as possible, inasmuch as by so doing the business
+of boiling out the oil is much accelerated, and its quantity
+considerably increased, besides perhaps improving it in quality.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 1</DOCNO>
+The Try-Works.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 2</DOCNO>
+Besides her hoisted boats, an American whaler is outwardly
+distinguished by her try-works.  She presents the curious anomaly of
+the most solid masonry joining with oak and hemp in constituting the
+completed ship.  It is as if from the open field a brick-kiln were
+transported to her planks.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 3</DOCNO>
+The try-works are planted between the foremast and mainmast, the
+most roomy part of the deck.  The timbers beneath are of a peculiar
+strength, fitted to sustain the weight of an almost solid mass of
+brick and mortar, some ten feet by eight square, and five in height.
+The foundation does not penetrate the deck, but the masonry is firmly
+secured to the surface by ponderous knees of iron bracing it on all
+sides, and screwing it down to the timbers.  On the flanks it is
+cased with wood, and at top completely covered by a large, sloping,
+battened hatchway.  Removing this hatch we expose the great try-pots,
+two in number, and each of several barrels' capacity.  When not in
+use, they are kept remarkably clean.  Sometimes they are polished
+with soapstone and sand, till they shine within like silver
+punch-bowls.  During the night-watches some cynical old sailors will
+crawl into them and coil themselves away there for a nap.  While
+employed in polishing them--one man in each pot, side by side--many
+confidential communications are carried on, over the iron lips.  It
+is a place also for profound mathematical meditation.  It was in the
+left hand try-pot of the Pequod, with the soapstone diligently
+circling round me, that I was first indirectly struck by the
+remarkable fact, that in geometry all bodies gliding along the
+cycloid, my soapstone for example, will descend from any point in
+precisely the same time.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 4</DOCNO>
+Removing the fire-board from the front of the try-works, the bare
+masonry of that side is exposed, penetrated by the two iron mouths of
+the furnaces, directly underneath the pots.  These mouths are fitted
+with heavy doors of iron.  The intense heat of the fire is prevented
+from communicating itself to the deck, by means of a shallow
+reservoir extending under the entire inclosed surface of the works.
+By a tunnel inserted at the rear, this reservoir is kept replenished
+with water as fast as it evaporates.  There are no external chimneys;
+they open direct from the rear wall.  And here let us go back for a
+moment.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 5</DOCNO>
+It was about nine o'clock at night that the Pequod's try-works were
+first started on this present voyage.  It belonged to Stubb to
+oversee the business.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 6</DOCNO>
+"All ready there?  Off hatch, then, and start her.  You cook, fire
+the works."  This was an easy thing, for the carpenter had been
+thrusting his shavings into the furnace throughout the passage.  Here
+be it said that in a whaling voyage the first fire in the try-works has
+to be fed for a time with wood.  After that no wood is used, except
+as a means of quick ignition to the staple fuel.  In a word, after
+being tried out, the crisp, shrivelled blubber, now called scraps or
+fritters, still contains considerable of its unctuous properties.
+These fritters feed the flames.  Like a plethoric burning martyr, or
+a self-consuming misanthrope, once ignited, the whale supplies his
+own fuel and burns by his own body.  Would that he consumed his own
+smoke! for his smoke is horrible to inhale, and inhale it you must,
+and not only that, but you must live in it for the time.  It has an
+unspeakable, wild, Hindoo odor about it, such as may lurk in the
+vicinity of funereal pyres.  It smells like the left wing of the day
+of judgment; it is an argument for the pit.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 7</DOCNO>
+By midnight the works were in full operation.  We were clear from the
+carcase; sail had been made; the wind was freshening; the wild ocean
+darkness was intense.  But that darkness was licked up by the fierce
+flames, which at intervals forked forth from the sooty flues, and
+illuminated every lofty rope in the rigging, as with the famed Greek
+fire.  The burning ship drove on, as if remorselessly commissioned to
+some vengeful deed.  So the pitch and sulphur-freighted brigs of the
+bold Hydriote, Canaris, issuing from their midnight harbors, with
+broad sheets of flame for sails, bore down upon the Turkish frigates,
+and folded them in conflagrations.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 8</DOCNO>
+The hatch, removed from the top of the works, now afforded a wide
+hearth in front of them.  Standing on this were the Tartarean shapes
+of the pagan harpooneers, always the whale-ship's stokers.  With huge
+pronged poles they pitched hissing masses of blubber into the
+scalding pots, or stirred up the fires beneath, till the snaky flames
+darted, curling, out of the doors to catch them by the feet.  The
+smoke rolled away in sullen heaps.  To every pitch of the ship there
+was a pitch of the boiling oil, which seemed all eagerness to leap
+into their faces.  Opposite the mouth of the works, on the further
+side of the wide wooden hearth, was the windlass.  This served for a
+sea-sofa.  Here lounged the watch, when not otherwise employed,
+looking into the red heat of the fire, till their eyes felt scorched
+in their heads.  Their tawny features, now all begrimed with smoke
+and sweat, their matted beards, and the contrasting barbaric
+brilliancy of their teeth, all these were strangely revealed in the
+capricious emblazonings of the works.  As they narrated to each other
+their unholy adventures, their tales of terror told in words of
+mirth; as their uncivilized laughter forked upwards out of them, like
+the flames from the furnace; as to and fro, in their front, the
+harpooneers wildly gesticulated with their huge pronged forks and
+dippers; as the wind howled on, and the sea leaped, and the ship
+groaned and dived, and yet steadfastly shot her red hell further and
+further into the blackness of the sea and the night, and scornfully
+champed the white bone in her mouth, and viciously spat round her on
+all sides; then the rushing Pequod, freighted with savages, and laden
+with fire, and burning a corpse, and plunging into that blackness of
+darkness, seemed the material counterpart of her monomaniac
+commander's soul.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 9</DOCNO>
+So seemed it to me, as I stood at her helm, and for long hours
+silently guided the way of this fire-ship on the sea.  Wrapped, for
+that interval, in darkness myself, I but the better saw the redness,
+the madness, the ghastliness of others.  The continual sight of the
+fiend shapes before me, capering half in smoke and half in fire,
+these at last begat kindred visions in my soul, so soon as I began to
+yield to that unaccountable drowsiness which ever would come over me
+at a midnight helm.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 10</DOCNO>
+But that night, in particular, a strange (and ever since
+inexplicable) thing occurred to me.  Starting from a brief standing
+sleep, I was horribly conscious of something fatally wrong.  The
+jaw-bone tiller smote my side, which leaned against it; in my ears
+was the low hum of sails, just beginning to shake in the wind; I
+thought my eyes were open; I was half conscious of putting my fingers
+to the lids and mechanically stretching them still further apart.
+But, spite of all this, I could see no compass before me to steer by;
+though it seemed but a minute since I had been watching the card, by
+the steady binnacle lamp illuminating it.  Nothing seemed before me
+but a jet gloom, now and then made ghastly by flashes of redness.
+Uppermost was the impression, that whatever swift, rushing thing I
+stood on was not so much bound to any haven ahead as rushing from all
+havens astern.  A stark, bewildered feeling, as of death, came over
+me.  Convulsively my hands grasped the tiller, but with the crazy
+conceit that the tiller was, somehow, in some enchanted way,
+inverted.  My God! what is the matter with me? thought I.  Lo! in my
+brief sleep I had turned myself about, and was fronting the ship's
+stern, with my back to her prow and the compass.  In an instant I
+faced back, just in time to prevent the vessel from flying up into
+the wind, and very probably capsizing her.  How glad and how grateful
+the relief from this unnatural hallucination of the night, and the
+fatal contingency of being brought by the lee!
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 11</DOCNO>
+Look not too long in the face of the fire, O man!  Never dream with
+thy hand on the helm!  Turn not thy back to the compass; accept the
+first hint of the hitching tiller; believe not the artificial fire,
+when its redness makes all things look ghastly.  To-morrow, in the
+natural sun, the skies will be bright; those who glared like devils
+in the forking flames, the morn will show in far other, at least
+gentler, relief; the glorious, golden, glad sun, the only true
+lamp--all others but liars!
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 12</DOCNO>
+Nevertheless the sun hides not Virginia's Dismal Swamp, nor Rome's
+accursed Campagna, nor wide Sahara, nor all the millions of miles of
+deserts and of griefs beneath the moon.  The sun hides not the ocean,
+which is the dark side of this earth, and which is two thirds of this
+earth.  So, therefore, that mortal man who hath more of joy than
+sorrow in him, that mortal man cannot be true--not true, or
+undeveloped.  With books the same.  The truest of all men was the Man
+of Sorrows, and the truest of all books is Solomon's, and
+Ecclesiastes is the fine hammered steel of woe.  "All is vanity."
+ALL.  This wilful world hath not got hold of unchristian Solomon's
+wisdom yet.  But he who dodges hospitals and jails, and walks fast
+crossing graveyards, and would rather talk of operas than hell;
+calls Cowper, Young, Pascal, Rousseau, poor devils all of sick men;
+and throughout a care-free lifetime swears by Rabelais as passing
+wise, and therefore jolly;--not that man is fitted to sit down on
+tomb-stones, and break the green damp mould with unfathomably
+wondrous Solomon.
+</DOC>
+<DOC>
+<DOCNO>Chapter 96, Paragraph 13</DOCNO>
+But even Solomon, he says, "the man that wandereth out of the way of
+understanding shall remain" (I.E., even while living) "in the
+congregation of the dead."  Give not thyself up, then, to fire, lest
+it invert thee, deaden thee; as for the time it did me.  There is a
+wisdom that is woe; but there is a woe that is madness.  And there is
+a Catskill eagle in some souls that can alike dive down into the
+blackest gorges, and soar out of them again and become invisible in
+the sunny spaces.  And even if he for ever flies within the gorge,
+that gorge is in the mountains; so that even in his lowest swoop the
+mountain eagle is still higher than other birds upon the plain, even
+though they soar.
+</DOC>
+<DOC>
+<DOCNO>Chapter 97, Paragraph 1</DOCNO>
+The Lamp.
+</DOC>
+<DOC>
+<DOCNO>Chapter 97, Paragraph 2</DOCNO>
+Had you descended from the Pequod's try-works to the Pequod's
+forecastle, where the off duty watch were sleeping, for one single
+moment you would have almost thought you were standing in some
+illuminated shrine of canonized kings and counsellors.  There they
+lay in their triangular oaken vaults, each mariner a chiselled
+muteness; a score of lamps flashing upon his hooded eyes.
+</DOC>
+<DOC>
+<DOCNO>Chapter 97, Paragraph 3</DOCNO>
+In merchantmen, oil for the sailor is more scarce than the milk of
+queens.  To dress in the dark, and eat in the dark, and stumble in
+darkness to his pallet, this is his usual lot.  But the whaleman, as
+he seeks the food of light, so he lives in light.  He makes his berth
+an Aladdin's lamp, and lays him down in it; so that in the pitchiest
+night the ship's black hull still houses an illumination.
+</DOC>
+<DOC>
+<DOCNO>Chapter 97, Paragraph 4</DOCNO>
+See with what entire freedom the whaleman takes his handful of
+lamps--often but old bottles and vials, though--to the copper cooler
+at the try-works, and replenishes them there, as mugs of ale at a
+vat.  He burns, too, the purest of oil, in its unmanufactured, and,
+therefore, unvitiated state; a fluid unknown to solar, lunar, or
+astral contrivances ashore.  It is sweet as early grass butter in
+April.  He goes and hunts for his oil, so as to be sure of its
+freshness and genuineness, even as the traveller on the prairie hunts
+up his own supper of game.
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 1</DOCNO>
+Stowing Down and Clearing Up.
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 2</DOCNO>
+Already has it been related how the great leviathan is afar off
+descried from the mast-head; how he is chased over the watery moors,
+and slaughtered in the valleys of the deep; how he is then towed
+alongside and beheaded; and how (on the principle which entitled the
+headsman of old to the garments in which the beheaded was killed) his
+great padded surtout becomes the property of his executioner; how, in
+due time, he is condemned to the pots, and, like Shadrach, Meshach,
+and Abednego, his spermaceti, oil, and bone pass unscathed through
+the fire;--but now it remains to conclude the last chapter of this
+part of the description by rehearsing--singing, if I may--the
+romantic proceeding of decanting off his oil into the casks and
+striking them down into the hold, where once again leviathan returns
+to his native profundities, sliding along beneath the surface as
+before; but, alas! never more to rise and blow.
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 3</DOCNO>
+While still warm, the oil, like hot punch, is received into the
+six-barrel casks; and while, perhaps, the ship is pitching and
+rolling this way and that in the midnight sea, the enormous casks are
+slewed round and headed over, end for end, and sometimes perilously
+scoot across the slippery deck, like so many land slides, till at
+last man-handled and stayed in their course; and all round the hoops,
+rap, rap, go as many hammers as can play upon them, for now, EX
+OFFICIO, every sailor is a cooper.
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 4</DOCNO>
+At length, when the last pint is casked, and all is cool, then the
+great hatchways are unsealed, the bowels of the ship are thrown open,
+and down go the casks to their final rest in the sea.  This done, the
+hatches are replaced, and hermetically closed, like a closet walled
+up.
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 5</DOCNO>
+In the sperm fishery, this is perhaps one of the most remarkable
+incidents in all the business of whaling.  One day the planks stream
+with freshets of blood and oil; on the sacred quarter-deck enormous
+masses of the whale's head are profanely piled; great rusty casks lie
+about, as in a brewery yard; the smoke from the try-works has
+besooted all the bulwarks; the mariners go about suffused with
+unctuousness; the entire ship seems great leviathan himself; while on
+all hands the din is deafening.
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 6</DOCNO>
+But a day or two after, you look about you, and prick your ears in
+this self-same ship; and were it not for the tell-tale boats and
+try-works, you would all but swear you trod some silent merchant
+vessel, with a most scrupulously neat commander.  The unmanufactured
+sperm oil possesses a singularly cleansing virtue.  This is the
+reason why the decks never look so white as just after what they call
+an affair of oil.  Besides, from the ashes of the burned scraps of
+the whale, a potent lye is readily made; and whenever any
+adhesiveness from the back of the whale remains clinging to the side,
+that lye quickly exterminates it.  Hands go diligently along the
+bulwarks, and with buckets of water and rags restore them to their
+full tidiness.  The soot is brushed from the lower rigging.  All the
+numerous implements which have been in use are likewise faithfully
+cleansed and put away.  The great hatch is scrubbed and placed upon
+the try-works, completely hiding the pots; every cask is out of
+sight; all tackles are coiled in unseen nooks; and when by the
+combined and simultaneous industry of almost the entire ship's
+company, the whole of this conscientious duty is at last concluded,
+then the crew themselves proceed to their own ablutions; shift
+themselves from top to toe; and finally issue to the immaculate deck,
+fresh and all aglow, as bridegrooms new-leaped from out the daintiest
+Holland.
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 7</DOCNO>
+Now, with elated step, they pace the planks in twos and threes, and
+humorously discourse of parlors, sofas, carpets, and fine cambrics;
+propose to mat the deck; think of having hanging to the top; object
+not to taking tea by moonlight on the piazza of the forecastle.  To
+hint to such musked mariners of oil, and bone, and blubber, were
+little short of audacity.  They know not the thing you distantly
+allude to.  Away, and bring us napkins!
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 8</DOCNO>
+But mark: aloft there, at the three mast heads, stand three men
+intent on spying out more whales, which, if caught, infallibly will
+again soil the old oaken furniture, and drop at least one small
+grease-spot somewhere.  Yes; and many is the time, when, after the
+severest uninterrupted labors, which know no night; continuing
+straight through for ninety-six hours; when from the boat, where they
+have swelled their wrists with all day rowing on the Line,--they only
+step to the deck to carry vast chains, and heave the heavy windlass,
+and cut and slash, yea, and in their very sweatings to be smoked and
+burned anew by the combined fires of the equatorial sun and the
+equatorial try-works; when, on the heel of all this, they have
+finally bestirred themselves to cleanse the ship, and make a spotless
+dairy room of it; many is the time the poor fellows, just buttoning
+the necks of their clean frocks, are startled by the cry of "There
+she blows!" and away they fly to fight another whale, and go through
+the whole weary thing again.  Oh! my friends, but this is
+man-killing!  Yet this is life.  For hardly have we mortals by long
+toilings extracted from this world's vast bulk its small but
+valuable sperm; and then, with weary patience, cleansed ourselves
+from its defilements, and learned to live here in clean tabernacles
+of the soul; hardly is this done, when--THERE SHE BLOWS!--the ghost
+is spouted up, and away we sail to fight some other world, and go
+through young life's old routine again.
+</DOC>
+<DOC>
+<DOCNO>Chapter 98, Paragraph 9</DOCNO>
+Oh! the metempsychosis!  Oh!  Pythagoras, that in bright Greece, two
+thousand years ago, did die, so good, so wise, so mild; I sailed with
+thee along the Peruvian coast last voyage--and, foolish as I am,
+taught thee, a green simple boy, how to splice a rope!
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 1</DOCNO>
+The Doubloon.
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 2</DOCNO>
+Ere now it has been related how Ahab was wont to pace his
+quarter-deck, taking regular turns at either limit, the binnacle and
+mainmast; but in the multiplicity of other things requiring narration
+it has not been added how that sometimes in these walks, when most
+plunged in his mood, he was wont to pause in turn at each spot, and
+stand there strangely eyeing the particular object before him.  When
+he halted before the binnacle, with his glance fastened on the
+pointed needle in the compass, that glance shot like a javelin with
+the pointed intensity of his purpose; and when resuming his walk he
+again paused before the mainmast, then, as the same riveted glance
+fastened upon the riveted gold coin there, he still wore the same
+aspect of nailed firmness, only dashed with a certain wild longing,
+if not hopefulness.
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 3</DOCNO>
+But one morning, turning to pass the doubloon, he seemed to be newly
+attracted by the strange figures and inscriptions stamped on it, as
+though now for the first time beginning to interpret for himself in
+some monomaniac way whatever significance might lurk in them.  And
+some certain significance lurks in all things, else all things are
+little worth, and the round world itself but an empty cipher, except
+to sell by the cartload, as they do hills about Boston, to fill up
+some morass in the Milky Way.
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 4</DOCNO>
+Now this doubloon was of purest, virgin gold, raked somewhere out of
+the heart of gorgeous hills, whence, east and west, over golden
+sands, the head-waters of many a Pactolus flows.  And though now
+nailed amidst all the rustiness of iron bolts and the verdigris of
+copper spikes, yet, untouchable and immaculate to any foulness, it
+still preserved its Quito glow.  Nor, though placed amongst a
+ruthless crew and every hour passed by ruthless hands, and through
+the livelong nights shrouded with thick darkness which might cover
+any pilfering approach, nevertheless every sunrise found the doubloon
+where the sunset left it last.  For it was set apart and sanctified
+to one awe-striking end; and however wanton in their sailor ways, one
+and all, the mariners revered it as the white whale's talisman.
+Sometimes they talked it over in the weary watch by night, wondering
+whose it was to be at last, and whether he would ever live to spend
+it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 5</DOCNO>
+Now those noble golden coins of South America are as medals of the
+sun and tropic token-pieces.  Here palms, alpacas, and volcanoes;
+sun's disks and stars; ecliptics, horns-of-plenty, and rich banners
+waving, are in luxuriant profusion stamped; so that the precious gold
+seems almost to derive an added preciousness and enhancing glories,
+by passing through those fancy mints, so Spanishly poetic.
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 6</DOCNO>
+It so chanced that the doubloon of the Pequod was a most wealthy
+example of these things.  On its round border it bore the letters,
+REPUBLICA DEL ECUADOR: QUITO.  So this bright coin came from a
+country planted in the middle of the world, and beneath the great
+equator, and named after it; and it had been cast midway up the
+Andes, in the unwaning clime that knows no autumn.  Zoned by those
+letters you saw the likeness of three Andes' summits; from one a
+flame; a tower on another; on the third a crowing cock; while arching
+over all was a segment of the partitioned zodiac, the signs all
+marked with their usual cabalistics, and the keystone sun entering
+the equinoctial point at Libra.
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 7</DOCNO>
+Before this equatorial coin, Ahab, not unobserved by others, was now
+pausing.
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 8</DOCNO>
+"There's something ever egotistical in mountain-tops and towers, and
+all other grand and lofty things; look here,--three peaks as proud as
+Lucifer.  The firm tower, that is Ahab; the volcano, that is Ahab;
+the courageous, the undaunted, and victorious fowl, that, too, is
+Ahab; all are Ahab; and this round gold is but the image of the
+rounder globe, which, like a magician's glass, to each and every man
+in turn but mirrors back his own mysterious self.  Great pains, small
+gains for those who ask the world to solve them; it cannot solve
+itself.  Methinks now this coined sun wears a ruddy face; but see!
+aye, he enters the sign of storms, the equinox! and but six months
+before he wheeled out of a former equinox at Aries!  From storm to
+storm!  So be it, then.  Born in throes, 't is fit that man should
+live in pains and die in pangs!  So be it, then!  Here's stout stuff
+for woe to work on.  So be it, then."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 9</DOCNO>
+"No fairy fingers can have pressed the gold, but devil's claws must have
+left their mouldings there since yesterday," murmured Starbuck to
+himself, leaning against the bulwarks.  "The old man seems to read
+Belshazzar's awful writing.  I have never marked the coin
+inspectingly.  He goes below; let me read.  A dark valley between
+three mighty, heaven-abiding peaks, that almost seem the Trinity, in
+some faint earthly symbol.  So in this vale of Death, God girds us
+round; and over all our gloom, the sun of Righteousness still shines
+a beacon and a hope.  If we bend down our eyes, the dark vale shows
+her mouldy soil; but if we lift them, the bright sun meets our glance
+half way, to cheer.  Yet, oh, the great sun is no fixture; and if, at
+midnight, we would fain snatch some sweet solace from him, we gaze
+for him in vain!  This coin speaks wisely, mildly, truly, but still
+sadly to me.  I will quit it, lest Truth shake me falsely."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 10</DOCNO>
+"There now's the old Mogul," soliloquized Stubb by the try-works,
+"he's been twigging it; and there goes Starbuck from the same, and
+both with faces which I should say might be somewhere within nine
+fathoms long.  And all from looking at a piece of gold, which did I
+have it now on Negro Hill or in Corlaer's Hook, I'd not look at it
+very long ere spending it.  Humph! in my poor, insignificant opinion,
+I regard this as queer.  I have seen doubloons before now in my
+voyagings; your doubloons of old Spain, your doubloons of Peru, your
+doubloons of Chili, your doubloons of Bolivia, your doubloons of
+Popayan; with plenty of gold moidores and pistoles, and joes, and
+half joes, and quarter joes.  What then should there be in this
+doubloon of the Equator that is so killing wonderful?  By Golconda!
+let me read it once.  Halloa! here's signs and wonders truly!  That,
+now, is what old Bowditch in his Epitome calls the zodiac, and what
+my almanac below calls ditto.  I'll get the almanac and as I have
+heard devils can be raised with Daboll's arithmetic, I'll try my hand
+at raising a meaning out of these queer curvicues here with the
+Massachusetts calendar.  Here's the book.  Let's see now.  Signs and
+wonders; and the sun, he's always among 'em.  Hem, hem, hem; here
+they are--here they go--all alive:--Aries, or the Ram; Taurus, or the
+Bull and Jimimi! here's Gemini himself, or the Twins.  Well; the sun
+he wheels among 'em.  Aye, here on the coin he's just crossing the
+threshold between two of twelve sitting-rooms all in a ring.  Book!
+you lie there; the fact is, you books must know your places.  You'll
+do to give us the bare words and facts, but we come in to supply the
+thoughts.  That's my small experience, so far as the Massachusetts
+calendar, and Bowditch's navigator, and Daboll's arithmetic go.
+Signs and wonders, eh?  Pity if there is nothing wonderful in signs,
+and significant in wonders!  There's a clue somewhere; wait a bit;
+hist--hark!  By Jove, I have it!  Look you, Doubloon, your zodiac
+here is the life of man in one round chapter; and now I'll read it
+off, straight out of the book.  Come, Almanack!  To begin: there's
+Aries, or the Ram--lecherous dog, he begets us; then, Taurus, or the
+Bull--he bumps us the first thing; then Gemini, or the Twins--that
+is, Virtue and Vice; we try to reach Virtue, when lo! comes Cancer
+the Crab, and drags us back; and here, going from Virtue, Leo, a
+roaring Lion, lies in the path--he gives a few fierce bites and surly
+dabs with his paw; we escape, and hail Virgo, the Virgin! that's our
+first love; we marry and think to be happy for aye, when pop comes
+Libra, or the Scales--happiness weighed and found wanting; and while
+we are very sad about that, Lord! how we suddenly jump, as Scorpio,
+or the Scorpion, stings us in the rear; we are curing the wound, when
+whang come the arrows all round; Sagittarius, or the Archer, is
+amusing himself.  As we pluck out the shafts, stand aside! here's
+the battering-ram, Capricornus, or the Goat; full tilt, he comes
+rushing, and headlong we are tossed; when Aquarius, or the
+Water-bearer, pours out his whole deluge and drowns us; and to wind
+up with Pisces, or the Fishes, we sleep.  There's a sermon now, writ
+in high heaven, and the sun goes through it every year, and yet comes
+out of it all alive and hearty.  Jollily he, aloft there, wheels
+through toil and trouble; and so, alow here, does jolly Stubb.  Oh,
+jolly's the word for aye!  Adieu, Doubloon!  But stop; here comes
+little King-Post; dodge round the try-works, now, and let's hear what
+he'll have to say.  There; he's before it; he'll out with something
+presently.  So, so; he's beginning."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 11</DOCNO>
+"I see nothing here, but a round thing made of gold, and whoever
+raises a certain whale, this round thing belongs to him.  So, what's
+all this staring been about?  It is worth sixteen dollars, that's
+true; and at two cents the cigar, that's nine hundred and sixty
+cigars.  I won't smoke dirty pipes like Stubb, but I like cigars, and
+here's nine hundred and sixty of them; so here goes Flask aloft to
+spy 'em out."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 12</DOCNO>
+"Shall I call that wise or foolish, now; if it be really wise it has
+a foolish look to it; yet, if it be really foolish, then has it a
+sort of wiseish look to it.  But, avast; here comes our old
+Manxman--the old hearse-driver, he must have been, that is, before he
+took to the sea.  He luffs up before the doubloon; halloa, and goes
+round on the other side of the mast; why, there's a horse-shoe nailed
+on that side; and now he's back again; what does that mean?  Hark!
+he's muttering--voice like an old worn-out coffee-mill.  Prick ears,
+and listen!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 13</DOCNO>
+"If the White Whale be raised, it must be in a month and a day, when
+the sun stands in some one of these signs.  I've studied signs, and
+know their marks; they were taught me two score years ago, by the old
+witch in Copenhagen.  Now, in what sign will the sun then be?  The
+horse-shoe sign; for there it is, right opposite the gold.  And
+what's the horse-shoe sign?  The lion is the horse-shoe sign--the
+roaring and devouring lion.  Ship, old ship! my old head shakes to
+think of thee."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 14</DOCNO>
+"There's another rendering now; but still one text.  All sorts of men
+in one kind of world, you see.  Dodge again! here comes Queequeg--all
+tattooing--looks like the signs of the Zodiac himself.  What says the
+Cannibal?  As I live he's comparing notes; looking at his thigh bone;
+thinks the sun is in the thigh, or in the calf, or in the bowels, I
+suppose, as the old women talk Surgeon's Astronomy in the back
+country.  And by Jove, he's found something there in the vicinity of
+his thigh--I guess it's Sagittarius, or the Archer.  No: he don't
+know what to make of the doubloon; he takes it for an old button off
+some king's trowsers.  But, aside again! here comes that ghost-devil,
+Fedallah; tail coiled out of sight as usual, oakum in the toes of his
+pumps as usual.  What does he say, with that look of his?  Ah, only
+makes a sign to the sign and bows himself; there is a sun on the
+coin--fire worshipper, depend upon it.  Ho! more and more.  This way
+comes Pip--poor boy! would he had died, or I; he's half horrible to
+me.  He too has been watching all of these interpreters--myself
+included--and look now, he comes to read, with that unearthly idiot
+face.  Stand away again and hear him.  Hark!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 15</DOCNO>
+"I look, you look, he looks; we look, ye look, they look."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 16</DOCNO>
+"Upon my soul, he's been studying Murray's Grammar!  Improving his
+mind, poor fellow!  But what's that he says now--hist!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 17</DOCNO>
+"I look, you look, he looks; we look, ye look, they look."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 18</DOCNO>
+"Why, he's getting it by heart--hist! again."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 19</DOCNO>
+"I look, you look, he looks; we look, ye look, they look."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 20</DOCNO>
+"Well, that's funny."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 21</DOCNO>
+"And I, you, and he; and we, ye, and they, are all bats; and I'm a
+crow, especially when I stand a'top of this pine tree here.  Caw!
+caw! caw! caw! caw! caw!  Ain't I a crow?  And where's the
+scare-crow?  There he stands; two bones stuck into a pair of old
+trowsers, and two more poked into the sleeves of an old jacket."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 22</DOCNO>
+"Wonder if he means me?--complimentary!--poor lad!--I could go hang
+myself.  Any way, for the present, I'll quit Pip's vicinity.  I can
+stand the rest, for they have plain wits; but he's too crazy-witty
+for my sanity.  So, so, I leave him muttering."
+</DOC>
+<DOC>
+<DOCNO>Chapter 99, Paragraph 23</DOCNO>
+"Here's the ship's navel, this doubloon here, and they are all on
+fire to unscrew it.  But, unscrew your navel, and what's the
+consequence?  Then again, if it stays here, that is ugly, too, for
+when aught's nailed to the mast it's a sign that things grow
+desperate.  Ha, ha! old Ahab! the White Whale; he'll nail ye!  This
+is a pine tree.  My father, in old Tolland county, cut down a pine
+tree once, and found a silver ring grown over in it; some old
+darkey's wedding ring.  How did it get there?  And so they'll say in
+the resurrection, when they come to fish up this old mast, and find a
+doubloon lodged in it, with bedded oysters for the shaggy bark.  Oh,
+the gold! the precious, precious, gold! the green miser'll hoard ye
+soon!  Hish! hish!  God goes 'mong the worlds blackberrying.  Cook!
+ho, cook! and cook us!  Jenny! hey, hey, hey, hey, hey, Jenny, Jenny!
+and get your hoe-cake done!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 1</DOCNO>
+Leg and Arm.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 2</DOCNO>
+The Pequod, of Nantucket, Meets the Samuel Enderby, of London.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 3</DOCNO>
+"Ship, ahoy!  Hast seen the White Whale?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 4</DOCNO>
+So cried Ahab, once more hailing a ship showing English colours,
+bearing down under the stern.  Trumpet to mouth, the old man was
+standing in his hoisted quarter-boat, his ivory leg plainly revealed
+to the stranger captain, who was carelessly reclining in his own
+boat's bow.  He was a darkly-tanned, burly, good-natured,
+fine-looking man, of sixty or thereabouts, dressed in a spacious
+roundabout, that hung round him in festoons of blue pilot-cloth; and
+one empty arm of this jacket streamed behind him like the broidered
+arm of a hussar's surcoat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 5</DOCNO>
+"Hast seen the White Whale!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 6</DOCNO>
+"See you this?" and withdrawing it from the folds that had hidden
+it, he held up a white arm of sperm whale bone, terminating in a
+wooden head like a mallet.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 7</DOCNO>
+"Man my boat!" cried Ahab, impetuously, and tossing about the oars
+near him--"Stand by to lower!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 8</DOCNO>
+In less than a minute, without quitting his little craft, he and his
+crew were dropped to the water, and were soon alongside of the
+stranger.  But here a curious difficulty presented itself.  In the
+excitement of the moment, Ahab had forgotten that since the loss of
+his leg he had never once stepped on board of any vessel at sea but
+his own, and then it was always by an ingenious and very handy
+mechanical contrivance peculiar to the Pequod, and a thing not to be
+rigged and shipped in any other vessel at a moment's warning.  Now,
+it is no very easy matter for anybody--except those who are almost
+hourly used to it, like whalemen--to clamber up a ship's side from a
+boat on the open sea; for the great swells now lift the boat high up
+towards the bulwarks, and then instantaneously drop it half way down
+to the kelson.  So, deprived of one leg, and the strange ship of
+course being altogether unsupplied with the kindly invention, Ahab
+now found himself abjectly reduced to a clumsy landsman again;
+hopelessly eyeing the uncertain changeful height he could hardly hope
+to attain.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 9</DOCNO>
+It has before been hinted, perhaps, that every little untoward
+circumstance that befell him, and which indirectly sprang from his
+luckless mishap, almost invariably irritated or exasperated Ahab.
+And in the present instance, all this was heightened by the sight of
+the two officers of the strange ship, leaning over the side, by the
+perpendicular ladder of nailed cleets there, and swinging towards him
+a pair of tastefully-ornamented man-ropes; for at first they did not
+seem to bethink them that a one-legged man must be too much of a
+cripple to use their sea bannisters.  But this awkwardness only
+lasted a minute, because the strange captain, observing at a glance
+how affairs stood, cried out, "I see, I see!--avast heaving there!
+Jump, boys, and swing over the cutting-tackle."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 10</DOCNO>
+As good luck would have it, they had had a whale alongside a day or
+two previous, and the great tackles were still aloft, and the massive
+curved blubber-hook, now clean and dry, was still attached to the
+end.  This was quickly lowered to Ahab, who at once comprehending it
+all, slid his solitary thigh into the curve of the hook (it was like
+sitting in the fluke of an anchor, or the crotch of an apple tree),
+and then giving the word, held himself fast, and at the same time
+also helped to hoist his own weight, by pulling hand-over-hand upon
+one of the running parts of the tackle.  Soon he was carefully swung
+inside the high bulwarks, and gently landed upon the capstan head.
+With his ivory arm frankly thrust forth in welcome, the other captain
+advanced, and Ahab, putting out his ivory leg, and crossing the ivory
+arm (like two sword-fish blades) cried out in his walrus way, "Aye,
+aye, hearty! let us shake bones together!--an arm and a leg!--an arm
+that never can shrink, d'ye see; and a leg that never can run.  Where
+did'st thou see the White Whale?--how long ago?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 11</DOCNO>
+"The White Whale," said the Englishman, pointing his ivory arm
+towards the East, and taking a rueful sight along it, as if it had
+been a telescope; "there I saw him, on the Line, last season."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 12</DOCNO>
+"And he took that arm off, did he?" asked Ahab, now sliding down from
+the capstan, and resting on the Englishman's shoulder, as he did so.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 13</DOCNO>
+"Aye, he was the cause of it, at least; and that leg, too?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 14</DOCNO>
+"Spin me the yarn," said Ahab; "how was it?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 15</DOCNO>
+"It was the first time in my life that I ever cruised on the Line,"
+began the Englishman.  "I was ignorant of the White Whale at that
+time.  Well, one day we lowered for a pod of four or five whales, and
+my boat fastened to one of them; a regular circus horse he was, too,
+that went milling and milling round so, that my boat's crew could
+only trim dish, by sitting all their sterns on the outer gunwale.
+Presently up breaches from the bottom of the sea a bouncing great
+whale, with a milky-white head and hump, all crows' feet and
+wrinkles."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 16</DOCNO>
+"It was he, it was he!" cried Ahab, suddenly letting out his
+suspended breath.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 17</DOCNO>
+"And harpoons sticking in near his starboard fin."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 18</DOCNO>
+"Aye, aye--they were mine--MY irons," cried Ahab, exultingly--"but
+on!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 19</DOCNO>
+"Give me a chance, then," said the Englishman, good-humoredly.
+"Well, this old great-grandfather, with the white head and hump, runs
+all afoam into the pod, and goes to snapping furiously at my
+fast-line!
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 20</DOCNO>
+"Aye, I see!--wanted to part it; free the fast-fish--an old trick--I
+know him."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 21</DOCNO>
+"How it was exactly," continued the one-armed commander, "I do not
+know; but in biting the line, it got foul of his teeth, caught there
+somehow; but we didn't know it then; so that when we afterwards
+pulled on the line, bounce we came plump on to his hump! instead of
+the other whale's; that went off to windward, all fluking.  Seeing
+how matters stood, and what a noble great whale it was--the noblest
+and biggest I ever saw, sir, in my life--I resolved to capture him,
+spite of the boiling rage he seemed to be in.  And thinking the
+hap-hazard line would get loose, or the tooth it was tangled to
+might draw (for I have a devil of a boat's crew for a pull on a
+whale-line); seeing all this, I say, I jumped into my first mate's
+boat--Mr. Mounttop's here (by the way, Captain--Mounttop;
+Mounttop--the captain);--as I was saying, I jumped into Mounttop's
+boat, which, d'ye see, was gunwale and gunwale with mine, then; and
+snatching the first harpoon, let this old great-grandfather have it.
+But, Lord, look you, sir--hearts and souls alive, man--the next
+instant, in a jiff, I was blind as a bat--both eyes out--all befogged
+and bedeadened with black foam--the whale's tail looming straight up
+out of it, perpendicular in the air, like a marble steeple.  No use
+sterning all, then; but as I was groping at midday, with a blinding
+sun, all crown-jewels; as I was groping, I say, after the second
+iron, to toss it overboard--down comes the tail like a Lima tower,
+cutting my boat in two, leaving each half in splinters; and, flukes
+first, the white hump backed through the wreck, as though it was all
+chips.  We all struck out.  To escape his terrible flailings, I
+seized hold of my harpoon-pole sticking in him, and for a moment
+clung to that like a sucking fish.  But a combing sea dashed me off,
+and at the same instant, the fish, taking one good dart forwards,
+went down like a flash; and the barb of that cursed second iron
+towing along near me caught me here" (clapping his hand just below
+his shoulder); "yes, caught me just here, I say, and bore me down to
+Hell's flames, I was thinking; when, when, all of a sudden, thank the
+good God, the barb ript its way along the flesh--clear along the
+whole length of my arm--came out nigh my wrist, and up I
+floated;--and that gentleman there will tell you the rest (by the
+way, captain--Dr. Bunger, ship's surgeon: Bunger, my lad,--the
+captain).  Now, Bunger boy, spin your part of the yarn."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 22</DOCNO>
+The professional gentleman thus familiarly pointed out, had been all
+the time standing near them, with nothing specific visible, to denote
+his gentlemanly rank on board.  His face was an exceedingly round but
+sober one; he was dressed in a faded blue woollen frock or shirt, and
+patched trowsers; and had thus far been dividing his attention
+between a marlingspike he held in one hand, and a pill-box held in
+the other, occasionally casting a critical glance at the ivory limbs
+of the two crippled captains.  But, at his superior's introduction of
+him to Ahab, he politely bowed, and straightway went on to do his
+captain's bidding.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 23</DOCNO>
+"It was a shocking bad wound," began the whale-surgeon; "and, taking
+my advice, Captain Boomer here, stood our old Sammy--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 24</DOCNO>
+"Samuel Enderby is the name of my ship," interrupted the one-armed
+captain, addressing Ahab; "go on, boy."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 25</DOCNO>
+"Stood our old Sammy off to the northward, to get out of the blazing
+hot weather there on the Line.  But it was no use--I did all I could;
+sat up with him nights; was very severe with him in the matter of
+diet--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 26</DOCNO>
+"Oh, very severe!" chimed in the patient himself; then suddenly
+altering his voice, "Drinking hot rum toddies with me every night,
+till he couldn't see to put on the bandages; and sending me to bed,
+half seas over, about three o'clock in the morning.  Oh, ye stars! he
+sat up with me indeed, and was very severe in my diet.  Oh! a great
+watcher, and very dietetically severe, is Dr. Bunger. (Bunger, you
+dog, laugh out! why don't ye?  You know you're a precious jolly
+rascal.) But, heave ahead, boy, I'd rather be killed by you than kept
+alive by any other man."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 27</DOCNO>
+"My captain, you must have ere this perceived, respected sir"--said
+the imperturbable godly-looking Bunger, slightly bowing to Ahab--"is
+apt to be facetious at times; he spins us many clever things of that
+sort.  But I may as well say--en passant, as the French remark--that
+I myself--that is to say, Jack Bunger, late of the reverend
+clergy--am a strict total abstinence man; I never drink--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 28</DOCNO>
+"Water!" cried the captain; "he never drinks it; it's a sort of fits
+to him; fresh water throws him into the hydrophobia; but go on--go on
+with the arm story."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 29</DOCNO>
+"Yes, I may as well," said the surgeon, coolly.  "I was about
+observing, sir, before Captain Boomer's facetious interruption, that
+spite of my best and severest endeavors, the wound kept getting worse
+and worse; the truth was, sir, it was as ugly gaping wound as surgeon
+ever saw; more than two feet and several inches long.  I measured it
+with the lead line.  In short, it grew black; I knew what was
+threatened, and off it came.  But I had no hand in shipping that
+ivory arm there; that thing is against all rule"--pointing at it with
+the marlingspike--"that is the captain's work, not mine; he ordered
+the carpenter to make it; he had that club-hammer there put to the
+end, to knock some one's brains out with, I suppose, as he tried mine
+once.  He flies into diabolical passions sometimes.  Do ye see this
+dent, sir"--removing his hat, and brushing aside his hair, and
+exposing a bowl-like cavity in his skull, but which bore not the
+slightest scarry trace, or any token of ever having been a
+wound--"Well, the captain there will tell you how that came here;
+he knows."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 30</DOCNO>
+"No, I don't," said the captain, "but his mother did; he was born
+with it.  Oh, you solemn rogue, you--you Bunger! was there ever such
+another Bunger in the watery world?  Bunger, when you die, you ought
+to die in pickle, you dog; you should be preserved to future ages,
+you rascal."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 31</DOCNO>
+"What became of the White Whale?" now cried Ahab, who thus far had
+been impatiently listening to this by-play between the two
+Englishmen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 32</DOCNO>
+"Oh!" cried the one-armed captain, "oh, yes!  Well; after he sounded,
+we didn't see him again for some time; in fact, as I before hinted, I
+didn't then know what whale it was that had served me such a trick,
+till some time afterwards, when coming back to the Line, we heard
+about Moby Dick--as some call him--and then I knew it was he."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 33</DOCNO>
+"Did'st thou cross his wake again?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 34</DOCNO>
+"Twice."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 35</DOCNO>
+"But could not fasten?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 36</DOCNO>
+"Didn't want to try to: ain't one limb enough?  What should I do
+without this other arm?  And I'm thinking Moby Dick doesn't bite so
+much as he swallows."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 37</DOCNO>
+"Well, then," interrupted Bunger, "give him your left arm for bait to
+get the right.  Do you know, gentlemen"--very gravely and
+mathematically bowing to each Captain in succession--"Do you know,
+gentlemen, that the digestive organs of the whale are so inscrutably
+constructed by Divine Providence, that it is quite impossible for him
+to completely digest even a man's arm?  And he knows it too.  So that
+what you take for the White Whale's malice is only his awkwardness.
+For he never means to swallow a single limb; he only thinks to
+terrify by feints.  But sometimes he is like the old juggling fellow,
+formerly a patient of mine in Ceylon, that making believe swallow
+jack-knives, once upon a time let one drop into him in good earnest,
+and there it stayed for a twelvemonth or more; when I gave him an
+emetic, and he heaved it up in small tacks, d'ye see.  No possible
+way for him to digest that jack-knife, and fully incorporate it into
+his general bodily system.  Yes, Captain Boomer, if you are quick
+enough about it, and have a mind to pawn one arm for the sake of the
+privilege of giving decent burial to the other, why in that case
+the arm is yours; only let the whale have another chance at you
+shortly, that's all."
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 38</DOCNO>
+"No, thank ye, Bunger," said the English Captain, "he's welcome to
+the arm he has, since I can't help it, and didn't know him then; but
+not to another one.  No more White Whales for me; I've lowered for
+him once, and that has satisfied me.  There would be great glory in
+killing him, I know that; and there is a ship-load of precious sperm
+in him, but, hark ye, he's best let alone; don't you think so,
+Captain?"--glancing at the ivory leg.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 39</DOCNO>
+"He is.  But he will still be hunted, for all that.  What is best let
+alone, that accursed thing is not always what least allures.  He's
+all a magnet!  How long since thou saw'st him last?  Which way
+heading?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 40</DOCNO>
+"Bless my soul, and curse the foul fiend's," cried Bunger, stoopingly
+walking round Ahab, and like a dog, strangely snuffing; "this man's
+blood--bring the thermometer!--it's at the boiling point!--his pulse
+makes these planks beat!--sir!"--taking a lancet from his pocket, and
+drawing near to Ahab's arm.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 41</DOCNO>
+"Avast!" roared Ahab, dashing him against the bulwarks--"Man the
+boat!  Which way heading?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 42</DOCNO>
+"Good God!" cried the English Captain, to whom the question was put.
+"What's the matter?  He was heading east, I think.--Is your Captain
+crazy?" whispering Fedallah.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 43</DOCNO>
+But Fedallah, putting a finger on his lip, slid over the bulwarks to
+take the boat's steering oar, and Ahab, swinging the cutting-tackle
+towards him, commanded the ship's sailors to stand by to lower.
+</DOC>
+<DOC>
+<DOCNO>Chapter 100, Paragraph 44</DOCNO>
+In a moment he was standing in the boat's stern, and the Manilla men
+were springing to their oars.  In vain the English Captain hailed
+him.  With back to the stranger ship, and face set like a flint to
+his own, Ahab stood upright till alongside of the Pequod.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 1</DOCNO>
+The Decanter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 2</DOCNO>
+Ere the English ship fades from sight, be it set down here, that she
+hailed from London, and was named after the late Samuel Enderby,
+merchant of that city, the original of the famous whaling house of
+Enderby & Sons; a house which in my poor whaleman's opinion, comes
+not far behind the united royal houses of the Tudors and Bourbons, in
+point of real historical interest.  How long, prior to the year of
+our Lord 1775, this great whaling house was in existence, my numerous
+fish-documents do not make plain; but in that year (1775) it fitted
+out the first English ships that ever regularly hunted the Sperm
+Whale; though for some score of years previous (ever since 1726) our
+valiant Coffins and Maceys of Nantucket and the Vineyard had in large
+fleets pursued that Leviathan, but only in the North and South
+Atlantic: not elsewhere.  Be it distinctly recorded here, that the
+Nantucketers were the first among mankind to harpoon with civilized
+steel the great Sperm Whale; and that for half a century they were
+the only people of the whole globe who so harpooned him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 3</DOCNO>
+In 1778, a fine ship, the Amelia, fitted out for the express purpose,
+and at the sole charge of the vigorous Enderbys, boldly rounded Cape
+Horn, and was the first among the nations to lower a whale-boat of
+any sort in the great South Sea.  The voyage was a skilful and lucky
+one; and returning to her berth with her hold full of the precious
+sperm, the Amelia's example was soon followed by other ships, English
+and American, and thus the vast Sperm Whale grounds of the Pacific
+were thrown open.  But not content with this good deed, the
+indefatigable house again bestirred itself: Samuel and all his
+Sons--how many, their mother only knows--and under their immediate
+auspices, and partly, I think, at their expense, the British
+government was induced to send the sloop-of-war Rattler on a whaling
+voyage of discovery into the South Sea.  Commanded by a naval
+Post-Captain, the Rattler made a rattling voyage of it, and did some
+service; how much does not appear.  But this is not all.  In 1819,
+the same house fitted out a discovery whale ship of their own, to go
+on a tasting cruise to the remote waters of Japan.  That ship--well
+called the "Syren"--made a noble experimental cruise; and it was thus
+that the great Japanese Whaling Ground first became generally known.
+The Syren in this famous voyage was commanded by a Captain Coffin, a
+Nantucketer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 4</DOCNO>
+All honour to the Enderbies, therefore, whose house, I think, exists
+to the present day; though doubtless the original Samuel must long
+ago have slipped his cable for the great South Sea of the other
+world.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 5</DOCNO>
+The ship named after him was worthy of the honour, being a very fast
+sailer and a noble craft every way.  I boarded her once at midnight
+somewhere off the Patagonian coast, and drank good flip down in the
+forecastle.  It was a fine gam we had, and they were all
+trumps--every soul on board.  A short life to them, and a jolly
+death.  And that fine gam I had--long, very long after old Ahab
+touched her planks with his ivory heel--it minds me of the noble,
+solid, Saxon hospitality of that ship; and may my parson forget me,
+and the devil remember me, if I ever lose sight of it.  Flip?  Did I
+say we had flip?  Yes, and we flipped it at the rate of ten gallons
+the hour; and when the squall came (for it's squally off there by
+Patagonia), and all hands--visitors and all--were called to reef
+topsails, we were so top-heavy that we had to swing each other aloft
+in bowlines; and we ignorantly furled the skirts of our jackets into
+the sails, so that we hung there, reefed fast in the howling gale, a
+warning example to all drunken tars.  However, the masts did not go
+overboard; and by and by we scrambled down, so sober, that we had to
+pass the flip again, though the savage salt spray bursting down the
+forecastle scuttle, rather too much diluted and pickled it to my
+taste.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 6</DOCNO>
+The beef was fine--tough, but with body in it.  They said it was
+bull-beef; others, that it was dromedary beef; but I do not know, for
+certain, how that was.  They had dumplings too; small, but
+substantial, symmetrically globular, and indestructible dumplings.  I
+fancied that you could feel them, and roll them about in you after
+they were swallowed.  If you stooped over too far forward, you risked
+their pitching out of you like billiard-balls.  The bread--but that
+couldn't be helped; besides, it was an anti-scorbutic; in short, the
+bread contained the only fresh fare they had.  But the forecastle was
+not very light, and it was very easy to step over into a dark corner
+when you ate it.  But all in all, taking her from truck to helm,
+considering the dimensions of the cook's boilers, including his own
+live parchment boilers; fore and aft, I say, the Samuel Enderby was a
+jolly ship; of good fare and plenty; fine flip and strong; crack
+fellows all, and capital from boot heels to hat-band.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 7</DOCNO>
+But why was it, think ye, that the Samuel Enderby, and some other
+English whalers I know of--not all though--were such famous,
+hospitable ships; that passed round the beef, and the bread, and the
+can, and the joke; and were not soon weary of eating, and drinking,
+and laughing?  I will tell you.  The abounding good cheer of these
+English whalers is matter for historical research.  Nor have I been
+at all sparing of historical whale research, when it has seemed
+needed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 8</DOCNO>
+The English were preceded in the whale fishery by the Hollanders,
+Zealanders, and Danes; from whom they derived many terms still extant
+in the fishery; and what is yet more, their fat old fashions,
+touching plenty to eat and drink.  For, as a general thing, the
+English merchant-ship scrimps her crew; but not so the English
+whaler.  Hence, in the English, this thing of whaling good cheer is
+not normal and natural, but incidental and particular; and,
+therefore, must have some special origin, which is here pointed out,
+and will be still further elucidated.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 9</DOCNO>
+During my researches in the Leviathanic histories, I stumbled upon an
+ancient Dutch volume, which, by the musty whaling smell of it, I knew
+must be about whalers.  The title was, "Dan Coopman," wherefore I
+concluded that this must be the invaluable memoirs of some Amsterdam
+cooper in the fishery, as every whale ship must carry its cooper.  I
+was reinforced in this opinion by seeing that it was the production
+of one "Fitz Swackhammer."  But my friend Dr. Snodhead, a very
+learned man, professor of Low Dutch and High German in the college of
+Santa Claus and St. Pott's, to whom I handed the work for
+translation, giving him a box of sperm candles for his trouble--this
+same Dr. Snodhead, so soon as he spied the book, assured me that "Dan
+Coopman" did not mean "The Cooper," but "The Merchant."  In short,
+this ancient and learned Low Dutch book treated of the commerce of
+Holland; and, among other subjects, contained a very interesting
+account of its whale fishery.  And in this chapter it was, headed,
+"Smeer," or "Fat," that I found a long detailed list of the outfits
+for the larders and cellars of 180 sail of Dutch whalemen; from which
+list, as translated by Dr. Snodhead, I transcribe the following:
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 10</DOCNO>
+400,000 lbs. of beef.
+60,000 lbs. Friesland pork.
+150,000 lbs. of stock fish.
+550,000 lbs. of biscuit.
+72,000 lbs. of soft bread.
+2,800 firkins of butter.
+20,000 lbs. Texel & Leyden cheese.
+144,000 lbs. cheese (probably an inferior article).
+550 ankers of Geneva.
+10,800 barrels of beer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 11</DOCNO>
+Most statistical tables are parchingly dry in the reading; not so in
+the present case, however, where the reader is flooded with whole
+pipes, barrels, quarts, and gills of good gin and good cheer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 12</DOCNO>
+At the time, I devoted three days to the studious digesting of all
+this beer, beef, and bread, during which many profound thoughts were
+incidentally suggested to me, capable of a transcendental and
+Platonic application; and, furthermore, I compiled supplementary
+tables of my own, touching the probable quantity of stock-fish, etc.,
+consumed by every Low Dutch harpooneer in that ancient Greenland and
+Spitzbergen whale fishery.  In the first place, the amount of butter,
+and Texel and Leyden cheese consumed, seems amazing.  I impute it,
+though, to their naturally unctuous natures, being rendered still
+more unctuous by the nature of their vocation, and especially by
+their pursuing their game in those frigid Polar Seas, on the very
+coasts of that Esquimaux country where the convivial natives pledge
+each other in bumpers of train oil.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 13</DOCNO>
+The quantity of beer, too, is very large, 10,800 barrels.  Now,
+as those polar fisheries could only be prosecuted in the short summer
+of that climate, so that the whole cruise of one of these Dutch
+whalemen, including the short voyage to and from the Spitzbergen sea,
+did not much exceed three months, say, and reckoning 30 men to each
+of their fleet of 180 sail, we have 5,400 Low Dutch seamen in all;
+therefore, I say, we have precisely two barrels of beer per man, for
+a twelve weeks' allowance, exclusive of his fair proportion of that
+550 ankers of gin.  Now, whether these gin and beer harpooneers, so
+fuddled as one might fancy them to have been, were the right sort of
+men to stand up in a boat's head, and take good aim at flying whales;
+this would seem somewhat improbable.  Yet they did aim at them, and
+hit them too.  But this was very far North, be it remembered, where
+beer agrees well with the constitution; upon the Equator, in our
+southern fishery, beer would be apt to make the harpooneer sleepy at
+the mast-head and boozy in his boat; and grievous loss might ensue to
+Nantucket and New Bedford.
+</DOC>
+<DOC>
+<DOCNO>Chapter 101, Paragraph 14</DOCNO>
+But no more; enough has been said to show that the old Dutch whalers
+of two or three centuries ago were high livers; and that the English
+whalers have not neglected so excellent an example.  For, say they,
+when cruising in an empty ship, if you can get nothing better out of
+the world, get a good dinner out of it, at least.  And this empties
+the decanter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 1</DOCNO>
+A Bower in the Arsacides.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 2</DOCNO>
+Hitherto, in descriptively treating of the Sperm Whale, I have
+chiefly dwelt upon the marvels of his outer aspect; or separately and
+in detail upon some few interior structural features.  But to a large
+and thorough sweeping comprehension of him, it behooves me now to
+unbutton him still further, and untagging the points of his hose,
+unbuckling his garters, and casting loose the hooks and the eyes of
+the joints of his innermost bones, set him before you in his
+ultimatum; that is to say, in his unconditional skeleton.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 3</DOCNO>
+But how now, Ishmael?  How is it, that you, a mere oarsman in the
+fishery, pretend to know aught about the subterranean parts of the
+whale?  Did erudite Stubb, mounted upon your capstan, deliver
+lectures on the anatomy of the Cetacea; and by help of the windlass,
+hold up a specimen rib for exhibition?  Explain thyself, Ishmael.
+Can you land a full-grown whale on your deck for examination, as a
+cook dishes a roast-pig?  Surely not.  A veritable witness have you
+hitherto been, Ishmael; but have a care how you seize the privilege
+of Jonah alone; the privilege of discoursing upon the joists and
+beams; the rafters, ridge-pole, sleepers, and under-pinnings, making
+up the frame-work of leviathan; and belike of the tallow-vats,
+dairy-rooms, butteries, and cheeseries in his bowels.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 4</DOCNO>
+I confess, that since Jonah, few whalemen have penetrated very far
+beneath the skin of the adult whale; nevertheless, I have been
+blessed with an opportunity to dissect him in miniature.  In a ship I
+belonged to, a small cub Sperm Whale was once bodily hoisted to the
+deck for his poke or bag, to make sheaths for the barbs of the
+harpoons, and for the heads of the lances.  Think you I let that
+chance go, without using my boat-hatchet and jack-knife, and breaking
+the seal and reading all the contents of that young cub?
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 5</DOCNO>
+And as for my exact knowledge of the bones of the leviathan in their
+gigantic, full grown development, for that rare knowledge I am
+indebted to my late royal friend Tranquo, king of Tranque, one of
+the Arsacides.  For being at Tranque, years ago, when attached to the
+trading-ship Dey of Algiers, I was invited to spend part of the
+Arsacidean holidays with the lord of Tranque, at his retired palm
+villa at Pupella; a sea-side glen not very far distant from what our
+sailors called Bamboo-Town, his capital.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 6</DOCNO>
+Among many other fine qualities, my royal friend Tranquo, being
+gifted with a devout love for all matters of barbaric vertu, had
+brought together in Pupella whatever rare things the more ingenious
+of his people could invent; chiefly carved woods of wonderful
+devices, chiselled shells, inlaid spears, costly paddles, aromatic
+canoes; and all these distributed among whatever natural wonders, the
+wonder-freighted, tribute-rendering waves had cast upon his shores.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 7</DOCNO>
+Chief among these latter was a great Sperm Whale, which, after an
+unusually long raging gale, had been found dead and stranded, with
+his head against a cocoa-nut tree, whose plumage-like, tufted
+droopings seemed his verdant jet.  When the vast body had at last
+been stripped of its fathom-deep enfoldings, and the bones become
+dust dry in the sun, then the skeleton was carefully transported up
+the Pupella glen, where a grand temple of lordly palms now sheltered
+it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 8</DOCNO>
+The ribs were hung with trophies; the vertebrae were carved with
+Arsacidean annals, in strange hieroglyphics; in the skull, the
+priests kept up an unextinguished aromatic flame, so that the mystic
+head again sent forth its vapoury spout; while, suspended from a
+bough, the terrific lower jaw vibrated over all the devotees, like
+the hair-hung sword that so affrighted Damocles.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 9</DOCNO>
+It was a wondrous sight.  The wood was green as mosses of the Icy
+Glen; the trees stood high and haughty, feeling their living sap; the
+industrious earth beneath was as a weaver's loom, with a gorgeous
+carpet on it, whereof the ground-vine tendrils formed the warp and
+woof, and the living flowers the figures.  All the trees, with all
+their laden branches; all the shrubs, and ferns, and grasses; the
+message-carrying air; all these unceasingly were active.  Through the
+lacings of the leaves, the great sun seemed a flying shuttle weaving
+the unwearied verdure.  Oh, busy weaver! unseen weaver!--pause!--one
+word!--whither flows the fabric? what palace may it deck? wherefore
+all these ceaseless toilings?  Speak, weaver!--stay thy hand!--but
+one single word with thee!  Nay--the shuttle flies--the figures float
+from forth the loom; the freshet-rushing carpet for ever slides
+away.  The weaver-god, he weaves; and by that weaving is he deafened,
+that he hears no mortal voice; and by that humming, we, too, who look
+on the loom are deafened; and only when we escape it shall we hear
+the thousand voices that speak through it.  For even so it is in all
+material factories.  The spoken words that are inaudible among the
+flying spindles; those same words are plainly heard without the
+walls, bursting from the opened casements.  Thereby have villainies
+been detected.  Ah, mortal! then, be heedful; for so, in all this din
+of the great world's loom, thy subtlest thinkings may be overheard
+afar.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 10</DOCNO>
+Now, amid the green, life-restless loom of that Arsacidean wood, the
+great, white, worshipped skeleton lay lounging--a gigantic idler!
+Yet, as the ever-woven verdant warp and woof intermixed and hummed
+around him, the mighty idler seemed the cunning weaver; himself all
+woven over with the vines; every month assuming greener, fresher
+verdure; but himself a skeleton.  Life folded Death; Death trellised
+Life; the grim god wived with youthful Life, and begat him
+curly-headed glories.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 11</DOCNO>
+Now, when with royal Tranquo I visited this wondrous whale, and saw
+the skull an altar, and the artificial smoke ascending from where the
+real jet had issued, I marvelled that the king should regard a chapel
+as an object of vertu.  He laughed.  But more I marvelled that the
+priests should swear that smoky jet of his was genuine.  To and fro I
+paced before this skeleton--brushed the vines aside--broke through
+the ribs--and with a ball of Arsacidean twine, wandered, eddied long
+amid its many winding, shaded colonnades and arbours.  But soon my
+line was out; and following it back, I emerged from the opening where I
+entered.  I saw no living thing within; naught was there but bones.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 12</DOCNO>
+Cutting me a green measuring-rod, I once more dived within the
+skeleton.  From their arrow-slit in the skull, the priests perceived
+me taking the altitude of the final rib, "How now!" they shouted;
+"Dar'st thou measure this our god!  That's for us."  "Aye,
+priests--well, how long do ye make him, then?"  But hereupon a fierce
+contest rose among them, concerning feet and inches; they cracked
+each other's sconces with their yard-sticks--the great skull
+echoed--and seizing that lucky chance, I quickly concluded my own
+admeasurements.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 13</DOCNO>
+These admeasurements I now propose to set before you.  But first, be
+it recorded, that, in this matter, I am not free to utter any fancied
+measurement I please.  Because there are skeleton authorities you
+can refer to, to test my accuracy.  There is a Leviathanic Museum,
+they tell me, in Hull, England, one of the whaling ports of that
+country, where they have some fine specimens of fin-backs and other
+whales.  Likewise, I have heard that in the museum of Manchester, in
+New Hampshire, they have what the proprietors call "the only perfect
+specimen of a Greenland or River Whale in the United States."
+Moreover, at a place in Yorkshire, England, Burton Constable by name,
+a certain Sir Clifford Constable has in his possession the skeleton
+of a Sperm Whale, but of moderate size, by no means of the full-grown
+magnitude of my friend King Tranquo's.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 14</DOCNO>
+In both cases, the stranded whales to which these two skeletons
+belonged, were originally claimed by their proprietors upon similar
+grounds.  King Tranquo seizing his because he wanted it; and Sir
+Clifford, because he was lord of the seignories of those parts.  Sir
+Clifford's whale has been articulated throughout; so that, like a
+great chest of drawers, you can open and shut him, in all his bony
+cavities--spread out his ribs like a gigantic fan--and swing all day
+upon his lower jaw.  Locks are to be put upon some of his trap-doors
+and shutters; and a footman will show round future visitors with a
+bunch of keys at his side.  Sir Clifford thinks of charging twopence
+for a peep at the whispering gallery in the spinal column; threepence
+to hear the echo in the hollow of his cerebellum; and sixpence for
+the unrivalled view from his forehead.
+</DOC>
+<DOC>
+<DOCNO>Chapter 102, Paragraph 15</DOCNO>
+The skeleton dimensions I shall now proceed to set down are copied
+verbatim from my right arm, where I had them tattooed; as in my wild
+wanderings at that period, there was no other secure way of
+preserving such valuable statistics.  But as I was crowded for space,
+and wished the other parts of my body to remain a blank page for a
+poem I was then composing--at least, what untattooed parts might
+remain--I did not trouble myself with the odd inches; nor, indeed,
+should inches at all enter into a congenial admeasurement of the
+whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 1</DOCNO>
+Measurement of The Whale's Skeleton.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 2</DOCNO>
+In the first place, I wish to lay before you a particular, plain
+statement, touching the living bulk of this leviathan, whose skeleton
+we are briefly to exhibit.  Such a statement may prove useful here.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 3</DOCNO>
+According to a careful calculation I have made, and which I partly
+base upon Captain Scoresby's estimate, of seventy tons for the
+largest sized Greenland whale of sixty feet in length; according to
+my careful calculation, I say, a Sperm Whale of the largest
+magnitude, between eighty-five and ninety feet in length, and
+something less than forty feet in its fullest circumference, such a
+whale will weigh at least ninety tons; so that, reckoning thirteen
+men to a ton, he would considerably outweigh the combined population
+of a whole village of one thousand one hundred inhabitants.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 4</DOCNO>
+Think you not then that brains, like yoked cattle, should be put to
+this leviathan, to make him at all budge to any landsman's
+imagination?
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 5</DOCNO>
+Having already in various ways put before you his skull, spout-hole,
+jaw, teeth, tail, forehead, fins, and divers other parts, I shall now
+simply point out what is most interesting in the general bulk of his
+unobstructed bones.  But as the colossal skull embraces so very large
+a proportion of the entire extent of the skeleton; as it is by far
+the most complicated part; and as nothing is to be repeated
+concerning it in this chapter, you must not fail to carry it in your
+mind, or under your arm, as we proceed, otherwise you will not gain a
+complete notion of the general structure we are about to view.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 6</DOCNO>
+In length, the Sperm Whale's skeleton at Tranque measured seventy-two
+Feet; so that when fully invested and extended in life, he must have
+been ninety feet long; for in the whale, the skeleton loses about one
+fifth in length compared with the living body.  Of this seventy-two
+feet, his skull and jaw comprised some twenty feet, leaving some
+fifty feet of plain back-bone.  Attached to this back-bone, for
+something less than a third of its length, was the mighty circular
+basket of ribs which once enclosed his vitals.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 7</DOCNO>
+To me this vast ivory-ribbed chest, with the long, unrelieved spine,
+extending far away from it in a straight line, not a little resembled
+the hull of a great ship new-laid upon the stocks, when only some
+twenty of her naked bow-ribs are inserted, and the keel is otherwise,
+for the time, but a long, disconnected timber.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 8</DOCNO>
+The ribs were ten on a side.  The first, to begin from the neck, was
+nearly six feet long; the second, third, and fourth were each
+successively longer, till you came to the climax of the fifth, or one
+of the middle ribs, which measured eight feet and some inches.  From
+that part, the remaining ribs diminished, till the tenth and last
+only spanned five feet and some inches.  In general thickness, they
+all bore a seemly correspondence to their length.  The middle ribs
+were the most arched.  In some of the Arsacides they are used for
+beams whereon to lay footpath bridges over small streams.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 9</DOCNO>
+In considering these ribs, I could not but be struck anew with the
+circumstance, so variously repeated in this book, that the skeleton
+of the whale is by no means the mould of his invested form.  The
+largest of the Tranque ribs, one of the middle ones, occupied that
+part of the fish which, in life, is greatest in depth.  Now, the
+greatest depth of the invested body of this particular whale must
+have been at least sixteen feet; whereas, the corresponding rib
+measured but little more than eight feet.  So that this rib only
+conveyed half of the true notion of the living magnitude of that
+part.  Besides, for some way, where I now saw but a naked spine, all
+that had been once wrapped round with tons of added bulk in flesh,
+muscle, blood, and bowels.  Still more, for the ample fins, I here
+saw but a few disordered joints; and in place of the weighty and
+majestic, but boneless flukes, an utter blank!
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 10</DOCNO>
+How vain and foolish, then, thought I, for timid untravelled man to
+try to comprehend aright this wondrous whale, by merely poring over
+his dead attenuated skeleton, stretched in this peaceful wood.  No.
+Only in the heart of quickest perils; only when within the eddyings
+of his angry flukes; only on the profound unbounded sea, can the
+fully invested whale be truly and livingly found out.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 11</DOCNO>
+But the spine.  For that, the best way we can consider it is, with a
+crane, to pile its bones high up on end.  No speedy enterprise.  But
+now it's done, it looks much like Pompey's Pillar.
+</DOC>
+<DOC>
+<DOCNO>Chapter 103, Paragraph 12</DOCNO>
+There are forty and odd vertebrae in all, which in the skeleton are
+not locked together.  They mostly lie like the great knobbed blocks
+on a Gothic spire, forming solid courses of heavy masonry.  The
+largest, a middle one, is in width something less than three feet,
+and in depth more than four.  The smallest, where the spine tapers
+away into the tail, is only two inches in width, and looks something
+like a white billiard-ball.  I was told that there were still smaller
+ones, but they had been lost by some little cannibal urchins, the
+priest's children, who had stolen them to play marbles with.  Thus we
+see how that the spine of even the hugest of living things tapers off
+at last into simple child's play.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 1</DOCNO>
+The Fossil Whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 2</DOCNO>
+>From his mighty bulk the whale affords a most congenial theme whereon
+to enlarge, amplify, and generally expatiate.  Would you, you could
+not compress him.  By good rights he should only be treated of in
+imperial folio.  Not to tell over again his furlongs from spiracle to
+tail, and the yards he measures about the waist; only think of the
+gigantic involutions of his intestines, where they lie in him like
+great cables and hawsers coiled away in the subterranean orlop-deck
+of a line-of-battle-ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 3</DOCNO>
+Since I have undertaken to manhandle this Leviathan, it behooves me
+to approve myself omnisciently exhaustive in the enterprise; not
+overlooking the minutest seminal germs of his blood, and spinning him
+out to the uttermost coil of his bowels.  Having already described
+him in most of his present habitatory and anatomical peculiarities,
+it now remains to magnify him in an archaeological, fossiliferous,
+and antediluvian point of view.  Applied to any other creature than
+the Leviathan--to an ant or a flea--such portly terms might justly be
+deemed unwarrantably grandiloquent.  But when Leviathan is the text,
+the case is altered.  Fain am I to stagger to this emprise under
+the weightiest words of the dictionary.  And here be it said, that
+whenever it has been convenient to consult one in the course of these
+dissertations, I have invariably used a huge quarto edition of
+Johnson, expressly purchased for that purpose; because that famous
+lexicographer's uncommon personal bulk more fitted him to compile a
+lexicon to be used by a whale author like me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 4</DOCNO>
+One often hears of writers that rise and swell with their subject,
+though it may seem but an ordinary one.  How, then, with me, writing
+of this Leviathan?  Unconsciously my chirography expands into placard
+capitals.  Give me a condor's quill!  Give me Vesuvius' crater for an
+inkstand!  Friends, hold my arms!  For in the mere act of penning my
+thoughts of this Leviathan, they weary me, and make me faint with
+their outreaching comprehensiveness of sweep, as if to include the
+whole circle of the sciences, and all the generations of whales, and
+men, and mastodons, past, present, and to come, with all the
+revolving panoramas of empire on earth, and throughout the whole
+universe, not excluding its suburbs.  Such, and so magnifying, is the
+virtue of a large and liberal theme!  We expand to its bulk.  To
+produce a mighty book, you must choose a mighty theme.  No great and
+enduring volume can ever be written on the flea, though many there be
+who have tried it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 5</DOCNO>
+Ere entering upon the subject of Fossil Whales, I present my
+credentials as a geologist, by stating that in my miscellaneous time
+I have been a stone-mason, and also a great digger of ditches,
+canals and wells, wine-vaults, cellars, and cisterns of all sorts.
+Likewise, by way of preliminary, I desire to remind the reader, that
+while in the earlier geological strata there are found the fossils of
+monsters now almost completely extinct; the subsequent relics
+discovered in what are called the Tertiary formations seem the
+connecting, or at any rate intercepted links, between the
+antichronical creatures, and those whose remote posterity are said to
+have entered the Ark; all the Fossil Whales hitherto discovered
+belong to the Tertiary period, which is the last preceding the
+superficial formations.  And though none of them precisely answer to
+any known species of the present time, they are yet sufficiently akin
+to them in general respects, to justify their taking rank as
+Cetacean fossils.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 6</DOCNO>
+Detached broken fossils of pre-adamite whales, fragments of their
+bones and skeletons, have within thirty years past, at various
+intervals, been found at the base of the Alps, in Lombardy, in
+France, in England, in Scotland, and in the States of Louisiana,
+Mississippi, and Alabama.  Among the more curious of such remains is
+part of a skull, which in the year 1779 was disinterred in the Rue
+Dauphine in Paris, a short street opening almost directly upon the
+palace of the Tuileries; and bones disinterred in excavating the
+great docks of Antwerp, in Napoleon's time.  Cuvier pronounced these
+fragments to have belonged to some utterly unknown Leviathanic
+species.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 7</DOCNO>
+But by far the most wonderful of all Cetacean relics was the almost
+complete vast skeleton of an extinct monster, found in the year 1842,
+on the plantation of Judge Creagh, in Alabama.  The awe-stricken
+credulous slaves in the vicinity took it for the bones of one of the
+fallen angels.  The Alabama doctors declared it a huge reptile, and
+bestowed upon it the name of Basilosaurus.  But some specimen bones
+of it being taken across the sea to Owen, the English Anatomist, it
+turned out that this alleged reptile was a whale, though of a
+departed species.  A significant illustration of the fact, again and
+again repeated in this book, that the skeleton of the whale furnishes
+but little clue to the shape of his fully invested body.  So Owen
+rechristened the monster Zeuglodon; and in his paper read before the
+London Geological Society, pronounced it, in substance, one of the
+most extraordinary creatures which the mutations of the globe have
+blotted out of existence.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 8</DOCNO>
+When I stand among these mighty Leviathan skeletons, skulls, tusks,
+jaws, ribs, and vertebrae, all characterized by partial resemblances
+to the existing breeds of sea-monsters; but at the same time bearing
+on the other hand similar affinities to the annihilated antichronical
+Leviathans, their incalculable seniors; I am, by a flood, borne back
+to that wondrous period, ere time itself can be said to have begun;
+for time began with man.  Here Saturn's grey chaos rolls over me, and
+I obtain dim, shuddering glimpses into those Polar eternities; when
+wedged bastions of ice pressed hard upon what are now the Tropics;
+and in all the 25,000 miles of this world's circumference, not an
+inhabitable hand's breadth of land was visible.  Then the whole world
+was the whale's; and, king of creation, he left his wake along the
+present lines of the Andes and the Himmalehs.  Who can show a
+pedigree like Leviathan?  Ahab's harpoon had shed older blood than
+the Pharaoh's.  Methuselah seems a school-boy.  I look round to shake
+hands with Shem.  I am horror-struck at this antemosaic, unsourced
+existence of the unspeakable terrors of the whale, which, having been
+before all time, must needs exist after all humane ages are over.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 9</DOCNO>
+But not alone has this Leviathan left his pre-adamite traces in the
+stereotype plates of nature, and in limestone and marl bequeathed his
+ancient bust; but upon Egyptian tablets, whose antiquity seems to
+claim for them an almost fossiliferous character, we find the
+unmistakable print of his fin.  In an apartment of the great temple
+of Denderah, some fifty years ago, there was discovered upon the
+granite ceiling a sculptured and painted planisphere, abounding in
+centaurs, griffins, and dolphins, similar to the grotesque figures
+on the celestial globe of the moderns.  Gliding among them, old
+Leviathan swam as of yore; was there swimming in that planisphere,
+centuries before Solomon was cradled.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 10</DOCNO>
+Nor must there be omitted another strange attestation of the
+antiquity of the whale, in his own osseous post-diluvian reality, as
+set down by the venerable John Leo, the old Barbary traveller.
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 11</DOCNO>
+"Not far from the Sea-side, they have a Temple, the Rafters and Beams
+of which are made of Whale-Bones; for Whales of a monstrous size are
+oftentimes cast up dead upon that shore.  The Common People imagine,
+that by a secret Power bestowed by God upon the temple, no Whale can
+pass it without immediate death.  But the truth of the Matter is,
+that on either side of the Temple, there are Rocks that shoot two
+Miles into the Sea, and wound the Whales when they light upon 'em.
+They keep a Whale's Rib of an incredible length for a Miracle, which
+lying upon the Ground with its convex part uppermost, makes an Arch,
+the Head of which cannot be reached by a Man upon a Camel's Back.
+This Rib (says John Leo) is said to have layn there a hundred Years
+before I saw it.  Their Historians affirm, that a Prophet who
+prophesy'd of Mahomet, came from this Temple, and some do not stand
+to assert, that the Prophet Jonas was cast forth by the Whale at the
+Base of the Temple."
+</DOC>
+<DOC>
+<DOCNO>Chapter 104, Paragraph 12</DOCNO>
+In this Afric Temple of the Whale I leave you, reader, and if you be
+a Nantucketer, and a whaleman, you will silently worship there.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 1</DOCNO>
+Does the Whale's Magnitude Diminish?--Will He Perish?
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 2</DOCNO>
+Inasmuch, then, as this Leviathan comes floundering down upon us from
+the head-waters of the Eternities, it may be fitly inquired, whether,
+in the long course of his generations, he has not degenerated from
+the original bulk of his sires.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 3</DOCNO>
+But upon investigation we find, that not only are the whales of the
+present day superior in magnitude to those whose fossil remains are
+found in the Tertiary system (embracing a distinct geological period
+prior to man), but of the whales found in that Tertiary system, those
+belonging to its latter formations exceed in size those of its
+earlier ones.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 4</DOCNO>
+Of all the pre-adamite whales yet exhumed, by far the largest is the
+Alabama one mentioned in the last chapter, and that was less than
+seventy feet in length in the skeleton.  Whereas, we have already
+seen, that the tape-measure gives seventy-two feet for the skeleton
+of a large sized modern whale.  And I have heard, on whalemen's
+authority, that Sperm Whales have been captured near a hundred feet
+long at the time of capture.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 5</DOCNO>
+But may it not be, that while the whales of the present hour are an
+advance in magnitude upon those of all previous geological periods;
+may it not be, that since Adam's time they have degenerated?
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 6</DOCNO>
+Assuredly, we must conclude so, if we are to credit the accounts of
+such gentlemen as Pliny, and the ancient naturalists generally.  For
+Pliny tells us of Whales that embraced acres of living bulk, and
+Aldrovandus of others which measured eight hundred feet in
+length--Rope Walks and Thames Tunnels of Whales!  And even in the
+days of Banks and Solander, Cooke's naturalists, we find a Danish
+member of the Academy of Sciences setting down certain Iceland Whales
+(reydan-siskur, or Wrinkled Bellies) at one hundred and twenty yards;
+that is, three hundred and sixty feet.  And Lacepede, the French
+naturalist, in his elaborate history of whales, in the very beginning
+of his work (page 3), sets down the Right Whale at one hundred
+metres, three hundred and twenty-eight feet.  And this work was
+published so late as A.D. 1825.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 7</DOCNO>
+But will any whaleman believe these stories?  No.  The whale of
+to-day is as big as his ancestors in Pliny's time.  And if ever I go
+where Pliny is, I, a whaleman (more than he was), will make bold to
+tell him so.  Because I cannot understand how it is, that while the
+Egyptian mummies that were buried thousands of years before even
+Pliny was born, do not measure so much in their coffins as a modern
+Kentuckian in his socks; and while the cattle and other animals
+sculptured on the oldest Egyptian and Nineveh tablets, by the
+relative proportions in which they are drawn, just as plainly prove
+that the high-bred, stall-fed, prize cattle of Smithfield, not only
+equal, but far exceed in magnitude the fattest of Pharaoh's fat kine;
+in the face of all this, I will not admit that of all animals the
+whale alone should have degenerated.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 8</DOCNO>
+But still another inquiry remains; one often agitated by the more
+recondite Nantucketers.  Whether owing to the almost omniscient
+look-outs at the mast-heads of the whaleships, now penetrating even
+through Behring's straits, and into the remotest secret drawers and
+lockers of the world; and the thousand harpoons and lances darted
+along all continental coasts; the moot point is, whether Leviathan
+can long endure so wide a chase, and so remorseless a havoc; whether
+he must not at last be exterminated from the waters, and the last
+whale, like the last man, smoke his last pipe, and then himself
+evaporate in the final puff.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 9</DOCNO>
+Comparing the humped herds of whales with the humped herds of
+buffalo, which, not forty years ago, overspread by tens of thousands
+the prairies of Illinois and Missouri, and shook their iron manes and
+scowled with their thunder-clotted brows upon the sites of populous
+river-capitals, where now the polite broker sells you land at a
+dollar an inch; in such a comparison an irresistible argument would
+seem furnished, to show that the hunted whale cannot now escape
+speedy extinction.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 10</DOCNO>
+But you must look at this matter in every light.  Though so short a
+period ago--not a good lifetime--the census of the buffalo in
+Illinois exceeded the census of men now in London, and though at the
+present day not one horn or hoof of them remains in all that region;
+and though the cause of this wondrous extermination was the spear of
+man; yet the far different nature of the whale-hunt peremptorily
+forbids so inglorious an end to the Leviathan.  Forty men in one ship
+hunting the Sperm Whales for forty-eight months think they have done
+extremely well, and thank God, if at last they carry home the oil of
+forty fish.  Whereas, in the days of the old Canadian and Indian
+hunters and trappers of the West, when the far west (in whose sunset
+suns still rise) was a wilderness and a virgin, the same number of
+moccasined men, for the same number of months, mounted on horse
+instead of sailing in ships, would have slain not forty, but forty
+thousand and more buffaloes; a fact that, if need were, could be
+statistically stated.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 11</DOCNO>
+Nor, considered aright, does it seem any argument in favour of the
+gradual extinction of the Sperm Whale, for example, that in former
+years (the latter part of the last century, say) these Leviathans, in
+small pods, were encountered much oftener than at present, and, in
+consequence, the voyages were not so prolonged, and were also much
+more remunerative.  Because, as has been elsewhere noticed, those
+whales, influenced by some views to safety, now swim the seas in
+immense caravans, so that to a large degree the scattered solitaries,
+yokes, and pods, and schools of other days are now aggregated into
+vast but widely separated, unfrequent armies.  That is all.  And
+equally fallacious seems the conceit, that because the so-called
+whale-bone whales no longer haunt many grounds in former years
+abounding with them, hence that species also is declining.  For they
+are only being driven from promontory to cape; and if one coast is no
+longer enlivened with their jets, then, be sure, some other and
+remoter strand has been very recently startled by the unfamiliar
+spectacle.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 12</DOCNO>
+Furthermore: concerning these last mentioned Leviathans, they have
+two firm fortresses, which, in all human probability, will for ever
+remain impregnable.  And as upon the invasion of their valleys, the
+frosty Swiss have retreated to their mountains; so, hunted from the
+savannas and glades of the middle seas, the whale-bone whales can at
+last resort to their Polar citadels, and diving under the ultimate
+glassy barriers and walls there, come up among icy fields and floes;
+and in a charmed circle of everlasting December, bid defiance to all
+pursuit from man.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 13</DOCNO>
+But as perhaps fifty of these whale-bone whales are harpooned for one
+cachalot, some philosophers of the forecastle have concluded that
+this positive havoc has already very seriously diminished their
+battalions.  But though for some time past a number of these whales,
+not less than 13,000, have been annually slain on the nor'-west
+coast by the Americans alone; yet there are considerations which
+render even this circumstance of little or no account as an opposing
+argument in this matter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 14</DOCNO>
+Natural as it is to be somewhat incredulous concerning the
+populousness of the more enormous creatures of the globe, yet what
+shall we say to Harto, the historian of Goa, when he tells us that at
+one hunting the King of Siam took 4,000 elephants; that in those
+regions elephants are numerous as droves of cattle in the temperate
+climes.  And there seems no reason to doubt that if these elephants,
+which have now been hunted for thousands of years, by Semiramis, by
+Porus, by Hannibal, and by all the successive monarchs of the
+East--if they still survive there in great numbers, much more may the
+great whale outlast all hunting, since he has a pasture to expatiate
+in, which is precisely twice as large as all Asia, both Americas,
+Europe and Africa, New Holland, and all the Isles of the sea
+combined.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 15</DOCNO>
+Moreover: we are to consider, that from the presumed great longevity
+of whales, their probably attaining the age of a century and more,
+therefore at any one period of time, several distinct adult
+generations must be contemporary.  And what that is, we may soon
+gain some idea of, by imagining all the grave-yards, cemeteries, and
+family vaults of creation yielding up the live bodies of all the men,
+women, and children who were alive seventy-five years ago; and adding
+this countless host to the present human population of the globe.
+</DOC>
+<DOC>
+<DOCNO>Chapter 105, Paragraph 16</DOCNO>
+Wherefore, for all these things, we account the whale immortal in his
+species, however perishable in his individuality.  He swam the seas
+before the continents broke water; he once swam over the site of the
+Tuileries, and Windsor Castle, and the Kremlin.  In Noah's flood he
+despised Noah's Ark; and if ever the world is to be again flooded,
+like the Netherlands, to kill off its rats, then the eternal whale
+will still survive, and rearing upon the topmost crest of the
+equatorial flood, spout his frothed defiance to the skies.
+</DOC>
+<DOC>
+<DOCNO>Chapter 106, Paragraph 1</DOCNO>
+Ahab's Leg.
+</DOC>
+<DOC>
+<DOCNO>Chapter 106, Paragraph 2</DOCNO>
+The precipitating manner in which Captain Ahab had quitted the Samuel
+Enderby of London, had not been unattended with some small violence
+to his own person.  He had lighted with such energy upon a thwart of
+his boat that his ivory leg had received a half-splintering shock.
+And when after gaining his own deck, and his own pivot-hole there, he
+so vehemently wheeled round with an urgent command to the steersman
+(it was, as ever, something about his not steering inflexibly
+enough); then, the already shaken ivory received such an additional
+twist and wrench, that though it still remained entire, and to all
+appearances lusty, yet Ahab did not deem it entirely trustworthy.
+</DOC>
+<DOC>
+<DOCNO>Chapter 106, Paragraph 3</DOCNO>
+And, indeed, it seemed small matter for wonder, that for all his
+pervading, mad recklessness, Ahab did at times give careful heed to
+the condition of that dead bone upon which he partly stood.  For it
+had not been very long prior to the Pequod's sailing from Nantucket,
+that he had been found one night lying prone upon the ground, and
+insensible; by some unknown, and seemingly inexplicable, unimaginable
+casualty, his ivory limb having been so violently displaced, that it
+had stake-wise smitten, and all but pierced his groin; nor was it
+without extreme difficulty that the agonizing wound was entirely
+cured.
+</DOC>
+<DOC>
+<DOCNO>Chapter 106, Paragraph 4</DOCNO>
+Nor, at the time, had it failed to enter his monomaniac mind, that
+all the anguish of that then present suffering was but the direct
+issue of a former woe; and he too plainly seemed to see, that as the
+most poisonous reptile of the marsh perpetuates his kind as
+inevitably as the sweetest songster of the grove; so, equally with
+every felicity, all miserable events do naturally beget their like.
+Yea, more than equally, thought Ahab; since both the ancestry and
+posterity of Grief go further than the ancestry and posterity of Joy.
+For, not to hint of this: that it is an inference from certain
+canonic teachings, that while some natural enjoyments here shall have
+no children born to them for the other world, but, on the contrary,
+shall be followed by the joy-childlessness of all hell's despair;
+whereas, some guilty mortal miseries shall still fertilely beget to
+themselves an eternally progressive progeny of griefs beyond the
+grave; not at all to hint of this, there still seems an inequality in
+the deeper analysis of the thing.  For, thought Ahab, while even the
+highest earthly felicities ever have a certain unsignifying pettiness
+lurking in them, but, at bottom, all heartwoes, a mystic
+significance, and, in some men, an archangelic grandeur; so do their
+diligent tracings-out not belie the obvious deduction.  To trail the
+genealogies of these high mortal miseries, carries us at last among
+the sourceless primogenitures of the gods; so that, in the face of
+all the glad, hay-making suns, and soft cymballing, round
+harvest-moons, we must needs give in to this: that the gods
+themselves are not for ever glad.  The ineffaceable, sad birth-mark
+in the brow of man, is but the stamp of sorrow in the signers.
+</DOC>
+<DOC>
+<DOCNO>Chapter 106, Paragraph 5</DOCNO>
+Unwittingly here a secret has been divulged, which perhaps might more
+properly, in set way, have been disclosed before.  With many other
+particulars concerning Ahab, always had it remained a mystery to
+some, why it was, that for a certain period, both before and after
+the sailing of the Pequod, he had hidden himself away with such
+Grand-Lama-like exclusiveness; and, for that one interval, sought
+speechless refuge, as it were, among the marble senate of the dead.
+Captain Peleg's bruited reason for this thing appeared by no means
+adequate; though, indeed, as touching all Ahab's deeper part, every
+revelation partook more of significant darkness than of explanatory
+light.  But, in the end, it all came out; this one matter did, at
+least.  That direful mishap was at the bottom of his temporary
+recluseness.  And not only this, but to that ever-contracting,
+dropping circle ashore, who, for any reason, possessed the privilege
+of a less banned approach to him; to that timid circle the above
+hinted casualty--remaining, as it did, moodily unaccounted for by
+Ahab--invested itself with terrors, not entirely underived from the
+land of spirits and of wails.  So that, through their zeal for him,
+they had all conspired, so far as in them lay, to muffle up the
+knowledge of this thing from others; and hence it was, that not till
+a considerable interval had elapsed, did it transpire upon the
+Pequod's decks.
+</DOC>
+<DOC>
+<DOCNO>Chapter 106, Paragraph 6</DOCNO>
+But be all this as it may; let the unseen, ambiguous synod in the
+air, or the vindictive princes and potentates of fire, have to do or
+not with earthly Ahab, yet, in this present matter of his leg, he
+took plain practical procedures;--he called the carpenter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 106, Paragraph 7</DOCNO>
+And when that functionary appeared before him, he bade him without
+delay set about making a new leg, and directed the mates to see him
+supplied with all the studs and joists of jaw-ivory (Sperm Whale)
+which had thus far been accumulated on the voyage, in order that a
+careful selection of the stoutest, clearest-grained stuff might be
+secured.  This done, the carpenter received orders to have the leg
+completed that night; and to provide all the fittings for it,
+independent of those pertaining to the distrusted one in use.
+Moreover, the ship's forge was ordered to be hoisted out of its
+temporary idleness in the hold; and, to accelerate the affair, the
+blacksmith was commanded to proceed at once to the forging of
+whatever iron contrivances might be needed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 107, Paragraph 1</DOCNO>
+The Carpenter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 107, Paragraph 2</DOCNO>
+Seat thyself sultanically among the moons of Saturn, and take high
+abstracted man alone; and he seems a wonder, a grandeur, and a woe.
+But from the same point, take mankind in mass, and for the most part,
+they seem a mob of unnecessary duplicates, both contemporary and
+hereditary.  But most humble though he was, and far from furnishing
+an example of the high, humane abstraction; the Pequod's carpenter
+was no duplicate; hence, he now comes in person on this stage.
+</DOC>
+<DOC>
+<DOCNO>Chapter 107, Paragraph 3</DOCNO>
+Like all sea-going ship carpenters, and more especially those
+belonging to whaling vessels, he was, to a certain off-handed,
+practical extent, alike experienced in numerous trades and callings
+collateral to his own; the carpenter's pursuit being the ancient and
+outbranching trunk of all those numerous handicrafts which more or
+less have to do with wood as an auxiliary material.  But, besides the
+application to him of the generic remark above, this carpenter of the
+Pequod was singularly efficient in those thousand nameless mechanical
+emergencies continually recurring in a large ship, upon a three or
+four years' voyage, in uncivilized and far-distant seas.  For not to
+speak of his readiness in ordinary duties:--repairing stove boats,
+sprung spars, reforming the shape of clumsy-bladed oars, inserting
+bull's eyes in the deck, or new tree-nails in the side planks, and
+other miscellaneous matters more directly pertaining to his special
+business; he was moreover unhesitatingly expert in all manner of
+conflicting aptitudes, both useful and capricious.
+</DOC>
+<DOC>
+<DOCNO>Chapter 107, Paragraph 4</DOCNO>
+The one grand stage where he enacted all his various parts so
+manifold, was his vice-bench; a long rude ponderous table furnished
+with several vices, of different sizes, and both of iron and of wood.
+At all times except when whales were alongside, this bench was
+securely lashed athwartships against the rear of the Try-works.
+</DOC>
+<DOC>
+<DOCNO>Chapter 107, Paragraph 5</DOCNO>
+A belaying pin is found too large to be easily inserted into its
+hole: the carpenter claps it into one of his ever-ready vices, and
+straightway files it smaller.  A lost land-bird of strange plumage
+strays on board, and is made a captive: out of clean shaved rods of
+right-whale bone, and cross-beams of sperm whale ivory, the carpenter
+makes a pagoda-looking cage for it.  An oarsman sprains his wrist:
+the carpenter concocts a soothing lotion.  Stubb longed for
+vermillion stars to be painted upon the blade of his every oar;
+screwing each oar in his big vice of wood, the carpenter
+symmetrically supplies the constellation.  A sailor takes a fancy to
+wear shark-bone ear-rings: the carpenter drills his ears.  Another
+has the toothache: the carpenter out pincers, and clapping one hand
+upon his bench bids him be seated there; but the poor fellow
+unmanageably winces under the unconcluded operation; whirling round
+the handle of his wooden vice, the carpenter signs him to clap his
+jaw in that, if he would have him draw the tooth.
+</DOC>
+<DOC>
+<DOCNO>Chapter 107, Paragraph 6</DOCNO>
+Thus, this carpenter was prepared at all points, and alike
+indifferent and without respect in all.  Teeth he accounted bits of
+ivory; heads he deemed but top-blocks; men themselves he lightly held
+for capstans.  But while now upon so wide a field thus variously
+accomplished and with such liveliness of expertness in him, too; all
+this would seem to argue some uncommon vivacity of intelligence.  But
+not precisely so.  For nothing was this man more remarkable, than for
+a certain impersonal stolidity as it were; impersonal, I say; for it
+so shaded off into the surrounding infinite of things, that it seemed
+one with the general stolidity discernible in the whole visible
+world; which while pauselessly active in uncounted modes, still
+eternally holds its peace, and ignores you, though you dig
+foundations for cathedrals.  Yet was this half-horrible stolidity in
+him, involving, too, as it appeared, an all-ramifying
+heartlessness;--yet was it oddly dashed at times, with an old,
+crutch-like, antediluvian, wheezing humorousness, not unstreaked now
+and then with a certain grizzled wittiness; such as might have served
+to pass the time during the midnight watch on the bearded forecastle
+of Noah's ark.  Was it that this old carpenter had been a life-long
+wanderer, whose much rolling, to and fro, not only had gathered no
+moss; but what is more, had rubbed off whatever small outward
+clingings might have originally pertained to him?  He was a stript
+abstract; an unfractioned integral; uncompromised as a new-born babe;
+living without premeditated reference to this world or the next.  You
+might almost say, that this strange uncompromisedness in him involved
+a sort of unintelligence; for in his numerous trades, he did not seem
+to work so much by reason or by instinct, or simply because he had
+been tutored to it, or by any intermixture of all these, even or
+uneven; but merely by a kind of deaf and dumb, spontaneous literal
+process.  He was a pure manipulator; his brain, if he had ever had
+one, must have early oozed along into the muscles of his fingers.  He
+was like one of those unreasoning but still highly useful, MULTUM IN
+PARVO, Sheffield contrivances, assuming the exterior--though a little
+swelled--of a common pocket knife; but containing, not only blades of
+various sizes, but also screw-drivers, cork-screws, tweezers, awls,
+pens, rulers, nail-filers, countersinkers.  So, if his superiors
+wanted to use the carpenter for a screw-driver, all they had to do
+was to open that part of him, and the screw was fast: or if for
+tweezers, take him up by the legs, and there they were.
+</DOC>
+<DOC>
+<DOCNO>Chapter 107, Paragraph 7</DOCNO>
+Yet, as previously hinted, this omnitooled, open-and-shut carpenter,
+was, after all, no mere machine of an automaton.  If he did not have
+a common soul in him, he had a subtle something that somehow
+anomalously did its duty.  What that was, whether essence of
+quicksilver, or a few drops of hartshorn, there is no telling.  But
+there it was; and there it had abided for now some sixty years or
+more.  And this it was, this same unaccountable, cunning
+life-principle in him; this it was, that kept him a great part of the
+time soliloquizing; but only like an unreasoning wheel, which also
+hummingly soliloquizes; or rather, his body was a sentry-box and this
+soliloquizer on guard there, and talking all the time to keep himself
+awake.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 1</DOCNO>
+Ahab and the Carpenter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 2</DOCNO>
+The Deck--First Night Watch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 3</DOCNO>
+(CARPENTER STANDING BEFORE HIS VICE-BENCH, AND BY THE LIGHT OF TWO
+LANTERNS BUSILY FILING THE IVORY JOIST FOR THE LEG, WHICH JOIST IS
+FIRMLY FIXED IN THE VICE.  SLABS OF IVORY, LEATHER STRAPS, PADS,
+SCREWS, AND VARIOUS TOOLS OF ALL SORTS LYING ABOUT THE BENCH.
+FORWARD, THE RED FLAME OF THE FORGE IS SEEN, WHERE THE BLACKSMITH IS
+AT WORK.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 4</DOCNO>
+Drat the file, and drat the bone!  That is hard which should be soft,
+and that is soft which should be hard.  So we go, who file old jaws
+and shinbones.  Let's try another.  Aye, now, this works better
+(SNEEZES).  Halloa, this bone dust is (SNEEZES)--why it's
+(SNEEZES)--yes it's (SNEEZES)--bless my soul, it won't let me speak!
+This is what an old fellow gets now for working in dead lumber.  Saw
+a live tree, and you don't get this dust; amputate a live bone, and
+you don't get it (SNEEZES).  Come, come, you old Smut, there, bear a
+hand, and let's have that ferule and buckle-screw; I'll be ready
+for them presently.  Lucky now (SNEEZES) there's no knee-joint to
+make; that might puzzle a little; but a mere shinbone--why it's
+easy as making hop-poles; only I should like to put a good finish on.
+Time, time; if I but only had the time, I could turn him out as neat
+a leg now as ever (SNEEZES) scraped to a lady in a parlor.  Those
+buckskin legs and calves of legs I've seen in shop windows wouldn't
+compare at all.  They soak water, they do; and of course get
+rheumatic, and have to be doctored (SNEEZES) with washes and lotions,
+just like live legs.  There; before I saw it off, now, I must call his
+old Mogulship, and see whether the length will be all right; too
+short, if anything, I guess.  Ha! that's the heel; we are in luck;
+here he comes, or it's somebody else, that's certain.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 5</DOCNO>
+AHAB (ADVANCING)
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 6</DOCNO>
+(DURING THE ENSUING SCENE, THE CARPENTER CONTINUES SNEEZING AT TIMES)
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 7</DOCNO>
+Well, manmaker!
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 8</DOCNO>
+Just in time, sir.  If the captain pleases, I will now mark the
+length.  Let me measure, sir.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 9</DOCNO>
+Measured for a leg! good.  Well, it's not the first time.  About it!
+There; keep thy finger on it.  This is a cogent vice thou hast here,
+carpenter; let me feel its grip once.  So, so; it does pinch some.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 10</DOCNO>
+Oh, sir, it will break bones--beware, beware!
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 11</DOCNO>
+No fear; I like a good grip; I like to feel something in this
+slippery world that can hold, man.  What's Prometheus about
+there?--the blacksmith, I mean--what's he about?
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 12</DOCNO>
+He must be forging the buckle-screw, sir, now.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 13</DOCNO>
+Right.  It's a partnership; he supplies the muscle part.  He makes a
+fierce red flame there!
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 14</DOCNO>
+Aye, sir; he must have the white heat for this kind of fine work.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 15</DOCNO>
+Um-m.  So he must.  I do deem it now a most meaning thing, that that
+old Greek, Prometheus, who made men, they say, should have been a
+blacksmith, and animated them with fire; for what's made in fire must
+properly belong to fire; and so hell's probable.  How the soot flies!
+This must be the remainder the Greek made the Africans of.
+Carpenter, when he's through with that buckle, tell him to forge a
+pair of steel shoulder-blades; there's a pedlar aboard with a
+crushing pack.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 16</DOCNO>
+Sir?
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 17</DOCNO>
+Hold; while Prometheus is about it, I'll order a complete man after a
+desirable pattern.  Imprimis, fifty feet high in his socks; then,
+chest modelled after the Thames Tunnel; then, legs with roots to 'em,
+to stay in one place; then, arms three feet through the wrist; no
+heart at all, brass forehead, and about a quarter of an acre of fine
+brains; and let me see--shall I order eyes to see outwards?  No, but
+put a sky-light on top of his head to illuminate inwards.  There,
+take the order, and away.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 18</DOCNO>
+Now, what's he speaking about, and who's he speaking to, I should
+like to know?  Shall I keep standing here? (ASIDE).
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 19</DOCNO>
+'Tis but indifferent architecture to make a blind dome; here's one.
+No, no, no; I must have a lantern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 20</DOCNO>
+Ho, ho!  That's it, hey?  Here are two, sir; one will serve my turn.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 21</DOCNO>
+What art thou thrusting that thief-catcher into my face for, man?
+Thrusted light is worse than presented pistols.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 22</DOCNO>
+I thought, sir, that you spoke to carpenter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 23</DOCNO>
+Carpenter? why that's--but no;--a very tidy, and, I may say, an
+extremely gentlemanlike sort of business thou art in here,
+carpenter;--or would'st thou rather work in clay?
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 24</DOCNO>
+Sir?--Clay? clay, sir?  That's mud; we leave clay to ditchers, sir.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 25</DOCNO>
+The fellow's impious!  What art thou sneezing about?
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 26</DOCNO>
+Bone is rather dusty, sir.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 27</DOCNO>
+Take the hint, then; and when thou art dead, never bury thyself under
+living people's noses.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 28</DOCNO>
+Sir?--oh! ah!--I guess so;--yes--dear!
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 29</DOCNO>
+Look ye, carpenter, I dare say thou callest thyself a right good
+workmanlike workman, eh?  Well, then, will it speak thoroughly well
+for thy work, if, when I come to mount this leg thou makest, I shall
+nevertheless feel another leg in the same identical place with it;
+that is, carpenter, my old lost leg; the flesh and blood one, I mean.
+Canst thou not drive that old Adam away?
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 30</DOCNO>
+Truly, sir, I begin to understand somewhat now.  Yes, I have heard
+something curious on that score, sir; how that a dismasted man never
+entirely loses the feeling of his old spar, but it will be still
+pricking him at times.  May I humbly ask if it be really so, sir?
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 31</DOCNO>
+It is, man.  Look, put thy live leg here in the place where mine once
+was; so, now, here is only one distinct leg to the eye, yet two to
+the soul.  Where thou feelest tingling life; there, exactly there,
+there to a hair, do I.  Is't a riddle?
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 32</DOCNO>
+I should humbly call it a poser, sir.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 33</DOCNO>
+Hist, then.  How dost thou know that some entire, living, thinking
+thing may not be invisibly and uninterpenetratingly standing
+precisely where thou now standest; aye, and standing there in thy
+spite?  In thy most solitary hours, then, dost thou not fear
+eavesdroppers?  Hold, don't speak!  And if I still feel the smart of
+my crushed leg, though it be now so long dissolved; then, why mayst
+not thou, carpenter, feel the fiery pains of hell for ever, and
+without a body?  Hah!
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 34</DOCNO>
+Good Lord!  Truly, sir, if it comes to that, I must calculate over
+again; I think I didn't carry a small figure, sir.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 35</DOCNO>
+Look ye, pudding-heads should never grant premises.--How long before
+the leg is done?
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 36</DOCNO>
+Perhaps an hour, sir.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 37</DOCNO>
+Bungle away at it then, and bring it to me (TURNS TO GO).  Oh, Life!
+Here I am, proud as Greek god, and yet standing debtor to this
+blockhead for a bone to stand on!  Cursed be that mortal
+inter-indebtedness which will not do away with ledgers.  I would be
+free as air; and I'm down in the whole world's books.  I am so rich,
+I could have given bid for bid with the wealthiest Praetorians at the
+auction of the Roman empire (which was the world's); and yet I owe
+for the flesh in the tongue I brag with.  By heavens!  I'll get a
+crucible, and into it, and dissolve myself down to one small,
+compendious vertebra.  So.
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 38</DOCNO>
+CARPENTER (RESUMING HIS WORK).
+</DOC>
+<DOC>
+<DOCNO>Chapter 108, Paragraph 39</DOCNO>
+Well, well, well!  Stubb knows him best of all, and Stubb always says
+he's queer; says nothing but that one sufficient little word queer;
+he's queer, says Stubb; he's queer--queer, queer; and keeps dinning
+it into Mr. Starbuck all the time--queer--sir--queer, queer, very
+queer.  And here's his leg!  Yes, now that I think of it, here's his
+bedfellow! has a stick of whale's jaw-bone for a wife!  And this is
+his leg; he'll stand on this.  What was that now about one leg
+standing in three places, and all three places standing in one
+hell--how was that?  Oh!  I don't wonder he looked so scornful at me!
+I'm a sort of strange-thoughted sometimes, they say; but that's only
+haphazard-like.  Then, a short, little old body like me, should never
+undertake to wade out into deep waters with tall, heron-built
+captains; the water chucks you under the chin pretty quick, and
+there's a great cry for life-boats.  And here's the heron's leg! long
+and slim, sure enough!  Now, for most folks one pair of legs lasts a
+lifetime, and that must be because they use them mercifully, as a
+tender-hearted old lady uses her roly-poly old coach-horses.  But
+Ahab; oh he's a hard driver.  Look, driven one leg to death, and
+spavined the other for life, and now wears out bone legs by the cord.
+Halloa, there, you Smut! bear a hand there with those screws, and
+let's finish it before the resurrection fellow comes a-calling with
+his horn for all legs, true or false, as brewery-men go round
+collecting old beer barrels, to fill 'em up again.  What a leg this
+is!  It looks like a real live leg, filed down to nothing but the
+core; he'll be standing on this to-morrow; he'll be taking altitudes
+on it.  Halloa!  I almost forgot the little oval slate, smoothed
+ivory, where he figures up the latitude.  So, so; chisel, file, and
+sand-paper, now!
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 1</DOCNO>
+Ahab and Starbuck in the Cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 2</DOCNO>
+According to usage they were pumping the ship next morning; and lo!
+no inconsiderable oil came up with the water; the casks below must
+have sprung a bad leak.  Much concern was shown; and Starbuck went
+down into the cabin to report this unfavourable affair.*
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 3</DOCNO>
+*In Sperm-whalemen with any considerable quantity of oil on board, it
+is a regular semiweekly duty to conduct a hose into the hold, and
+drench the casks with sea-water; which afterwards, at varying
+intervals, is removed by the ship's pumps.  Hereby the casks are
+sought to be kept damply tight; while by the changed character of the
+withdrawn water, the mariners readily detect any serious leakage in
+the precious cargo.
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 4</DOCNO>
+Now, from the South and West the Pequod was drawing nigh to Formosa
+and the Bashee Isles, between which lies one of the tropical outlets
+from the China waters into the Pacific.  And so Starbuck found Ahab
+with a general chart of the oriental archipelagoes spread before him;
+and another separate one representing the long eastern coasts of the
+Japanese islands--Niphon, Matsmai, and Sikoke.  With his snow-white
+new ivory leg braced against the screwed leg of his table, and with a
+long pruning-hook of a jack-knife in his hand, the wondrous old man,
+with his back to the gangway door, was wrinkling his brow, and
+tracing his old courses again.
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 5</DOCNO>
+"Who's there?" hearing the footstep at the door, but not turning
+round to it.  "On deck!  Begone!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 6</DOCNO>
+"Captain Ahab mistakes; it is I.  The oil in the hold is leaking,
+sir.  We must up Burtons and break out."
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 7</DOCNO>
+"Up Burtons and break out?  Now that we are nearing Japan; heave-to
+here for a week to tinker a parcel of old hoops?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 8</DOCNO>
+"Either do that, sir, or waste in one day more oil than we may make
+good in a year.  What we come twenty thousand miles to get is worth
+saving, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 9</DOCNO>
+"So it is, so it is; if we get it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 10</DOCNO>
+"I was speaking of the oil in the hold, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 11</DOCNO>
+"And I was not speaking or thinking of that at all.  Begone!  Let it
+leak!  I'm all aleak myself.  Aye! leaks in leaks! not only full of
+leaky casks, but those leaky casks are in a leaky ship; and that's a
+far worse plight than the Pequod's, man.  Yet I don't stop to plug my
+leak; for who can find it in the deep-loaded hull; or how hope to
+plug it, even if found, in this life's howling gale?  Starbuck!
+I'll not have the Burtons hoisted."
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 12</DOCNO>
+"What will the owners say, sir?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 13</DOCNO>
+"Let the owners stand on Nantucket beach and outyell the Typhoons.
+What cares Ahab?  Owners, owners?  Thou art always prating to me,
+Starbuck, about those miserly owners, as if the owners were my
+conscience.  But look ye, the only real owner of anything is its
+commander; and hark ye, my conscience is in this ship's keel.--On
+deck!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 14</DOCNO>
+"Captain Ahab," said the reddening mate, moving further into the
+cabin, with a daring so strangely respectful and cautious that it
+almost seemed not only every way seeking to avoid the slightest
+outward manifestation of itself, but within also seemed more than
+half distrustful of itself; "A better man than I might well pass over
+in thee what he would quickly enough resent in a younger man; aye,
+and in a happier, Captain Ahab."
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 15</DOCNO>
+"Devils!  Dost thou then so much as dare to critically think of
+me?--On deck!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 16</DOCNO>
+"Nay, sir, not yet; I do entreat.  And I do dare, sir--to be
+forbearing!  Shall we not understand each other better than hitherto,
+Captain Ahab?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 17</DOCNO>
+Ahab seized a loaded musket from the rack (forming part of most
+South-Sea-men's cabin furniture), and pointing it towards Starbuck,
+exclaimed: "There is one God that is Lord over the earth, and one
+Captain that is lord over the Pequod.--On deck!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 18</DOCNO>
+For an instant in the flashing eyes of the mate, and his fiery
+cheeks, you would have almost thought that he had really received the
+blaze of the levelled tube.  But, mastering his emotion, he half
+calmly rose, and as he quitted the cabin, paused for an instant and
+said: "Thou hast outraged, not insulted me, sir; but for that I ask
+thee not to beware of Starbuck; thou wouldst but laugh; but let Ahab
+beware of Ahab; beware of thyself, old man."
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 19</DOCNO>
+"He waxes brave, but nevertheless obeys; most careful bravery that!"
+murmured Ahab, as Starbuck disappeared.  "What's that he said--Ahab
+beware of Ahab--there's something there!"  Then unconsciously using
+the musket for a staff, with an iron brow he paced to and fro in the
+little cabin; but presently the thick plaits of his forehead relaxed,
+and returning the gun to the rack, he went to the deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 20</DOCNO>
+"Thou art but too good a fellow, Starbuck," he said lowly to the
+mate; then raising his voice to the crew: "Furl the t'gallant-sails,
+and close-reef the top-sails, fore and aft; back the main-yard; up
+Burton, and break out in the main-hold."
+</DOC>
+<DOC>
+<DOCNO>Chapter 109, Paragraph 21</DOCNO>
+It were perhaps vain to surmise exactly why it was, that as
+respecting Starbuck, Ahab thus acted.  It may have been a flash of
+honesty in him; or mere prudential policy which, under the
+circumstance, imperiously forbade the slightest symptom of open
+disaffection, however transient, in the important chief officer of
+his ship.  However it was, his orders were executed; and the Burtons
+were hoisted.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 1</DOCNO>
+Queequeg in His Coffin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 2</DOCNO>
+Upon searching, it was found that the casks last struck into the hold
+were perfectly sound, and that the leak must be further off.  So, it
+being calm weather, they broke out deeper and deeper, disturbing the
+slumbers of the huge ground-tier butts; and from that black midnight
+sending those gigantic moles into the daylight above.  So deep did
+they go; and so ancient, and corroded, and weedy the aspect of the
+lowermost puncheons, that you almost looked next for some mouldy
+corner-stone cask containing coins of Captain Noah, with copies of
+the posted placards, vainly warning the infatuated old world from the
+flood.  Tierce after tierce, too, of water, and bread, and beef, and
+shooks of staves, and iron bundles of hoops, were hoisted out, till
+at last the piled decks were hard to get about; and the hollow hull
+echoed under foot, as if you were treading over empty catacombs, and
+reeled and rolled in the sea like an air-freighted demijohn.
+Top-heavy was the ship as a dinnerless student with all Aristotle in
+his head.  Well was it that the Typhoons did not visit them then.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 3</DOCNO>
+Now, at this time it was that my poor pagan companion, and fast
+bosom-friend, Queequeg, was seized with a fever, which brought him
+nigh to his endless end.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 4</DOCNO>
+Be it said, that in this vocation of whaling, sinecures are unknown;
+dignity and danger go hand in hand; till you get to be Captain, the
+higher you rise the harder you toil.  So with poor Queequeg, who, as
+harpooneer, must not only face all the rage of the living whale,
+but--as we have elsewhere seen--mount his dead back in a rolling sea;
+and finally descend into the gloom of the hold, and bitterly sweating
+all day in that subterraneous confinement, resolutely manhandle the
+clumsiest casks and see to their stowage.  To be short, among
+whalemen, the harpooneers are the holders, so called.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 5</DOCNO>
+Poor Queequeg! when the ship was about half disembowelled, you should
+have stooped over the hatchway, and peered down upon him there;
+where, stripped to his woollen drawers, the tattooed savage was
+crawling about amid that dampness and slime, like a green spotted
+lizard at the bottom of a well.  And a well, or an ice-house, it
+somehow proved to him, poor pagan; where, strange to say, for all the
+heat of his sweatings, he caught a terrible chill which lapsed into a
+fever; and at last, after some days' suffering, laid him in his
+hammock, close to the very sill of the door of death.  How he wasted
+and wasted away in those few long-lingering days, till there seemed
+but little left of him but his frame and tattooing.  But as all else
+in him thinned, and his cheek-bones grew sharper, his eyes,
+nevertheless, seemed growing fuller and fuller; they became of a
+strange softness of lustre; and mildly but deeply looked out at you
+there from his sickness, a wondrous testimony to that immortal health
+in him which could not die, or be weakened.  And like circles on the
+water, which, as they grow fainter, expand; so his eyes seemed
+rounding and rounding, like the rings of Eternity.  An awe that
+cannot be named would steal over you as you sat by the side of this
+waning savage, and saw as strange things in his face, as any beheld
+who were bystanders when Zoroaster died.  For whatever is truly
+wondrous and fearful in man, never yet was put into words or books.
+And the drawing near of Death, which alike levels all, alike
+impresses all with a last revelation, which only an author from the
+dead could adequately tell.  So that--let us say it again--no dying
+Chaldee or Greek had higher and holier thoughts than those, whose
+mysterious shades you saw creeping over the face of poor Queequeg, as
+he quietly lay in his swaying hammock, and the rolling sea seemed
+gently rocking him to his final rest, and the ocean's invisible
+flood-tide lifted him higher and higher towards his destined heaven.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 6</DOCNO>
+Not a man of the crew but gave him up; and, as for Queequeg himself,
+what he thought of his case was forcibly shown by a curious favour he
+asked.  He called one to him in the grey morning watch, when the day
+was just breaking, and taking his hand, said that while in Nantucket
+he had chanced to see certain little canoes of dark wood, like the
+rich war-wood of his native isle; and upon inquiry, he had learned
+that all whalemen who died in Nantucket, were laid in those same dark
+canoes, and that the fancy of being so laid had much pleased him; for
+it was not unlike the custom of his own race, who, after embalming a
+dead warrior, stretched him out in his canoe, and so left him to be
+floated away to the starry archipelagoes; for not only do they
+believe that the stars are isles, but that far beyond all visible
+horizons, their own mild, uncontinented seas, interflow with the blue
+heavens; and so form the white breakers of the milky way.  He added,
+that he shuddered at the thought of being buried in his hammock,
+according to the usual sea-custom, tossed like something vile to the
+death-devouring sharks.  No: he desired a canoe like those of
+Nantucket, all the more congenial to him, being a whaleman, that like
+a whale-boat these coffin-canoes were without a keel; though that
+involved but uncertain steering, and much lee-way adown the dim ages.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 7</DOCNO>
+Now, when this strange circumstance was made known aft, the carpenter
+was at once commanded to do Queequeg's bidding, whatever it might
+include.  There was some heathenish, coffin-coloured old lumber
+aboard, which, upon a long previous voyage, had been cut from the
+aboriginal groves of the Lackaday islands, and from these dark planks
+the coffin was recommended to be made.  No sooner was the carpenter
+apprised of the order, than taking his rule, he forthwith with all
+the indifferent promptitude of his character, proceeded into the
+forecastle and took Queequeg's measure with great accuracy, regularly
+chalking Queequeg's person as he shifted the rule.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 8</DOCNO>
+"Ah! poor fellow! he'll have to die now," ejaculated the Long Island
+sailor.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 9</DOCNO>
+Going to his vice-bench, the carpenter for convenience sake and
+general reference, now transferringly measured on it the exact length
+the coffin was to be, and then made the transfer permanent by cutting
+two notches at its extremities.  This done, he marshalled the planks
+and his tools, and to work.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 10</DOCNO>
+When the last nail was driven, and the lid duly planed and fitted, he
+lightly shouldered the coffin and went forward with it, inquiring
+whether they were ready for it yet in that direction.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 11</DOCNO>
+Overhearing the indignant but half-humorous cries with which the
+people on deck began to drive the coffin away, Queequeg, to every
+one's consternation, commanded that the thing should be instantly
+brought to him, nor was there any denying him; seeing that, of all
+mortals, some dying men are the most tyrannical; and certainly, since
+they will shortly trouble us so little for evermore, the poor fellows
+ought to be indulged.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 12</DOCNO>
+Leaning over in his hammock, Queequeg long regarded the coffin with
+an attentive eye.  He then called for his harpoon, had the wooden
+stock drawn from it, and then had the iron part placed in the coffin
+along with one of the paddles of his boat.  All by his own request,
+also, biscuits were then ranged round the sides within: a flask of
+fresh water was placed at the head, and a small bag of woody earth
+scraped up in the hold at the foot; and a piece of sail-cloth being
+rolled up for a pillow, Queequeg now entreated to be lifted into his
+final bed, that he might make trial of its comforts, if any it had.
+He lay without moving a few minutes, then told one to go to his bag
+and bring out his little god, Yojo.  Then crossing his arms on his
+breast with Yojo between, he called for the coffin lid (hatch he
+called it) to be placed over him.  The head part turned over with a
+leather hinge, and there lay Queequeg in his coffin with little but
+his composed countenance in view.  "Rarmai" (it will do; it is easy),
+he murmured at last, and signed to be replaced in his hammock.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 13</DOCNO>
+But ere this was done, Pip, who had been slily hovering near by all
+this while, drew nigh to him where he lay, and with soft sobbings,
+took him by the hand; in the other, holding his tambourine.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 14</DOCNO>
+"Poor rover! will ye never have done with all this weary roving?
+where go ye now?  But if the currents carry ye to those sweet
+Antilles where the beaches are only beat with water-lilies, will ye
+do one little errand for me?  Seek out one Pip, who's now been
+missing long: I think he's in those far Antilles.  If ye find him,
+then comfort him; for he must be very sad; for look! he's left his
+tambourine behind;--I found it.  Rig-a-dig, dig, dig!  Now, Queequeg,
+die; and I'll beat ye your dying march."
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 15</DOCNO>
+"I have heard," murmured Starbuck, gazing down the scuttle, "that in
+violent fevers, men, all ignorance, have talked in ancient tongues;
+and that when the mystery is probed, it turns out always that in
+their wholly forgotten childhood those ancient tongues had been
+really spoken in their hearing by some lofty scholars.  So, to my
+fond faith, poor Pip, in this strange sweetness of his lunacy, brings
+heavenly vouchers of all our heavenly homes.  Where learned he that,
+but there?--Hark! he speaks again: but more wildly now."
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 16</DOCNO>
+"Form two and two!  Let's make a General of him!  Ho, where's his
+harpoon?  Lay it across here.--Rig-a-dig, dig, dig! huzza!  Oh for a
+game cock now to sit upon his head and crow!  Queequeg dies
+game!--mind ye that; Queequeg dies game!--take ye good heed of that;
+Queequeg dies game!  I say; game, game, game! but base little Pip, he
+died a coward; died all a'shiver;--out upon Pip!  Hark ye; if ye find
+Pip, tell all the Antilles he's a runaway; a coward, a coward, a
+coward!  Tell them he jumped from a whale-boat!  I'd never beat my
+tambourine over base Pip, and hail him General, if he were once more
+dying here.  No, no! shame upon all cowards--shame upon them!  Let 'em
+go drown like Pip, that jumped from a whale-boat.  Shame! shame!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 17</DOCNO>
+During all this, Queequeg lay with closed eyes, as if in a dream.
+Pip was led away, and the sick man was replaced in his hammock.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 18</DOCNO>
+But now that he had apparently made every preparation for death; now
+that his coffin was proved a good fit, Queequeg suddenly rallied;
+soon there seemed no need of the carpenter's box: and thereupon,
+when some expressed their delighted surprise, he, in substance, said,
+that the cause of his sudden convalescence was this;--at a critical
+moment, he had just recalled a little duty ashore, which he was
+leaving undone; and therefore had changed his mind about dying: he
+could not die yet, he averred.  They asked him, then, whether to live
+or die was a matter of his own sovereign will and pleasure.  He
+answered, certainly.  In a word, it was Queequeg's conceit, that if a
+man made up his mind to live, mere sickness could not kill him:
+nothing but a whale, or a gale, or some violent, ungovernable,
+unintelligent destroyer of that sort.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 19</DOCNO>
+Now, there is this noteworthy difference between savage and
+civilized; that while a sick, civilized man may be six months
+convalescing, generally speaking, a sick savage is almost half-well
+again in a day.  So, in good time my Queequeg gained strength; and at
+length after sitting on the windlass for a few indolent days (but
+eating with a vigorous appetite) he suddenly leaped to his feet,
+threw out his arms and legs, gave himself a good stretching, yawned
+a little bit, and then springing into the head of his hoisted boat,
+and poising a harpoon, pronounced himself fit for a fight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 110, Paragraph 20</DOCNO>
+With a wild whimsiness, he now used his coffin for a sea-chest; and
+emptying into it his canvas bag of clothes, set them in order there.
+Many spare hours he spent, in carving the lid with all manner of
+grotesque figures and drawings; and it seemed that hereby he was
+striving, in his rude way, to copy parts of the twisted tattooing on
+his body.  And this tattooing had been the work of a departed
+prophet and seer of his island, who, by those hieroglyphic marks, had
+written out on his body a complete theory of the heavens and the
+earth, and a mystical treatise on the art of attaining truth; so that
+Queequeg in his own proper person was a riddle to unfold; a wondrous
+work in one volume; but whose mysteries not even himself could read,
+though his own live heart beat against them; and these mysteries were
+therefore destined in the end to moulder away with the living
+parchment whereon they were inscribed, and so be unsolved to the
+last.  And this thought it must have been which suggested to Ahab
+that wild exclamation of his, when one morning turning away from
+surveying poor Queequeg--"Oh, devilish tantalization of the gods!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 111, Paragraph 1</DOCNO>
+The Pacific.
+</DOC>
+<DOC>
+<DOCNO>Chapter 111, Paragraph 2</DOCNO>
+When gliding by the Bashee isles we emerged at last upon the great
+South Sea; were it not for other things, I could have greeted my dear
+Pacific with uncounted thanks, for now the long supplication of my
+youth was answered; that serene ocean rolled eastwards from me a
+thousand leagues of blue.
+</DOC>
+<DOC>
+<DOCNO>Chapter 111, Paragraph 3</DOCNO>
+There is, one knows not what sweet mystery about this sea, whose
+gently awful stirrings seem to speak of some hidden soul beneath;
+like those fabled undulations of the Ephesian sod over the buried
+Evangelist St. John.  And meet it is, that over these sea-pastures,
+wide-rolling watery prairies and Potters' Fields of all four
+continents, the waves should rise and fall, and ebb and flow
+unceasingly; for here, millions of mixed shades and shadows, drowned
+dreams, somnambulisms, reveries; all that we call lives and souls,
+lie dreaming, dreaming, still; tossing like slumberers in their beds;
+the ever-rolling waves but made so by their restlessness.
+</DOC>
+<DOC>
+<DOCNO>Chapter 111, Paragraph 4</DOCNO>
+To any meditative Magian rover, this serene Pacific, once beheld,
+must ever after be the sea of his adoption.  It rolls the midmost
+waters of the world, the Indian ocean and Atlantic being but its
+arms.  The same waves wash the moles of the new-built Californian
+towns, but yesterday planted by the recentest race of men, and lave
+the faded but still gorgeous skirts of Asiatic lands, older than
+Abraham; while all between float milky-ways of coral isles, and
+low-lying, endless, unknown Archipelagoes, and impenetrable Japans.
+Thus this mysterious, divine Pacific zones the world's whole bulk
+about; makes all coasts one bay to it; seems the tide-beating heart
+of earth.  Lifted by those eternal swells, you needs must own the
+seductive god, bowing your head to Pan.
+</DOC>
+<DOC>
+<DOCNO>Chapter 111, Paragraph 5</DOCNO>
+But few thoughts of Pan stirred Ahab's brain, as standing like an
+iron statue at his accustomed place beside the mizen rigging, with
+one nostril he unthinkingly snuffed the sugary musk from the Bashee
+isles (in whose sweet woods mild lovers must be walking), and with
+the other consciously inhaled the salt breath of the new found sea;
+that sea in which the hated White Whale must even then be swimming.
+Launched at length upon these almost final waters, and gliding
+towards the Japanese cruising-ground, the old man's purpose
+intensified itself.  His firm lips met like the lips of a vice; the
+Delta of his forehead's veins swelled like overladen brooks; in his
+very sleep, his ringing cry ran through the vaulted hull, "Stern all!
+the White Whale spouts thick blood!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 1</DOCNO>
+The Blacksmith.
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 2</DOCNO>
+Availing himself of the mild, summer-cool weather that now reigned
+in these latitudes, and in preparation for the peculiarly active
+pursuits shortly to be anticipated, Perth, the begrimed, blistered
+old blacksmith, had not removed his portable forge to the hold again,
+after concluding his contributory work for Ahab's leg, but still
+retained it on deck, fast lashed to ringbolts by the foremast; being
+now almost incessantly invoked by the headsmen, and harpooneers, and
+bowsmen to do some little job for them; altering, or repairing, or
+new shaping their various weapons and boat furniture.  Often he would
+be surrounded by an eager circle, all waiting to be served; holding
+boat-spades, pike-heads, harpoons, and lances, and jealously watching
+his every sooty movement, as he toiled.  Nevertheless, this old man's
+was a patient hammer wielded by a patient arm.  No murmur, no
+impatience, no petulance did come from him.  Silent, slow, and
+solemn; bowing over still further his chronically broken back, he
+toiled away, as if toil were life itself, and the heavy beating of
+his hammer the heavy beating of his heart.  And so it was.--Most
+miserable!
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 3</DOCNO>
+A peculiar walk in this old man, a certain slight but painful
+appearing yawing in his gait, had at an early period of the voyage
+excited the curiosity of the mariners.  And to the importunity of
+their persisted questionings he had finally given in; and so it came
+to pass that every one now knew the shameful story of his wretched
+fate.
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 4</DOCNO>
+Belated, and not innocently, one bitter winter's midnight, on the
+road running between two country towns, the blacksmith half-stupidly
+felt the deadly numbness stealing over him, and sought refuge in a
+leaning, dilapidated barn.  The issue was, the loss of the
+extremities of both feet.  Out of this revelation, part by part, at
+last came out the four acts of the gladness, and the one long, and as
+yet uncatastrophied fifth act of the grief of his life's drama.
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 5</DOCNO>
+He was an old man, who, at the age of nearly sixty, had postponedly
+encountered that thing in sorrow's technicals called ruin.  He had
+been an artisan of famed excellence, and with plenty to do; owned a
+house and garden; embraced a youthful, daughter-like, loving wife,
+and three blithe, ruddy children; every Sunday went to a
+cheerful-looking church, planted in a grove.  But one night, under
+cover of darkness, and further concealed in a most cunning
+disguisement, a desperate burglar slid into his happy home, and
+robbed them all of everything.  And darker yet to tell, the
+blacksmith himself did ignorantly conduct this burglar into his
+family's heart.  It was the Bottle Conjuror!  Upon the opening of
+that fatal cork, forth flew the fiend, and shrivelled up his home.
+Now, for prudent, most wise, and economic reasons, the blacksmith's
+shop was in the basement of his dwelling, but with a separate
+entrance to it; so that always had the young and loving healthy wife
+listened with no unhappy nervousness, but with vigorous pleasure, to
+the stout ringing of her young-armed old husband's hammer; whose
+reverberations, muffled by passing through the floors and walls, came
+up to her, not unsweetly, in her nursery; and so, to stout Labor's
+iron lullaby, the blacksmith's infants were rocked to slumber.
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 6</DOCNO>
+Oh, woe on woe!  Oh, Death, why canst thou not sometimes be timely?
+Hadst thou taken this old blacksmith to thyself ere his full ruin
+came upon him, then had the young widow had a delicious grief, and
+her orphans a truly venerable, legendary sire to dream of in their
+after years; and all of them a care-killing competency.  But Death
+plucked down some virtuous elder brother, on whose whistling daily
+toil solely hung the responsibilities of some other family, and left
+the worse than useless old man standing, till the hideous rot of life
+should make him easier to harvest.
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 7</DOCNO>
+Why tell the whole?  The blows of the basement hammer every day grew
+more and more between; and each blow every day grew fainter than the
+last; the wife sat frozen at the window, with tearless eyes,
+glitteringly gazing into the weeping faces of her children; the
+bellows fell; the forge choked up with cinders; the house was sold;
+the mother dived down into the long church-yard grass; her children
+twice followed her thither; and the houseless, familyless old man
+staggered off a vagabond in crape; his every woe unreverenced; his
+grey head a scorn to flaxen curls!
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 8</DOCNO>
+Death seems the only desirable sequel for a career like this; but
+Death is only a launching into the region of the strange Untried; it
+is but the first salutation to the possibilities of the immense
+Remote, the Wild, the Watery, the Unshored; therefore, to the
+death-longing eyes of such men, who still have left in them some
+interior compunctions against suicide, does the all-contributed and
+all-receptive ocean alluringly spread forth his whole plain of
+unimaginable, taking terrors, and wonderful, new-life adventures; and
+from the hearts of infinite Pacifics, the thousand mermaids sing to
+them--"Come hither, broken-hearted; here is another life without the
+guilt of intermediate death; here are wonders supernatural, without
+dying for them.  Come hither! bury thyself in a life which, to your
+now equally abhorred and abhorring, landed world, is more oblivious
+than death.  Come hither! put up THY gravestone, too, within the
+churchyard, and come hither, till we marry thee!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 112, Paragraph 9</DOCNO>
+Hearkening to these voices, East and West, by early sunrise, and by
+fall of eve, the blacksmith's soul responded, Aye, I come!  And so
+Perth went a-whaling.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 1</DOCNO>
+The Forge.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 2</DOCNO>
+With matted beard, and swathed in a bristling shark-skin apron, about
+mid-day, Perth was standing between his forge and anvil, the latter
+placed upon an iron-wood log, with one hand holding a pike-head in
+the coals, and with the other at his forge's lungs, when Captain Ahab
+came along, carrying in his hand a small rusty-looking leathern bag.
+While yet a little distance from the forge, moody Ahab paused; till
+at last, Perth, withdrawing his iron from the fire, began hammering
+it upon the anvil--the red mass sending off the sparks in thick
+hovering flights, some of which flew close to Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 3</DOCNO>
+"Are these thy Mother Carey's chickens, Perth? they are always flying
+in thy wake; birds of good omen, too, but not to all;--look here,
+they burn; but thou--thou liv'st among them without a scorch."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 4</DOCNO>
+"Because I am scorched all over, Captain Ahab," answered Perth,
+resting for a moment on his hammer; "I am past scorching; not easily
+can'st thou scorch a scar."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 5</DOCNO>
+"Well, well; no more.  Thy shrunk voice sounds too calmly, sanely
+woeful to me.  In no Paradise myself, I am impatient of all misery in
+others that is not mad.  Thou should'st go mad, blacksmith; say, why
+dost thou not go mad?  How can'st thou endure without being mad?  Do
+the heavens yet hate thee, that thou can'st not go mad?--What wert
+thou making there?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 6</DOCNO>
+"Welding an old pike-head, sir; there were seams and dents in it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 7</DOCNO>
+"And can'st thou make it all smooth again, blacksmith, after such
+hard usage as it had?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 8</DOCNO>
+"I think so, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 9</DOCNO>
+"And I suppose thou can'st smoothe almost any seams and dents; never
+mind how hard the metal, blacksmith?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 10</DOCNO>
+"Aye, sir, I think I can; all seams and dents but one."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 11</DOCNO>
+"Look ye here, then," cried Ahab, passionately advancing, and leaning
+with both hands on Perth's shoulders; "look ye here--HERE--can ye
+smoothe out a seam like this, blacksmith," sweeping one hand across
+his ribbed brow; "if thou could'st, blacksmith, glad enough would I
+lay my head upon thy anvil, and feel thy heaviest hammer between my
+eyes.  Answer!  Can'st thou smoothe this seam?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 12</DOCNO>
+"Oh! that is the one, sir!  Said I not all seams and dents but one?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 13</DOCNO>
+"Aye, blacksmith, it is the one; aye, man, it is unsmoothable; for
+though thou only see'st it here in my flesh, it has worked down into
+the bone of my skull--THAT is all wrinkles!  But, away with child's
+play; no more gaffs and pikes to-day.  Look ye here!" jingling the
+leathern bag, as if it were full of gold coins.  "I, too, want a
+harpoon made; one that a thousand yoke of fiends could not part,
+Perth; something that will stick in a whale like his own fin-bone.
+There's the stuff," flinging the pouch upon the anvil.  "Look ye,
+blacksmith, these are the gathered nail-stubbs of the steel shoes of
+racing horses."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 14</DOCNO>
+"Horse-shoe stubbs, sir?  Why, Captain Ahab, thou hast here, then,
+the best and stubbornest stuff we blacksmiths ever work."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 15</DOCNO>
+"I know it, old man; these stubbs will weld together like glue from
+the melted bones of murderers.  Quick! forge me the harpoon.  And
+forge me first, twelve rods for its shank; then wind, and twist, and
+hammer these twelve together like the yarns and strands of a
+tow-line.  Quick!  I'll blow the fire."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 16</DOCNO>
+When at last the twelve rods were made, Ahab tried them, one by one,
+by spiralling them, with his own hand, round a long, heavy iron bolt.
+"A flaw!" rejecting the last one.  "Work that over again, Perth."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 17</DOCNO>
+This done, Perth was about to begin welding the twelve into one, when
+Ahab stayed his hand, and said he would weld his own iron.  As, then,
+with regular, gasping hems, he hammered on the anvil, Perth passing
+to him the glowing rods, one after the other, and the hard pressed
+forge shooting up its intense straight flame, the Parsee passed
+silently, and bowing over his head towards the fire, seemed invoking
+some curse or some blessing on the toil.  But, as Ahab looked up, he
+slid aside.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 18</DOCNO>
+"What's that bunch of lucifers dodging about there for?" muttered
+Stubb, looking on from the forecastle.  "That Parsee smells fire like
+a fusee; and smells of it himself, like a hot musket's powder-pan."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 19</DOCNO>
+At last the shank, in one complete rod, received its final heat; and
+as Perth, to temper it, plunged it all hissing into the cask of water
+near by, the scalding steam shot up into Ahab's bent face.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 20</DOCNO>
+"Would'st thou brand me, Perth?" wincing for a moment with the pain;
+"have I been but forging my own branding-iron, then?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 21</DOCNO>
+"Pray God, not that; yet I fear something, Captain Ahab.  Is not this
+harpoon for the White Whale?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 22</DOCNO>
+"For the white fiend!  But now for the barbs; thou must make them
+thyself, man.  Here are my razors--the best of steel; here, and make
+the barbs sharp as the needle-sleet of the Icy Sea."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 23</DOCNO>
+For a moment, the old blacksmith eyed the razors as though he would
+fain not use them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 24</DOCNO>
+"Take them, man, I have no need for them; for I now neither shave,
+sup, nor pray till--but here--to work!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 25</DOCNO>
+Fashioned at last into an arrowy shape, and welded by Perth to the
+shank, the steel soon pointed the end of the iron; and as the
+blacksmith was about giving the barbs their final heat, prior to
+tempering them, he cried to Ahab to place the water-cask near.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 26</DOCNO>
+"No, no--no water for that; I want it of the true death-temper.
+Ahoy, there!  Tashtego, Queequeg, Daggoo!  What say ye, pagans!  Will
+ye give me as much blood as will cover this barb?" holding it high
+up.  A cluster of dark nods replied, Yes.  Three punctures were made
+in the heathen flesh, and the White Whale's barbs were then tempered.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 27</DOCNO>
+"Ego non baptizo te in nomine patris, sed in nomine diaboli!"
+deliriously howled Ahab, as the malignant iron scorchingly devoured
+the baptismal blood.
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 28</DOCNO>
+Now, mustering the spare poles from below, and selecting one of
+hickory, with the bark still investing it, Ahab fitted the end to the
+socket of the iron.  A coil of new tow-line was then unwound, and
+some fathoms of it taken to the windlass, and stretched to a great
+tension.  Pressing his foot upon it, till the rope hummed like a
+harp-string, then eagerly bending over it, and seeing no strandings,
+Ahab exclaimed, "Good! and now for the seizings."
+</DOC>
+<DOC>
+<DOCNO>Chapter 113, Paragraph 29</DOCNO>
+At one extremity the rope was unstranded, and the separate spread
+yarns were all braided and woven round the socket of the harpoon; the
+pole was then driven hard up into the socket; from the lower end the
+rope was traced half-way along the pole's length, and firmly secured
+so, with intertwistings of twine.  This done, pole, iron, and
+rope--like the Three Fates--remained inseparable, and Ahab moodily
+stalked away with the weapon; the sound of his ivory leg, and the
+sound of the hickory pole, both hollowly ringing along every plank.
+But ere he entered his cabin, light, unnatural, half-bantering, yet
+most piteous sound was heard.  Oh, Pip! thy wretched laugh, thy
+idle but unresting eye; all thy strange mummeries not unmeaningly
+blended with the black tragedy of the melancholy ship, and mocked it!
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 1</DOCNO>
+The Gilder.
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 2</DOCNO>
+Penetrating further and further into the heart of the Japanese
+cruising ground, the Pequod was soon all astir in the fishery.
+Often, in mild, pleasant weather, for twelve, fifteen, eighteen, and
+twenty hours on the stretch, they were engaged in the boats, steadily
+pulling, or sailing, or paddling after the whales, or for an
+interlude of sixty or seventy minutes calmly awaiting their uprising;
+though with but small success for their pains.
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 3</DOCNO>
+At such times, under an abated sun; afloat all day upon smooth, slow
+heaving swells; seated in his boat, light as a birch canoe; and so
+sociably mixing with the soft waves themselves, that like
+hearth-stone cats they purr against the gunwale; these are the times
+of dreamy quietude, when beholding the tranquil beauty and brilliancy
+of the ocean's skin, one forgets the tiger heart that pants beneath
+it; and would not willingly remember, that this velvet paw but
+conceals a remorseless fang.
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 4</DOCNO>
+These are the times, when in his whale-boat the rover softly feels a
+certain filial, confident, land-like feeling towards the sea; that he
+regards it as so much flowery earth; and the distant ship revealing
+only the tops of her masts, seems struggling forward, not through
+high rolling waves, but through the tall grass of a rolling prairie:
+as when the western emigrants' horses only show their erected ears,
+while their hidden bodies widely wade through the amazing verdure.
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 5</DOCNO>
+The long-drawn virgin vales; the mild blue hill-sides; as over these
+there steals the hush, the hum; you almost swear that play-wearied
+children lie sleeping in these solitudes, in some glad May-time, when
+the flowers of the woods are plucked.  And all this mixes with your
+most mystic mood; so that fact and fancy, half-way meeting,
+interpenetrate, and form one seamless whole.
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 6</DOCNO>
+Nor did such soothing scenes, however temporary, fail of at least as
+temporary an effect on Ahab.  But if these secret golden keys did
+seem to open in him his own secret golden treasuries, yet did his
+breath upon them prove but tarnishing.
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 7</DOCNO>
+Oh, grassy glades! oh, ever vernal endless landscapes in the soul; in
+ye,--though long parched by the dead drought of the earthy
+life,--in ye, men yet may roll, like young horses in new morning
+clover; and for some few fleeting moments, feel the cool dew of the
+life immortal on them.  Would to God these blessed calms would last.
+But the mingled, mingling threads of life are woven by warp and woof:
+calms crossed by storms, a storm for every calm.  There is no steady
+unretracing progress in this life; we do not advance through fixed
+gradations, and at the last one pause:--through infancy's unconscious
+spell, boyhood's thoughtless faith, adolescence' doubt (the common
+doom), then scepticism, then disbelief, resting at last in manhood's
+pondering repose of If.  But once gone through, we trace the round
+again; and are infants, boys, and men, and Ifs eternally.  Where lies
+the final harbor, whence we unmoor no more?  In what rapt ether sails
+the world, of which the weariest will never weary?  Where is the
+foundling's father hidden?  Our souls are like those orphans whose
+unwedded mothers die in bearing them: the secret of our paternity
+lies in their grave, and we must there to learn it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 8</DOCNO>
+And that same day, too, gazing far down from his boat's side into
+that same golden sea, Starbuck lowly murmured:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 9</DOCNO>
+"Loveliness unfathomable, as ever lover saw in his young bride's
+eye!--Tell me not of thy teeth-tiered sharks, and thy kidnapping
+cannibal ways.  Let faith oust fact; let fancy oust memory; I look
+deep down and do believe."
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 10</DOCNO>
+And Stubb, fish-like, with sparkling scales, leaped up in that same
+golden light:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 114, Paragraph 11</DOCNO>
+"I am Stubb, and Stubb has his history; but here Stubb takes oaths
+that he has always been jolly!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 1</DOCNO>
+The Pequod Meets The Bachelor.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 2</DOCNO>
+And jolly enough were the sights and the sounds that came bearing
+down before the wind, some few weeks after Ahab's harpoon had been
+welded.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 3</DOCNO>
+It was a Nantucket ship, the Bachelor, which had just wedged in her
+last cask of oil, and bolted down her bursting hatches; and now, in
+glad holiday apparel, was joyously, though somewhat vain-gloriously,
+sailing round among the widely-separated ships on the ground,
+previous to pointing her prow for home.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 4</DOCNO>
+The three men at her mast-head wore long streamers of narrow red
+bunting at their hats; from the stern, a whale-boat was suspended,
+bottom down; and hanging captive from the bowsprit was seen the long
+lower jaw of the last whale they had slain.  Signals, ensigns, and
+jacks of all colours were flying from her rigging, on every side.
+Sideways lashed in each of her three basketed tops were two barrels
+of sperm; above which, in her top-mast cross-trees, you saw slender
+breakers of the same precious fluid; and nailed to her main truck was
+a brazen lamp.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 5</DOCNO>
+As was afterwards learned, the Bachelor had met with the most
+surprising success; all the more wonderful, for that while cruising
+in the same seas numerous other vessels had gone entire months
+without securing a single fish.  Not only had barrels of beef and
+bread been given away to make room for the far more valuable sperm,
+but additional supplemental casks had been bartered for, from the
+ships she had met; and these were stowed along the deck, and in the
+captain's and officers' state-rooms.  Even the cabin table itself
+had been knocked into kindling-wood; and the cabin mess dined off the
+broad head of an oil-butt, lashed down to the floor for a
+centrepiece.  In the forecastle, the sailors had actually caulked
+and pitched their chests, and filled them; it was humorously added,
+that the cook had clapped a head on his largest boiler, and filled
+it; that the steward had plugged his spare coffee-pot and filled it;
+that the harpooneers had headed the sockets of their irons and filled
+them; that indeed everything was filled with sperm, except the
+captain's pantaloons pockets, and those he reserved to thrust his
+hands into, in self-complacent testimony of his entire satisfaction.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 6</DOCNO>
+As this glad ship of good luck bore down upon the moody Pequod, the
+barbarian sound of enormous drums came from her forecastle; and
+drawing still nearer, a crowd of her men were seen standing round her
+huge try-pots, which, covered with the parchment-like POKE or stomach
+skin of the black fish, gave forth a loud roar to every stroke of the
+clenched hands of the crew.  On the quarter-deck, the mates and
+harpooneers were dancing with the olive-hued girls who had eloped
+with them from the Polynesian Isles; while suspended in an
+ornamented boat, firmly secured aloft between the foremast and
+mainmast, three Long Island negroes, with glittering fiddle-bows of
+whale ivory, were presiding over the hilarious jig.  Meanwhile,
+others of the ship's company were tumultuously busy at the masonry of
+the try-works, from which the huge pots had been removed.  You would
+have almost thought they were pulling down the cursed Bastille, such
+wild cries they raised, as the now useless brick and mortar were
+being hurled into the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 7</DOCNO>
+Lord and master over all this scene, the captain stood erect on the
+ship's elevated quarter-deck, so that the whole rejoicing drama was
+full before him, and seemed merely contrived for his own individual
+diversion.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 8</DOCNO>
+And Ahab, he too was standing on his quarter-deck, shaggy and black,
+with a stubborn gloom; and as the two ships crossed each other's
+wakes--one all jubilations for things passed, the other all
+forebodings as to things to come--their two captains in themselves
+impersonated the whole striking contrast of the scene.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 9</DOCNO>
+"Come aboard, come aboard!" cried the gay Bachelor's commander,
+lifting a glass and a bottle in the air.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 10</DOCNO>
+"Hast seen the White Whale?" gritted Ahab in reply.
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 11</DOCNO>
+"No; only heard of him; but don't believe in him at all," said the
+other good-humoredly.  "Come aboard!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 12</DOCNO>
+"Thou art too damned jolly.  Sail on.  Hast lost any men?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 13</DOCNO>
+"Not enough to speak of--two islanders, that's all;--but come aboard,
+old hearty, come along.  I'll soon take that black from your brow.
+Come along, will ye (merry's the play); a full ship and
+homeward-bound."
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 14</DOCNO>
+"How wondrous familiar is a fool!" muttered Ahab; then aloud, "Thou
+art a full ship and homeward bound, thou sayst; well, then, call me
+an empty ship, and outward-bound.  So go thy ways, and I will mine.
+Forward there!  Set all sail, and keep her to the wind!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 115, Paragraph 15</DOCNO>
+And thus, while the one ship went cheerily before the breeze, the
+other stubbornly fought against it; and so the two vessels parted;
+the crew of the Pequod looking with grave, lingering glances towards
+the receding Bachelor; but the Bachelor's men never heeding their
+gaze for the lively revelry they were in.  And as Ahab, leaning over
+the taffrail, eyed the homewardbound craft, he took from his pocket a
+small vial of sand, and then looking from the ship to the vial,
+seemed thereby bringing two remote associations together, for that
+vial was filled with Nantucket soundings.
+</DOC>
+<DOC>
+<DOCNO>Chapter 116, Paragraph 1</DOCNO>
+The Dying Whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 116, Paragraph 2</DOCNO>
+Not seldom in this life, when, on the right side, fortune's favourites
+sail close by us, we, though all adroop before, catch somewhat of the
+rushing breeze, and joyfully feel our bagging sails fill out.  So
+seemed it with the Pequod.  For next day after encountering the gay
+Bachelor, whales were seen and four were slain; and one of them by
+Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 116, Paragraph 3</DOCNO>
+It was far down the afternoon; and when all the spearings of the
+crimson fight were done: and floating in the lovely sunset sea and
+sky, sun and whale both stilly died together; then, such a sweetness
+and such plaintiveness, such inwreathing orisons curled up in that
+rosy air, that it almost seemed as if far over from the deep green
+convent valleys of the Manilla isles, the Spanish land-breeze,
+wantonly turned sailor, had gone to sea, freighted with these vesper
+hymns.
+</DOC>
+<DOC>
+<DOCNO>Chapter 116, Paragraph 4</DOCNO>
+Soothed again, but only soothed to deeper gloom, Ahab, who had
+sterned off from the whale, sat intently watching his final wanings
+from the now tranquil boat.  For that strange spectacle observable in
+all sperm whales dying--the turning sunwards of the head, and so
+expiring--that strange spectacle, beheld of such a placid evening,
+somehow to Ahab conveyed a wondrousness unknown before.
+</DOC>
+<DOC>
+<DOCNO>Chapter 116, Paragraph 5</DOCNO>
+"He turns and turns him to it,--how slowly, but how steadfastly, his
+homage-rendering and invoking brow, with his last dying motions.  He
+too worships fire; most faithful, broad, baronial vassal of the
+sun!--Oh that these too-favouring eyes should see these too-favouring
+sights.  Look! here, far water-locked; beyond all hum of human weal
+or woe; in these most candid and impartial seas; where to traditions
+no rocks furnish tablets; where for long Chinese ages, the billows
+have still rolled on speechless and unspoken to, as stars that shine
+upon the Niger's unknown source; here, too, life dies sunwards full
+of faith; but see! no sooner dead, than death whirls round the
+corpse, and it heads some other way.
+</DOC>
+<DOC>
+<DOCNO>Chapter 116, Paragraph 6</DOCNO>
+"Oh, thou dark Hindoo half of nature, who of drowned bones hast
+builded thy separate throne somewhere in the heart of these
+unverdured seas; thou art an infidel, thou queen, and too truly
+speakest to me in the wide-slaughtering Typhoon, and the hushed
+burial of its after calm.  Nor has this thy whale sunwards turned his
+dying head, and then gone round again, without a lesson to me.
+</DOC>
+<DOC>
+<DOCNO>Chapter 116, Paragraph 7</DOCNO>
+"Oh, trebly hooped and welded hip of power!  Oh, high aspiring,
+rainbowed jet!--that one strivest, this one jettest all in vain!  In
+vain, oh whale, dost thou seek intercedings with yon all-quickening
+sun, that only calls forth life, but gives it not again.  Yet dost
+thou, darker half, rock me with a prouder, if a darker faith.  All
+thy unnamable imminglings float beneath me here; I am buoyed by
+breaths of once living things, exhaled as air, but water now.
+</DOC>
+<DOC>
+<DOCNO>Chapter 116, Paragraph 8</DOCNO>
+"Then hail, for ever hail, O sea, in whose eternal tossings the wild
+fowl finds his only rest.  Born of earth, yet suckled by the sea;
+though hill and valley mothered me, ye billows are my
+foster-brothers!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 1</DOCNO>
+The Whale Watch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 2</DOCNO>
+The four whales slain that evening had died wide apart; one, far to
+windward; one, less distant, to leeward; one ahead; one astern.
+These last three were brought alongside ere nightfall; but the
+windward one could not be reached till morning; and the boat that had
+killed it lay by its side all night; and that boat was Ahab's.
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 3</DOCNO>
+The waif-pole was thrust upright into the dead whale's spout-hole;
+and the lantern hanging from its top, cast a troubled flickering
+glare upon the black, glossy back, and far out upon the midnight
+waves, which gently chafed the whale's broad flank, like soft surf
+upon a beach.
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 4</DOCNO>
+Ahab and all his boat's crew seemed asleep but the Parsee; who
+crouching in the bow, sat watching the sharks, that spectrally played
+round the whale, and tapped the light cedar planks with their tails.
+A sound like the moaning in squadrons over Asphaltites of unforgiven
+ghosts of Gomorrah, ran shuddering through the air.
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 5</DOCNO>
+Started from his slumbers, Ahab, face to face, saw the Parsee; and
+hooped round by the gloom of the night they seemed the last men in a
+flooded world.  "I have dreamed it again," said he.
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 6</DOCNO>
+"Of the hearses?  Have I not said, old man, that neither hearse nor
+coffin can be thine?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 7</DOCNO>
+"And who are hearsed that die on the sea?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 8</DOCNO>
+"But I said, old man, that ere thou couldst die on this voyage, two
+hearses must verily be seen by thee on the sea; the first not made by
+mortal hands; and the visible wood of the last one must be grown in
+America."
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 9</DOCNO>
+"Aye, aye! a strange sight that, Parsee:--a hearse and its plumes
+floating over the ocean with the waves for the pall-bearers.  Ha!
+Such a sight we shall not soon see."
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 10</DOCNO>
+"Believe it or not, thou canst not die till it be seen, old man."
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 11</DOCNO>
+"And what was that saying about thyself?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 12</DOCNO>
+"Though it come to the last, I shall still go before thee thy pilot."
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 13</DOCNO>
+"And when thou art so gone before--if that ever befall--then ere I
+can follow, thou must still appear to me, to pilot me still?--Was it
+not so?  Well, then, did I believe all ye say, oh my pilot!  I have
+here two pledges that I shall yet slay Moby Dick and survive it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 14</DOCNO>
+"Take another pledge, old man," said the Parsee, as his eyes lighted
+up like fire-flies in the gloom--"Hemp only can kill thee."
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 15</DOCNO>
+"The gallows, ye mean.--I am immortal then, on land and on sea,"
+cried Ahab, with a laugh of derision;--"Immortal on land and on sea!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 117, Paragraph 16</DOCNO>
+Both were silent again, as one man.  The grey dawn came on, and the
+slumbering crew arose from the boat's bottom, and ere noon the dead
+whale was brought to the ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 1</DOCNO>
+The Quadrant.
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 2</DOCNO>
+The season for the Line at length drew near; and every day when Ahab,
+coming from his cabin, cast his eyes aloft, the vigilant helmsman
+would ostentatiously handle his spokes, and the eager mariners
+quickly run to the braces, and would stand there with all their eyes
+centrally fixed on the nailed doubloon; impatient for the order to
+point the ship's prow for the equator.  In good time the order came.
+It was hard upon high noon; and Ahab, seated in the bows of his
+high-hoisted boat, was about taking his wonted daily observation of
+the sun to determine his latitude.
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 3</DOCNO>
+Now, in that Japanese sea, the days in summer are as freshets of
+effulgences.  That unblinkingly vivid Japanese sun seems the blazing
+focus of the glassy ocean's immeasurable burning-glass.  The sky
+looks lacquered; clouds there are none; the horizon floats; and this
+nakedness of unrelieved radiance is as the insufferable splendors of
+God's throne.  Well that Ahab's quadrant was furnished with coloured
+glasses, through which to take sight of that solar fire.  So,
+swinging his seated form to the roll of the ship, and with his
+astrological-looking instrument placed to his eye, he remained in
+that posture for some moments to catch the precise instant when the
+sun should gain its precise meridian.  Meantime while his whole
+attention was absorbed, the Parsee was kneeling beneath him on the
+ship's deck, and with face thrown up like Ahab's, was eyeing the same
+sun with him; only the lids of his eyes half hooded their orbs, and
+his wild face was subdued to an earthly passionlessness.  At length
+the desired observation was taken; and with his pencil upon his ivory
+leg, Ahab soon calculated what his latitude must be at that precise
+instant.  Then falling into a moment's revery, he again looked up
+towards the sun and murmured to himself: "Thou sea-mark! thou high
+and mighty Pilot! thou tellest me truly where I AM--but canst thou
+cast the least hint where I SHALL be?  Or canst thou tell where some
+other thing besides me is this moment living?  Where is Moby Dick?
+This instant thou must be eyeing him.  These eyes of mine look into
+the very eye that is even now beholding him; aye, and into the eye
+that is even now equally beholding the objects on the unknown,
+thither side of thee, thou sun!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 4</DOCNO>
+Then gazing at his quadrant, and handling, one after the other, its
+numerous cabalistical contrivances, he pondered again, and muttered:
+"Foolish toy! babies' plaything of haughty Admirals, and Commodores,
+and Captains; the world brags of thee, of thy cunning and might; but
+what after all canst thou do, but tell the poor, pitiful point, where
+thou thyself happenest to be on this wide planet, and the hand that
+holds thee: no! not one jot more!  Thou canst not tell where one drop
+of water or one grain of sand will be to-morrow noon; and yet with
+thy impotence thou insultest the sun!  Science!  Curse thee, thou
+vain toy; and cursed be all the things that cast man's eyes aloft to
+that heaven, whose live vividness but scorches him, as these old eyes
+are even now scorched with thy light, O sun!  Level by nature to this
+earth's horizon are the glances of man's eyes; not shot from the
+crown of his head, as if God had meant him to gaze on his firmament.
+Curse thee, thou quadrant!" dashing it to the deck, "no longer will I
+guide my earthly way by thee; the level ship's compass, and the level
+deadreckoning, by log and by line; THESE shall conduct me, and show
+me my place on the sea.  Aye," lighting from the boat to the deck,
+"thus I trample on thee, thou paltry thing that feebly pointest on
+high; thus I split and destroy thee!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 5</DOCNO>
+As the frantic old man thus spoke and thus trampled with his live and
+dead feet, a sneering triumph that seemed meant for Ahab, and a
+fatalistic despair that seemed meant for himself--these passed over
+the mute, motionless Parsee's face.  Unobserved he rose and glided
+away; while, awestruck by the aspect of their commander, the seamen
+clustered together on the forecastle, till Ahab, troubledly pacing
+the deck, shouted out--"To the braces!  Up helm!--square in!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 6</DOCNO>
+In an instant the yards swung round; and as the ship half-wheeled
+upon her heel, her three firm-seated graceful masts erectly poised
+upon her long, ribbed hull, seemed as the three Horatii pirouetting
+on one sufficient steed.
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 7</DOCNO>
+Standing between the knight-heads, Starbuck watched the Pequod's
+tumultuous way, and Ahab's also, as he went lurching along the deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 8</DOCNO>
+"I have sat before the dense coal fire and watched it all aglow, full
+of its tormented flaming life; and I have seen it wane at last, down,
+down, to dumbest dust.  Old man of oceans! of all this fiery life of
+thine, what will at length remain but one little heap of ashes!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 118, Paragraph 9</DOCNO>
+"Aye," cried Stubb, "but sea-coal ashes--mind ye that, Mr.
+Starbuck--sea-coal, not your common charcoal.  Well, well; I heard
+Ahab mutter, 'Here some one thrusts these cards into these old hands
+of mine; swears that I must play them, and no others.'  And damn me,
+Ahab, but thou actest right; live in the game, and die in it!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 1</DOCNO>
+The Candles.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 2</DOCNO>
+Warmest climes but nurse the cruellest fangs: the tiger of Bengal
+crouches in spiced groves of ceaseless verdure.  Skies the most
+effulgent but basket the deadliest thunders: gorgeous Cuba knows
+tornadoes that never swept tame northern lands.  So, too, it is, that
+in these resplendent Japanese seas the mariner encounters the direst
+of all storms, the Typhoon.  It will sometimes burst from out that
+cloudless sky, like an exploding bomb upon a dazed and sleepy town.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 3</DOCNO>
+Towards evening of that day, the Pequod was torn of her canvas, and
+bare-poled was left to fight a Typhoon which had struck her directly
+ahead.  When darkness came on, sky and sea roared and split with the
+thunder, and blazed with the lightning, that showed the disabled
+masts fluttering here and there with the rags which the first fury of
+the tempest had left for its after sport.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 4</DOCNO>
+Holding by a shroud, Starbuck was standing on the quarter-deck; at
+every flash of the lightning glancing aloft, to see what additional
+disaster might have befallen the intricate hamper there; while Stubb
+and Flask were directing the men in the higher hoisting and firmer
+lashing of the boats.  But all their pains seemed naught.  Though
+lifted to the very top of the cranes, the windward quarter boat
+(Ahab's) did not escape.  A great rolling sea, dashing high up
+against the reeling ship's high teetering side, stove in the boat's
+bottom at the stern, and left it again, all dripping through like a
+sieve.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 5</DOCNO>
+"Bad work, bad work!  Mr. Starbuck," said Stubb, regarding the wreck,
+"but the sea will have its way.  Stubb, for one, can't fight it.  You
+see, Mr. Starbuck, a wave has such a great long start before it
+leaps, all round the world it runs, and then comes the spring!  But
+as for me, all the start I have to meet it, is just across the deck
+here.  But never mind; it's all in fun: so the old song
+says;"--(SINGS.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 6</DOCNO>
+Oh! jolly is the gale,
+And a joker is the whale,
+A' flourishin' his tail,--
+Such a funny, sporty, gamy, jesty, joky, hoky-poky lad, is the Ocean, oh!
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 7</DOCNO>
+The scud all a flyin',
+That's his flip only foamin';
+When he stirs in the spicin',--
+Such a funny, sporty, gamy, jesty, joky, hoky-poky lad, is the Ocean, oh!
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 8</DOCNO>
+Thunder splits the ships,
+But he only smacks his lips,
+A tastin' of this flip,--
+Such a funny, sporty, gamy, jesty, joky, hoky-poky lad, is the Ocean, oh!
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 9</DOCNO>
+"Avast Stubb," cried Starbuck, "let the Typhoon sing, and strike his
+harp here in our rigging; but if thou art a brave man thou wilt hold
+thy peace."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 10</DOCNO>
+"But I am not a brave man; never said I was a brave man; I am a
+coward; and I sing to keep up my spirits.  And I tell you what it is,
+Mr. Starbuck, there's no way to stop my singing in this world but to
+cut my throat.  And when that's done, ten to one I sing ye the
+doxology for a wind-up."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 11</DOCNO>
+"Madman! look through my eyes if thou hast none of thine own."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 12</DOCNO>
+"What! how can you see better of a dark night than anybody else,
+never mind how foolish?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 13</DOCNO>
+"Here!" cried Starbuck, seizing Stubb by the shoulder, and pointing
+his hand towards the weather bow, "markest thou not that the gale
+comes from the eastward, the very course Ahab is to run for Moby
+Dick? the very course he swung to this day noon? now mark his boat
+there; where is that stove?  In the stern-sheets, man; where he is
+wont to stand--his stand-point is stove, man!  Now jump overboard,
+and sing away, if thou must!
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 14</DOCNO>
+"I don't half understand ye: what's in the wind?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 15</DOCNO>
+"Yes, yes, round the Cape of Good Hope is the shortest way to
+Nantucket," soliloquized Starbuck suddenly, heedless of Stubb's
+question.  "The gale that now hammers at us to stave us, we can turn
+it into a fair wind that will drive us towards home.  Yonder, to
+windward, all is blackness of doom; but to leeward, homeward--I see
+it lightens up there; but not with the lightning."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 16</DOCNO>
+At that moment in one of the intervals of profound darkness,
+following the flashes, a voice was heard at his side; and almost at
+the same instant a volley of thunder peals rolled overhead.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 17</DOCNO>
+"Who's there?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 18</DOCNO>
+"Old Thunder!" said Ahab, groping his way along the bulwarks to his
+pivot-hole; but suddenly finding his path made plain to him by
+elbowed lances of fire.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 19</DOCNO>
+Now, as the lightning rod to a spire on shore is intended to carry
+off the perilous fluid into the soil; so the kindred rod which at sea
+some ships carry to each mast, is intended to conduct it into the
+water.  But as this conductor must descend to considerable depth,
+that its end may avoid all contact with the hull; and as moreover, if
+kept constantly towing there, it would be liable to many mishaps,
+besides interfering not a little with some of the rigging, and more
+or less impeding the vessel's way in the water; because of all this,
+the lower parts of a ship's lightning-rods are not always overboard;
+but are generally made in long slender links, so as to be the more
+readily hauled up into the chains outside, or thrown down into the
+sea, as occasion may require.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 20</DOCNO>
+"The rods! the rods!" cried Starbuck to the crew, suddenly admonished
+to vigilance by the vivid lightning that had just been darting
+flambeaux, to light Ahab to his post.  "Are they overboard? drop them
+over, fore and aft.  Quick!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 21</DOCNO>
+"Avast!" cried Ahab; "let's have fair play here, though we be the
+weaker side.  Yet I'll contribute to raise rods on the Himmalehs and
+Andes, that all the world may be secured; but out on privileges!  Let
+them be, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 22</DOCNO>
+"Look aloft!" cried Starbuck.  "The corpusants! the corpusants!
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 23</DOCNO>
+All the yard-arms were tipped with a pallid fire; and touched at each
+tri-pointed lightning-rod-end with three tapering white flames, each
+of the three tall masts was silently burning in that sulphurous air,
+like three gigantic wax tapers before an altar.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 24</DOCNO>
+"Blast the boat! let it go!" cried Stubb at this instant, as a
+swashing sea heaved up under his own little craft, so that its
+gunwale violently jammed his hand, as he was passing a lashing.
+"Blast it!"--but slipping backward on the deck, his uplifted eyes
+caught the flames; and immediately shifting his tone he cried--"The
+corpusants have mercy on us all!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 25</DOCNO>
+To sailors, oaths are household words; they will swear in the trance
+of the calm, and in the teeth of the tempest; they will imprecate
+curses from the topsail-yard-arms, when most they teeter over to a
+seething sea; but in all my voyagings, seldom have I heard a common
+oath when God's burning finger has been laid on the ship; when His
+"Mene, Mene, Tekel Upharsin" has been woven into the shrouds and the
+cordage.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 26</DOCNO>
+While this pallidness was burning aloft, few words were heard from
+the enchanted crew; who in one thick cluster stood on the forecastle,
+all their eyes gleaming in that pale phosphorescence, like a far away
+constellation of stars.  Relieved against the ghostly light, the
+gigantic jet negro, Daggoo, loomed up to thrice his real stature, and
+seemed the black cloud from which the thunder had come.  The parted
+mouth of Tashtego revealed his shark-white teeth, which strangely
+gleamed as if they too had been tipped by corpusants; while lit up by
+the preternatural light, Queequeg's tattooing burned like Satanic
+blue flames on his body.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 27</DOCNO>
+The tableau all waned at last with the pallidness aloft; and once
+more the Pequod and every soul on her decks were wrapped in a pall.
+A moment or two passed, when Starbuck, going forward, pushed against
+some one.  It was Stubb.  "What thinkest thou now, man; I heard thy
+cry; it was not the same in the song."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 28</DOCNO>
+"No, no, it wasn't; I said the corpusants have mercy on us all; and I
+hope they will, still.  But do they only have mercy on long
+faces?--have they no bowels for a laugh?  And look ye, Mr.
+Starbuck--but it's too dark to look.  Hear me, then: I take that
+mast-head flame we saw for a sign of good luck; for those masts are
+rooted in a hold that is going to be chock a' block with sperm-oil,
+d'ye see; and so, all that sperm will work up into the masts, like
+sap in a tree.  Yes, our three masts will yet be as three spermaceti
+candles--that's the good promise we saw."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 29</DOCNO>
+At that moment Starbuck caught sight of Stubb's face slowly beginning
+to glimmer into sight.  Glancing upwards, he cried: "See! see!" and
+once more the high tapering flames were beheld with what seemed
+redoubled supernaturalness in their pallor.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 30</DOCNO>
+"The corpusants have mercy on us all," cried Stubb, again.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 31</DOCNO>
+At the base of the mainmast, full beneath the doubloon and the
+flame, the Parsee was kneeling in Ahab's front, but with his head
+bowed away from him; while near by, from the arched and overhanging
+rigging, where they had just been engaged securing a spar, a number
+of the seamen, arrested by the glare, now cohered together, and hung
+pendulous, like a knot of numbed wasps from a drooping, orchard twig.
+In various enchanted attitudes, like the standing, or stepping, or
+running skeletons in Herculaneum, others remained rooted to the deck;
+but all their eyes upcast.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 32</DOCNO>
+"Aye, aye, men!" cried Ahab.  "Look up at it; mark it well; the white
+flame but lights the way to the White Whale!  Hand me those mainmast
+links there; I would fain feel this pulse, and let mine beat against
+it; blood against fire!  So."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 33</DOCNO>
+Then turning--the last link held fast in his left hand, he put his
+foot upon the Parsee; and with fixed upward eye, and high-flung right
+arm, he stood erect before the lofty tri-pointed trinity of flames.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 34</DOCNO>
+"Oh! thou clear spirit of clear fire, whom on these seas I as Persian
+once did worship, till in the sacramental act so burned by thee, that
+to this hour I bear the scar; I now know thee, thou clear spirit, and
+I now know that thy right worship is defiance.  To neither love nor
+reverence wilt thou be kind; and e'en for hate thou canst but kill;
+and all are killed.  No fearless fool now fronts thee.  I own thy
+speechless, placeless power; but to the last gasp of my earthquake
+life will dispute its unconditional, unintegral mastery in me.  In the
+midst of the personified impersonal, a personality stands here.
+Though but a point at best; whencesoe'er I came; wheresoe'er I go;
+yet while I earthly live, the queenly personality lives in me, and
+feels her royal rights.  But war is pain, and hate is woe.  Come in
+thy lowest form of love, and I will kneel and kiss thee; but at thy
+highest, come as mere supernal power; and though thou launchest
+navies of full-freighted worlds, there's that in here that still
+remains indifferent.  Oh, thou clear spirit, of thy fire thou madest
+me, and like a true child of fire, I breathe it back to thee."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 35</DOCNO>
+[SUDDEN, REPEATED FLASHES OF LIGHTNING; THE NINE FLAMES LEAP
+LENGTHWISE TO THRICE THEIR PREVIOUS HEIGHT; AHAB, WITH THE REST,
+CLOSES HIS EYES, HIS RIGHT HAND PRESSED HARD UPON THEM.]
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 36</DOCNO>
+"I own thy speechless, placeless power; said I not so?  Nor was it
+wrung from me; nor do I now drop these links.  Thou canst blind; but
+I can then grope.  Thou canst consume; but I can then be ashes.  Take
+the homage of these poor eyes, and shutter-hands.  I would not take
+it.  The lightning flashes through my skull; mine eye-balls ache and
+ache; my whole beaten brain seems as beheaded, and rolling on some
+stunning ground.  Oh, oh!  Yet blindfold, yet will I talk to thee.
+Light though thou be, thou leapest out of darkness; but I am darkness
+leaping out of light, leaping out of thee!  The javelins cease; open
+eyes; see, or not?  There burn the flames!  Oh, thou magnanimous! now
+I do glory in my genealogy.  But thou art but my fiery father; my
+sweet mother, I know not.  Oh, cruel! what hast thou done with her?
+There lies my puzzle; but thine is greater.  Thou knowest not how
+came ye, hence callest thyself unbegotten; certainly knowest not thy
+beginning, hence callest thyself unbegun.  I know that of me, which
+thou knowest not of thyself, oh, thou omnipotent.  There is some
+unsuffusing thing beyond thee, thou clear spirit, to whom all thy
+eternity is but time, all thy creativeness mechanical.  Through thee,
+thy flaming self, my scorched eyes do dimly see it.  Oh, thou
+foundling fire, thou hermit immemorial, thou too hast thy
+incommunicable riddle, thy unparticipated grief.  Here again with
+haughty agony, I read my sire.  Leap! leap up, and lick the sky!  I
+leap with thee; I burn with thee; would fain be welded with thee;
+defyingly I worship thee!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 37</DOCNO>
+"The boat! the boat!" cried Starbuck, "look at thy boat, old man!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 38</DOCNO>
+Ahab's harpoon, the one forged at Perth's fire, remained firmly
+lashed in its conspicuous crotch, so that it projected beyond his
+whale-boat's bow; but the sea that had stove its bottom had caused
+the loose leather sheath to drop off; and from the keen steel barb
+there now came a levelled flame of pale, forked fire.  As the silent
+harpoon burned there like a serpent's tongue, Starbuck grasped Ahab
+by the arm--"God, God is against thee, old man; forbear! 'tis an
+ill voyage! ill begun, ill continued; let me square the yards, while
+we may, old man, and make a fair wind of it homewards, to go on a
+better voyage than this."
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 39</DOCNO>
+Overhearing Starbuck, the panic-stricken crew instantly ran to the
+braces--though not a sail was left aloft.  For the moment all the
+aghast mate's thoughts seemed theirs; they raised a half mutinous
+cry.  But dashing the rattling lightning links to the deck, and
+snatching the burning harpoon, Ahab waved it like a torch among them;
+swearing to transfix with it the first sailor that but cast loose a
+rope's end.  Petrified by his aspect, and still more shrinking from
+the fiery dart that he held, the men fell back in dismay, and Ahab
+again spoke:--
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 40</DOCNO>
+"All your oaths to hunt the White Whale are as binding as mine; and
+heart, soul, and body, lungs and life, old Ahab is bound.  And that
+ye may know to what tune this heart beats; look ye here; thus I blow
+out the last fear!"  And with one blast of his breath he extinguished
+the flame.
+</DOC>
+<DOC>
+<DOCNO>Chapter 119, Paragraph 41</DOCNO>
+As in the hurricane that sweeps the plain, men fly the neighborhood
+of some lone, gigantic elm, whose very height and strength but render
+it so much the more unsafe, because so much the more a mark for
+thunderbolts; so at those last words of Ahab's many of the mariners
+did run from him in a terror of dismay.
+</DOC>
+<DOC>
+<DOCNO>Chapter 120, Paragraph 1</DOCNO>
+The Deck Towards the End of the First Night Watch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 120, Paragraph 2</DOCNO>
+AHAB STANDING BY THE HELM.  STARBUCK APPROACHING HIM.
+</DOC>
+<DOC>
+<DOCNO>Chapter 120, Paragraph 3</DOCNO>
+We must send down the main-top-sail yard, sir.  The band is working
+loose and the lee lift is half-stranded.  Shall I strike it, sir?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 120, Paragraph 4</DOCNO>
+"Strike nothing; lash it.  If I had sky-sail poles, I'd sway them up
+now."
+</DOC>
+<DOC>
+<DOCNO>Chapter 120, Paragraph 5</DOCNO>
+"Sir!--in God's name!--sir?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 120, Paragraph 6</DOCNO>
+"Well."
+</DOC>
+<DOC>
+<DOCNO>Chapter 120, Paragraph 7</DOCNO>
+"The anchors are working, sir.  Shall I get them inboard?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 120, Paragraph 8</DOCNO>
+"Strike nothing, and stir nothing, but lash everything.  The wind
+rises, but it has not got up to my table-lands yet.  Quick, and see
+to it.--By masts and keels! he takes me for the hunch-backed skipper
+of some coasting smack.  Send down my main-top-sail yard!  Ho,
+gluepots!  Loftiest trucks were made for wildest winds, and this
+brain-truck of mine now sails amid the cloud-scud.  Shall I strike
+that?  Oh, none but cowards send down their brain-trucks in tempest
+time.  What a hooroosh aloft there!  I would e'en take it for
+sublime, did I not know that the colic is a noisy malady.  Oh, take
+medicine, take medicine!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 121, Paragraph 1</DOCNO>
+Midnight.--The Forecastle Bulwarks.
+</DOC>
+<DOC>
+<DOCNO>Chapter 121, Paragraph 2</DOCNO>
+STUBB AND FLASK MOUNTED ON THEM, AND PASSING ADDITIONAL LASHINGS OVER
+THE ANCHORS THERE HANGING.
+</DOC>
+<DOC>
+<DOCNO>Chapter 121, Paragraph 3</DOCNO>
+No, Stubb; you may pound that knot there as much as you please, but
+you will never pound into me what you were just now saying.  And how
+long ago is it since you said the very contrary?  Didn't you once say
+that whatever ship Ahab sails in, that ship should pay something
+extra on its insurance policy, just as though it were loaded with
+powder barrels aft and boxes of lucifers forward?  Stop, now; didn't
+you say so?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 121, Paragraph 4</DOCNO>
+"Well, suppose I did?  What then?  I've part changed my flesh since
+that time, why not my mind?  Besides, supposing we ARE loaded with
+powder barrels aft and lucifers forward; how the devil could the
+lucifers get afire in this drenching spray here?  Why, my little man,
+you have pretty red hair, but you couldn't get afire now.  Shake
+yourself; you're Aquarius, or the water-bearer, Flask; might fill
+pitchers at your coat collar.  Don't you see, then, that for these
+extra risks the Marine Insurance companies have extra guarantees?
+Here are hydrants, Flask.  But hark, again, and I'll answer ye the
+other thing.  First take your leg off from the crown of the anchor
+here, though, so I can pass the rope; now listen.  What's the mighty
+difference between holding a mast's lightning-rod in the storm, and
+standing close by a mast that hasn't got any lightning-rod at all in
+a storm?  Don't you see, you timber-head, that no harm can come to
+the holder of the rod, unless the mast is first struck?  What are you
+talking about, then?  Not one ship in a hundred carries rods, and
+Ahab,--aye, man, and all of us,--were in no more danger then, in my
+poor opinion, than all the crews in ten thousand ships now sailing
+the seas.  Why, you King-Post, you, I suppose you would have every
+man in the world go about with a small lightning-rod running up the
+corner of his hat, like a militia officer's skewered feather, and
+trailing behind like his sash.  Why don't ye be sensible, Flask? it's
+easy to be sensible; why don't ye, then? any man with half an eye can
+be sensible."
+</DOC>
+<DOC>
+<DOCNO>Chapter 121, Paragraph 5</DOCNO>
+"I don't know that, Stubb.  You sometimes find it rather hard."
+</DOC>
+<DOC>
+<DOCNO>Chapter 121, Paragraph 6</DOCNO>
+"Yes, when a fellow's soaked through, it's hard to be sensible,
+that's a fact.  And I am about drenched with this spray.  Never mind;
+catch the turn there, and pass it.  Seems to me we are lashing down
+these anchors now as if they were never going to be used again.
+Tying these two anchors here, Flask, seems like tying a man's hands
+behind him.  And what big generous hands they are, to be sure.  These
+are your iron fists, hey?  What a hold they have, too!  I wonder,
+Flask, whether the world is anchored anywhere; if she is, she swings
+with an uncommon long cable, though.  There, hammer that knot down,
+and we've done.  So; next to touching land, lighting on deck is the
+most satisfactory.  I say, just wring out my jacket skirts, will ye?
+Thank ye.  They laugh at long-togs so, Flask; but seems to me, a
+Long tailed coat ought always to be worn in all storms afloat.  The
+tails tapering down that way, serve to carry off the water, d'ye see.
+Same with cocked hats; the cocks form gable-end eave-troughs, Flask.
+No more monkey-jackets and tarpaulins for me; I must mount a
+swallow-tail, and drive down a beaver; so.  Halloa! whew! there goes
+my tarpaulin overboard; Lord, Lord, that the winds that come from
+heaven should be so unmannerly!  This is a nasty night, lad."
+</DOC>
+<DOC>
+<DOCNO>Chapter 122, Paragraph 1</DOCNO>
+Midnight Aloft.--Thunder and Lightning.
+</DOC>
+<DOC>
+<DOCNO>Chapter 122, Paragraph 2</DOCNO>
+THE MAIN-TOP-SAIL YARD.--TASHTEGO PASSING NEW LASHINGS AROUND IT.
+</DOC>
+<DOC>
+<DOCNO>Chapter 122, Paragraph 3</DOCNO>
+"Um, um, um.  Stop that thunder!  Plenty too much thunder up here.
+What's the use of thunder?  Um, um, um.  We don't want thunder; we
+want rum; give us a glass of rum.  Um, um, um!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 1</DOCNO>
+The Musket.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 2</DOCNO>
+During the most violent shocks of the Typhoon, the man at the
+Pequod's jaw-bone tiller had several times been reelingly hurled to
+the deck by its spasmodic motions, even though preventer tackles had
+been attached to it--for they were slack--because some play to the
+tiller was indispensable.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 3</DOCNO>
+In a severe gale like this, while the ship is but a tossed
+shuttlecock to the blast, it is by no means uncommon to see the
+needles in the compasses, at intervals, go round and round.  It was
+thus with the Pequod's; at almost every shock the helmsman had not
+failed to notice the whirling velocity with which they revolved upon
+the cards; it is a sight that hardly anyone can behold without some
+sort of unwonted emotion.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 4</DOCNO>
+Some hours after midnight, the Typhoon abated so much, that through
+the strenuous exertions of Starbuck and Stubb--one engaged forward
+and the other aft--the shivered remnants of the jib and fore and
+main-top-sails were cut adrift from the spars, and went eddying away
+to leeward, like the feathers of an albatross, which sometimes are
+cast to the winds when that storm-tossed bird is on the wing.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 5</DOCNO>
+The three corresponding new sails were now bent and reefed, and a
+storm-trysail was set further aft; so that the ship soon went through
+the water with some precision again; and the course--for the present,
+East-south-east--which he was to steer, if practicable, was once more
+given to the helmsman.  For during the violence of the gale, he had
+only steered according to its vicissitudes.  But as he was now
+bringing the ship as near her course as possible, watching the
+compass meanwhile, lo! a good sign! the wind seemed coming round
+astern; aye, the foul breeze became fair!
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 6</DOCNO>
+Instantly the yards were squared, to the lively song of "HO! THE FAIR
+WIND! OH-YE-HO, CHEERLY MEN!" the crew singing for joy, that so
+promising an event should so soon have falsified the evil portents
+preceding it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 7</DOCNO>
+In compliance with the standing order of his commander--to report
+immediately, and at any one of the twenty-four hours, any decided
+change in the affairs of the deck,--Starbuck had no sooner trimmed
+the yards to the breeze--however reluctantly and gloomily,--than he
+mechanically went below to apprise Captain Ahab of the circumstance.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 8</DOCNO>
+Ere knocking at his state-room, he involuntarily paused before it a
+moment.  The cabin lamp--taking long swings this way and that--was
+burning fitfully, and casting fitful shadows upon the old man's
+bolted door,--a thin one, with fixed blinds inserted, in place of
+upper panels.  The isolated subterraneousness of the cabin made a
+certain humming silence to reign there, though it was hooped round by
+all the roar of the elements.  The loaded muskets in the rack were
+shiningly revealed, as they stood upright against the forward
+bulkhead.  Starbuck was an honest, upright man; but out of Starbuck's
+heart, at that instant when he saw the muskets, there strangely
+evolved an evil thought; but so blent with its neutral or good
+accompaniments that for the instant he hardly knew it for itself.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 9</DOCNO>
+"He would have shot me once," he murmured, "yes, there's the very
+musket that he pointed at me;--that one with the studded stock; let
+me touch it--lift it.  Strange, that I, who have handled so many
+deadly lances, strange, that I should shake so now.  Loaded?  I must
+see.  Aye, aye; and powder in the pan;--that's not good.  Best spill
+it?--wait.  I'll cure myself of this.  I'll hold the musket boldly
+while I think.--I come to report a fair wind to him.  But how fair?
+Fair for death and doom,--THAT'S fair for Moby Dick.  It's a fair
+wind that's only fair for that accursed fish.--The very tube he
+pointed at me!--the very one; THIS one--I hold it here; he would have
+killed me with the very thing I handle now.--Aye and he would fain
+kill all his crew.  Does he not say he will not strike his spars to
+any gale?  Has he not dashed his heavenly quadrant? and in these same
+perilous seas, gropes he not his way by mere dead reckoning of the
+error-abounding log? and in this very Typhoon, did he not swear that
+he would have no lightning-rods?  But shall this crazed old man be
+tamely suffered to drag a whole ship's company down to doom with
+him?--Yes, it would make him the wilful murderer of thirty men and
+more, if this ship come to any deadly harm; and come to deadly harm,
+my soul swears this ship will, if Ahab have his way.  If, then, he
+were this instant--put aside, that crime would not be his.  Ha! is he
+muttering in his sleep?  Yes, just there,--in there, he's sleeping.
+Sleeping? aye, but still alive, and soon awake again.  I can't
+withstand thee, then, old man.  Not reasoning; not remonstrance; not
+entreaty wilt thou hearken to; all this thou scornest.  Flat
+obedience to thy own flat commands, this is all thou breathest.  Aye,
+and say'st the men have vow'd thy vow; say'st all of us are Ahabs.
+Great God forbid!--But is there no other way? no lawful way?--Make
+him a prisoner to be taken home?  What! hope to wrest this old man's
+living power from his own living hands?  Only a fool would try it.
+Say he were pinioned even; knotted all over with ropes and hawsers;
+chained down to ring-bolts on this cabin floor; he would be more
+hideous than a caged tiger, then.  I could not endure the sight;
+could not possibly fly his howlings; all comfort, sleep itself,
+inestimable reason would leave me on the long intolerable voyage.
+What, then, remains?  The land is hundreds of leagues away, and
+locked Japan the nearest.  I stand alone here upon an open sea, with
+two oceans and a whole continent between me and law.--Aye, aye, 'tis
+so.--Is heaven a murderer when its lightning strikes a would-be
+murderer in his bed, tindering sheets and skin together?--And would I
+be a murderer, then, if"--and slowly, stealthily, and half sideways
+looking, he placed the loaded musket's end against the door.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 10</DOCNO>
+"On this level, Ahab's hammock swings within; his head this way.  A
+touch, and Starbuck may survive to hug his wife and child again.--Oh
+Mary!  Mary!--boy! boy! boy!--But if I wake thee not to death, old
+man, who can tell to what unsounded deeps Starbuck's body this day
+week may sink, with all the crew!  Great God, where art Thou?  Shall
+I? shall I?--The wind has gone down and shifted, sir; the fore and
+main topsails are reefed and set; she heads her course."
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 11</DOCNO>
+"Stern all!  Oh Moby Dick, I clutch thy heart at last!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 12</DOCNO>
+Such were the sounds that now came hurtling from out the old man's
+tormented sleep, as if Starbuck's voice had caused the long dumb
+dream to speak.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 13</DOCNO>
+The yet levelled musket shook like a drunkard's arm against the
+panel; Starbuck seemed wrestling with an angel; but turning from the
+door, he placed the death-tube in its rack, and left the place.
+</DOC>
+<DOC>
+<DOCNO>Chapter 123, Paragraph 14</DOCNO>
+"He's too sound asleep, Mr. Stubb; go thou down, and wake him, and
+tell him.  I must see to the deck here.  Thou know'st what to say."
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 1</DOCNO>
+The Needle.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 2</DOCNO>
+Next morning the not-yet-subsided sea rolled in long slow billows of
+mighty bulk, and striving in the Pequod's gurgling track, pushed her
+on like giants' palms outspread.  The strong, unstaggering breeze
+abounded so, that sky and air seemed vast outbellying sails; the
+whole world boomed before the wind.  Muffled in the full morning
+light, the invisible sun was only known by the spread intensity of
+his place; where his bayonet rays moved on in stacks.  Emblazonings,
+as of crowned Babylonian kings and queens, reigned over everything.
+The sea was as a crucible of molten gold, that bubblingly leaps with
+light and heat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 3</DOCNO>
+Long maintaining an enchanted silence, Ahab stood apart; and every
+time the tetering ship loweringly pitched down her bowsprit, he
+turned to eye the bright sun's rays produced ahead; and when she
+profoundly settled by the stern, he turned behind, and saw the sun's
+rearward place, and how the same yellow rays were blending with his
+undeviating wake.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 4</DOCNO>
+"Ha, ha, my ship! thou mightest well be taken now for the sea-chariot
+of the sun.  Ho, ho! all ye nations before my prow, I bring the sun
+to ye!  Yoke on the further billows; hallo! a tandem, I drive the
+sea!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 5</DOCNO>
+But suddenly reined back by some counter thought, he hurried towards
+the helm, huskily demanding how the ship was heading.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 6</DOCNO>
+"East-sou-east, sir," said the frightened steersman.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 7</DOCNO>
+"Thou liest!" smiting him with his clenched fist.  "Heading East at
+this hour in the morning, and the sun astern?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 8</DOCNO>
+Upon this every soul was confounded; for the phenomenon just then
+observed by Ahab had unaccountably escaped every one else; but its
+very blinding palpableness must have been the cause.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 9</DOCNO>
+Thrusting his head half way into the binnacle, Ahab caught one
+glimpse of the compasses; his uplifted arm slowly fell; for a moment
+he almost seemed to stagger.  Standing behind him Starbuck looked,
+and lo! the two compasses pointed East, and the Pequod was as
+infallibly going West.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 10</DOCNO>
+But ere the first wild alarm could get out abroad among the crew, the
+old man with a rigid laugh exclaimed, "I have it!  It has happened
+before.  Mr. Starbuck, last night's thunder turned our
+compasses--that's all.  Thou hast before now heard of such a thing, I
+take it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 11</DOCNO>
+"Aye; but never before has it happened to me, sir," said the pale
+mate, gloomily.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 12</DOCNO>
+Here, it must needs be said, that accidents like this have in more
+than one case occurred to ships in violent storms.  The magnetic
+energy, as developed in the mariner's needle, is, as all know,
+essentially one with the electricity beheld in heaven; hence it is
+not to be much marvelled at, that such things should be.  Instances
+where the lightning has actually struck the vessel, so as to smite
+down some of the spars and rigging, the effect upon the needle has at
+times been still more fatal; all its loadstone virtue being
+annihilated, so that the before magnetic steel was of no more use
+than an old wife's knitting needle.  But in either case, the needle
+never again, of itself, recovers the original virtue thus marred or
+lost; and if the binnacle compasses be affected, the same fate
+reaches all the others that may be in the ship; even were the
+lowermost one inserted into the kelson.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 13</DOCNO>
+Deliberately standing before the binnacle, and eyeing the
+transpointed compasses, the old man, with the sharp of his extended
+hand, now took the precise bearing of the sun, and satisfied that the
+needles were exactly inverted, shouted out his orders for the ship's
+course to be changed accordingly.  The yards were hard up; and once
+more the Pequod thrust her undaunted bows into the opposing wind, for
+the supposed fair one had only been juggling her.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 14</DOCNO>
+Meanwhile, whatever were his own secret thoughts, Starbuck said
+nothing, but quietly he issued all requisite orders; while Stubb and
+Flask--who in some small degree seemed then to be sharing his
+feelings--likewise unmurmuringly acquiesced.  As for the men, though
+some of them lowly rumbled, their fear of Ahab was greater than their
+fear of Fate.  But as ever before, the pagan harpooneers remained
+almost wholly unimpressed; or if impressed, it was only with a
+certain magnetism shot into their congenial hearts from inflexible
+Ahab's.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 15</DOCNO>
+For a space the old man walked the deck in rolling reveries.  But
+chancing to slip with his ivory heel, he saw the crushed copper
+sight-tubes of the quadrant he had the day before dashed to the deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 16</DOCNO>
+"Thou poor, proud heaven-gazer and sun's pilot! yesterday I wrecked
+thee, and to-day the compasses would fain have wrecked me.  So, so.
+But Ahab is lord over the level loadstone yet.  Mr. Starbuck--a lance
+without a pole; a top-maul, and the smallest of the sail-maker's
+needles.  Quick!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 17</DOCNO>
+Accessory, perhaps, to the impulse dictating the thing he was now
+about to do, were certain prudential motives, whose object might have
+been to revive the spirits of his crew by a stroke of his subtile
+skill, in a matter so wondrous as that of the inverted compasses.
+Besides, the old man well knew that to steer by transpointed needles,
+though clumsily practicable, was not a thing to be passed over by
+superstitious sailors, without some shudderings and evil portents.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 18</DOCNO>
+"Men," said he, steadily turning upon the crew, as the mate handed
+him the things he had demanded, "my men, the thunder turned old
+Ahab's needles; but out of this bit of steel Ahab can make one of his
+own, that will point as true as any."
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 19</DOCNO>
+Abashed glances of servile wonder were exchanged by the sailors, as
+this was said; and with fascinated eyes they awaited whatever magic
+might follow.  But Starbuck looked away.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 20</DOCNO>
+With a blow from the top-maul Ahab knocked off the steel head of the
+lance, and then handing to the mate the long iron rod remaining, bade
+him hold it upright, without its touching the deck.  Then, with the
+maul, after repeatedly smiting the upper end of this iron rod, he
+placed the blunted needle endwise on the top of it, and less strongly
+hammered that, several times, the mate still holding the rod as
+before.  Then going through some small strange motions with
+it--whether indispensable to the magnetizing of the steel, or merely
+intended to augment the awe of the crew, is uncertain--he called for
+linen thread; and moving to the binnacle, slipped out the two
+reversed needles there, and horizontally suspended the sail-needle by
+its middle, over one of the compass-cards.  At first, the steel went
+round and round, quivering and vibrating at either end; but at last
+it settled to its place, when Ahab, who had been intently watching
+for this result, stepped frankly back from the binnacle, and pointing
+his stretched arm towards it, exclaimed,--"Look ye, for yourselves,
+if Ahab be not lord of the level loadstone!  The sun is East, and
+that compass swears it!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 21</DOCNO>
+One after another they peered in, for nothing but their own eyes
+could persuade such ignorance as theirs, and one after another they
+slunk away.
+</DOC>
+<DOC>
+<DOCNO>Chapter 124, Paragraph 22</DOCNO>
+In his fiery eyes of scorn and triumph, you then saw Ahab in all his
+fatal pride.
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 1</DOCNO>
+The Log and Line.
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 2</DOCNO>
+While now the fated Pequod had been so long afloat this voyage, the
+log and line had but very seldom been in use.  Owing to a confident
+reliance upon other means of determining the vessel's place, some
+merchantmen, and many whalemen, especially when cruising, wholly
+neglect to heave the log; though at the same time, and frequently
+more for form's sake than anything else, regularly putting down upon
+the customary slate the course steered by the ship, as well as the
+presumed average rate of progression every hour.  It had been thus
+with the Pequod.  The wooden reel and angular log attached hung, long
+untouched, just beneath the railing of the after bulwarks.  Rains and
+spray had damped it; sun and wind had warped it; all the elements
+had combined to rot a thing that hung so idly.  But heedless of all
+this, his mood seized Ahab, as he happened to glance upon the reel,
+not many hours after the magnet scene, and he remembered how his
+quadrant was no more, and recalled his frantic oath about the level
+log and line.  The ship was sailing plungingly; astern the billows
+rolled in riots.
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 3</DOCNO>
+"Forward, there!  Heave the log!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 4</DOCNO>
+Two seamen came.  The golden-hued Tahitian and the grizzly Manxman.
+"Take the reel, one of ye, I'll heave."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 5</DOCNO>
+They went towards the extreme stern, on the ship's lee side, where
+the deck, with the oblique energy of the wind, was now almost dipping
+into the creamy, sidelong-rushing sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 6</DOCNO>
+The Manxman took the reel, and holding it high up, by the projecting
+handle-ends of the spindle, round which the spool of line revolved,
+so stood with the angular log hanging downwards, till Ahab advanced
+to him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 7</DOCNO>
+Ahab stood before him, and was lightly unwinding some thirty or forty
+turns to form a preliminary hand-coil to toss overboard, when the old
+Manxman, who was intently eyeing both him and the line, made bold to
+speak.
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 8</DOCNO>
+"Sir, I mistrust it; this line looks far gone, long heat and wet have
+spoiled it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 9</DOCNO>
+"'Twill hold, old gentleman.  Long heat and wet, have they spoiled
+thee?  Thou seem'st to hold.  Or, truer perhaps, life holds thee;
+not thou it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 10</DOCNO>
+"I hold the spool, sir.  But just as my captain says.  With these
+grey hairs of mine 'tis not worth while disputing, 'specially with a
+superior, who'll ne'er confess."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 11</DOCNO>
+"What's that?  There now's a patched professor in Queen Nature's
+granite-founded College; but methinks he's too subservient.  Where
+wert thou born?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 12</DOCNO>
+"In the little rocky Isle of Man, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 13</DOCNO>
+"Excellent!  Thou'st hit the world by that."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 14</DOCNO>
+"I know not, sir, but I was born there."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 15</DOCNO>
+"In the Isle of Man, hey?  Well, the other way, it's good.  Here's a
+man from Man; a man born in once independent Man, and now unmanned of
+Man; which is sucked in--by what?  Up with the reel!  The dead, blind
+wall butts all inquiring heads at last.  Up with it!  So."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 16</DOCNO>
+The log was heaved.  The loose coils rapidly straightened out in a
+long dragging line astern, and then, instantly, the reel began to
+whirl.  In turn, jerkingly raised and lowered by the rolling billows,
+the towing resistance of the log caused the old reelman to stagger
+strangely.
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 17</DOCNO>
+"Hold hard!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 18</DOCNO>
+Snap! the overstrained line sagged down in one long festoon; the
+tugging log was gone.
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 19</DOCNO>
+"I crush the quadrant, the thunder turns the needles, and now the mad
+sea parts the log-line.  But Ahab can mend all.  Haul in here,
+Tahitian; reel up, Manxman.  And look ye, let the carpenter make
+another log, and mend thou the line.  See to it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 20</DOCNO>
+"There he goes now; to him nothing's happened; but to me, the skewer
+seems loosening out of the middle of the world.  Haul in, haul in,
+Tahitian!  These lines run whole, and whirling out: come in broken,
+and dragging slow.  Ha, Pip? come to help; eh, Pip?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 21</DOCNO>
+"Pip? whom call ye Pip?  Pip jumped from the whale-boat.  Pip's
+missing.  Let's see now if ye haven't fished him up here, fisherman.
+It drags hard; I guess he's holding on.  Jerk him, Tahiti!  Jerk him
+off; we haul in no cowards here.  Ho! there's his arm just breaking
+water.  A hatchet! a hatchet! cut it off--we haul in no cowards here.
+Captain Ahab! sir, sir! here's Pip, trying to get on board again."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 22</DOCNO>
+"Peace, thou crazy loon," cried the Manxman, seizing him by the arm.
+"Away from the quarter-deck!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 23</DOCNO>
+"The greater idiot ever scolds the lesser," muttered Ahab, advancing.
+"Hands off from that holiness!  Where sayest thou Pip was, boy?
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 24</DOCNO>
+"Astern there, sir, astern!  Lo! lo!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 25</DOCNO>
+"And who art thou, boy?  I see not my reflection in the vacant pupils
+of thy eyes.  Oh God! that man should be a thing for immortal souls
+to sieve through!  Who art thou, boy?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 26</DOCNO>
+"Bell-boy, sir; ship's-crier; ding, dong, ding!  Pip!  Pip!  Pip!  One
+hundred pounds of clay reward for Pip; five feet high--looks
+cowardly--quickest known by that!  Ding, dong, ding!  Who's seen Pip
+the coward?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 27</DOCNO>
+"There can be no hearts above the snow-line.  Oh, ye frozen heavens!
+look down here.  Ye did beget this luckless child, and have abandoned
+him, ye creative libertines.  Here, boy; Ahab's cabin shall be Pip's
+home henceforth, while Ahab lives.  Thou touchest my inmost centre,
+boy; thou art tied to me by cords woven of my heart-strings.  Come,
+let's down."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 28</DOCNO>
+"What's this? here's velvet shark-skin," intently gazing at Ahab's
+hand, and feeling it.  "Ah, now, had poor Pip but felt so kind a
+thing as this, perhaps he had ne'er been lost!  This seems to me,
+sir, as a man-rope; something that weak souls may hold by.  Oh, sir,
+let old Perth now come and rivet these two hands together; the black
+one with the white, for I will not let this go."
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 29</DOCNO>
+"Oh, boy, nor will I thee, unless I should thereby drag thee to worse
+horrors than are here.  Come, then, to my cabin.  Lo! ye believers in
+gods all goodness, and in man all ill, lo you! see the omniscient
+gods oblivious of suffering man; and man, though idiotic, and knowing
+not what he does, yet full of the sweet things of love and gratitude.
+Come!  I feel prouder leading thee by thy black hand, than though I
+grasped an Emperor's!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 125, Paragraph 30</DOCNO>
+"There go two daft ones now," muttered the old Manxman.  "One daft
+with strength, the other daft with weakness.  But here's the end of
+the rotten line--all dripping, too.  Mend it, eh?  I think we had
+best have a new line altogether.  I'll see Mr. Stubb about it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 1</DOCNO>
+The Life-Buoy.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 2</DOCNO>
+Steering now south-eastward by Ahab's levelled steel, and her
+progress solely determined by Ahab's level log and line; the Pequod
+held on her path towards the Equator.  Making so long a passage
+through such unfrequented waters, descrying no ships, and ere long,
+sideways impelled by unvarying trade winds, over waves monotonously
+mild; all these seemed the strange calm things preluding some riotous
+and desperate scene.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 3</DOCNO>
+At last, when the ship drew near to the outskirts, as it were, of the
+Equatorial fishing-ground, and in the deep darkness that goes before
+the dawn, was sailing by a cluster of rocky islets; the watch--then
+headed by Flask--was startled by a cry so plaintively wild and
+unearthly--like half-articulated wailings of the ghosts of all
+Herod's murdered Innocents--that one and all, they started from their
+reveries, and for the space of some moments stood, or sat, or leaned
+all transfixedly listening, like the carved Roman slave, while that
+wild cry remained within hearing.  The Christian or civilized part of
+the crew said it was mermaids, and shuddered; but the pagan
+harpooneers remained unappalled.  Yet the grey Manxman--the oldest
+mariner of all--declared that the wild thrilling sounds that were
+heard, were the voices of newly drowned men in the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 4</DOCNO>
+Below in his hammock, Ahab did not hear of this till grey dawn, when
+he came to the deck; it was then recounted to him by Flask, not
+unaccompanied with hinted dark meanings.  He hollowly laughed, and
+thus explained the wonder.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 5</DOCNO>
+Those rocky islands the ship had passed were the resort of great
+numbers of seals, and some young seals that had lost their dams, or
+some dams that had lost their cubs, must have risen nigh the ship and
+kept company with her, crying and sobbing with their human sort of
+wail.  But this only the more affected some of them, because most
+mariners cherish a very superstitious feeling about seals, arising
+not only from their peculiar tones when in distress, but also from
+the human look of their round heads and semi-intelligent faces, seen
+peeringly uprising from the water alongside.  In the sea, under
+certain circumstances, seals have more than once been mistaken for
+men.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 6</DOCNO>
+But the bodings of the crew were destined to receive a most plausible
+confirmation in the fate of one of their number that morning.  At
+sun-rise this man went from his hammock to his mast-head at the fore;
+and whether it was that he was not yet half waked from his sleep (for
+sailors sometimes go aloft in a transition state), whether it was
+thus with the man, there is now no telling; but, be that as it may,
+he had not been long at his perch, when a cry was heard--a cry and a
+rushing--and looking up, they saw a falling phantom in the air; and
+looking down, a little tossed heap of white bubbles in the blue of
+the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 7</DOCNO>
+The life-buoy--a long slender cask--was dropped from the stern, where
+it always hung obedient to a cunning spring; but no hand rose to
+seize it, and the sun having long beat upon this cask it had
+shrunken, so that it slowly filled, and that parched wood also
+filled at its every pore; and the studded iron-bound cask followed
+the sailor to the bottom, as if to yield him his pillow, though in
+sooth but a hard one.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 8</DOCNO>
+And thus the first man of the Pequod that mounted the mast to look
+out for the White Whale, on the White Whale's own peculiar ground;
+that man was swallowed up in the deep.  But few, perhaps, thought of
+that at the time.  Indeed, in some sort, they were not grieved at
+this event, at least as a portent; for they regarded it, not as a
+foreshadowing of evil in the future, but as the fulfilment of an
+evil already presaged.  They declared that now they knew the reason
+of those wild shrieks they had heard the night before.  But again the
+old Manxman said nay.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 9</DOCNO>
+The lost life-buoy was now to be replaced; Starbuck was directed to
+see to it; but as no cask of sufficient lightness could be found, and
+as in the feverish eagerness of what seemed the approaching crisis of
+the voyage, all hands were impatient of any toil but what was
+directly connected with its final end, whatever that might prove to
+be; therefore, they were going to leave the ship's stern unprovided
+with a buoy, when by certain strange signs and inuendoes Queequeg
+hinted a hint concerning his coffin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 10</DOCNO>
+"A life-buoy of a coffin!" cried Starbuck, starting.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 11</DOCNO>
+"Rather queer, that, I should say," said Stubb.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 12</DOCNO>
+"It will make a good enough one," said Flask, "the carpenter here can
+arrange it easily."
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 13</DOCNO>
+"Bring it up; there's nothing else for it," said Starbuck, after a
+melancholy pause.  "Rig it, carpenter; do not look at me so--the
+coffin, I mean.  Dost thou hear me?  Rig it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 14</DOCNO>
+"And shall I nail down the lid, sir?" moving his hand as with a
+hammer.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 15</DOCNO>
+"Aye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 16</DOCNO>
+"And shall I caulk the seams, sir?" moving his hand as with a
+caulking-iron.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 17</DOCNO>
+"Aye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 18</DOCNO>
+"And shall I then pay over the same with pitch, sir?" moving his hand
+as with a pitch-pot.
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 19</DOCNO>
+"Away! what possesses thee to this?  Make a life-buoy of the coffin,
+and no more.--Mr. Stubb, Mr. Flask, come forward with me."
+</DOC>
+<DOC>
+<DOCNO>Chapter 126, Paragraph 20</DOCNO>
+"He goes off in a huff.  The whole he can endure; at the parts he
+baulks.  Now I don't like this.  I make a leg for Captain Ahab, and
+he wears it like a gentleman; but I make a bandbox for Queequeg, and
+he won't put his head into it.  Are all my pains to go for nothing
+with that coffin?  And now I'm ordered to make a life-buoy of it.
+It's like turning an old coat; going to bring the flesh on the other
+side now.  I don't like this cobbling sort of business--I don't like
+it at all; it's undignified; it's not my place.  Let tinkers' brats
+do tinkerings; we are their betters.  I like to take in hand none but
+clean, virgin, fair-and-square mathematical jobs, something that
+regularly begins at the beginning, and is at the middle when midway,
+and comes to an end at the conclusion; not a cobbler's job, that's at
+an end in the middle, and at the beginning at the end.  It's the old
+woman's tricks to be giving cobbling jobs.  Lord! what an affection
+all old women have for tinkers.  I know an old woman of sixty-five
+who ran away with a bald-headed young tinker once.  And that's the
+reason I never would work for lonely widow old women ashore, when I
+kept my job-shop in the Vineyard; they might have taken it into their
+lonely old heads to run off with me.  But heigh-ho! there are no caps
+at sea but snow-caps.  Let me see.  Nail down the lid; caulk the
+seams; pay over the same with pitch; batten them down tight, and hang
+it with the snap-spring over the ship's stern.  Were ever such things
+done before with a coffin?  Some superstitious old carpenters, now,
+would be tied up in the rigging, ere they would do the job.  But I'm
+made of knotty Aroostook hemlock; I don't budge.  Cruppered with a
+coffin!  Sailing about with a grave-yard tray!  But never mind.  We
+workers in woods make bridal-bedsteads and card-tables, as well as
+coffins and hearses.  We work by the month, or by the job, or by the
+profit; not for us to ask the why and wherefore of our work, unless
+it be too confounded cobbling, and then we stash it if we can.  Hem!
+I'll do the job, now, tenderly.  I'll have me--let's see--how many in
+the ship's company, all told?  But I've forgotten.  Any way, I'll
+have me thirty separate, Turk's-headed life-lines, each three feet
+long hanging all round to the coffin.  Then, if the hull go down,
+there'll be thirty lively fellows all fighting for one coffin, a
+sight not seen very often beneath the sun!  Come hammer,
+caulking-iron, pitch-pot, and marling-spike!  Let's to it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 1</DOCNO>
+The Deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 2</DOCNO>
+THE COFFIN LAID UPON TWO LINE-TUBS, BETWEEN THE VICE-BENCH AND THE
+OPEN HATCHWAY; THE CARPENTER CAULKING ITS SEAMS; THE STRING OF
+TWISTED OAKUM SLOWLY UNWINDING FROM A LARGE ROLL OF IT PLACED IN THE
+BOSOM OF HIS FROCK.--AHAB COMES SLOWLY FROM THE CABIN-GANGWAY, AND
+HEARS PIP FOLLOWING HIM.
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 3</DOCNO>
+Back, lad; I will be with ye again presently.  He goes!  Not this
+hand complies with my humor more genially than that boy.--Middle
+aisle of a church!  What's here?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 4</DOCNO>
+"Life-buoy, sir.  Mr. Starbuck's orders.  Oh, look, sir!  Beware the
+hatchway!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 5</DOCNO>
+"Thank ye, man.  Thy coffin lies handy to the vault."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 6</DOCNO>
+"Sir?  The hatchway? oh!  So it does, sir, so it does."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 7</DOCNO>
+"Art not thou the leg-maker?  Look, did not this stump come from thy
+shop?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 8</DOCNO>
+"I believe it did, sir; does the ferrule stand, sir?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 9</DOCNO>
+"Well enough.  But art thou not also the undertaker?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 10</DOCNO>
+"Aye, sir; I patched up this thing here as a coffin for Queequeg; but
+they've set me now to turning it into something else."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 11</DOCNO>
+"Then tell me; art thou not an arrant, all-grasping, intermeddling,
+monopolising, heathenish old scamp, to be one day making legs, and
+the next day coffins to clap them in, and yet again life-buoys out of
+those same coffins?  Thou art as unprincipled as the gods, and as
+much of a jack-of-all-trades."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 12</DOCNO>
+"But I do not mean anything, sir.  I do as I do."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 13</DOCNO>
+"The gods again.  Hark ye, dost thou not ever sing working about a
+coffin?  The Titans, they say, hummed snatches when chipping out the
+craters for volcanoes; and the grave-digger in the play sings, spade
+in hand.  Dost thou never?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 14</DOCNO>
+"Sing, sir?  Do I sing?  Oh, I'm indifferent enough, sir, for that;
+but the reason why the grave-digger made music must have been because
+there was none in his spade, sir.  But the caulking mallet is full of
+it.  Hark to it."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 15</DOCNO>
+"Aye, and that's because the lid there's a sounding-board; and what
+in all things makes the sounding-board is this--there's naught
+beneath.  And yet, a coffin with a body in it rings pretty much the
+same, Carpenter.  Hast thou ever helped carry a bier, and heard the
+coffin knock against the churchyard gate, going in?
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 16</DOCNO>
+"Faith, sir, I've--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 17</DOCNO>
+"Faith?  What's that?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 18</DOCNO>
+"Why, faith, sir, it's only a sort of exclamation-like--that's all,
+sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 19</DOCNO>
+"Um, um; go on."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 20</DOCNO>
+"I was about to say, sir, that--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 21</DOCNO>
+"Art thou a silk-worm?  Dost thou spin thy own shroud out of thyself?
+Look at thy bosom!  Despatch! and get these traps out of sight."
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 22</DOCNO>
+"He goes aft.  That was sudden, now; but squalls come sudden in hot
+latitudes.  I've heard that the Isle of Albemarle, one of the
+Gallipagos, is cut by the Equator right in the middle.  Seems to me
+some sort of Equator cuts yon old man, too, right in his middle.
+He's always under the Line--fiery hot, I tell ye!  He's looking this
+way--come, oakum; quick.  Here we go again.  This wooden mallet is
+the cork, and I'm the professor of musical glasses--tap, tap!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 23</DOCNO>
+(AHAB TO HIMSELF.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 127, Paragraph 24</DOCNO>
+"There's a sight!  There's a sound!  The grey-headed woodpecker
+tapping the hollow tree!  Blind and dumb might well be envied now.
+See! that thing rests on two line-tubs, full of tow-lines.  A most
+malicious wag, that fellow.  Rat-tat!  So man's seconds tick!  Oh!
+how immaterial are all materials!  What things real are there, but
+imponderable thoughts?  Here now's the very dreaded symbol of grim
+death, by a mere hap, made the expressive sign of the help and hope
+of most endangered life.  A life-buoy of a coffin!  Does it go
+further?  Can it be that in some spiritual sense the coffin is, after
+all, but an immortality-preserver!  I'll think of that.  But no.  So
+far gone am I in the dark side of earth, that its other side, the
+theoretic bright one, seems but uncertain twilight to me.  Will ye
+never have done, Carpenter, with that accursed sound?  I go below;
+let me not see that thing here when I return again.  Now, then, Pip,
+we'll talk this over; I do suck most wondrous philosophies from thee!
+Some unknown conduits from the unknown worlds must empty into thee!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 1</DOCNO>
+The Pequod Meets The Rachel.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 2</DOCNO>
+Next day, a large ship, the Rachel, was descried, bearing directly
+down upon the Pequod, all her spars thickly clustering with men.  At
+the time the Pequod was making good speed through the water; but as
+the broad-winged windward stranger shot nigh to her, the boastful
+sails all fell together as blank bladders that are burst, and all
+life fled from the smitten hull.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 3</DOCNO>
+"Bad news; she brings bad news," muttered the old Manxman.  But ere
+her commander, who, with trumpet to mouth, stood up in his boat; ere
+he could hopefully hail, Ahab's voice was heard.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 4</DOCNO>
+"Hast seen the White Whale?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 5</DOCNO>
+"Aye, yesterday.  Have ye seen a whale-boat adrift?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 6</DOCNO>
+Throttling his joy, Ahab negatively answered this unexpected
+question; and would then have fain boarded the stranger, when the
+stranger captain himself, having stopped his vessel's way, was seen
+descending her side.  A few keen pulls, and his boat-hook soon
+clinched the Pequod's main-chains, and he sprang to the deck.
+Immediately he was recognised by Ahab for a Nantucketer he knew.  But
+no formal salutation was exchanged.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 7</DOCNO>
+"Where was he?--not killed!--not killed!" cried Ahab, closely
+advancing.  "How was it?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 8</DOCNO>
+It seemed that somewhat late on the afternoon of the day previous,
+while three of the stranger's boats were engaged with a shoal of
+whales, which had led them some four or five miles from the ship; and
+while they were yet in swift chase to windward, the white hump and
+head of Moby Dick had suddenly loomed up out of the water, not very
+far to leeward; whereupon, the fourth rigged boat--a reserved
+one--had been instantly lowered in chase.  After a keen sail before
+the wind, this fourth boat--the swiftest keeled of all--seemed to
+have succeeded in fastening--at least, as well as the man at the
+mast-head could tell anything about it.  In the distance he saw the
+diminished dotted boat; and then a swift gleam of bubbling white
+water; and after that nothing more; whence it was concluded that the
+stricken whale must have indefinitely run away with his pursuers, as
+often happens.  There was some apprehension, but no positive alarm,
+as yet.  The recall signals were placed in the rigging; darkness came
+on; and forced to pick up her three far to windward boats--ere going
+in quest of the fourth one in the precisely opposite direction--the
+ship had not only been necessitated to leave that boat to its fate
+till near midnight, but, for the time, to increase her distance from
+it.  But the rest of her crew being at last safe aboard, she crowded
+all sail--stunsail on stunsail--after the missing boat; kindling a
+fire in her try-pots for a beacon; and every other man aloft on the
+look-out.  But though when she had thus sailed a sufficient distance
+to gain the presumed place of the absent ones when last seen; though
+she then paused to lower her spare boats to pull all around her; and
+not finding anything, had again dashed on; again paused, and lowered
+her boats; and though she had thus continued doing till daylight;
+yet not the least glimpse of the missing keel had been seen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 9</DOCNO>
+The story told, the stranger Captain immediately went on to reveal
+his object in boarding the Pequod.  He desired that ship to unite
+with his own in the search; by sailing over the sea some four or five
+miles apart, on parallel lines, and so sweeping a double horizon, as
+it were.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 10</DOCNO>
+"I will wager something now," whispered Stubb to Flask, "that some
+one in that missing boat wore off that Captain's best coat; mayhap,
+his watch--he's so cursed anxious to get it back.  Who ever heard of
+two pious whale-ships cruising after one missing whale-boat in the
+height of the whaling season?  See, Flask, only see how pale he
+looks--pale in the very buttons of his eyes--look--it wasn't the
+coat--it must have been the--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 11</DOCNO>
+"My boy, my own boy is among them.  For God's sake--I beg, I
+conjure"--here exclaimed the stranger Captain to Ahab, who thus far
+had but icily received his petition.  "For eight-and-forty hours let
+me charter your ship--I will gladly pay for it, and roundly pay for
+it--if there be no other way--for eight-and-forty hours only--only
+that--you must, oh, you must, and you SHALL do this thing."
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 12</DOCNO>
+"His son!" cried Stubb, "oh, it's his son he's lost!  I take back the
+coat and watch--what says Ahab?  We must save that boy."
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 13</DOCNO>
+"He's drowned with the rest on 'em, last night," said the old Manx
+sailor standing behind them; "I heard; all of ye heard their
+spirits."
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 14</DOCNO>
+Now, as it shortly turned out, what made this incident of the
+Rachel's the more melancholy, was the circumstance, that not only was
+one of the Captain's sons among the number of the missing boat's
+crew; but among the number of the other boat's crews, at the same
+time, but on the other hand, separated from the ship during the dark
+vicissitudes of the chase, there had been still another son; as that
+for a time, the wretched father was plunged to the bottom of the
+cruellest perplexity; which was only solved for him by his chief
+mate's instinctively adopting the ordinary procedure of a whale-ship
+in such emergencies, that is, when placed between jeopardized but
+divided boats, always to pick up the majority first.  But the
+captain, for some unknown constitutional reason, had refrained from
+mentioning all this, and not till forced to it by Ahab's iciness did
+he allude to his one yet missing boy; a little lad, but twelve years
+old, whose father with the earnest but unmisgiving hardihood of a
+Nantucketer's paternal love, had thus early sought to initiate him in
+the perils and wonders of a vocation almost immemorially the destiny
+of all his race.  Nor does it unfrequently occur, that Nantucket
+captains will send a son of such tender age away from them, for a
+protracted three or four years' voyage in some other ship than their
+own; so that their first knowledge of a whaleman's career shall be
+unenervated by any chance display of a father's natural but untimely
+partiality, or undue apprehensiveness and concern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 15</DOCNO>
+Meantime, now the stranger was still beseeching his poor boon of
+Ahab; and Ahab still stood like an anvil, receiving every shock, but
+without the least quivering of his own.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 16</DOCNO>
+"I will not go," said the stranger, "till you say aye to me.  Do to
+me as you would have me do to you in the like case.  For YOU too have
+a boy, Captain Ahab--though but a child, and nestling safely at home
+now--a child of your old age too--Yes, yes, you relent; I see
+it--run, run, men, now, and stand by to square in the yards."
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 17</DOCNO>
+"Avast," cried Ahab--"touch not a rope-yarn"; then in a voice that
+prolongingly moulded every word--"Captain Gardiner, I will not do it.
+Even now I lose time.  Good-bye, good-bye.  God bless ye, man, and
+may I forgive myself, but I must go.  Mr. Starbuck, look at the
+binnacle watch, and in three minutes from this present instant warn
+off all strangers: then brace forward again, and let the ship sail
+as before."
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 18</DOCNO>
+Hurriedly turning, with averted face, he descended into his cabin,
+leaving the strange captain transfixed at this unconditional and
+utter rejection of his so earnest suit.  But starting from his
+enchantment, Gardiner silently hurried to the side; more fell than
+stepped into his boat, and returned to his ship.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 19</DOCNO>
+Soon the two ships diverged their wakes; and long as the strange
+vessel was in view, she was seen to yaw hither and thither at every
+dark spot, however small, on the sea.  This way and that her yards
+were swung round; starboard and larboard, she continued to tack;
+now she beat against a head sea; and again it pushed her before it;
+while all the while, her masts and yards were thickly clustered with
+men, as three tall cherry trees, when the boys are cherrying among
+the boughs.
+</DOC>
+<DOC>
+<DOCNO>Chapter 128, Paragraph 20</DOCNO>
+But by her still halting course and winding, woeful way, you plainly
+saw that this ship that so wept with spray, still remained without
+comfort.  She was Rachel, weeping for her children, because they were
+not.
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 1</DOCNO>
+The Cabin.
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 2</DOCNO>
+(AHAB MOVING TO GO ON DECK; PIP CATCHES HIM BY THE HAND TO FOLLOW.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 3</DOCNO>
+Lad, lad, I tell thee thou must not follow Ahab now.  The hour is
+coming when Ahab would not scare thee from him, yet would not have
+thee by him.  There is that in thee, poor lad, which I feel too
+curing to my malady.  Like cures like; and for this hunt, my malady
+becomes my most desired health.  Do thou abide below here, where they
+shall serve thee, as if thou wert the captain.  Aye, lad, thou shalt
+sit here in my own screwed chair; another screw to it, thou must be."
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 4</DOCNO>
+"No, no, no! ye have not a whole body, sir; do ye but use poor me for
+your one lost leg; only tread upon me, sir; I ask no more, so I
+remain a part of ye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 5</DOCNO>
+"Oh! spite of million villains, this makes me a bigot in the fadeless
+fidelity of man!--and a black! and crazy!--but methinks
+like-cures-like applies to him too; he grows so sane again."
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 6</DOCNO>
+"They tell me, sir, that Stubb did once desert poor little Pip, whose
+drowned bones now show white, for all the blackness of his living
+skin.  But I will never desert ye, sir, as Stubb did him.  Sir, I
+must go with ye."
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 7</DOCNO>
+"If thou speakest thus to me much more, Ahab's purpose keels up in
+him.  I tell thee no; it cannot be."
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 8</DOCNO>
+"Oh good master, master, master!
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 9</DOCNO>
+"Weep so, and I will murder thee! have a care, for Ahab too is mad.
+Listen, and thou wilt often hear my ivory foot upon the deck, and
+still know that I am there.  And now I quit thee.  Thy hand!--Met!
+True art thou, lad, as the circumference to its centre.  So: God for
+ever bless thee; and if it come to that,--God for ever save thee, let
+what will befall."
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 10</DOCNO>
+(AHAB GOES; PIP STEPS ONE STEP FORWARD.)
+</DOC>
+<DOC>
+<DOCNO>Chapter 129, Paragraph 11</DOCNO>
+"Here he this instant stood; I stand in his air,--but I'm alone.
+Now were even poor Pip here I could endure it, but he's missing.
+Pip!  Pip!  Ding, dong, ding!  Who's seen Pip?  He must be up here;
+let's try the door.  What? neither lock, nor bolt, nor bar; and yet
+there's no opening it.  It must be the spell; he told me to stay
+here: Aye, and told me this screwed chair was mine.  Here, then, I'll
+seat me, against the transom, in the ship's full middle, all her keel
+and her three masts before me.  Here, our old sailors say, in their
+black seventy-fours great admirals sometimes sit at table, and lord
+it over rows of captains and lieutenants.  Ha! what's this? epaulets!
+epaulets! the epaulets all come crowding!  Pass round the decanters;
+glad to see ye; fill up, monsieurs!  What an odd feeling, now, when a
+black boy's host to white men with gold lace upon their
+coats!--Monsieurs, have ye seen one Pip?--a little negro lad, five
+feet high, hang-dog look, and cowardly!  Jumped from a whale-boat
+once;--seen him?  No!  Well then, fill up again, captains, and let's
+drink shame upon all cowards!  I name no names.  Shame upon them!
+Put one foot upon the table.  Shame upon all cowards.--Hist! above
+there, I hear ivory--Oh, master! master!  I am indeed down-hearted
+when you walk over me.  But here I'll stay, though this stern
+strikes rocks; and they bulge through; and oysters come to join me."
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 1</DOCNO>
+The Hat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 2</DOCNO>
+And now that at the proper time and place, after so long and wide a
+preliminary cruise, Ahab,--all other whaling waters swept--seemed to
+have chased his foe into an ocean-fold, to slay him the more securely
+there; now, that he found himself hard by the very latitude and
+longitude where his tormenting wound had been inflicted; now that a
+vessel had been spoken which on the very day preceding had actually
+encountered Moby Dick;--and now that all his successive meetings with
+various ships contrastingly concurred to show the demoniac
+indifference with which the white whale tore his hunters, whether
+sinning or sinned against; now it was that there lurked a something
+in the old man's eyes, which it was hardly sufferable for feeble
+souls to see.  As the unsetting polar star, which through the
+livelong, arctic, six months' night sustains its piercing, steady,
+central gaze; so Ahab's purpose now fixedly gleamed down upon the
+constant midnight of the gloomy crew.  It domineered above them so,
+that all their bodings, doubts, misgivings, fears, were fain to hide
+beneath their souls, and not sprout forth a single spear or leaf.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 3</DOCNO>
+In this foreshadowing interval too, all humor, forced or natural,
+vanished.  Stubb no more strove to raise a smile; Starbuck no more
+strove to check one.  Alike, joy and sorrow, hope and fear, seemed
+ground to finest dust, and powdered, for the time, in the clamped
+mortar of Ahab's iron soul.  Like machines, they dumbly moved about
+the deck, ever conscious that the old man's despot eye was on them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 4</DOCNO>
+But did you deeply scan him in his more secret confidential hours;
+when he thought no glance but one was on him; then you would have
+seen that even as Ahab's eyes so awed the crew's, the inscrutable
+Parsee's glance awed his; or somehow, at least, in some wild way, at
+times affected it.  Such an added, gliding strangeness began to
+invest the thin Fedallah now; such ceaseless shudderings shook him;
+that the men looked dubious at him; half uncertain, as it seemed,
+whether indeed he were a mortal substance, or else a tremulous shadow
+cast upon the deck by some unseen being's body.  And that shadow was
+always hovering there.  For not by night, even, had Fedallah ever
+certainly been known to slumber, or go below.  He would stand still
+for hours: but never sat or leaned; his wan but wondrous eyes did
+plainly say--We two watchmen never rest.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 5</DOCNO>
+Nor, at any time, by night or day could the mariners now step upon
+the deck, unless Ahab was before them; either standing in his
+pivot-hole, or exactly pacing the planks between two undeviating
+limits,--the main-mast and the mizen; or else they saw him standing
+in the cabin-scuttle,--his living foot advanced upon the deck, as if
+to step; his hat slouched heavily over his eyes; so that however
+motionless he stood, however the days and nights were added on, that
+he had not swung in his hammock; yet hidden beneath that slouching
+hat, they could never tell unerringly whether, for all this, his eyes
+were really closed at times; or whether he was still intently
+scanning them; no matter, though he stood so in the scuttle for a
+whole hour on the stretch, and the unheeded night-damp gathered in
+beads of dew upon that stone-carved coat and hat.  The clothes that
+the night had wet, the next day's sunshine dried upon him; and so,
+day after day, and night after night; he went no more beneath the
+planks; whatever he wanted from the cabin that thing he sent for.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 6</DOCNO>
+He ate in the same open air; that is, his two only meals,--breakfast
+and dinner: supper he never touched; nor reaped his beard; which
+darkly grew all gnarled, as unearthed roots of trees blown over,
+which still grow idly on at naked base, though perished in the upper
+verdure.  But though his whole life was now become one watch on deck;
+and though the Parsee's mystic watch was without intermission as his
+own; yet these two never seemed to speak--one man to the
+other--unless at long intervals some passing unmomentous matter made
+it necessary.  Though such a potent spell seemed secretly to join the
+twain; openly, and to the awe-struck crew, they seemed pole-like
+asunder.  If by day they chanced to speak one word; by night, dumb
+men were both, so far as concerned the slightest verbal interchange.
+At times, for longest hours, without a single hail, they stood far
+parted in the starlight; Ahab in his scuttle, the Parsee by the
+mainmast; but still fixedly gazing upon each other; as if in the
+Parsee Ahab saw his forethrown shadow, in Ahab the Parsee his
+abandoned substance.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 7</DOCNO>
+And yet, somehow, did Ahab--in his own proper self, as daily, hourly,
+and every instant, commandingly revealed to his subordinates,--Ahab
+seemed an independent lord; the Parsee but his slave.  Still again
+both seemed yoked together, and an unseen tyrant driving them; the
+lean shade siding the solid rib.  For be this Parsee what he may, all
+rib and keel was solid Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 8</DOCNO>
+At the first faintest glimmering of the dawn, his iron voice was
+heard from aft,--"Man the mast-heads!"--and all through the day,
+till after sunset and after twilight, the same voice every hour, at
+the striking of the helmsman's bell, was heard--"What d'ye
+see?--sharp! sharp!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 9</DOCNO>
+But when three or four days had slided by, after meeting the
+children-seeking Rachel; and no spout had yet been seen; the
+monomaniac old man seemed distrustful of his crew's fidelity; at
+least, of nearly all except the Pagan harpooneers; he seemed to
+doubt, even, whether Stubb and Flask might not willingly overlook the
+sight he sought.  But if these suspicions were really his, he
+sagaciously refrained from verbally expressing them, however his
+actions might seem to hint them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 10</DOCNO>
+"I will have the first sight of the whale myself,"--he said.  "Aye!
+Ahab must have the doubloon! and with his own hands he rigged a nest
+of basketed bowlines; and sending a hand aloft, with a single sheaved
+block, to secure to the main-mast head, he received the two ends of
+the downward-reeved rope; and attaching one to his basket prepared a
+pin for the other end, in order to fasten it at the rail.  This done,
+with that end yet in his hand and standing beside the pin, he looked
+round upon his crew, sweeping from one to the other; pausing his
+glance long upon Daggoo, Queequeg, Tashtego; but shunning Fedallah;
+and then settling his firm relying eye upon the chief mate,
+said,--"Take the rope, sir--I give it into thy hands, Starbuck."
+Then arranging his person in the basket, he gave the word for them to
+hoist him to his perch, Starbuck being the one who secured the rope
+at last; and afterwards stood near it.  And thus, with one hand
+clinging round the royal mast, Ahab gazed abroad upon the sea for
+miles and miles,--ahead, astern, this side, and that,--within the
+wide expanded circle commanded at so great a height.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 11</DOCNO>
+When in working with his hands at some lofty almost isolated place in
+the rigging, which chances to afford no foothold, the sailor at sea
+is hoisted up to that spot, and sustained there by the rope; under
+these circumstances, its fastened end on deck is always given in
+strict charge to some one man who has the special watch of it.
+Because in such a wilderness of running rigging, whose various
+different relations aloft cannot always be infallibly discerned by
+what is seen of them at the deck; and when the deck-ends of these
+ropes are being every few minutes cast down from the fastenings, it
+would be but a natural fatality, if, unprovided with a constant
+watchman, the hoisted sailor should by some carelessness of the crew
+be cast adrift and fall all swooping to the sea.  So Ahab's
+proceedings in this matter were not unusual; the only strange thing
+about them seemed to be, that Starbuck, almost the one only man who
+had ever ventured to oppose him with anything in the slightest degree
+approaching to decision--one of those too, whose faithfulness on the
+look-out he had seemed to doubt somewhat;--it was strange, that this
+was the very man he should select for his watchman; freely giving his
+whole life into such an otherwise distrusted person's hands.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 12</DOCNO>
+Now, the first time Ahab was perched aloft; ere he had been there ten
+minutes; one of those red-billed savage sea-hawks which so often fly
+incommodiously close round the manned mast-heads of whalemen in these
+latitudes; one of these birds came wheeling and screaming round his
+head in a maze of untrackably swift circlings.  Then it darted a
+thousand feet straight up into the air; then spiralized downwards,
+and went eddying again round his head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 13</DOCNO>
+But with his gaze fixed upon the dim and distant horizon, Ahab seemed
+not to mark this wild bird; nor, indeed, would any one else have
+marked it much, it being no uncommon circumstance; only now almost
+the least heedful eye seemed to see some sort of cunning meaning in
+almost every sight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 14</DOCNO>
+"Your hat, your hat, sir!" suddenly cried the Sicilian seaman, who
+being posted at the mizen-mast-head, stood directly behind Ahab,
+though somewhat lower than his level, and with a deep gulf of air
+dividing them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 15</DOCNO>
+But already the sable wing was before the old man's eyes; the long
+hooked bill at his head: with a scream, the black hawk darted away
+with his prize.
+</DOC>
+<DOC>
+<DOCNO>Chapter 130, Paragraph 16</DOCNO>
+An eagle flew thrice round Tarquin's head, removing his cap to
+replace it, and thereupon Tanaquil, his wife, declared that Tarquin
+would be king of Rome.  But only by the replacing of the cap was that
+omen accounted good.  Ahab's hat was never restored; the wild hawk
+flew on and on with it; far in advance of the prow: and at last
+disappeared; while from the point of that disappearance, a minute
+black spot was dimly discerned, falling from that vast height into
+the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 1</DOCNO>
+The Pequod Meets The Delight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 2</DOCNO>
+The intense Pequod sailed on; the rolling waves and days went by; the
+life-buoy-coffin still lightly swung; and another ship, most
+miserably misnamed the Delight, was descried.  As she drew nigh, all
+eyes were fixed upon her broad beams, called shears, which, in some
+whaling-ships, cross the quarter-deck at the height of eight or nine
+feet; serving to carry the spare, unrigged, or disabled boats.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 3</DOCNO>
+Upon the stranger's shears were beheld the shattered, white ribs, and
+some few splintered planks, of what had once been a whale-boat; but
+you now saw through this wreck, as plainly as you see through the
+peeled, half-unhinged, and bleaching skeleton of a horse.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 4</DOCNO>
+"Hast seen the White Whale?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 5</DOCNO>
+"Look!" replied the hollow-cheeked captain from his taffrail; and
+with his trumpet he pointed to the wreck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 6</DOCNO>
+"Hast killed him?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 7</DOCNO>
+"The harpoon is not yet forged that ever will do that," answered the
+other, sadly glancing upon a rounded hammock on the deck, whose
+gathered sides some noiseless sailors were busy in sewing together.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 8</DOCNO>
+"Not forged!" and snatching Perth's levelled iron from the crotch,
+Ahab held it out, exclaiming--"Look ye, Nantucketer; here in this
+hand I hold his death!  Tempered in blood, and tempered by lightning
+are these barbs; and I swear to temper them triply in that hot place
+behind the fin, where the White Whale most feels his accursed life!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 9</DOCNO>
+"Then God keep thee, old man--see'st thou that"--pointing to the
+hammock--"I bury but one of five stout men, who were alive only
+yesterday; but were dead ere night.  Only THAT one I bury; the rest
+were buried before they died; you sail upon their tomb."  Then
+turning to his crew--"Are ye ready there? place the plank then on the
+rail, and lift the body; so, then--Oh!  God"--advancing towards the
+hammock with uplifted hands--"may the resurrection and the life--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 10</DOCNO>
+"Brace forward!  Up helm!" cried Ahab like lightning to his men.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 11</DOCNO>
+But the suddenly started Pequod was not quick enough to escape the
+sound of the splash that the corpse soon made as it struck the sea;
+not so quick, indeed, but that some of the flying bubbles might have
+sprinkled her hull with their ghostly baptism.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 12</DOCNO>
+As Ahab now glided from the dejected Delight, the strange life-buoy
+hanging at the Pequod's stern came into conspicuous relief.
+</DOC>
+<DOC>
+<DOCNO>Chapter 131, Paragraph 13</DOCNO>
+"Ha! yonder! look yonder, men!" cried a foreboding voice in her wake.
+"In vain, oh, ye strangers, ye fly our sad burial; ye but turn us
+your taffrail to show us your coffin!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 1</DOCNO>
+The Symphony.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 2</DOCNO>
+It was a clear steel-blue day.  The firmaments of air and sea were
+hardly separable in that all-pervading azure; only, the pensive air
+was transparently pure and soft, with a woman's look, and the robust
+and man-like sea heaved with long, strong, lingering swells, as
+Samson's chest in his sleep.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 3</DOCNO>
+Hither, and thither, on high, glided the snow-white wings of small,
+unspeckled birds; these were the gentle thoughts of the feminine air;
+but to and fro in the deeps, far down in the bottomless blue, rushed
+mighty leviathans, sword-fish, and sharks; and these were the strong,
+troubled, murderous thinkings of the masculine sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 4</DOCNO>
+But though thus contrasting within, the contrast was only in shades
+and shadows without; those two seemed one; it was only the sex, as it
+were, that distinguished them.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 5</DOCNO>
+Aloft, like a royal czar and king, the sun seemed giving this gentle
+air to this bold and rolling sea; even as bride to groom.  And at the
+girdling line of the horizon, a soft and tremulous motion--most seen
+here at the Equator--denoted the fond, throbbing trust, the loving
+alarms, with which the poor bride gave her bosom away.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 6</DOCNO>
+Tied up and twisted; gnarled and knotted with wrinkles; haggardly
+firm and unyielding; his eyes glowing like coals, that still glow in
+the ashes of ruin; untottering Ahab stood forth in the clearness of
+the morn; lifting his splintered helmet of a brow to the fair girl's
+forehead of heaven.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 7</DOCNO>
+Oh, immortal infancy, and innocency of the azure!  Invisible winged
+creatures that frolic all round us!  Sweet childhood of air and sky!
+how oblivious were ye of old Ahab's close-coiled woe!  But so have I
+seen little Miriam and Martha, laughing-eyed elves, heedlessly gambol
+around their old sire; sporting with the circle of singed locks which
+grew on the marge of that burnt-out crater of his brain.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 8</DOCNO>
+Slowly crossing the deck from the scuttle, Ahab leaned over the side
+and watched how his shadow in the water sank and sank to his gaze,
+the more and the more that he strove to pierce the profundity.  But
+the lovely aromas in that enchanted air did at last seem to dispel,
+for a moment, the cankerous thing in his soul.  That glad, happy air,
+that winsome sky, did at last stroke and caress him; the step-mother
+world, so long cruel--forbidding--now threw affectionate arms round
+his stubborn neck, and did seem to joyously sob over him, as if over
+one, that however wilful and erring, she could yet find it in her
+heart to save and to bless.  From beneath his slouched hat Ahab
+dropped a tear into the sea; nor did all the Pacific contain such
+wealth as that one wee drop.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 9</DOCNO>
+Starbuck saw the old man; saw him, how he heavily leaned over the
+side; and he seemed to hear in his own true heart the measureless
+sobbing that stole out of the centre of the serenity around.  Careful
+not to touch him, or be noticed by him, he yet drew near to him, and
+stood there.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 10</DOCNO>
+Ahab turned.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 11</DOCNO>
+"Starbuck!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 12</DOCNO>
+"Sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 13</DOCNO>
+"Oh, Starbuck! it is a mild, mild wind, and a mild looking sky.  On
+such a day--very much such a sweetness as this--I struck my first
+whale--a boy-harpooneer of eighteen!  Forty--forty--forty years
+ago!--ago!  Forty years of continual whaling! forty years of
+privation, and peril, and storm-time! forty years on the pitiless
+sea! for forty years has Ahab forsaken the peaceful land, for forty
+years to make war on the horrors of the deep!  Aye and yes, Starbuck,
+out of those forty years I have not spent three ashore.  When I think
+of this life I have led; the desolation of solitude it has been; the
+masoned, walled-town of a Captain's exclusiveness, which admits but
+small entrance to any sympathy from the green country without--oh,
+weariness! heaviness!  Guinea-coast slavery of solitary
+command!--when I think of all this; only half-suspected, not so
+keenly known to me before--and how for forty years I have fed upon
+dry salted fare--fit emblem of the dry nourishment of my soil!--when
+the poorest landsman has had fresh fruit to his daily hand, and
+broken the world's fresh bread to my mouldy crusts--away, whole
+oceans away, from that young girl-wife I wedded past fifty, and
+sailed for Cape Horn the next day, leaving but one dent in my
+marriage pillow--wife? wife?--rather a widow with her husband alive!
+Aye, I widowed that poor girl when I married her, Starbuck; and
+then, the madness, the frenzy, the boiling blood and the smoking
+brow, with which, for a thousand lowerings old Ahab has furiously,
+foamingly chased his prey--more a demon than a man!--aye, aye! what a
+forty years' fool--fool--old fool, has old Ahab been!  Why this
+strife of the chase? why weary, and palsy the arm at the oar, and the
+iron, and the lance? how the richer or better is Ahab now?  Behold.
+Oh, Starbuck! is it not hard, that with this weary load I bear, one
+poor leg should have been snatched from under me?  Here, brush this
+old hair aside; it blinds me, that I seem to weep.  Locks so grey did
+never grow but from out some ashes!  But do I look very old, so very,
+very old, Starbuck?  I feel deadly faint, bowed, and humped, as
+though I were Adam, staggering beneath the piled centuries since
+Paradise.  God!  God!  God!--crack my heart!--stave my
+brain!--mockery! mockery! bitter, biting mockery of grey hairs, have
+I lived enough joy to wear ye; and seem and feel thus intolerably
+old?  Close! stand close to me, Starbuck; let me look into a human
+eye; it is better than to gaze into sea or sky; better than to gaze
+upon God.  By the green land; by the bright hearth-stone! this is the
+magic glass, man; I see my wife and my child in thine eye.  No, no;
+stay on board, on board!--lower not when I do; when branded Ahab
+gives chase to Moby Dick.  That hazard shall not be thine.  No, no!
+not with the far away home I see in that eye!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 14</DOCNO>
+"Oh, my Captain! my Captain! noble soul! grand old heart, after all!
+why should any one give chase to that hated fish!  Away with me! let
+us fly these deadly waters! let us home!  Wife and child, too, are
+Starbuck's--wife and child of his brotherly, sisterly, play-fellow
+youth; even as thine, sir, are the wife and child of thy loving,
+longing, paternal old age!  Away! let us away!--this instant let me
+alter the course!  How cheerily, how hilariously, O my Captain, would
+we bowl on our way to see old Nantucket again!  I think, sir, they
+have some such mild blue days, even as this, in Nantucket."
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 15</DOCNO>
+"They have, they have.  I have seen them--some summer days in the
+morning.  About this time--yes, it is his noon nap now--the boy
+vivaciously wakes; sits up in bed; and his mother tells him of me, of
+cannibal old me; how I am abroad upon the deep, but will yet come
+back to dance him again."
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 16</DOCNO>
+"'Tis my Mary, my Mary herself!  She promised that my boy, every
+morning, should be carried to the hill to catch the first glimpse of
+his father's sail!  Yes, yes! no more! it is done! we head for
+Nantucket!  Come, my Captain, study out the course, and let us away!
+See, see! the boy's face from the window! the boy's hand on the
+hill!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 17</DOCNO>
+But Ahab's glance was averted; like a blighted fruit tree he shook,
+and cast his last, cindered apple to the soil.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 18</DOCNO>
+"What is it, what nameless, inscrutable, unearthly thing is it; what
+cozening, hidden lord and master, and cruel, remorseless emperor
+commands me; that against all natural lovings and longings, I so keep
+pushing, and crowding, and jamming myself on all the time; recklessly
+making me ready to do what in my own proper, natural heart, I durst
+not so much as dare?  Is Ahab, Ahab?  Is it I, God, or who, that
+lifts this arm?  But if the great sun move not of himself; but is as an
+errand-boy in heaven; nor one single star can revolve, but by some
+invisible power; how then can this one small heart beat; this one
+small brain think thoughts; unless God does that beating, does that
+thinking, does that living, and not I.  By heaven, man, we are turned
+round and round in this world, like yonder windlass, and Fate is the
+handspike.  And all the time, lo! that smiling sky, and this
+unsounded sea!  Look! see yon Albicore! who put it into him to chase
+and fang that flying-fish?  Where do murderers go, man!  Who's to
+doom, when the judge himself is dragged to the bar?  But it is a
+mild, mild wind, and a mild looking sky; and the air smells now, as
+if it blew from a far-away meadow; they have been making hay
+somewhere under the slopes of the Andes, Starbuck, and the mowers are
+sleeping among the new-mown hay.  Sleeping?  Aye, toil we how we may,
+we all sleep at last on the field.  Sleep?  Aye, and rust amid
+greenness; as last year's scythes flung down, and left in the half-cut
+swaths--Starbuck!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 19</DOCNO>
+But blanched to a corpse's hue with despair, the Mate had stolen
+away.
+</DOC>
+<DOC>
+<DOCNO>Chapter 132, Paragraph 20</DOCNO>
+Ahab crossed the deck to gaze over on the other side; but started at
+two reflected, fixed eyes in the water there.  Fedallah was
+motionlessly leaning over the same rail.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 1</DOCNO>
+The Chase--First Day.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 2</DOCNO>
+That night, in the mid-watch, when the old man--as his wont at
+intervals--stepped forth from the scuttle in which he leaned, and
+went to his pivot-hole, he suddenly thrust out his face fiercely,
+snuffing up the sea air as a sagacious ship's dog will, in drawing
+nigh to some barbarous isle.  He declared that a whale must be near.
+Soon that peculiar odor, sometimes to a great distance given forth by
+the living sperm whale, was palpable to all the watch; nor was any
+mariner surprised when, after inspecting the compass, and then the
+dog-vane, and then ascertaining the precise bearing of the odor as
+nearly as possible, Ahab rapidly ordered the ship's course to be
+slightly altered, and the sail to be shortened.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 3</DOCNO>
+The acute policy dictating these movements was sufficiently
+vindicated at daybreak, by the sight of a long sleek on the sea
+directly and lengthwise ahead, smooth as oil, and resembling in the
+pleated watery wrinkles bordering it, the polished metallic-like
+marks of some swift tide-rip, at the mouth of a deep, rapid stream.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 4</DOCNO>
+"Man the mast-heads!  Call all hands!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 5</DOCNO>
+Thundering with the butts of three clubbed handspikes on the
+forecastle deck, Daggoo roused the sleepers with such judgment claps
+that they seemed to exhale from the scuttle, so instantaneously did
+they appear with their clothes in their hands.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 6</DOCNO>
+"What d'ye see?" cried Ahab, flattening his face to the sky.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 7</DOCNO>
+"Nothing, nothing sir!" was the sound hailing down in reply.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 8</DOCNO>
+"T'gallant sails!--stunsails! alow and aloft, and on both sides!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 9</DOCNO>
+All sail being set, he now cast loose the life-line, reserved for
+swaying him to the main royal-mast head; and in a few moments they
+were hoisting him thither, when, while but two thirds of the way
+aloft, and while peering ahead through the horizontal vacancy between
+the main-top-sail and top-gallant-sail, he raised a gull-like cry in
+the air.  "There she blows!--there she blows!  A hump like a
+snow-hill!  It is Moby Dick!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 10</DOCNO>
+Fired by the cry which seemed simultaneously taken up by the three
+look-outs, the men on deck rushed to the rigging to behold the famous
+whale they had so long been pursuing.  Ahab had now gained his final
+perch, some feet above the other look-outs, Tashtego standing just
+beneath him on the cap of the top-gallant-mast, so that the Indian's
+head was almost on a level with Ahab's heel.  From this height the
+whale was now seen some mile or so ahead, at every roll of the sea
+revealing his high sparkling hump, and regularly jetting his silent
+spout into the air.  To the credulous mariners it seemed the same
+silent spout they had so long ago beheld in the moonlit Atlantic and
+Indian Oceans.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 11</DOCNO>
+"And did none of ye see it before?" cried Ahab, hailing the perched
+men all around him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 12</DOCNO>
+"I saw him almost that same instant, sir, that Captain Ahab did, and
+I cried out," said Tashtego.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 13</DOCNO>
+"Not the same instant; not the same--no, the doubloon is mine, Fate
+reserved the doubloon for me.  I only; none of ye could have raised
+the White Whale first.  There she blows!--there she blows!--there
+she blows!  There again!--there again!" he cried, in long-drawn,
+lingering, methodic tones, attuned to the gradual prolongings of the
+whale's visible jets.  "He's going to sound!  In stunsails!  Down
+top-gallant-sails!  Stand by three boats.  Mr. Starbuck, remember,
+stay on board, and keep the ship.  Helm there!  Luff, luff a point!
+So; steady, man, steady!  There go flukes!  No, no; only black water!
+All ready the boats there?  Stand by, stand by!  Lower me, Mr.
+Starbuck; lower, lower,--quick, quicker!" and he slid through the air
+to the deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 14</DOCNO>
+"He is heading straight to leeward, sir," cried Stubb, "right away
+from us; cannot have seen the ship yet."
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 15</DOCNO>
+"Be dumb, man!  Stand by the braces!  Hard down the helm!--brace up!
+Shiver her!--shiver her!--So; well that!  Boats, boats!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 16</DOCNO>
+Soon all the boats but Starbuck's were dropped; all the boat-sails
+set--all the paddles plying; with rippling swiftness, shooting to
+leeward; and Ahab heading the onset.  A pale, death-glimmer lit up
+Fedallah's sunken eyes; a hideous motion gnawed his mouth.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 17</DOCNO>
+Like noiseless nautilus shells, their light prows sped through the
+sea; but only slowly they neared the foe.  As they neared him, the
+ocean grew still more smooth; seemed drawing a carpet over its waves;
+seemed a noon-meadow, so serenely it spread.  At length the
+breathless hunter came so nigh his seemingly unsuspecting prey, that his
+entire dazzling hump was distinctly visible, sliding along the sea as
+if an isolated thing, and continually set in a revolving ring of
+finest, fleecy, greenish foam.  He saw the vast, involved wrinkles of
+the slightly projecting head beyond.  Before it, far out on the soft
+Turkish-rugged waters, went the glistening white shadow from his
+broad, milky forehead, a musical rippling playfully accompanying the
+shade; and behind, the blue waters interchangeably flowed over into
+the moving valley of his steady wake; and on either hand bright
+bubbles arose and danced by his side.  But these were broken again by
+the light toes of hundreds of gay fowl softly feathering the sea,
+alternate with their fitful flight; and like to some flag-staff
+rising from the painted hull of an argosy, the tall but shattered
+pole of a recent lance projected from the white whale's back; and at
+intervals one of the cloud of soft-toed fowls hovering, and to and
+fro skimming like a canopy over the fish, silently perched and rocked
+on this pole, the long tail feathers streaming like pennons.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 18</DOCNO>
+A gentle joyousness--a mighty mildness of repose in swiftness,
+invested the gliding whale.  Not the white bull Jupiter swimming away
+with ravished Europa clinging to his graceful horns; his lovely,
+leering eyes sideways intent upon the maid; with smooth bewitching
+fleetness, rippling straight for the nuptial bower in Crete; not
+Jove, not that great majesty Supreme! did surpass the glorified White
+Whale as he so divinely swam.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 19</DOCNO>
+On each soft side--coincident with the parted swell, that but once
+leaving him, then flowed so wide away--on each bright side, the whale
+shed off enticings.  No wonder there had been some among the hunters
+who namelessly transported and allured by all this serenity, had
+ventured to assail it; but had fatally found that quietude but the
+vesture of tornadoes.  Yet calm, enticing calm, oh, whale! thou
+glidest on, to all who for the first time eye thee, no matter how
+many in that same way thou may'st have bejuggled and destroyed
+before.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 20</DOCNO>
+And thus, through the serene tranquillities of the tropical sea,
+among waves whose hand-clappings were suspended by exceeding rapture,
+Moby Dick moved on, still withholding from sight the full terrors of
+his submerged trunk, entirely hiding the wrenched hideousness of his
+jaw.  But soon the fore part of him slowly rose from the water; for
+an instant his whole marbleized body formed a high arch, like
+Virginia's Natural Bridge, and warningly waving his bannered flukes
+in the air, the grand god revealed himself, sounded, and went out of
+sight.  Hoveringly halting, and dipping on the wing, the white
+sea-fowls longingly lingered over the agitated pool that he left.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 21</DOCNO>
+With oars apeak, and paddles down, the sheets of their sails adrift,
+the three boats now stilly floated, awaiting Moby Dick's
+reappearance.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 22</DOCNO>
+"An hour," said Ahab, standing rooted in his boat's stern; and he
+gazed beyond the whale's place, towards the dim blue spaces and wide
+wooing vacancies to leeward.  It was only an instant; for again his
+eyes seemed whirling round in his head as he swept the watery circle.
+The breeze now freshened; the sea began to swell.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 23</DOCNO>
+"The birds!--the birds!" cried Tashtego.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 24</DOCNO>
+In long Indian file, as when herons take wing, the white birds were
+now all flying towards Ahab's boat; and when within a few yards began
+fluttering over the water there, wheeling round and round, with
+joyous, expectant cries.  Their vision was keener than man's; Ahab
+could discover no sign in the sea.  But suddenly as he peered down
+and down into its depths, he profoundly saw a white living spot no
+bigger than a white weasel, with wonderful celerity uprising, and
+magnifying as it rose, till it turned, and then there were plainly
+revealed two long crooked rows of white, glistening teeth, floating
+up from the undiscoverable bottom.  It was Moby Dick's open mouth and
+scrolled jaw; his vast, shadowed bulk still half blending with the
+blue of the sea.  The glittering mouth yawned beneath the boat like
+an open-doored marble tomb; and giving one sidelong sweep with his
+steering oar, Ahab whirled the craft aside from this tremendous
+apparition.  Then, calling upon Fedallah to change places with him,
+went forward to the bows, and seizing Perth's harpoon, commanded his
+crew to grasp their oars and stand by to stern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 25</DOCNO>
+Now, by reason of this timely spinning round the boat upon its axis,
+its bow, by anticipation, was made to face the whale's head while yet
+under water.  But as if perceiving this stratagem, Moby Dick, with
+that malicious intelligence ascribed to him, sidelingly transplanted
+himself, as it were, in an instant, shooting his pleated head
+lengthwise beneath the boat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 26</DOCNO>
+Through and through; through every plank and each rib, it thrilled
+for an instant, the whale obliquely lying on his back, in the manner
+of a biting shark, slowly and feelingly taking its bows full within
+his mouth, so that the long, narrow, scrolled lower jaw curled high
+up into the open air, and one of the teeth caught in a row-lock.  The
+bluish pearl-white of the inside of the jaw was within six inches of
+Ahab's head, and reached higher than that.  In this attitude the
+White Whale now shook the slight cedar as a mildly cruel cat her
+mouse.  With unastonished eyes Fedallah gazed, and crossed his arms;
+but the tiger-yellow crew were tumbling over each other's heads to
+gain the uttermost stern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 27</DOCNO>
+And now, while both elastic gunwales were springing in and out, as
+the whale dallied with the doomed craft in this devilish way; and
+from his body being submerged beneath the boat, he could not be
+darted at from the bows, for the bows were almost inside of him, as
+it were; and while the other boats involuntarily paused, as before a
+quick crisis impossible to withstand, then it was that monomaniac
+Ahab, furious with this tantalizing vicinity of his foe, which placed
+him all alive and helpless in the very jaws he hated; frenzied with
+all this, he seized the long bone with his naked hands, and wildly
+strove to wrench it from its gripe.  As now he thus vainly strove,
+the jaw slipped from him; the frail gunwales bent in, collapsed, and
+snapped, as both jaws, like an enormous shears, sliding further aft,
+bit the craft completely in twain, and locked themselves fast again
+in the sea, midway between the two floating wrecks.  These floated
+aside, the broken ends drooping, the crew at the stern-wreck clinging
+to the gunwales, and striving to hold fast to the oars to lash them
+across.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 28</DOCNO>
+At that preluding moment, ere the boat was yet snapped, Ahab, the
+first to perceive the whale's intent, by the crafty upraising of his
+head, a movement that loosed his hold for the time; at that moment
+his hand had made one final effort to push the boat out of the bite.
+But only slipping further into the whale's mouth, and tilting over
+sideways as it slipped, the boat had shaken off his hold on the jaw;
+spilled him out of it, as he leaned to the push; and so he fell
+flat-faced upon the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 29</DOCNO>
+Ripplingly withdrawing from his prey, Moby Dick now lay at a little
+distance, vertically thrusting his oblong white head up and down in
+the billows; and at the same time slowly revolving his whole spindled
+body; so that when his vast wrinkled forehead rose--some twenty or
+more feet out of the water--the now rising swells, with all their
+confluent waves, dazzlingly broke against it; vindictively tossing
+their shivered spray still higher into the air.*  So, in a gale, the
+but half baffled Channel billows only recoil from the base of the
+Eddystone, triumphantly to overleap its summit with their scud.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 30</DOCNO>
+*This motion is peculiar to the sperm whale.  It receives its
+designation (pitchpoling) from its being likened to that preliminary
+up-and-down poise of the whale-lance, in the exercise called
+pitchpoling, previously described.  By this motion the whale must
+best and most comprehensively view whatever objects may be encircling
+him.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 31</DOCNO>
+But soon resuming his horizontal attitude, Moby Dick swam swiftly
+round and round the wrecked crew; sideways churning the water in his
+vengeful wake, as if lashing himself up to still another and more
+deadly assault.  The sight of the splintered boat seemed to madden
+him, as the blood of grapes and mulberries cast before Antiochus's
+elephants in the book of Maccabees.  Meanwhile Ahab half smothered in
+the foam of the whale's insolent tail, and too much of a cripple to
+swim,--though he could still keep afloat, even in the heart of such a
+whirlpool as that; helpless Ahab's head was seen, like a tossed
+bubble which the least chance shock might burst.  From the boat's
+fragmentary stern, Fedallah incuriously and mildly eyed him; the
+clinging crew, at the other drifting end, could not succor him; more
+than enough was it for them to look to themselves.  For so
+revolvingly appalling was the White Whale's aspect, and so
+planetarily swift the ever-contracting circles he made, that he
+seemed horizontally swooping upon them.  And though the other boats,
+unharmed, still hovered hard by; still they dared not pull into the
+eddy to strike, lest that should be the signal for the instant
+destruction of the jeopardized castaways, Ahab and all; nor in that
+case could they themselves hope to escape.  With straining eyes,
+then, they remained on the outer edge of the direful zone, whose
+centre had now become the old man's head.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 32</DOCNO>
+Meantime, from the beginning all this had been descried from the
+ship's mast heads; and squaring her yards, she had borne down upon
+the scene; and was now so nigh, that Ahab in the water hailed
+her!--"Sail on the"--but that moment a breaking sea dashed on him
+from Moby Dick, and whelmed him for the time.  But struggling out of
+it again, and chancing to rise on a towering crest, he
+shouted,--"Sail on the whale!--Drive him off!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 33</DOCNO>
+The Pequod's prows were pointed; and breaking up the charmed circle,
+she effectually parted the white whale from his victim.  As he
+sullenly swam off, the boats flew to the rescue.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 34</DOCNO>
+Dragged into Stubb's boat with blood-shot, blinded eyes, the white
+brine caking in his wrinkles; the long tension of Ahab's bodily
+strength did crack, and helplessly he yielded to his body's doom: for
+a time, lying all crushed in the bottom of Stubb's boat, like one
+trodden under foot of herds of elephants.  Far inland, nameless wails
+came from him, as desolate sounds from out ravines.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 35</DOCNO>
+But this intensity of his physical prostration did but so much the
+more abbreviate it.  In an instant's compass, great hearts sometimes
+condense to one deep pang, the sum total of those shallow pains
+kindly diffused through feebler men's whole lives.  And so, such
+hearts, though summary in each one suffering; still, if the gods
+decree it, in their life-time aggregate a whole age of woe, wholly
+made up of instantaneous intensities; for even in their pointless
+centres, those noble natures contain the entire circumferences of
+inferior souls.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 36</DOCNO>
+"The harpoon," said Ahab, half way rising, and draggingly leaning on
+one bended arm--"is it safe?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 37</DOCNO>
+"Aye, sir, for it was not darted; this is it," said Stubb, showing
+it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 38</DOCNO>
+"Lay it before me;--any missing men?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 39</DOCNO>
+"One, two, three, four, five;--there were five oars, sir, and here
+are five men."
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 40</DOCNO>
+"That's good.--Help me, man; I wish to stand.  So, so, I see him!
+there! there! going to leeward still; what a leaping spout!--Hands
+off from me!  The eternal sap runs up in Ahab's bones again!  Set the
+sail; out oars; the helm!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 41</DOCNO>
+It is often the case that when a boat is stove, its crew, being
+picked up by another boat, help to work that second boat; and the
+chase is thus continued with what is called double-banked oars.  It
+was thus now.  But the added power of the boat did not equal the
+added power of the whale, for he seemed to have treble-banked his
+every fin; swimming with a velocity which plainly showed, that if
+now, under these circumstances, pushed on, the chase would prove an
+indefinitely prolonged, if not a hopeless one; nor could any crew
+endure for so long a period, such an unintermitted, intense straining
+at the oar; a thing barely tolerable only in some one brief
+vicissitude.  The ship itself, then, as it sometimes happens, offered
+the most promising intermediate means of overtaking the chase.
+Accordingly, the boats now made for her, and were soon swayed up to
+their cranes--the two parts of the wrecked boat having been
+previously secured by her--and then hoisting everything to her side,
+and stacking her canvas high up, and sideways outstretching it with
+stun-sails, like the double-jointed wings of an albatross; the Pequod
+bore down in the leeward wake of Moby-Dick.  At the well known,
+methodic intervals, the whale's glittering spout was regularly
+announced from the manned mast-heads; and when he would be reported
+as just gone down, Ahab would take the time, and then pacing the
+deck, binnacle-watch in hand, so soon as the last second of the
+allotted hour expired, his voice was heard.--"Whose is the doubloon
+now?  D'ye see him?" and if the reply was, No, sir! straightway he
+commanded them to lift him to his perch.  In this way the day wore
+on; Ahab, now aloft and motionless; anon, unrestingly pacing the
+planks.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 42</DOCNO>
+As he was thus walking, uttering no sound, except to hail the men
+aloft, or to bid them hoist a sail still higher, or to spread one to
+a still greater breadth--thus to and fro pacing, beneath his slouched
+hat, at every turn he passed his own wrecked boat, which had been
+dropped upon the quarter-deck, and lay there reversed; broken bow to
+shattered stern.  At last he paused before it; and as in an already
+over-clouded sky fresh troops of clouds will sometimes sail across,
+so over the old man's face there now stole some such added gloom as
+this.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 43</DOCNO>
+Stubb saw him pause; and perhaps intending, not vainly, though, to
+evince his own unabated fortitude, and thus keep up a valiant place
+in his Captain's mind, he advanced, and eyeing the wreck
+exclaimed--"The thistle the ass refused; it pricked his mouth too
+keenly, sir; ha! ha!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 44</DOCNO>
+"What soulless thing is this that laughs before a wreck?  Man, man!
+did I not know thee brave as fearless fire (and as mechanical) I
+could swear thou wert a poltroon.  Groan nor laugh should be heard
+before a wreck."
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 45</DOCNO>
+"Aye, sir," said Starbuck drawing near, "'tis a solemn sight; an
+omen, and an ill one."
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 46</DOCNO>
+"Omen? omen?--the dictionary!  If the gods think to speak outright to
+man, they will honourably speak outright; not shake their heads, and
+give an old wives' darkling hint.--Begone!  Ye two are the opposite
+poles of one thing; Starbuck is Stubb reversed, and Stubb is
+Starbuck; and ye two are all mankind; and Ahab stands alone among the
+millions of the peopled earth, nor gods nor men his neighbors!  Cold,
+cold--I shiver!--How now?  Aloft there!  D'ye see him?  Sing out for
+every spout, though he spout ten times a second!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 47</DOCNO>
+The day was nearly done; only the hem of his golden robe was
+rustling.  Soon, it was almost dark, but the look-out men still
+remained unset.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 48</DOCNO>
+"Can't see the spout now, sir;--too dark"--cried a voice from the
+air.
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 49</DOCNO>
+"How heading when last seen?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 50</DOCNO>
+"As before, sir,--straight to leeward."
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 51</DOCNO>
+"Good! he will travel slower now 'tis night.  Down royals and
+top-gallant stun-sails, Mr. Starbuck.  We must not run over him
+before morning; he's making a passage now, and may heave-to a while.
+Helm there! keep her full before the wind!--Aloft! come down!--Mr.
+Stubb, send a fresh hand to the fore-mast head, and see it manned
+till morning."--Then advancing towards the doubloon in the
+main-mast--"Men, this gold is mine, for I earned it; but I shall let
+it abide here till the White Whale is dead; and then, whosoever of ye
+first raises him, upon the day he shall be killed, this gold is that
+man's; and if on that day I shall again raise him, then, ten times
+its sum shall be divided among all of ye!  Away now!--the deck is
+thine, sir!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 133, Paragraph 52</DOCNO>
+And so saying, he placed himself half way within the scuttle, and
+slouching his hat, stood there till dawn, except when at intervals
+rousing himself to see how the night wore on.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 1</DOCNO>
+The Chase--Second Day.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 2</DOCNO>
+At day-break, the three mast-heads were punctually manned afresh.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 3</DOCNO>
+"D'ye see him?" cried Ahab after allowing a little space for the
+light to spread.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 4</DOCNO>
+"See nothing, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 5</DOCNO>
+"Turn up all hands and make sail! he travels faster than I thought
+for;--the top-gallant sails!--aye, they should have been kept on her
+all night.  But no matter--'tis but resting for the rush."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 6</DOCNO>
+Here be it said, that this pertinacious pursuit of one particular
+whale, continued through day into night, and through night into day,
+is a thing by no means unprecedented in the South sea fishery.  For
+such is the wonderful skill, prescience of experience, and invincible
+confidence acquired by some great natural geniuses among the
+Nantucket commanders; that from the simple observation of a whale
+when last descried, they will, under certain given circumstances,
+pretty accurately foretell both the direction in which he will
+continue to swim for a time, while out of sight, as well as his
+probable rate of progression during that period.  And, in these
+cases, somewhat as a pilot, when about losing sight of a coast, whose
+general trending he well knows, and which he desires shortly to
+return to again, but at some further point; like as this pilot stands
+by his compass, and takes the precise bearing of the cape at present
+visible, in order the more certainly to hit aright the remote, unseen
+headland, eventually to be visited: so does the fisherman, at his
+compass, with the whale; for after being chased, and diligently
+marked, through several hours of daylight, then, when night obscures
+the fish, the creature's future wake through the darkness is almost
+as established to the sagacious mind of the hunter, as the pilot's
+coast is to him.  So that to this hunter's wondrous skill, the
+proverbial evanescence of a thing writ in water, a wake, is to all
+desired purposes well nigh as reliable as the steadfast land.  And as
+the mighty iron Leviathan of the modern railway is so familiarly
+known in its every pace, that, with watches in their hands, men time
+his rate as doctors that of a baby's pulse; and lightly say of it,
+the up train or the down train will reach such or such a spot, at
+such or such an hour; even so, almost, there are occasions when these
+Nantucketers time that other Leviathan of the deep, according to the
+observed humor of his speed; and say to themselves, so many hours
+hence this whale will have gone two hundred miles, will have about
+reached this or that degree of latitude or longitude.  But to render
+this acuteness at all successful in the end, the wind and the sea
+must be the whaleman's allies; for of what present avail to the
+becalmed or windbound mariner is the skill that assures him he is
+exactly ninety-three leagues and a quarter from his port?  Inferable
+from these statements, are many collateral subtile matters touching
+the chase of whales.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 7</DOCNO>
+The ship tore on; leaving such a furrow in the sea as when a
+cannon-ball, missent, becomes a plough-share and turns up the level
+field.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 8</DOCNO>
+"By salt and hemp!" cried Stubb, "but this swift motion of the deck
+creeps up one's legs and tingles at the heart.  This ship and I are
+two brave fellows!--Ha, ha!  Some one take me up, and launch me,
+spine-wise, on the sea,--for by live-oaks! my spine's a keel.  Ha,
+ha! we go the gait that leaves no dust behind!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 9</DOCNO>
+"There she blows--she blows!--she blows!--right ahead!" was now the
+mast-head cry.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 10</DOCNO>
+"Aye, aye!" cried Stubb, "I knew it--ye can't escape--blow on and
+split your spout, O whale! the mad fiend himself is after ye! blow
+your trump--blister your lungs!--Ahab will dam off your blood, as a
+miller shuts his watergate upon the stream!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 11</DOCNO>
+And Stubb did but speak out for well nigh all that crew.  The
+frenzies of the chase had by this time worked them bubblingly up,
+like old wine worked anew.  Whatever pale fears and forebodings some
+of them might have felt before; these were not only now kept out of
+sight through the growing awe of Ahab, but they were broken up, and
+on all sides routed, as timid prairie hares that scatter before the
+bounding bison.  The hand of Fate had snatched all their souls; and
+by the stirring perils of the previous day; the rack of the past
+night's suspense; the fixed, unfearing, blind, reckless way in which
+their wild craft went plunging towards its flying mark; by all these
+things, their hearts were bowled along.  The wind that made great
+bellies of their sails, and rushed the vessel on by arms invisible as
+irresistible; this seemed the symbol of that unseen agency which so
+enslaved them to the race.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 12</DOCNO>
+They were one man, not thirty.  For as the one ship that held them
+all; though it was put together of all contrasting things--oak, and
+maple, and pine wood; iron, and pitch, and hemp--yet all these ran
+into each other in the one concrete hull, which shot on its way, both
+balanced and directed by the long central keel; even so, all the
+individualities of the crew, this man's valor, that man's fear; guilt
+and guiltiness, all varieties were welded into oneness, and were all
+directed to that fatal goal which Ahab their one lord and keel did
+point to.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 13</DOCNO>
+The rigging lived.  The mast-heads, like the tops of tall palms, were
+outspreadingly tufted with arms and legs.  Clinging to a spar with
+one hand, some reached forth the other with impatient wavings;
+others, shading their eyes from the vivid sunlight, sat far out on
+the rocking yards; all the spars in full bearing of mortals, ready
+and ripe for their fate.  Ah! how they still strove through that
+infinite blueness to seek out the thing that might destroy them!
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 14</DOCNO>
+"Why sing ye not out for him, if ye see him?" cried Ahab, when, after
+the lapse of some minutes since the first cry, no more had been
+heard.  "Sway me up, men; ye have been deceived; not Moby Dick casts
+one odd jet that way, and then disappears."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 15</DOCNO>
+It was even so; in their headlong eagerness, the men had mistaken
+some other thing for the whale-spout, as the event itself soon
+proved; for hardly had Ahab reached his perch; hardly was the rope
+belayed to its pin on deck, when he struck the key-note to an
+orchestra, that made the air vibrate as with the combined discharges
+of rifles.  The triumphant halloo of thirty buckskin lungs was heard,
+as--much nearer to the ship than the place of the imaginary jet, less
+than a mile ahead--Moby Dick bodily burst into view!  For not by any
+calm and indolent spoutings; not by the peaceable gush of that mystic
+fountain in his head, did the White Whale now reveal his vicinity;
+but by the far more wondrous phenomenon of breaching.  Rising with
+his utmost velocity from the furthest depths, the Sperm Whale thus
+booms his entire bulk into the pure element of air, and piling up a
+mountain of dazzling foam, shows his place to the distance of seven
+miles and more.  In those moments, the torn, enraged waves he shakes
+off, seem his mane; in some cases, this breaching is his act of
+defiance.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 16</DOCNO>
+"There she breaches! there she breaches!" was the cry, as in his
+immeasurable bravadoes the White Whale tossed himself salmon-like to
+Heaven.  So suddenly seen in the blue plain of the sea, and relieved
+against the still bluer margin of the sky, the spray that he raised,
+for the moment, intolerably glittered and glared like a glacier; and
+stood there gradually fading and fading away from its first sparkling
+intensity, to the dim mistiness of an advancing shower in a vale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 17</DOCNO>
+"Aye, breach your last to the sun, Moby Dick!" cried Ahab, "thy hour
+and thy harpoon are at hand!--Down! down all of ye, but one man at
+the fore.  The boats!--stand by!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 18</DOCNO>
+Unmindful of the tedious rope-ladders of the shrouds, the men, like
+shooting stars, slid to the deck, by the isolated backstays and
+halyards; while Ahab, less dartingly, but still rapidly was dropped
+from his perch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 19</DOCNO>
+"Lower away," he cried, so soon as he had reached his boat--a spare
+one, rigged the afternoon previous.  "Mr. Starbuck, the ship is
+thine--keep away from the boats, but keep near them.  Lower, all!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 20</DOCNO>
+As if to strike a quick terror into them, by this time being the
+first assailant himself, Moby Dick had turned, and was now coming for
+the three crews.  Ahab's boat was central; and cheering his men, he
+told them he would take the whale head-and-head,--that is, pull
+straight up to his forehead,--a not uncommon thing; for when within a
+certain limit, such a course excludes the coming onset from the
+whale's sidelong vision.  But ere that close limit was gained, and
+while yet all three boats were plain as the ship's three masts to his
+eye; the White Whale churning himself into furious speed, almost in
+an instant as it were, rushing among the boats with open jaws, and a
+lashing tail, offered appalling battle on every side; and heedless of
+the irons darted at him from every boat, seemed only intent on
+annihilating each separate plank of which those boats were made.  But
+skilfully manoeuvred, incessantly wheeling like trained chargers in
+the field; the boats for a while eluded him; though, at times, but by
+a plank's breadth; while all the time, Ahab's unearthly slogan tore
+every other cry but his to shreds.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 21</DOCNO>
+But at last in his untraceable evolutions, the White Whale so crossed
+and recrossed, and in a thousand ways entangled the slack of the
+three lines now fast to him, that they foreshortened, and, of
+themselves, warped the devoted boats towards the planted irons in
+him; though now for a moment the whale drew aside a little, as if to
+rally for a more tremendous charge.  Seizing that opportunity, Ahab
+first paid out more line: and then was rapidly hauling and jerking
+in upon it again--hoping that way to disencumber it of some
+snarls--when lo!--a sight more savage than the embattled teeth of
+sharks!
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 22</DOCNO>
+Caught and twisted--corkscrewed in the mazes of the line, loose
+harpoons and lances, with all their bristling barbs and points, came
+flashing and dripping up to the chocks in the bows of Ahab's boat.
+Only one thing could be done.  Seizing the boat-knife, he critically
+reached within--through--and then, without--the rays of steel;
+dragged in the line beyond, passed it, inboard, to the bowsman, and
+then, twice sundering the rope near the chocks--dropped the
+intercepted fagot of steel into the sea; and was all fast again.
+That instant, the White Whale made a sudden rush among the remaining
+tangles of the other lines; by so doing, irresistibly dragged the
+more involved boats of Stubb and Flask towards his flukes; dashed
+them together like two rolling husks on a surf-beaten beach, and
+then, diving down into the sea, disappeared in a boiling maelstrom,
+in which, for a space, the odorous cedar chips of the wrecks danced
+round and round, like the grated nutmeg in a swiftly stirred bowl of
+punch.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 23</DOCNO>
+While the two crews were yet circling in the waters, reaching out
+after the revolving line-tubs, oars, and other floating furniture,
+while aslope little Flask bobbed up and down like an empty vial,
+twitching his legs upwards to escape the dreaded jaws of sharks; and
+Stubb was lustily singing out for some one to ladle him up; and while
+the old man's line--now parting--admitted of his pulling into the
+creamy pool to rescue whom he could;--in that wild simultaneousness
+of a thousand concreted perils,--Ahab's yet unstricken boat seemed
+drawn up towards Heaven by invisible wires,--as, arrow-like, shooting
+perpendicularly from the sea, the White Whale dashed his broad
+forehead against its bottom, and sent it, turning over and over, into
+the air; till it fell again--gunwale downwards--and Ahab and his men
+struggled out from under it, like seals from a sea-side cave.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 24</DOCNO>
+The first uprising momentum of the whale--modifying its direction as
+he struck the surface--involuntarily launched him along it, to a
+little distance from the centre of the destruction he had made; and
+with his back to it, he now lay for a moment slowly feeling with his
+flukes from side to side; and whenever a stray oar, bit of plank, the
+least chip or crumb of the boats touched his skin, his tail swiftly
+drew back, and came sideways smiting the sea.  But soon, as if
+satisfied that his work for that time was done, he pushed his pleated
+forehead through the ocean, and trailing after him the intertangled
+lines, continued his leeward way at a traveller's methodic pace.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 25</DOCNO>
+As before, the attentive ship having descried the whole fight, again
+came bearing down to the rescue, and dropping a boat, picked up the
+floating mariners, tubs, oars, and whatever else could be caught at,
+and safely landed them on her decks.  Some sprained shoulders,
+wrists, and ankles; livid contusions; wrenched harpoons and lances;
+inextricable intricacies of rope; shattered oars and planks; all
+these were there; but no fatal or even serious ill seemed to have
+befallen any one.  As with Fedallah the day before, so Ahab was now
+found grimly clinging to his boat's broken half, which afforded a
+comparatively easy float; nor did it so exhaust him as the previous
+day's mishap.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 26</DOCNO>
+But when he was helped to the deck, all eyes were fastened upon him;
+as instead of standing by himself he still half-hung upon the
+shoulder of Starbuck, who had thus far been the foremost to assist
+him.  His ivory leg had been snapped off, leaving but one short sharp
+splinter.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 27</DOCNO>
+"Aye, aye, Starbuck, 'tis sweet to lean sometimes, be the leaner who
+he will; and would old Ahab had leaned oftener than he has."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 28</DOCNO>
+"The ferrule has not stood, sir," said the carpenter, now coming up;
+"I put good work into that leg."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 29</DOCNO>
+"But no bones broken, sir, I hope," said Stubb with true concern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 30</DOCNO>
+"Aye! and all splintered to pieces, Stubb!--d'ye see it.--But even
+with a broken bone, old Ahab is untouched; and I account no living
+bone of mine one jot more me, than this dead one that's lost.  Nor
+white whale, nor man, nor fiend, can so much as graze old Ahab in his
+own proper and inaccessible being.  Can any lead touch yonder floor,
+any mast scrape yonder roof?--Aloft there! which way?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 31</DOCNO>
+"Dead to leeward, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 32</DOCNO>
+"Up helm, then; pile on the sail again, ship keepers! down the rest
+of the spare boats and rig them--Mr. Starbuck away, and muster the
+boat's crews."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 33</DOCNO>
+"Let me first help thee towards the bulwarks, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 34</DOCNO>
+"Oh, oh, oh! how this splinter gores me now!  Accursed fate! that the
+unconquerable captain in the soul should have such a craven mate!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 35</DOCNO>
+"Sir?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 36</DOCNO>
+"My body, man, not thee.  Give me something for a cane--there, that
+shivered lance will do.  Muster the men.  Surely I have not seen him
+yet.  By heaven it cannot be!--missing?--quick! call them all."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 37</DOCNO>
+The old man's hinted thought was true.  Upon mustering the company,
+the Parsee was not there.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 38</DOCNO>
+"The Parsee!" cried Stubb--"he must have been caught in--"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 39</DOCNO>
+"The black vomit wrench thee!--run all of ye above, alow, cabin,
+forecastle--find him--not gone--not gone!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 40</DOCNO>
+But quickly they returned to him with the tidings that the Parsee was
+nowhere to be found.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 41</DOCNO>
+"Aye, sir," said Stubb--"caught among the tangles of your line--I
+thought I saw him dragging under."
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 42</DOCNO>
+"MY line! MY line?  Gone?--gone?  What means that little word?--What
+death-knell rings in it, that old Ahab shakes as if he were the
+belfry.  The harpoon, too!--toss over the litter there,--d'ye see
+it?--the forged iron, men, the white whale's--no, no, no,--blistered
+fool! this hand did dart it!--'tis in the fish!--Aloft there!  Keep
+him nailed--Quick!--all hands to the rigging of the boats--collect
+the oars--harpooneers! the irons, the irons!--hoist the royals higher--a
+pull on all the sheets!--helm there! steady, steady for your life!
+I'll ten times girdle the unmeasured globe; yea and dive straight
+through it, but I'll slay him yet!
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 43</DOCNO>
+"Great God! but for one single instant show thyself," cried Starbuck;
+"never, never wilt thou capture him, old man--In Jesus' name no more
+of this, that's worse than devil's madness.  Two days chased; twice
+stove to splinters; thy very leg once more snatched from under thee;
+thy evil shadow gone--all good angels mobbing thee with warnings:--
+what more wouldst thou have?--Shall we keep chasing this murderous
+fish till he swamps the last man?  Shall we be dragged by him to the
+bottom of the sea?  Shall we be towed by him to the infernal world?
+Oh, oh,--Impiety and blasphemy to hunt him more!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 44</DOCNO>
+"Starbuck, of late I've felt strangely moved to thee; ever since that
+hour we both saw--thou know'st what, in one another's eyes.  But in
+this matter of the whale, be the front of thy face to me as the palm
+of this hand--a lipless, unfeatured blank.  Ahab is for ever Ahab,
+man.  This whole act's immutably decreed.  'Twas rehearsed by thee
+and me a billion years before this ocean rolled.  Fool!  I am the
+Fates' lieutenant; I act under orders.  Look thou, underling! that
+thou obeyest mine.--Stand round me, men.  Ye see an old man cut down
+to the stump; leaning on a shivered lance; propped up on a lonely
+foot.  'Tis Ahab--his body's part; but Ahab's soul's a centipede,
+that moves upon a hundred legs.  I feel strained, half stranded, as
+ropes that tow dismasted frigates in a gale; and I may look so.  But
+ere I break, yell hear me crack; and till ye hear THAT, know that
+Ahab's hawser tows his purpose yet.  Believe ye, men, in the things
+called omens?  Then laugh aloud, and cry encore!  For ere they drown,
+drowning things will twice rise to the surface; then rise again, to
+sink for evermore.  So with Moby Dick--two days he's floated--tomorrow
+will be the third.  Aye, men, he'll rise once more,--but only to
+spout his last!  D'ye feel brave men, brave?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 45</DOCNO>
+"As fearless fire," cried Stubb.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 46</DOCNO>
+"And as mechanical," muttered Ahab.  Then as the men went forward, he
+muttered on: "The things called omens!  And yesterday I talked the
+same to Starbuck there, concerning my broken boat.  Oh! how valiantly
+I seek to drive out of others' hearts what's clinched so fast in
+mine!--The Parsee--the Parsee!--gone, gone? and he was to go
+before:--but still was to be seen again ere I could perish--How's
+that?--There's a riddle now might baffle all the lawyers backed by
+the ghosts of the whole line of judges:--like a hawk's beak it pecks
+my brain.  I'LL, I'LL solve it, though!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 47</DOCNO>
+When dusk descended, the whale was still in sight to leeward.
+</DOC>
+<DOC>
+<DOCNO>Chapter 134, Paragraph 48</DOCNO>
+So once more the sail was shortened, and everything passed nearly as
+on the previous night; only, the sound of hammers, and the hum of the
+grindstone was heard till nearly daylight, as the men toiled by
+lanterns in the complete and careful rigging of the spare boats and
+sharpening their fresh weapons for the morrow.  Meantime, of the
+broken keel of Ahab's wrecked craft the carpenter made him another
+leg; while still as on the night before, slouched Ahab stood fixed
+within his scuttle; his hid, heliotrope glance anticipatingly gone
+backward on its dial; sat due eastward for the earliest sun.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 1</DOCNO>
+The Chase.--Third Day.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 2</DOCNO>
+The morning of the third day dawned fair and fresh, and once more the
+solitary night-man at the fore-mast-head was relieved by crowds of
+the daylight look-outs, who dotted every mast and almost every spar.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 3</DOCNO>
+"D'ye see him?" cried Ahab; but the whale was not yet in sight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 4</DOCNO>
+"In his infallible wake, though; but follow that wake, that's all.
+Helm there; steady, as thou goest, and hast been going.  What a
+lovely day again! were it a new-made world, and made for a
+summer-house to the angels, and this morning the first of its
+throwing open to them, a fairer day could not dawn upon that world.
+Here's food for thought, had Ahab time to think; but Ahab never
+thinks; he only feels, feels, feels; THAT'S tingling enough for
+mortal man! to think's audacity.  God only has that right and
+privilege.  Thinking is, or ought to be, a coolness and a calmness;
+and our poor hearts throb, and our poor brains beat too much for
+that.  And yet, I've sometimes thought my brain was very calm--frozen
+calm, this old skull cracks so, like a glass in which the contents
+turned to ice, and shiver it.  And still this hair is growing now;
+this moment growing, and heat must breed it; but no, it's like that
+sort of common grass that will grow anywhere, between the earthy
+clefts of Greenland ice or in Vesuvius lava.  How the wild winds blow
+it; they whip it about me as the torn shreds of split sails lash the
+tossed ship they cling to.  A vile wind that has no doubt blown ere
+this through prison corridors and cells, and wards of hospitals, and
+ventilated them, and now comes blowing hither as innocent as fleeces.
+Out upon it!--it's tainted.  Were I the wind, I'd blow no more on
+such a wicked, miserable world.  I'd crawl somewhere to a cave, and
+slink there.  And yet, 'tis a noble and heroic thing, the wind! who
+ever conquered it?  In every fight it has the last and bitterest
+blow.  Run tilting at it, and you but run through it.  Ha! a coward
+wind that strikes stark naked men, but will not stand to receive a
+single blow.  Even Ahab is a braver thing--a nobler thing than THAT.
+Would now the wind but had a body; but all the things that most
+exasperate and outrage mortal man, all these things are bodiless, but
+only bodiless as objects, not as agents.  There's a most special, a
+most cunning, oh, a most malicious difference!  And yet, I say again,
+and swear it now, that there's something all glorious and gracious in
+the wind.  These warm Trade Winds, at least, that in the clear
+heavens blow straight on, in strong and steadfast, vigorous mildness;
+and veer not from their mark, however the baser currents of the sea
+may turn and tack, and mightiest Mississippies of the land swift and
+swerve about, uncertain where to go at last.  And by the eternal
+Poles! these same Trades that so directly blow my good ship on; these
+Trades, or something like them--something so unchangeable, and full
+as strong, blow my keeled soul along!  To it!  Aloft there!  What
+d'ye see?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 5</DOCNO>
+"Nothing, sir."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 6</DOCNO>
+"Nothing! and noon at hand!  The doubloon goes a-begging!  See the
+sun!  Aye, aye, it must be so.  I've oversailed him.  How, got the
+start?  Aye, he's chasing ME now; not I, HIM--that's bad; I might
+have known it, too.  Fool! the lines--the harpoons he's towing.  Aye,
+aye, I have run him by last night.  About! about!  Come down, all of
+ye, but the regular look outs!  Man the braces!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 7</DOCNO>
+Steering as she had done, the wind had been somewhat on the Pequod's
+quarter, so that now being pointed in the reverse direction, the
+braced ship sailed hard upon the breeze as she rechurned the cream in
+her own white wake.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 8</DOCNO>
+"Against the wind he now steers for the open jaw," murmured Starbuck
+to himself, as he coiled the new-hauled main-brace upon the rail.
+"God keep us, but already my bones feel damp within me, and from the
+inside wet my flesh.  I misdoubt me that I disobey my God in obeying
+him!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 9</DOCNO>
+"Stand by to sway me up!" cried Ahab, advancing to the hempen basket.
+"We should meet him soon."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 10</DOCNO>
+"Aye, aye, sir," and straightway Starbuck did Ahab's bidding, and
+once more Ahab swung on high.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 11</DOCNO>
+A whole hour now passed; gold-beaten out to ages.  Time itself now
+held long breaths with keen suspense.  But at last, some three points
+off the weather bow, Ahab descried the spout again, and instantly
+from the three mast-heads three shrieks went up as if the tongues of
+fire had voiced it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 12</DOCNO>
+"Forehead to forehead I meet thee, this third time, Moby Dick!  On
+deck there!--brace sharper up; crowd her into the wind's eye.  He's
+too far off to lower yet, Mr. Starbuck.  The sails shake!  Stand over
+that helmsman with a top-maul!  So, so; he travels fast, and I must
+down.  But let me have one more good round look aloft here at the
+sea; there's time for that.  An old, old sight, and yet somehow so
+young; aye, and not changed a wink since I first saw it, a boy, from
+the sand-hills of Nantucket!  The same!--the same!--the same to Noah
+as to me.  There's a soft shower to leeward.  Such lovely
+leewardings!  They must lead somewhere--to something else than common
+land, more palmy than the palms.  Leeward! the white whale goes that
+way; look to windward, then; the better if the bitterer quarter.  But
+good bye, good bye, old mast-head!  What's this?--green? aye, tiny
+mosses in these warped cracks.  No such green weather stains on
+Ahab's head!  There's the difference now between man's old age and
+matter's.  But aye, old mast, we both grow old together; sound in our
+hulls, though, are we not, my ship?  Aye, minus a leg, that's all.
+By heaven this dead wood has the better of my live flesh every way.
+I can't compare with it; and I've known some ships made of dead trees
+outlast the lives of men made of the most vital stuff of vital
+fathers.  What's that he said? he should still go before me, my
+pilot; and yet to be seen again?  But where?  Will I have eyes at the
+bottom of the sea, supposing I descend those endless stairs? and all
+night I've been sailing from him, wherever he did sink to.  Aye, aye,
+like many more thou told'st direful truth as touching thyself, O
+Parsee; but, Ahab, there thy shot fell short.  Good-bye,
+mast-head--keep a good eye upon the whale, the while I'm gone.  We'll
+talk to-morrow, nay, to-night, when the white whale lies down there,
+tied by head and tail."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 13</DOCNO>
+He gave the word; and still gazing round him, was steadily lowered
+through the cloven blue air to the deck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 14</DOCNO>
+In due time the boats were lowered; but as standing in his shallop's
+stern, Ahab just hovered upon the point of the descent, he waved to
+the mate,--who held one of the tackle-ropes on deck--and bade him
+pause.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 15</DOCNO>
+"Starbuck!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 16</DOCNO>
+"Sir?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 17</DOCNO>
+"For the third time my soul's ship starts upon this voyage,
+Starbuck."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 18</DOCNO>
+"Aye, sir, thou wilt have it so."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 19</DOCNO>
+"Some ships sail from their ports, and ever afterwards are missing,
+Starbuck!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 20</DOCNO>
+"Truth, sir: saddest truth."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 21</DOCNO>
+"Some men die at ebb tide; some at low water; some at the full of the
+flood;--and I feel now like a billow that's all one crested comb,
+Starbuck.  I am old;--shake hands with me, man."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 22</DOCNO>
+Their hands met; their eyes fastened; Starbuck's tears the glue.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 23</DOCNO>
+"Oh, my captain, my captain!--noble heart--go not--go not!--see, it's
+a brave man that weeps; how great the agony of the persuasion then!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 24</DOCNO>
+"Lower away!"--cried Ahab, tossing the mate's arm from him.  "Stand
+by the crew!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 25</DOCNO>
+In an instant the boat was pulling round close under the stern.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 26</DOCNO>
+"The sharks! the sharks!" cried a voice from the low cabin-window
+there; "O master, my master, come back!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 27</DOCNO>
+But Ahab heard nothing; for his own voice was high-lifted then; and
+the boat leaped on.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 28</DOCNO>
+Yet the voice spake true; for scarce had he pushed from the ship,
+when numbers of sharks, seemingly rising from out the dark waters
+beneath the hull, maliciously snapped at the blades of the oars,
+every time they dipped in the water; and in this way accompanied the
+boat with their bites.  It is a thing not uncommonly happening to the
+whale-boats in those swarming seas; the sharks at times apparently
+following them in the same prescient way that vultures hover over the
+banners of marching regiments in the east.  But these were the first
+sharks that had been observed by the Pequod since the White Whale had
+been first descried; and whether it was that Ahab's crew were all
+such tiger-yellow barbarians, and therefore their flesh more musky to
+the senses of the sharks--a matter sometimes well known to affect
+them,--however it was, they seemed to follow that one boat without
+molesting the others.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 29</DOCNO>
+"Heart of wrought steel!" murmured Starbuck gazing over the side, and
+following with his eyes the receding boat--"canst thou yet ring
+boldly to that sight?--lowering thy keel among ravening sharks, and
+followed by them, open-mouthed to the chase; and this the critical
+third day?--For when three days flow together in one continuous
+intense pursuit; be sure the first is the morning, the second the
+noon, and the third the evening and the end of that thing--be that
+end what it may.  Oh! my God! what is this that shoots through me,
+and leaves me so deadly calm, yet expectant,--fixed at the top of a
+shudder!  Future things swim before me, as in empty outlines and
+skeletons; all the past is somehow grown dim.  Mary, girl! thou
+fadest in pale glories behind me; boy!  I seem to see but thy eyes
+grown wondrous blue.  Strangest problems of life seem clearing; but
+clouds sweep between--Is my journey's end coming?  My legs feel
+faint; like his who has footed it all day.  Feel thy heart,--beats
+it yet?  Stir thyself, Starbuck!--stave it off--move, move! speak
+aloud!--Mast-head there!  See ye my boy's hand on the
+hill?--Crazed;--aloft there!--keep thy keenest eye upon the boats:--
+mark well the whale!--Ho! again!--drive off that hawk! see! he
+pecks--he tears the vane"--pointing to the red flag flying at the
+main-truck--"Ha! he soars away with it!--Where's the old man now?
+see'st thou that sight, oh Ahab!--shudder, shudder!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 30</DOCNO>
+The boats had not gone very far, when by a signal from the
+mast-heads--a downward pointed arm, Ahab knew that the whale had
+sounded; but intending to be near him at the next rising, he held on
+his way a little sideways from the vessel; the becharmed crew
+maintaining the profoundest silence, as the head-beat waves hammered
+and hammered against the opposing bow.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 31</DOCNO>
+"Drive, drive in your nails, oh ye waves! to their uttermost heads
+drive them in! ye but strike a thing without a lid; and no coffin and
+no hearse can be mine:--and hemp only can kill me!  Ha! ha!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 32</DOCNO>
+Suddenly the waters around them slowly swelled in broad circles; then
+quickly upheaved, as if sideways sliding from a submerged berg of
+ice, swiftly rising to the surface.  A low rumbling sound was heard;
+a subterraneous hum; and then all held their breaths; as bedraggled
+with trailing ropes, and harpoons, and lances, a vast form shot
+lengthwise, but obliquely from the sea.  Shrouded in a thin drooping
+veil of mist, it hovered for a moment in the rainbowed air; and then
+fell swamping back into the deep.  Crushed thirty feet upwards, the
+waters flashed for an instant like heaps of fountains, then brokenly
+sank in a shower of flakes, leaving the circling surface creamed like
+new milk round the marble trunk of the whale.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 33</DOCNO>
+"Give way!" cried Ahab to the oarsmen, and the boats darted forward
+to the attack; but maddened by yesterday's fresh irons that corroded
+in him, Moby Dick seemed combinedly possessed by all the angels that
+fell from heaven.  The wide tiers of welded tendons overspreading his
+broad white forehead, beneath the transparent skin, looked knitted
+together; as head on, he came churning his tail among the boats; and
+once more flailed them apart; spilling out the irons and lances from
+the two mates' boats, and dashing in one side of the upper part of
+their bows, but leaving Ahab's almost without a scar.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 34</DOCNO>
+While Daggoo and Queequeg were stopping the strained planks; and as
+the whale swimming out from them, turned, and showed one entire flank
+as he shot by them again; at that moment a quick cry went up.  Lashed
+round and round to the fish's back; pinioned in the turns upon turns
+in which, during the past night, the whale had reeled the involutions
+of the lines around him, the half torn body of the Parsee was seen;
+his sable raiment frayed to shreds; his distended eyes turned full
+upon old Ahab.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 35</DOCNO>
+The harpoon dropped from his hand.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 36</DOCNO>
+"Befooled, befooled!"--drawing in a long lean breath--"Aye, Parsee!
+I see thee again.--Aye, and thou goest before; and this, THIS then is
+the hearse that thou didst promise.  But I hold thee to the last
+letter of thy word.  Where is the second hearse?  Away, mates, to the
+ship! those boats are useless now; repair them if ye can in time, and
+return to me; if not, Ahab is enough to die--Down, men! the first
+thing that but offers to jump from this boat I stand in, that thing I
+harpoon.  Ye are not other men, but my arms and my legs; and so obey
+me.--Where's the whale? gone down again?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 37</DOCNO>
+But he looked too nigh the boat; for as if bent upon escaping with
+the corpse he bore, and as if the particular place of the last
+encounter had been but a stage in his leeward voyage, Moby Dick was
+now again steadily swimming forward; and had almost passed the
+ship,--which thus far had been sailing in the contrary direction to
+him, though for the present her headway had been stopped.  He seemed
+swimming with his utmost velocity, and now only intent upon pursuing
+his own straight path in the sea.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 38</DOCNO>
+"Oh!  Ahab," cried Starbuck, "not too late is it, even now, the third
+day, to desist.  See!  Moby Dick seeks thee not.  It is thou, thou,
+that madly seekest him!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 39</DOCNO>
+Setting sail to the rising wind, the lonely boat was swiftly impelled
+to leeward, by both oars and canvas.  And at last when Ahab was
+sliding by the vessel, so near as plainly to distinguish Starbuck's
+face as he leaned over the rail, he hailed him to turn the vessel
+about, and follow him, not too swiftly, at a judicious interval.
+Glancing upwards, he saw Tashtego, Queequeg, and Daggoo, eagerly
+mounting to the three mast-heads; while the oarsmen were rocking in
+the two staved boats which had but just been hoisted to the side, and
+were busily at work in repairing them.  One after the other, through
+the port-holes, as he sped, he also caught flying glimpses of Stubb
+and Flask, busying themselves on deck among bundles of new irons and
+lances.  As he saw all this; as he heard the hammers in the broken
+boats; far other hammers seemed driving a nail into his heart.  But
+he rallied.  And now marking that the vane or flag was gone from the
+main-mast-head, he shouted to Tashtego, who had just gained that
+perch, to descend again for another flag, and a hammer and nails, and
+so nail it to the mast.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 40</DOCNO>
+Whether fagged by the three days' running chase, and the resistance
+to his swimming in the knotted hamper he bore; or whether it was some
+latent deceitfulness and malice in him: whichever was true, the White
+Whale's way now began to abate, as it seemed, from the boat so
+rapidly nearing him once more; though indeed the whale's last start
+had not been so long a one as before.  And still as Ahab glided over
+the waves the unpitying sharks accompanied him; and so pertinaciously
+stuck to the boat; and so continually bit at the plying oars, that
+the blades became jagged and crunched, and left small splinters in
+the sea, at almost every dip.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 41</DOCNO>
+"Heed them not! those teeth but give new rowlocks to your oars.  Pull
+on! 'tis the better rest, the shark's jaw than the yielding water."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 42</DOCNO>
+"But at every bite, sir, the thin blades grow smaller and smaller!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 43</DOCNO>
+"They will last long enough! pull on!--But who can tell"--he
+muttered--"whether these sharks swim to feast on the whale or on
+Ahab?--But pull on!  Aye, all alive, now--we near him.  The helm!
+take the helm! let me pass,"--and so saying two of the oarsmen helped
+him forward to the bows of the still flying boat.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 44</DOCNO>
+At length as the craft was cast to one side, and ran ranging along
+with the White Whale's flank, he seemed strangely oblivious of its
+advance--as the whale sometimes will--and Ahab was fairly within the
+smoky mountain mist, which, thrown off from the whale's spout, curled
+round his great, Monadnock hump; he was even thus close to him; when,
+with body arched back, and both arms lengthwise high-lifted to the
+poise, he darted his fierce iron, and his far fiercer curse into the
+hated whale.  As both steel and curse sank to the socket, as if
+sucked into a morass, Moby Dick sideways writhed; spasmodically
+rolled his nigh flank against the bow, and, without staving a hole in
+it, so suddenly canted the boat over, that had it not been for the
+elevated part of the gunwale to which he then clung, Ahab would once
+more have been tossed into the sea.  As it was, three of the
+oarsmen--who foreknew not the precise instant of the dart, and were
+therefore unprepared for its effects--these were flung out; but so
+fell, that, in an instant two of them clutched the gunwale again, and
+rising to its level on a combing wave, hurled themselves bodily
+inboard again; the third man helplessly dropping astern, but still
+afloat and swimming.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 45</DOCNO>
+Almost simultaneously, with a mighty volition of ungraduated,
+instantaneous swiftness, the White Whale darted through the weltering
+sea.  But when Ahab cried out to the steersman to take new turns with
+the line, and hold it so; and commanded the crew to turn round on
+their seats, and tow the boat up to the mark; the moment the
+treacherous line felt that double strain and tug, it snapped in the
+empty air!
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 46</DOCNO>
+"What breaks in me?  Some sinew cracks!--'tis whole again; oars!
+oars!  Burst in upon him!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 47</DOCNO>
+Hearing the tremendous rush of the sea-crashing boat, the whale
+wheeled round to present his blank forehead at bay; but in that
+evolution, catching sight of the nearing black hull of the ship;
+seemingly seeing in it the source of all his persecutions; bethinking
+it--it may be--a larger and nobler foe; of a sudden, he bore down
+upon its advancing prow, smiting his jaws amid fiery showers of foam.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 48</DOCNO>
+Ahab staggered; his hand smote his forehead.  "I grow blind; hands!
+stretch out before me that I may yet grope my way.  Is't night?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 49</DOCNO>
+"The whale!  The ship!" cried the cringing oarsmen.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 50</DOCNO>
+"Oars! oars!  Slope downwards to thy depths, O sea, that ere it be
+for ever too late, Ahab may slide this last, last time upon his
+mark!  I see: the ship! the ship!  Dash on, my men!  Will ye not
+save my ship?"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 51</DOCNO>
+But as the oarsmen violently forced their boat through the
+sledge-hammering seas, the before whale-smitten bow-ends of two
+planks burst through, and in an instant almost, the temporarily
+disabled boat lay nearly level with the waves; its half-wading,
+splashing crew, trying hard to stop the gap and bale out the pouring
+water.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 52</DOCNO>
+Meantime, for that one beholding instant, Tashtego's mast-head hammer
+remained suspended in his hand; and the red flag, half-wrapping him
+as with a plaid, then streamed itself straight out from him, as his
+own forward-flowing heart; while Starbuck and Stubb, standing upon
+the bowsprit beneath, caught sight of the down-coming monster just as
+soon as he.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 53</DOCNO>
+"The whale, the whale!  Up helm, up helm!  Oh, all ye sweet powers of
+air, now hug me close!  Let not Starbuck die, if die he must, in a
+woman's fainting fit.  Up helm, I say--ye fools, the jaw! the jaw!
+Is this the end of all my bursting prayers? all my life-long
+fidelities?  Oh, Ahab, Ahab, lo, thy work.  Steady! helmsman, steady.
+Nay, nay!  Up helm again!  He turns to meet us!  Oh, his
+unappeasable brow drives on towards one, whose duty tells him he
+cannot depart.  My God, stand by me now!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 54</DOCNO>
+"Stand not by me, but stand under me, whoever you are that will now
+help Stubb; for Stubb, too, sticks here.  I grin at thee, thou
+grinning whale!  Who ever helped Stubb, or kept Stubb awake, but
+Stubb's own unwinking eye?  And now poor Stubb goes to bed upon a
+mattrass that is all too soft; would it were stuffed with brushwood!
+I grin at thee, thou grinning whale!  Look ye, sun, moon, and stars!
+I call ye assassins of as good a fellow as ever spouted up his ghost.
+For all that, I would yet ring glasses with ye, would ye but hand
+the cup!  Oh, oh! oh, oh! thou grinning whale, but there'll be plenty
+of gulping soon!  Why fly ye not, O Ahab!  For me, off shoes and
+jacket to it; let Stubb die in his drawers!  A most mouldy and over
+salted death, though;--cherries! cherries! cherries!  Oh, Flask, for
+one red cherry ere we die!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 55</DOCNO>
+"Cherries?  I only wish that we were where they grow.  Oh, Stubb, I
+hope my poor mother's drawn my part-pay ere this; if not, few coppers
+will now come to her, for the voyage is up."
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 56</DOCNO>
+>From the ship's bows, nearly all the seamen now hung inactive;
+hammers, bits of plank, lances, and harpoons, mechanically retained
+in their hands, just as they had darted from their various
+employments; all their enchanted eyes intent upon the whale, which
+from side to side strangely vibrating his predestinating head, sent a
+broad band of overspreading semicircular foam before him as he
+rushed.  Retribution, swift vengeance, eternal malice were in his
+whole aspect, and spite of all that mortal man could do, the solid
+white buttress of his forehead smote the ship's starboard bow, till
+men and timbers reeled.  Some fell flat upon their faces.  Like
+dislodged trucks, the heads of the harpooneers aloft shook on their
+bull-like necks.  Through the breach, they heard the waters pour, as
+mountain torrents down a flume.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 57</DOCNO>
+"The ship!  The hearse!--the second hearse!" cried Ahab from the
+boat; "its wood could only be American!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 58</DOCNO>
+Diving beneath the settling ship, the whale ran quivering along its
+keel; but turning under water, swiftly shot to the surface again, far
+off the other bow, but within a few yards of Ahab's boat, where, for
+a time, he lay quiescent.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 59</DOCNO>
+"I turn my body from the sun.  What ho, Tashtego! let me hear thy
+hammer.  Oh! ye three unsurrendered spires of mine; thou uncracked
+keel; and only god-bullied hull; thou firm deck, and haughty helm,
+and Pole-pointed prow,--death-glorious ship! must ye then perish,
+and without me?  Am I cut off from the last fond pride of meanest
+shipwrecked captains?  Oh, lonely death on lonely life!  Oh, now I
+feel my topmost greatness lies in my topmost grief.  Ho, ho! from all
+your furthest bounds, pour ye now in, ye bold billows of my whole
+foregone life, and top this one piled comber of my death!  Towards
+thee I roll, thou all-destroying but unconquering whale; to the last
+I grapple with thee; from hell's heart I stab at thee; for hate's
+sake I spit my last breath at thee.  Sink all coffins and all hearses
+to one common pool! and since neither can be mine, let me then tow to
+pieces, while still chasing thee, though tied to thee, thou damned
+whale!  THUS, I give up the spear!"
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 60</DOCNO>
+The harpoon was darted; the stricken whale flew forward; with
+igniting velocity the line ran through the grooves;--ran foul.  Ahab
+stooped to clear it; he did clear it; but the flying turn caught him
+round the neck, and voicelessly as Turkish mutes bowstring their
+victim, he was shot out of the boat, ere the crew knew he was gone.
+Next instant, the heavy eye-splice in the rope's final end flew out
+of the stark-empty tub, knocked down an oarsman, and smiting the sea,
+disappeared in its depths.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 61</DOCNO>
+For an instant, the tranced boat's crew stood still; then turned.
+"The ship?  Great God, where is the ship?"  Soon they through dim,
+bewildering mediums saw her sidelong fading phantom, as in the
+gaseous Fata Morgana; only the uppermost masts out of water; while
+fixed by infatuation, or fidelity, or fate, to their once lofty
+perches, the pagan harpooneers still maintained their sinking
+lookouts on the sea.  And now, concentric circles seized the lone
+boat itself, and all its crew, and each floating oar, and every
+lance-pole, and spinning, animate and inanimate, all round and round
+in one vortex, carried the smallest chip of the Pequod out of sight.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 62</DOCNO>
+But as the last whelmings intermixingly poured themselves over the
+sunken head of the Indian at the mainmast, leaving a few inches of
+the erect spar yet visible, together with long streaming yards of the
+flag, which calmly undulated, with ironical coincidings, over the
+destroying billows they almost touched;--at that instant, a red arm
+and a hammer hovered backwardly uplifted in the open air, in the act
+of nailing the flag faster and yet faster to the subsiding spar.  A
+sky-hawk that tauntingly had followed the main-truck downwards from
+its natural home among the stars, pecking at the flag, and
+incommoding Tashtego there; this bird now chanced to intercept its
+broad fluttering wing between the hammer and the wood; and
+simultaneously feeling that etherial thrill, the submerged savage
+beneath, in his death-gasp, kept his hammer frozen there; and so the
+bird of heaven, with archangelic shrieks, and his imperial beak
+thrust upwards, and his whole captive form folded in the flag of
+Ahab, went down with his ship, which, like Satan, would not sink to
+hell till she had dragged a living part of heaven along with her, and
+helmeted herself with it.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 63</DOCNO>
+Now small fowls flew screaming over the yet yawning gulf; a sullen
+white surf beat against its steep sides; then all collapsed, and the
+great shroud of the sea rolled on as it rolled five thousand years
+ago.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 64</DOCNO>
+Epilogue
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 65</DOCNO>
+"AND I ONLY AM ESCAPED ALONE TO TELL THEE"
+Job.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 66</DOCNO>
+The drama's done.  Why then here does any one step forth?--Because
+one did survive the wreck.
+</DOC>
+<DOC>
+<DOCNO>Chapter 135, Paragraph 67</DOCNO>
+It so chanced, that after the Parsee's disappearance, I was he whom
+the Fates ordained to take the place of Ahab's bowsman, when that
+bowsman assumed the vacant post; the same, who, when on the last day
+the three men were tossed from out of the rocking boat, was dropped
+astern.  So, floating on the margin of the ensuing scene, and in full
+sight of it, when the halfspent suction of the sunk ship reached me,
+I was then, but slowly, drawn towards the closing vortex.  When I
+reached it, it had subsided to a creamy pool.  Round and round, then,
+and ever contracting towards the button-like black bubble at the axis
+of that slowly wheeling circle, like another Ixion I did revolve.
+Till, gaining that vital centre, the black bubble upward burst; and
+now, liberated by reason of its cunning spring, and, owing to its
+great buoyancy, rising with great force, the coffin life-buoy shot
+lengthwise from the sea, fell over, and floated by my side.  Buoyed
+up by that coffin, for almost one whole day and night, I floated on a
+soft and dirgelike main.  The unharming sharks, they glided by as if
+with padlocks on their mouths; the savage sea-hawks sailed with
+sheathed beaks.  On the second day, a sail drew near, nearer, and
+picked me up at last.  It was the devious-cruising Rachel, that in
+her retracing search after her missing children, only found another
+orphan.
+</DOC>
diff --git a/win32/visualc6/libzet.dsp b/win32/visualc6/libzet.dsp
new file mode 100644 (file)
index 0000000..26d7a52
--- /dev/null
@@ -0,0 +1,328 @@
+# Microsoft Developer Studio Project File - Name="libzet" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
+\r
+CFG=libzet - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "libzet.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "libzet.mak" CFG="libzet - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "libzet - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "libzet - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "libzet - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "Release"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c\r
+# ADD BASE RSC /l 0xc09 /d "NDEBUG"\r
+# ADD RSC /l 0xc09 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF  "$(CFG)" == "libzet - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "Debug"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ  /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0xc09 /d "_DEBUG"\r
+# ADD RSC /l 0xc09 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "libzet - Win32 Release"\r
+# Name "libzet - Win32 Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\alloc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\binsearch.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\bit.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\btbucket.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\btbulk.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\bucket.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\chash.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\cosine.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\libtextcodec\crc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\libtextcodec\detectfilter.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\dirichlet.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\docmap.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\error.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\fdset.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\freemap.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\getlongopt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\libtextcodec\gunzipfilter.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\hawkapi.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\heap.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\impact.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\impact_build.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\index.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\index_querybuild.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\iobtree.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\lcrand.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\makeindex.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\mem.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\merge.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\mime.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\mlparse.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\mlparse_wrap.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\objalloc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\okapi_k3.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\pcosine.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\poolalloc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\postings.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\psettings.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\psettings_default.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\pyramid.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\queryparse.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\rbtree.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\remerge.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\reposset.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\search.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\signals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\stack.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\staticalloc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\stem.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\stop.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\stop_default.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\storagep.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\str.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\libtextcodec\stream.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\summarise.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\trec_eval.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\vec.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\vocab.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\compat\win32_stubs.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# End Group\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zlib.lib\r
+# End Source File\r
+# End Target\r
+# End Project\r
diff --git a/win32/visualc6/zet.dsp b/win32/visualc6/zet.dsp
new file mode 100644 (file)
index 0000000..b9fa6e0
--- /dev/null
@@ -0,0 +1,104 @@
+# Microsoft Developer Studio Project File - Name="zet" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=zet - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "zet.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "zet.mak" CFG="zet - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "zet - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "zet - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "zet - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "zet___Win32_Release"\r
+# PROP BASE Intermediate_Dir "zet___Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "zet___Win32_Release"\r
+# PROP Intermediate_Dir "zet___Win32_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0xc09 /d "NDEBUG"\r
+# ADD RSC /l 0xc09 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"msvcrt"\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ELSEIF  "$(CFG)" == "zet - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "zet___Win32_Debug"\r
+# PROP BASE Intermediate_Dir "zet___Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "zet___Win32_Debug"\r
+# PROP Intermediate_Dir "zet___Win32_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0xc09 /d "_DEBUG"\r
+# ADD RSC /l 0xc09 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt" /pdbtype:sept\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "zet - Win32 Release"\r
+# Name "zet - Win32 Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\commandline.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# End Group\r
+# Begin Group "Resource Files"\r
+\r
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
+# End Group\r
+# End Target\r
+# End Project\r
diff --git a/win32/visualc6/zet_cat.dsp b/win32/visualc6/zet_cat.dsp
new file mode 100644 (file)
index 0000000..936875a
--- /dev/null
@@ -0,0 +1,104 @@
+# Microsoft Developer Studio Project File - Name="zet_cat" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=zet_cat - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "zet_cat.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "zet_cat.mak" CFG="zet_cat - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "zet_cat - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "zet_cat - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "zet_cat - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "zet_cat___Win32_Release"\r
+# PROP BASE Intermediate_Dir "zet_cat___Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "zet_cat___Win32_Release"\r
+# PROP Intermediate_Dir "zet_cat___Win32_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0xc09 /d "NDEBUG"\r
+# ADD RSC /l 0xc09 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"msvcrt"\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ELSEIF  "$(CFG)" == "zet_cat - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "zet_cat___Win32_Debug"\r
+# PROP BASE Intermediate_Dir "zet_cat___Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "zet_cat___Win32_Debug"\r
+# PROP Intermediate_Dir "zet_cat___Win32_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0xc09 /d "_DEBUG"\r
+# ADD RSC /l 0xc09 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt" /pdbtype:sept\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "zet_cat - Win32 Release"\r
+# Name "zet_cat - Win32 Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\tools\cat.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# End Group\r
+# Begin Group "Resource Files"\r
+\r
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
+# End Group\r
+# End Target\r
+# End Project\r
diff --git a/win32/visualc6/zet_diff.dsp b/win32/visualc6/zet_diff.dsp
new file mode 100644 (file)
index 0000000..48e3358
--- /dev/null
@@ -0,0 +1,104 @@
+# Microsoft Developer Studio Project File - Name="zet_diff" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=zet_diff - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "zet_diff.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "zet_diff.mak" CFG="zet_diff - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "zet_diff - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "zet_diff - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "zet_diff - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "zet_diff___Win32_Release"\r
+# PROP BASE Intermediate_Dir "zet_diff___Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "zet_diff___Win32_Release"\r
+# PROP Intermediate_Dir "zet_diff___Win32_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0xc09 /d "NDEBUG"\r
+# ADD RSC /l 0xc09 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"msvcrt"\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ELSEIF  "$(CFG)" == "zet_diff - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "zet_diff___Win32_Debug"\r
+# PROP BASE Intermediate_Dir "zet_diff___Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "zet_diff___Win32_Debug"\r
+# PROP Intermediate_Dir "zet_diff___Win32_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0xc09 /d "_DEBUG"\r
+# ADD RSC /l 0xc09 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt" /pdbtype:sept\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "zet_diff - Win32 Release"\r
+# Name "zet_diff - Win32 Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\tools\diff.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# End Group\r
+# Begin Group "Resource Files"\r
+\r
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
+# End Group\r
+# End Target\r
+# End Project\r
diff --git a/win32/visualc6/zet_trec.dsp b/win32/visualc6/zet_trec.dsp
new file mode 100644 (file)
index 0000000..decb61f
--- /dev/null
@@ -0,0 +1,104 @@
+# Microsoft Developer Studio Project File - Name="zet_trec" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=zet_trec - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "zet_trec.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "zet_trec.mak" CFG="zet_trec - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "zet_trec - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "zet_trec - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "zet_trec - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "zet_trec___Win32_Release"\r
+# PROP BASE Intermediate_Dir "zet_trec___Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "zet_trec___Win32_Release"\r
+# PROP Intermediate_Dir "zet_trec___Win32_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0xc09 /d "NDEBUG"\r
+# ADD RSC /l 0xc09 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"msvcrt"\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ELSEIF  "$(CFG)" == "zet_trec - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "zet_trec___Win32_Debug"\r
+# PROP BASE Intermediate_Dir "zet_trec___Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "zet_trec___Win32_Debug"\r
+# PROP Intermediate_Dir "zet_trec___Win32_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\src\include" /I "..\..\src\include\win32" /I "..\..\src\include\compat" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0xc09 /d "_DEBUG"\r
+# ADD RSC /l 0xc09 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt" /pdbtype:sept\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "zet_trec - Win32 Release"\r
+# Name "zet_trec - Win32 Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\src\trecrun.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# End Group\r
+# Begin Group "Resource Files"\r
+\r
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
+# End Group\r
+# End Target\r
+# End Project\r
diff --git a/win32/visualc6/zettair.dsw b/win32/visualc6/zettair.dsw
new file mode 100644 (file)
index 0000000..5f09183
--- /dev/null
@@ -0,0 +1,89 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r
+\r
+###############################################################################\r
+\r
+Project: "libzet"=".\libzet.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "zet"=".\zet.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+    Begin Project Dependency\r
+    Project_Dep_Name libzet\r
+    End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "zet_cat"=".\zet_cat.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+    Begin Project Dependency\r
+    Project_Dep_Name libzet\r
+    End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "zet_diff"=".\zet_diff.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+    Begin Project Dependency\r
+    Project_Dep_Name libzet\r
+    End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "zet_trec"=".\zet_trec.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+    Begin Project Dependency\r
+    Project_Dep_Name libzet\r
+    End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r